def test_all_args(self, match_engine): params = {} m_vlan = Vlan(match_engine) returned = m_vlan.get_all_args("") expect = ["Vlan2", "Vlan3", "Vlan4", "Vlan6", "Vlan7", "Vlan8"] ddiff = DeepDiff(expect, returned, ignore_order=True) assert not ddiff, ddiff
def test_working_state_vlan(self, match_engine): params = {} params["namespace"] = "" params[Vlan.ARG_NAME] = "Vlan4" m_vlan = Vlan(match_engine) returned = m_vlan.execute(params) expect = create_template_dict(dbs=["CONFIG_DB", "APPL_DB", "ASIC_DB", "STATE_DB"]) expect["CONFIG_DB"]["keys"].append("VLAN|Vlan4") expect["APPL_DB"]["keys"].append("VLAN_TABLE:Vlan4") expect["STATE_DB"]["keys"].append("VLAN_TABLE|Vlan4") expect["ASIC_DB"]["keys"].append("ASIC_STATE:SAI_OBJECT_TYPE_VLAN:oid:0x26000000000619") ddiff = DeepDiff(sort_lists(returned), sort_lists(expect), ignore_order=True) assert not ddiff, ddiff
def test_garbage_number_vlan(self, match_engine): params = {} params[Vlan.ARG_NAME] = "614" params["namespace"] = "" m_vlan = Vlan(match_engine) returned = m_vlan.execute(params) expect = create_template_dict(dbs=["CONFIG_DB", "APPL_DB", "ASIC_DB", "STATE_DB"]) expect["CONFIG_DB"]["tables_not_found"].append("VLAN") expect["APPL_DB"]["tables_not_found"].append("VLAN_TABLE") expect["STATE_DB"]["tables_not_found"].append("VLAN_TABLE") expect["ASIC_DB"]["tables_not_found"].append("ASIC_STATE:SAI_OBJECT_TYPE_VLAN") ddiff = DeepDiff(returned, expect, ignore_order=True) assert not ddiff, ddiff