|
272 | 272 |
|
273 | 273 | intf_counters_on_sup_partial_lc = "Not all linecards have published their counter values.\n"
|
274 | 274 |
|
| 275 | +intf_counters_on_sup_na = """\ |
| 276 | + IFACE STATE RX_OK RX_BPS RX_UTIL RX_ERR RX_DRP RX_OVR TX_OK TX_BPS TX_UTIL\ |
| 277 | + TX_ERR TX_DRP TX_OVR |
| 278 | +------------ ------- ------- --------- --------- -------- -------- -------- ------- --------- ---------\ |
| 279 | + -------- -------- -------- |
| 280 | + Ethernet1/1 U 100 10.00 B/s 0.00% 0 0 0 100 10.00 B/s 0.00%\ |
| 281 | + 0 0 0 |
| 282 | + Ethernet2/1 U 100 10.00 B/s 0.00% 0 0 0 100 10.00 B/s 0.00%\ |
| 283 | + 0 0 0 |
| 284 | +Ethernet11/1 N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A\ |
| 285 | + N/A N/A N/A |
| 286 | +""" |
| 287 | + |
275 | 288 | TEST_PERIOD = 3
|
276 | 289 |
|
277 | 290 |
|
@@ -512,6 +525,31 @@ def test_show_intf_counters_on_sup_partial_lc(self):
|
512 | 525 | os.system("cp /tmp/chassis_state_db.json {}"
|
513 | 526 | .format(os.path.join(test_path, "mock_tables/chassis_state_db.json")))
|
514 | 527 |
|
| 528 | + def test_show_intf_counters_on_sup_na(self): |
| 529 | + remove_tmp_cnstat_file() |
| 530 | + os.system("cp {} /tmp/".format(os.path.join(test_path, "mock_tables/chassis_state_db.json"))) |
| 531 | + os.system("cp {} {}".format(os.path.join(test_path, "portstat_db/on_sup_na/chassis_state_db.json"), |
| 532 | + os.path.join(test_path, "mock_tables/chassis_state_db.json"))) |
| 533 | + os.environ["UTILITIES_UNIT_TESTING_IS_SUP"] = "1" |
| 534 | + |
| 535 | + runner = CliRunner() |
| 536 | + result = runner.invoke( |
| 537 | + show.cli.commands["interfaces"].commands["counters"], []) |
| 538 | + print(result.exit_code) |
| 539 | + print(result.output) |
| 540 | + assert result.exit_code == 0 |
| 541 | + assert result.output == intf_counters_on_sup_na |
| 542 | + |
| 543 | + return_code, result = get_result_and_return_code(['portstat']) |
| 544 | + print("return_code: {}".format(return_code)) |
| 545 | + print("result = {}".format(result)) |
| 546 | + assert return_code == 0 |
| 547 | + assert result == intf_counters_on_sup_na |
| 548 | + |
| 549 | + os.environ["UTILITIES_UNIT_TESTING_IS_SUP"] = "0" |
| 550 | + os.system("cp /tmp/chassis_state_db.json {}" |
| 551 | + .format(os.path.join(test_path, "mock_tables/chassis_state_db.json"))) |
| 552 | + |
515 | 553 | @classmethod
|
516 | 554 | def teardown_class(cls):
|
517 | 555 | print("TEARDOWN")
|
|
0 commit comments