def test_all_args(self, match_engine): """ Scenario: Verify Whether the get_all_args method is working as expected """ params = {} m_fdb = Fdb(match_engine) returned = m_fdb.get_all_args("") expect = [ "Vlan50:04:3f:72:e3:70:08", "Vlan10:04:3f:72:ce:80:8b", "Vlan10:04:3f:72:ce:80:8c", "Vlan10:04:3f:72:ce:80:8d", "Vlan690:04:3f:72:ce:80:8b", "Vlan40:04:3f:72:e3:70:09", "Vlan691:04:3f:72:ce:80:8b" ] ddiff = DeepDiff(expect, returned, ignore_order=True) assert not ddiff, ddiff
def test_invalid_vlan(self, match_engine): """ Scenario: When invalid fdb key is given as input """ params = {Fdb.ARG_NAME: "Vlan6900:04:3f:72:ce:80:8b", "namespace": ""} m_fdb = Fdb(match_engine) returned = m_fdb.execute(params) expect = create_template_dict(dbs=["APPL_DB", "ASIC_DB", "STATE_DB"]) expect["STATE_DB"]["tables_not_found"].append("FDB_TABLE") expect["ASIC_DB"]["tables_not_found"].append( "ASIC_STATE:SAI_OBJECT_TYPE_BRIDGE_PORT") expect["ASIC_DB"]["tables_not_found"].append( "ASIC_STATE:SAI_OBJECT_TYPE_FDB_ENTRY") ddiff = DeepDiff(returned, expect, ignore_order=True) assert not ddiff, ddiff
def test_no_fdb(self, match_engine): """ Scenario: When no entry for the fdb is present in any of the db's """ params = {Fdb.ARG_NAME: "Vlan691:04:3f:72:ce:80:8c", "namespace": ""} m_fdb = Fdb(match_engine) returned = m_fdb.execute(params) expect = create_template_dict(dbs=["APPL_DB", "ASIC_DB", "STATE_DB"]) expect["STATE_DB"]["tables_not_found"].append("FDB_TABLE") expect["ASIC_DB"]["tables_not_found"].append( "ASIC_STATE:SAI_OBJECT_TYPE_BRIDGE_PORT") expect["ASIC_DB"]["tables_not_found"].append( "ASIC_STATE:SAI_OBJECT_TYPE_FDB_ENTRY") ddiff = DeepDiff(returned, expect, ignore_order=True) assert not ddiff, ddiff
def test_missing_asic_vlan(self, match_engine): """ Scenario: When FDB is learnt through hardware but vlan is missing """ params = {Fdb.ARG_NAME: "Vlan40:04:3f:72:e3:70:09", "namespace": ""} m_fdb = Fdb(match_engine) returned = m_fdb.execute(params) expect = create_template_dict(dbs=["APPL_DB", "ASIC_DB", "STATE_DB"]) expect["STATE_DB"]["keys"].append("FDB_TABLE|Vlan40:04:3f:72:e3:70:09") expect["ASIC_DB"]["tables_not_found"].append( "ASIC_STATE:SAI_OBJECT_TYPE_BRIDGE_PORT") expect["ASIC_DB"]["tables_not_found"].append( "ASIC_STATE:SAI_OBJECT_TYPE_FDB_ENTRY") ddiff = DeepDiff(returned, expect, ignore_order=True) assert not ddiff, ddiff
def test_fdb_asic_learn_state(self, match_engine): """ Scenario: When FDB is learnt through hardware """ params = {Fdb.ARG_NAME: "Vlan50:04:3f:72:e3:70:08", "namespace": ""} m_fdb = Fdb(match_engine) returned = m_fdb.execute(params) expect = create_template_dict(dbs=["APPL_DB", "ASIC_DB", "STATE_DB"]) expect["STATE_DB"]["keys"].append("FDB_TABLE|Vlan50:04:3f:72:e3:70:08") expect["ASIC_DB"]["keys"].append( "ASIC_STATE:SAI_OBJECT_TYPE_BRIDGE_PORT:oid:0x3a000000000d23") expect["ASIC_DB"]["keys"].append( "ASIC_STATE:SAI_OBJECT_TYPE_FDB_ENTRY:{\"bvid\":\"oid:0x26000000000d22\",\"mac\":\"04:3F:72:E3:70:08\",\"switch_id\":\"oid:0x21000000000000\"}" ) ddiff = DeepDiff(returned, expect, ignore_order=True) assert not ddiff, ddiff
def test_missing_asic_bridgeport(self, match_engine): """ Scenario: When FDB is learnt through hardware but bridge port is missing """ params = {Fdb.ARG_NAME: "Vlan690:04:3f:72:ce:80:8b", "namespace": ""} m_fdb = Fdb(match_engine) returned = m_fdb.execute(params) expect = create_template_dict(dbs=["APPL_DB", "ASIC_DB", "STATE_DB"]) expect["STATE_DB"]["keys"].append( "FDB_TABLE|Vlan690:04:3f:72:ce:80:8b") expect["ASIC_DB"]["tables_not_found"].append( "ASIC_STATE:SAI_OBJECT_TYPE_BRIDGE_PORT") expect["ASIC_DB"]["keys"].append( "ASIC_STATE:SAI_OBJECT_TYPE_FDB_ENTRY:{\"bvid\":\"oid:0x26000000000d1c\",\"mac\":\"04:3F:72:CE:80:8B\",\"switch_id\":\"oid:0x21000000000000\"}" ) ddiff = DeepDiff(returned, expect, ignore_order=True) assert not ddiff, ddiff