Ejemplo n.º 1
0
 def test_all_args(self, match_engine):
     """
     Scenario: Verify Whether the get_all_args method is working as expected
     """
     params = {}
     m_port = Port(match_engine)
     returned = m_port.get_all_args("")
     expect = ["Ethernet156", "Ethernet160", "Ethernet164", "Ethernet176"]
     ddiff = DeepDiff(expect, returned, ignore_order=True)
     assert not ddiff, ddiff
Ejemplo n.º 2
0
 def test_no_port(self, match_engine):
     """
     Scenario: When no entry for the port is present in any of the db's
     """
     params = {Port.ARG_NAME: "Ethernet152", "namespace": ""}
     m_port = Port(match_engine)
     returned = m_port.execute(params)
     expect = create_template_dict(
         dbs=["CONFIG_DB", "APPL_DB", "ASIC_DB", "STATE_DB"])
     expect["CONFIG_DB"]["tables_not_found"].append("PORT")
     expect["APPL_DB"]["tables_not_found"].append("PORT_TABLE")
     expect["STATE_DB"]["tables_not_found"].append("PORT_TABLE")
     expect["ASIC_DB"]["tables_not_found"].append(
         "ASIC_STATE:SAI_OBJECT_TYPE_PORT")
     expect["ASIC_DB"]["tables_not_found"].append(
         "ASIC_STATE:SAI_OBJECT_TYPE_HOSTIF")
     ddiff = DeepDiff(returned, expect, ignore_order=True)
     assert not ddiff, ddiff
Ejemplo n.º 3
0
 def test_missing_state_and_appl(self, match_engine):
     """
     Scenario: When the config was applied and it did not propagate to other db's
     """
     params = {Port.ARG_NAME: "Ethernet156", "namespace": ""}
     m_port = Port(match_engine)
     returned = m_port.execute(params)
     expect = create_template_dict(
         dbs=["CONFIG_DB", "APPL_DB", "ASIC_DB", "STATE_DB"])
     expect["CONFIG_DB"]["keys"].append("PORT|Ethernet156")
     expect["APPL_DB"]["tables_not_found"].append("PORT_TABLE")
     expect["STATE_DB"]["tables_not_found"].append("PORT_TABLE")
     expect["ASIC_DB"]["tables_not_found"].append(
         "ASIC_STATE:SAI_OBJECT_TYPE_PORT")
     expect["ASIC_DB"]["tables_not_found"].append(
         "ASIC_STATE:SAI_OBJECT_TYPE_HOSTIF")
     ddiff = DeepDiff(returned, expect, ignore_order=True)
     assert not ddiff, ddiff
Ejemplo n.º 4
0
 def test_missing_asic_port(self, match_engine):
     """
     Scenario: When the config was applied and just the SAI_OBJECT_TYPE_PORT is missing
     """
     params = {Port.ARG_NAME: "Ethernet160", "namespace": ""}
     m_port = Port(match_engine)
     returned = m_port.execute(params)
     expect = create_template_dict(
         dbs=["CONFIG_DB", "APPL_DB", "ASIC_DB", "STATE_DB"])
     expect["CONFIG_DB"]["keys"].append("PORT|Ethernet160")
     expect["APPL_DB"]["keys"].append("PORT_TABLE:Ethernet160")
     expect["STATE_DB"]["keys"].append("PORT_TABLE|Ethernet160")
     expect["ASIC_DB"]["keys"].append(
         "ASIC_STATE:SAI_OBJECT_TYPE_HOSTIF:oid:0xd000000000a49")
     expect["ASIC_DB"]["tables_not_found"].append(
         "ASIC_STATE:SAI_OBJECT_TYPE_PORT")
     ddiff = DeepDiff(sort_lists(returned),
                      sort_lists(expect),
                      ignore_order=True)
     assert not ddiff, ddiff
Ejemplo n.º 5
0
 def test_working_state(self, match_engine):
     """
     Scenario: When the config is properly applied and propagated
     """
     params = {Port.ARG_NAME: "Ethernet176", "namespace": ""}
     m_port = Port(match_engine)
     returned = m_port.execute(params)
     expect = create_template_dict(
         dbs=["CONFIG_DB", "APPL_DB", "ASIC_DB", "STATE_DB"])
     expect["CONFIG_DB"]["keys"].append("PORT|Ethernet176")
     expect["APPL_DB"]["keys"].append("PORT_TABLE:Ethernet176")
     expect["STATE_DB"]["keys"].append("PORT_TABLE|Ethernet176")
     expect["ASIC_DB"]["keys"].append(
         "ASIC_STATE:SAI_OBJECT_TYPE_PORT:oid:0x100000000036a")
     expect["ASIC_DB"]["keys"].append(
         "ASIC_STATE:SAI_OBJECT_TYPE_HOSTIF:oid:0xd000000000a4d")
     ddiff = DeepDiff(sort_lists(returned),
                      sort_lists(expect),
                      ignore_order=True)
     assert not ddiff, ddiff