997997}"""
998998
999999show_queue_voq_counters = """\
1000- Port Voq Counter/pkts Counter/bytes Drop/pkts Drop/bytes
1001- --------- ----- -------------- --------------- ----------- ------------
1002- Ethernet0 VOQ0 68 30 56 74
1003- Ethernet0 VOQ1 60 43 39 1
1004- Ethernet0 VOQ2 82 7 39 21
1005- Ethernet0 VOQ3 11 59 12 94
1006- Ethernet0 VOQ4 36 62 35 40
1007- Ethernet0 VOQ5 49 91 2 88
1008- Ethernet0 VOQ6 33 17 94 74
1009- Ethernet0 VOQ7 40 71 95 33
1000+ Port Voq Counter/pkts Counter/bytes Drop/pkts Drop/bytes
1001+ ---------------- ----- -------------- --------------- ----------- ------------
1002+ testsw| Ethernet0 VOQ0 68 30 56 74
1003+ testsw| Ethernet0 VOQ1 60 43 39 1
1004+ testsw| Ethernet0 VOQ2 82 7 39 21
1005+ testsw| Ethernet0 VOQ3 11 59 12 94
1006+ testsw| Ethernet0 VOQ4 36 62 35 40
1007+ testsw| Ethernet0 VOQ5 49 91 2 88
1008+ testsw| Ethernet0 VOQ6 33 17 94 74
1009+ testsw| Ethernet0 VOQ7 40 71 95 33
10101010
1011- Port Voq Counter/pkts Counter/bytes Drop/pkts Drop/bytes
1012- --------- ----- -------------- --------------- ----------- ------------
1013- Ethernet4 VOQ0 54 8 93 78
1014- Ethernet4 VOQ1 83 96 74 9
1015- Ethernet4 VOQ2 15 60 61 31
1016- Ethernet4 VOQ3 45 52 82 94
1017- Ethernet4 VOQ4 55 88 89 52
1018- Ethernet4 VOQ5 14 70 95 79
1019- Ethernet4 VOQ6 68 60 66 81
1020- Ethernet4 VOQ7 63 4 48 76
1011+ Port Voq Counter/pkts Counter/bytes Drop/pkts Drop/bytes
1012+ ---------------- ----- -------------- --------------- ----------- ------------
1013+ testsw| Ethernet4 VOQ0 54 8 93 78
1014+ testsw| Ethernet4 VOQ1 83 96 74 9
1015+ testsw| Ethernet4 VOQ2 15 60 61 31
1016+ testsw| Ethernet4 VOQ3 45 52 82 94
1017+ testsw| Ethernet4 VOQ4 55 88 89 52
1018+ testsw| Ethernet4 VOQ5 14 70 95 79
1019+ testsw| Ethernet4 VOQ6 68 60 66 81
1020+ testsw| Ethernet4 VOQ7 63 4 48 76
10211021
1022- Port Voq Counter/pkts Counter/bytes Drop/pkts Drop/bytes
1023- --------- ----- -------------- --------------- ----------- ------------
1024- Ethernet8 VOQ0 41 73 77 74
1025- Ethernet8 VOQ1 60 21 56 54
1026- Ethernet8 VOQ2 57 31 12 39
1027- Ethernet8 VOQ3 41 96 70 98
1028- Ethernet8 VOQ4 18 49 63 36
1029- Ethernet8 VOQ5 99 90 3 15
1030- Ethernet8 VOQ6 8 84 82 94
1031- Ethernet8 VOQ7 83 15 75 92
1022+ Port Voq Counter/pkts Counter/bytes Drop/pkts Drop/bytes
1023+ ---------------- ----- -------------- --------------- ----------- ------------
1024+ testsw| Ethernet8 VOQ0 41 73 77 74
1025+ testsw| Ethernet8 VOQ1 60 21 56 54
1026+ testsw| Ethernet8 VOQ2 57 31 12 39
1027+ testsw| Ethernet8 VOQ3 41 96 70 98
1028+ testsw| Ethernet8 VOQ4 18 49 63 36
1029+ testsw| Ethernet8 VOQ5 99 90 3 15
1030+ testsw| Ethernet8 VOQ6 8 84 82 94
1031+ testsw| Ethernet8 VOQ7 83 15 75 92
10321032
10331033"""
10341034
1035+ show_queue_voq_counters_with_clear = ["""\
1036+ Port Voq Counter/pkts Counter/bytes Drop/pkts Drop/bytes
1037+ ---------------- ----- -------------- --------------- ----------- ------------
1038+ testsw|Ethernet0 VOQ0 0 0 0 0
1039+ testsw|Ethernet0 VOQ1 0 0 0 0
1040+ testsw|Ethernet0 VOQ2 0 0 0 0
1041+ testsw|Ethernet0 VOQ3 0 0 0 0
1042+ testsw|Ethernet0 VOQ4 0 0 0 0
1043+ testsw|Ethernet0 VOQ5 0 0 0 0
1044+ testsw|Ethernet0 VOQ6 0 0 0 0
1045+ testsw|Ethernet0 VOQ7 0 0 0 0
1046+ """ , """\
1047+ Port Voq Counter/pkts Counter/bytes Drop/pkts Drop/bytes
1048+ ---------------- ----- -------------- --------------- ----------- ------------
1049+ testsw|Ethernet4 VOQ0 0 0 0 0
1050+ testsw|Ethernet4 VOQ1 0 0 0 0
1051+ testsw|Ethernet4 VOQ2 0 0 0 0
1052+ testsw|Ethernet4 VOQ3 0 0 0 0
1053+ testsw|Ethernet4 VOQ4 0 0 0 0
1054+ testsw|Ethernet4 VOQ5 0 0 0 0
1055+ testsw|Ethernet4 VOQ6 0 0 0 0
1056+ testsw|Ethernet4 VOQ7 0 0 0 0
1057+ """ , """\
1058+ Port Voq Counter/pkts Counter/bytes Drop/pkts Drop/bytes
1059+ ---------------- ----- -------------- --------------- ----------- ------------
1060+ testsw|Ethernet8 VOQ0 0 0 0 0
1061+ testsw|Ethernet8 VOQ1 0 0 0 0
1062+ testsw|Ethernet8 VOQ2 0 0 0 0
1063+ testsw|Ethernet8 VOQ3 0 0 0 0
1064+ testsw|Ethernet8 VOQ4 0 0 0 0
1065+ testsw|Ethernet8 VOQ5 0 0 0 0
1066+ testsw|Ethernet8 VOQ6 0 0 0 0
1067+ testsw|Ethernet8 VOQ7 0 0 0 0
1068+ """
1069+ ]
1070+
10351071show_queue_port_voq_counters = """\
1036- Port Voq Counter/pkts Counter/bytes Drop/pkts Drop/bytes
1037- --------- ----- -------------- --------------- ----------- ------------
1038- Ethernet0 VOQ0 68 30 56 74
1039- Ethernet0 VOQ1 60 43 39 1
1040- Ethernet0 VOQ2 82 7 39 21
1041- Ethernet0 VOQ3 11 59 12 94
1042- Ethernet0 VOQ4 36 62 35 40
1043- Ethernet0 VOQ5 49 91 2 88
1044- Ethernet0 VOQ6 33 17 94 74
1045- Ethernet0 VOQ7 40 71 95 33
1072+ Port Voq Counter/pkts Counter/bytes Drop/pkts Drop/bytes
1073+ ---------------- ----- -------------- --------------- ----------- ------------
1074+ testsw| Ethernet0 VOQ0 68 30 56 74
1075+ testsw| Ethernet0 VOQ1 60 43 39 1
1076+ testsw| Ethernet0 VOQ2 82 7 39 21
1077+ testsw| Ethernet0 VOQ3 11 59 12 94
1078+ testsw| Ethernet0 VOQ4 36 62 35 40
1079+ testsw| Ethernet0 VOQ5 49 91 2 88
1080+ testsw| Ethernet0 VOQ6 33 17 94 74
1081+ testsw| Ethernet0 VOQ7 40 71 95 33
10461082
10471083"""
10481084
10491085show_queue_voq_counters_json = """\
10501086 {
1051- "Ethernet0": {
1087+ "testsw| Ethernet0": {
10521088 "VOQ0": {
10531089 "dropbytes": "74",
10541090 "droppacket": "56",
10981134 "totalpacket": "40"
10991135 }
11001136 },
1101- "Ethernet4": {
1137+ "testsw| Ethernet4": {
11021138 "VOQ0": {
11031139 "dropbytes": "78",
11041140 "droppacket": "93",
11481184 "totalpacket": "63"
11491185 }
11501186 },
1151- "Ethernet8": {
1187+ "testsw| Ethernet8": {
11521188 "VOQ0": {
11531189 "dropbytes": "74",
11541190 "droppacket": "77",
12021238
12031239show_queue_port_voq_counters_json = """\
12041240 {
1205- "Ethernet0": {
1241+ "testsw| Ethernet0": {
12061242 "VOQ0": {
12071243 "dropbytes": "74",
12081244 "droppacket": "56",
@@ -1339,11 +1375,29 @@ def test_queue_voq_counters(self):
13391375 assert result .exit_code == 0
13401376 assert result .output == show_queue_voq_counters
13411377
1378+ def test_queue_voq_counters_with_clear (self ):
1379+ runner = CliRunner ()
1380+ result = runner .invoke (clear .cli .commands ['queuecounters' ], [])
1381+ assert result .exit_code == 0
1382+ result = runner .invoke (
1383+ show .cli .commands ["queue" ].commands ["counters" ],
1384+ ["--voq" ]
1385+ )
1386+ print (result .output )
1387+ show .run_command (['queuestat' , '-d' , '--voq' ])
1388+ assert result .exit_code == 0
1389+ assert "Ethernet0 Last cached time was" in result .output and \
1390+ "Ethernet4 Last cached time was" in result .output and \
1391+ "Ethernet8 Last cached time was" in result .output
1392+ assert show_queue_voq_counters_with_clear [0 ] in result .output and \
1393+ show_queue_voq_counters_with_clear [1 ] in result .output and \
1394+ show_queue_voq_counters_with_clear [2 ] in result .output
1395+
13421396 def test_queue_port_voq_counters (self ):
13431397 runner = CliRunner ()
13441398 result = runner .invoke (
13451399 show .cli .commands ["queue" ].commands ["counters" ],
1346- ["Ethernet0" , "--voq" ]
1400+ ["testsw| Ethernet0" , "--voq" ]
13471401 )
13481402 print (result .output )
13491403 assert result .exit_code == 0
@@ -1370,7 +1424,7 @@ def test_queue_voq_counters_port_json(self):
13701424 runner = CliRunner ()
13711425 result = runner .invoke (
13721426 show .cli .commands ["queue" ].commands ["counters" ],
1373- ["Ethernet0" , "--voq" , "--json" ]
1427+ ["testsw| Ethernet0" , "--voq" , "--json" ]
13741428 )
13751429 assert result .exit_code == 0
13761430 print (result .output )
0 commit comments