From 114faa4c591917540933348801d9f96cffcd8ca1 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Tue, 10 Apr 2018 18:27:00 -0700 Subject: [PATCH] Align with swss-common table name separator changes (#454) * Align with swss-common table name separator changes * Get appropriate table name separators by calling getTableNameSeparator() method * Align with new method name --- cfgmgr/buffermgr.cpp | 28 +++++++++++++++++++--------- cfgmgr/intfmgr.cpp | 10 +++++----- cfgmgr/vlanmgr.cpp | 10 +++++----- cfgmgr/vlanmgrd.cpp | 2 +- orchagent/orch.cpp | 2 +- portsyncd/linksync.cpp | 2 +- portsyncd/portsyncd.cpp | 2 +- teamsyncd/teamsync.cpp | 2 +- tests/test_acl.py | 30 +++++++++++++++--------------- tests/test_crm.py | 8 ++++---- tests/test_dirbcast.py | 6 +++--- tests/test_fdb.py | 12 ++++++------ tests/test_speed.py | 6 +++--- tests/test_vlan.py | 4 ++-- tests/test_vrf.py | 27 ++++++++------------------- 15 files changed, 75 insertions(+), 76 deletions(-) diff --git a/cfgmgr/buffermgr.cpp b/cfgmgr/buffermgr.cpp index 6e396700f350..c9e1a7e4cd50 100644 --- a/cfgmgr/buffermgr.cpp +++ b/cfgmgr/buffermgr.cpp @@ -15,12 +15,12 @@ using namespace swss; BufferMgr::BufferMgr(DBConnector *cfgDb, DBConnector *stateDb, string pg_lookup_file, const vector &tableNames) : Orch(cfgDb, tableNames), - m_statePortTable(stateDb, STATE_PORT_TABLE_NAME, CONFIGDB_TABLE_NAME_SEPARATOR), - m_cfgPortTable(cfgDb, CFG_PORT_TABLE_NAME, CONFIGDB_TABLE_NAME_SEPARATOR), - m_cfgCableLenTable(cfgDb, CFG_PORT_CABLE_LEN_TABLE_NAME, CONFIGDB_TABLE_NAME_SEPARATOR), - m_cfgBufferProfileTable(cfgDb, CFG_BUFFER_PROFILE_TABLE_NAME, CONFIGDB_TABLE_NAME_SEPARATOR), - m_cfgBufferPgTable(cfgDb, CFG_BUFFER_PG_TABLE_NAME, CONFIGDB_TABLE_NAME_SEPARATOR), - m_cfgLosslessPgPoolTable(cfgDb, CFG_BUFFER_POOL_TABLE_NAME, CONFIGDB_TABLE_NAME_SEPARATOR) + m_statePortTable(stateDb, STATE_PORT_TABLE_NAME), + m_cfgPortTable(cfgDb, CFG_PORT_TABLE_NAME), + m_cfgCableLenTable(cfgDb, CFG_PORT_CABLE_LEN_TABLE_NAME), + m_cfgBufferProfileTable(cfgDb, CFG_BUFFER_PROFILE_TABLE_NAME), + m_cfgBufferPgTable(cfgDb, CFG_BUFFER_PG_TABLE_NAME), + m_cfgLosslessPgPoolTable(cfgDb, CFG_BUFFER_POOL_TABLE_NAME) { readPgProfileLookupFile(pg_lookup_file); } @@ -130,7 +130,6 @@ void BufferMgr::doSpeedUpdateTask(string port, string speed) // Crete record in BUFFER_PROFILE table // key format is pg_lossless___profile - string buffer_pg_key = port + CONFIGDB_TABLE_NAME_SEPARATOR + LOSSLESS_PGS; string buffer_profile_key = "pg_lossless_" + speed + "_" + cable + "_profile"; // check if profile already exists - if yes - skip creation @@ -149,7 +148,10 @@ void BufferMgr::doSpeedUpdateTask(string port, string speed) // profile threshold field name mode += "_th"; - string pg_pool_reference = string(CFG_BUFFER_POOL_TABLE_NAME) + CONFIGDB_TABLE_NAME_SEPARATOR + INGRESS_LOSSLESS_PG_POOL_NAME; + string pg_pool_reference = string(CFG_BUFFER_POOL_TABLE_NAME) + + m_cfgBufferProfileTable.getTableNameSeparator() + + INGRESS_LOSSLESS_PG_POOL_NAME; + fvVector.push_back(make_pair("pool", "[" + pg_pool_reference + "]")); fvVector.push_back(make_pair("xon", m_pgProfileLookup[speed][cable].xon)); if (m_pgProfileLookup[speed][cable].xon_offset.length() > 0) { @@ -167,7 +169,15 @@ void BufferMgr::doSpeedUpdateTask(string port, string speed) } fvVector.clear(); - string profile_ref = string("[") + CFG_BUFFER_PROFILE_TABLE_NAME + CONFIGDB_TABLE_NAME_SEPARATOR + buffer_profile_key + "]"; + + string buffer_pg_key = port + m_cfgBufferPgTable.getTableNameSeparator() + LOSSLESS_PGS; + + string profile_ref = string("[") + + CFG_BUFFER_PROFILE_TABLE_NAME + + m_cfgBufferPgTable.getTableNameSeparator() + + buffer_profile_key + + "]"; + fvVector.push_back(make_pair("profile", profile_ref)); m_cfgBufferPgTable.set(buffer_pg_key, fvVector); } diff --git a/cfgmgr/intfmgr.cpp b/cfgmgr/intfmgr.cpp index c56dee07e939..7e30fa1bd9b6 100644 --- a/cfgmgr/intfmgr.cpp +++ b/cfgmgr/intfmgr.cpp @@ -16,11 +16,11 @@ using namespace swss; IntfMgr::IntfMgr(DBConnector *cfgDb, DBConnector *appDb, DBConnector *stateDb, const vector &tableNames) : Orch(cfgDb, tableNames), - m_cfgIntfTable(cfgDb, CFG_INTF_TABLE_NAME, CONFIGDB_TABLE_NAME_SEPARATOR), - m_cfgVlanIntfTable(cfgDb, CFG_VLAN_INTF_TABLE_NAME, CONFIGDB_TABLE_NAME_SEPARATOR), - m_statePortTable(stateDb, STATE_PORT_TABLE_NAME, CONFIGDB_TABLE_NAME_SEPARATOR), - m_stateLagTable(stateDb, STATE_LAG_TABLE_NAME, CONFIGDB_TABLE_NAME_SEPARATOR), - m_stateVlanTable(stateDb, STATE_VLAN_TABLE_NAME, CONFIGDB_TABLE_NAME_SEPARATOR), + m_cfgIntfTable(cfgDb, CFG_INTF_TABLE_NAME), + m_cfgVlanIntfTable(cfgDb, CFG_VLAN_INTF_TABLE_NAME), + m_statePortTable(stateDb, STATE_PORT_TABLE_NAME), + m_stateLagTable(stateDb, STATE_LAG_TABLE_NAME), + m_stateVlanTable(stateDb, STATE_VLAN_TABLE_NAME), m_appIntfTableProducer(appDb, APP_INTF_TABLE_NAME) { } diff --git a/cfgmgr/vlanmgr.cpp b/cfgmgr/vlanmgr.cpp index b46b663495d1..6990472fac95 100644 --- a/cfgmgr/vlanmgr.cpp +++ b/cfgmgr/vlanmgr.cpp @@ -21,11 +21,11 @@ extern MacAddress gMacAddress; VlanMgr::VlanMgr(DBConnector *cfgDb, DBConnector *appDb, DBConnector *stateDb, const vector &tableNames) : Orch(cfgDb, tableNames), - m_cfgVlanTable(cfgDb, CFG_VLAN_TABLE_NAME, CONFIGDB_TABLE_NAME_SEPARATOR), - m_cfgVlanMemberTable(cfgDb, CFG_VLAN_MEMBER_TABLE_NAME, CONFIGDB_TABLE_NAME_SEPARATOR), - m_statePortTable(stateDb, STATE_PORT_TABLE_NAME, CONFIGDB_TABLE_NAME_SEPARATOR), - m_stateLagTable(stateDb, STATE_LAG_TABLE_NAME, CONFIGDB_TABLE_NAME_SEPARATOR), - m_stateVlanTable(stateDb, STATE_VLAN_TABLE_NAME, CONFIGDB_TABLE_NAME_SEPARATOR), + m_cfgVlanTable(cfgDb, CFG_VLAN_TABLE_NAME), + m_cfgVlanMemberTable(cfgDb, CFG_VLAN_MEMBER_TABLE_NAME), + m_statePortTable(stateDb, STATE_PORT_TABLE_NAME), + m_stateLagTable(stateDb, STATE_LAG_TABLE_NAME), + m_stateVlanTable(stateDb, STATE_VLAN_TABLE_NAME), m_appVlanTableProducer(appDb, APP_VLAN_TABLE_NAME), m_appVlanMemberTableProducer(appDb, APP_VLAN_MEMBER_TABLE_NAME) { diff --git a/cfgmgr/vlanmgrd.cpp b/cfgmgr/vlanmgrd.cpp index 6fc0ed2efd3a..add128dd20ed 100644 --- a/cfgmgr/vlanmgrd.cpp +++ b/cfgmgr/vlanmgrd.cpp @@ -61,7 +61,7 @@ int main(int argc, char **argv) * switch_mac set. * Dynamic switch_mac update is not supported for now. */ - Table table(&cfgDb, "DEVICE_METADATA", CONFIGDB_TABLE_NAME_SEPARATOR); + Table table(&cfgDb, "DEVICE_METADATA"); std::vector ovalues; table.get("localhost", ovalues); auto it = std::find_if( ovalues.begin(), ovalues.end(), [](const FieldValueTuple& t){ return t.first == "mac";} ); diff --git a/orchagent/orch.cpp b/orchagent/orch.cpp index 81e213a168f4..2dce67e267ff 100644 --- a/orchagent/orch.cpp +++ b/orchagent/orch.cpp @@ -358,7 +358,7 @@ bool Orch::parseIndexRange(const string &input, sai_uint32_t &range_low, sai_uin void Orch::addConsumer(DBConnector *db, string tableName) { - if (db->getDB() == CONFIG_DB) + if (db->getDbId() == CONFIG_DB) { addExecutor(tableName, new Consumer(new SubscriberStateTable(db, tableName), this)); } diff --git a/portsyncd/linksync.cpp b/portsyncd/linksync.cpp index 628285abce3f..e5d33948657f 100644 --- a/portsyncd/linksync.cpp +++ b/portsyncd/linksync.cpp @@ -31,7 +31,7 @@ extern bool g_init; LinkSync::LinkSync(DBConnector *appl_db, DBConnector *state_db) : m_portTableProducer(appl_db, APP_PORT_TABLE_NAME), m_portTable(appl_db, APP_PORT_TABLE_NAME), - m_statePortTable(state_db, STATE_PORT_TABLE_NAME, CONFIGDB_TABLE_NAME_SEPARATOR) + m_statePortTable(state_db, STATE_PORT_TABLE_NAME) { /* See the comments for g_portSet in portsyncd.cpp */ for (string port : g_portSet) diff --git a/portsyncd/portsyncd.cpp b/portsyncd/portsyncd.cpp index 964b7f4bb848..df4bf2fdcb15 100644 --- a/portsyncd/portsyncd.cpp +++ b/portsyncd/portsyncd.cpp @@ -169,7 +169,7 @@ void handlePortConfigFromConfigDB(ProducerStateTable &p, DBConnector &cfgDb) { cout << "Get port configuration from ConfigDB..." << endl; - Table table(&cfgDb, CFG_PORT_TABLE_NAME, CONFIGDB_TABLE_NAME_SEPARATOR); + Table table(&cfgDb, CFG_PORT_TABLE_NAME); std::vector ovalues; std::vector keys; table.getKeys(keys); diff --git a/teamsyncd/teamsync.cpp b/teamsyncd/teamsync.cpp index d3fb222d5c0f..970c7aef1394 100644 --- a/teamsyncd/teamsync.cpp +++ b/teamsyncd/teamsync.cpp @@ -20,7 +20,7 @@ TeamSync::TeamSync(DBConnector *db, DBConnector *stateDb, Select *select) : m_select(select), m_lagTable(db, APP_LAG_TABLE_NAME), m_lagMemberTable(db, APP_LAG_MEMBER_TABLE_NAME), - m_stateLagTable(stateDb, STATE_LAG_TABLE_NAME, CONFIGDB_TABLE_NAME_SEPARATOR) + m_stateLagTable(stateDb, STATE_LAG_TABLE_NAME) { } diff --git a/tests/test_acl.py b/tests/test_acl.py index dfcdd9492aa1..4ab939fe49a2 100644 --- a/tests/test_acl.py +++ b/tests/test_acl.py @@ -21,7 +21,7 @@ def test_AclTableCreation(self, dvs): bind_ports = ["Ethernet0", "Ethernet4"] # create ACL_TABLE in config db - tbl = swsscommon.Table(db, "ACL_TABLE", '|') + tbl = swsscommon.Table(db, "ACL_TABLE") fvs = swsscommon.FieldValuePairs([("policy_desc", "test"), ("type", "L3"), ("ports", ",".join(bind_ports))]) tbl.set("test", fvs) @@ -95,7 +95,7 @@ def test_AclRuleL4SrcPort(self, dvs): adb = swsscommon.DBConnector(1, dvs.redis_sock, 0) # create acl rule - tbl = swsscommon.Table(db, "ACL_RULE", '|') + tbl = swsscommon.Table(db, "ACL_RULE") fvs = swsscommon.FieldValuePairs([("priority", "55"), ("PACKET_ACTION", "FORWARD"), ("L4_SRC_PORT", "65000")]) tbl.set("test|acl_test_rule", fvs) @@ -143,7 +143,7 @@ def test_AclTableDeletion(self, dvs): adb = swsscommon.DBConnector(1, dvs.redis_sock, 0) # get ACL_TABLE in config db - tbl = swsscommon.Table(db, "ACL_TABLE", '|') + tbl = swsscommon.Table(db, "ACL_TABLE") tbl._del("test") time.sleep(1) @@ -160,7 +160,7 @@ def test_V6AclTableCreation(self, dvs): bind_ports = ["Ethernet0", "Ethernet4", "Ethernet8"] # create ACL_TABLE in config db - tbl = swsscommon.Table(db, "ACL_TABLE", '|') + tbl = swsscommon.Table(db, "ACL_TABLE") fvs = swsscommon.FieldValuePairs([("policy_desc", "testv6"), ("type", "L3V6"), ("ports", ",".join(bind_ports))]) tbl.set("test-aclv6", fvs) @@ -235,7 +235,7 @@ def test_V6AclRuleIPv6Any(self, dvs): adb = swsscommon.DBConnector(1, dvs.redis_sock, 0) # create acl rule - tbl = swsscommon.Table(db, "ACL_RULE", '|') + tbl = swsscommon.Table(db, "ACL_RULE") fvs = swsscommon.FieldValuePairs([("priority", "1001"), ("PACKET_ACTION", "FORWARD"), ("IP_TYPE", "IPv6ANY")]) tbl.set("test-aclv6|test_rule1", fvs) @@ -286,7 +286,7 @@ def test_V6AclRuleIPv6AnyDrop(self, dvs): adb = swsscommon.DBConnector(1, dvs.redis_sock, 0) # create acl rule - tbl = swsscommon.Table(db, "ACL_RULE", '|') + tbl = swsscommon.Table(db, "ACL_RULE") fvs = swsscommon.FieldValuePairs([("priority", "1002"), ("PACKET_ACTION", "DROP"), ("IP_TYPE", "IPv6ANY")]) tbl.set("test-aclv6|test_rule2", fvs) @@ -337,7 +337,7 @@ def test_V6AclRuleIpProtocol(self, dvs): adb = swsscommon.DBConnector(1, dvs.redis_sock, 0) # create acl rule - tbl = swsscommon.Table(db, "ACL_RULE", '|') + tbl = swsscommon.Table(db, "ACL_RULE") fvs = swsscommon.FieldValuePairs([("priority", "1003"), ("PACKET_ACTION", "DROP"), ("IP_PROTOCOL", "6")]) tbl.set("test-aclv6|test_rule3", fvs) @@ -388,7 +388,7 @@ def test_V6AclRuleSrcIPv6(self, dvs): adb = swsscommon.DBConnector(1, dvs.redis_sock, 0) # create acl rule - tbl = swsscommon.Table(db, "ACL_RULE", '|') + tbl = swsscommon.Table(db, "ACL_RULE") fvs = swsscommon.FieldValuePairs([("priority", "1004"), ("PACKET_ACTION", "DROP"), ("SRC_IPV6", "2777::0/64")]) tbl.set("test-aclv6|test_rule4", fvs) @@ -439,7 +439,7 @@ def test_V6AclRuleDstIPv6(self, dvs): adb = swsscommon.DBConnector(1, dvs.redis_sock, 0) # create acl rule - tbl = swsscommon.Table(db, "ACL_RULE", '|') + tbl = swsscommon.Table(db, "ACL_RULE") fvs = swsscommon.FieldValuePairs([("priority", "1005"), ("PACKET_ACTION", "DROP"), ("DST_IPV6", "2002::2/128")]) tbl.set("test-aclv6|test_rule5", fvs) @@ -490,7 +490,7 @@ def test_V6AclRuleL4SrcPort(self, dvs): adb = swsscommon.DBConnector(1, dvs.redis_sock, 0) # create acl rule - tbl = swsscommon.Table(db, "ACL_RULE", '|') + tbl = swsscommon.Table(db, "ACL_RULE") fvs = swsscommon.FieldValuePairs([("priority", "1006"), ("PACKET_ACTION", "DROP"), ("L4_SRC_PORT", "65000")]) tbl.set("test-aclv6|test_rule6", fvs) @@ -541,7 +541,7 @@ def test_V6AclRuleL4DstPort(self, dvs): adb = swsscommon.DBConnector(1, dvs.redis_sock, 0) # create acl rule - tbl = swsscommon.Table(db, "ACL_RULE", '|') + tbl = swsscommon.Table(db, "ACL_RULE") fvs = swsscommon.FieldValuePairs([("priority", "1007"), ("PACKET_ACTION", "DROP"), ("L4_DST_PORT", "65001")]) tbl.set("test-aclv6|test_rule7", fvs) @@ -592,7 +592,7 @@ def test_V6AclRuleTCPFlags(self, dvs): adb = swsscommon.DBConnector(1, dvs.redis_sock, 0) # create acl rule - tbl = swsscommon.Table(db, "ACL_RULE", '|') + tbl = swsscommon.Table(db, "ACL_RULE") fvs = swsscommon.FieldValuePairs([("priority", "1008"), ("PACKET_ACTION", "DROP"), ("TCP_FLAGS", "0x07/0x3f")]) tbl.set("test-aclv6|test_rule8", fvs) @@ -643,7 +643,7 @@ def test_V6AclRuleL4SrcPortRange(self, dvs): adb = swsscommon.DBConnector(1, dvs.redis_sock, 0) # create acl rule - tbl = swsscommon.Table(db, "ACL_RULE", '|') + tbl = swsscommon.Table(db, "ACL_RULE") fvs = swsscommon.FieldValuePairs([("priority", "1009"), ("PACKET_ACTION", "DROP"), ("L4_SRC_PORT_RANGE", "1-100")]) tbl.set("test-aclv6|test_rule9", fvs) @@ -708,7 +708,7 @@ def test_V6AclRuleL4DstPortRange(self, dvs): adb = swsscommon.DBConnector(1, dvs.redis_sock, 0) # create acl rule - tbl = swsscommon.Table(db, "ACL_RULE", '|') + tbl = swsscommon.Table(db, "ACL_RULE") fvs = swsscommon.FieldValuePairs([("priority", "1010"), ("PACKET_ACTION", "DROP"), ("L4_DST_PORT_RANGE", "101-200")]) tbl.set("test-aclv6|test_rule10", fvs) @@ -770,7 +770,7 @@ def test_V6AclTableDeletion(self, dvs): adb = swsscommon.DBConnector(1, dvs.redis_sock, 0) # get ACL_TABLE in config db - tbl = swsscommon.Table(db, "ACL_TABLE", '|') + tbl = swsscommon.Table(db, "ACL_TABLE") tbl._del("test-aclv6") time.sleep(1) diff --git a/tests/test_crm.py b/tests/test_crm.py index 4cfe870e2121..c1fc74256c03 100644 --- a/tests/test_crm.py +++ b/tests/test_crm.py @@ -60,12 +60,12 @@ def test_CrmFdbEntry(dvs): tbl.set("Vlan2:52-54-00-25-06-E9", fvs) # create vlan - tbl = swsscommon.Table(cfg_db, "VLAN", "|") + tbl = swsscommon.Table(cfg_db, "VLAN") fvs = swsscommon.FieldValuePairs([("vlanid", "2")]) tbl.set("Vlan2", fvs) # create vlan member - tbl = swsscommon.Table(cfg_db, "VLAN_MEMBER", "|") + tbl = swsscommon.Table(cfg_db, "VLAN_MEMBER") fvs = swsscommon.FieldValuePairs([("tagging_mode", "untagged")]) tbl.set("Vlan2|Ethernet8", fvs) @@ -483,12 +483,12 @@ def test_CrmAcl(dvs): bind_ports = ["Ethernet0", "Ethernet4"] # create ACL table - ttbl = swsscommon.Table(db, "ACL_TABLE", '|') + ttbl = swsscommon.Table(db, "ACL_TABLE") fvs = swsscommon.FieldValuePairs([("policy_desc", "test"), ("type", "L3"), ("ports", ",".join(bind_ports))]) ttbl.set("test", fvs) # create ACL rule - rtbl = swsscommon.Table(db, "ACL_RULE", '|') + rtbl = swsscommon.Table(db, "ACL_RULE") fvs = swsscommon.FieldValuePairs([("priority", "55"), ("PACKET_ACTION", "FORWARD"), ("L4_SRC_PORT", "65000")]) rtbl.set("test|acl_test_rule", fvs) diff --git a/tests/test_dirbcast.py b/tests/test_dirbcast.py index b00623d7eea3..bf7d50c3c0e5 100644 --- a/tests/test_dirbcast.py +++ b/tests/test_dirbcast.py @@ -9,19 +9,19 @@ def test_DirectedBroadcast(dvs): adb = swsscommon.DBConnector(1, dvs.redis_sock, 0) # create vlan in config db - tbl = swsscommon.Table(db, "VLAN", '|') + tbl = swsscommon.Table(db, "VLAN") fvs = swsscommon.FieldValuePairs([("vlanid", "100")]) tbl.set("Vlan100", fvs) # create a vlan member in config db - tbl = swsscommon.Table(db, "VLAN_MEMBER", '|') + tbl = swsscommon.Table(db, "VLAN_MEMBER") fvs = swsscommon.FieldValuePairs([("tagging_mode", "tagged")]) tbl.set("Vlan100|Ethernet24", fvs) time.sleep(1) # create vlan interface in config db - tbl = swsscommon.Table(db, "VLAN_INTERFACE", '|') + tbl = swsscommon.Table(db, "VLAN_INTERFACE") fvs = swsscommon.FieldValuePairs([("family", "IPv4")]) tbl.set("Vlan100|192.169.0.1/27", fvs) diff --git a/tests/test_fdb.py b/tests/test_fdb.py index e0c717b9d258..d873a9f6dfd3 100644 --- a/tests/test_fdb.py +++ b/tests/test_fdb.py @@ -11,11 +11,11 @@ def create_entry(tbl, key, pairs): # FIXME: better to wait until DB create them time.sleep(1) -def create_entry_tbl(db, table, separator, key, pairs): - tbl = swsscommon.Table(db, table, separator) +def create_entry_tbl(db, table, key, pairs): + tbl = swsscommon.Table(db, table) create_entry(tbl, key, pairs) -def create_entry_pst(db, table, separator, key, pairs): +def create_entry_pst(db, table, key, pairs): tbl = swsscommon.ProducerStateTable(db, table) create_entry(tbl, key, pairs) @@ -83,7 +83,7 @@ def test_FDBAddedAfterMemberCreated(dvs): # create a FDB entry in Application DB create_entry_pst( appl_db, - "FDB_TABLE", ':', "Vlan2:52-54-00-25-06-E9", + "FDB_TABLE", "Vlan2:52-54-00-25-06-E9", [ ("port", "Ethernet0"), ("type", "dynamic"), @@ -96,7 +96,7 @@ def test_FDBAddedAfterMemberCreated(dvs): # create vlan create_entry_tbl( conf_db, - "VLAN", '|', "Vlan2", + "VLAN", "Vlan2", [ ("vlanid", "2"), ] @@ -105,7 +105,7 @@ def test_FDBAddedAfterMemberCreated(dvs): # create vlan member entry in application db create_entry_tbl( conf_db, - "VLAN_MEMBER", '|', "Vlan2|Ethernet0", + "VLAN_MEMBER", "Vlan2|Ethernet0", [ ("tagging_mode", "untagged"), ] diff --git a/tests/test_speed.py b/tests/test_speed.py index c4f0923e7841..c4f92a7ef78d 100644 --- a/tests/test_speed.py +++ b/tests/test_speed.py @@ -20,9 +20,9 @@ def test_SpeedAndBufferSet(self, dvs): cdb = swsscommon.DBConnector(4, dvs.redis_sock, 0) adb = swsscommon.DBConnector(1, dvs.redis_sock, 0) - cfg_port_table = swsscommon.Table(cdb, "PORT", '|') - cfg_buffer_profile_table = swsscommon.Table(cdb, "BUFFER_PROFILE", '|') - cfg_buffer_pg_table = swsscommon.Table(cdb, "BUFFER_PG", '|') + cfg_port_table = swsscommon.Table(cdb, "PORT") + cfg_buffer_profile_table = swsscommon.Table(cdb, "BUFFER_PROFILE") + cfg_buffer_pg_table = swsscommon.Table(cdb, "BUFFER_PG") asic_port_table = swsscommon.Table(adb, "ASIC_STATE:SAI_OBJECT_TYPE_PORT") asic_profile_table = swsscommon.Table(adb, "ASIC_STATE:SAI_OBJECT_TYPE_BUFFER_PROFILE") diff --git a/tests/test_vlan.py b/tests/test_vlan.py index 85bc74a319d7..76b56b9c1a8a 100644 --- a/tests/test_vlan.py +++ b/tests/test_vlan.py @@ -10,7 +10,7 @@ def test_VlanMemberCreation(dvs): # create vlan in config db - tbl = swsscommon.Table(db, "VLAN", '|') + tbl = swsscommon.Table(db, "VLAN") fvs = swsscommon.FieldValuePairs([("vlanid", "2")]) tbl.set("Vlan2", fvs) @@ -38,7 +38,7 @@ def test_VlanMemberCreation(dvs): assert vlan_oid != None # create vlan member in config db - tbl = swsscommon.Table(db, "VLAN_MEMBER", '|') + tbl = swsscommon.Table(db, "VLAN_MEMBER") fvs = swsscommon.FieldValuePairs([("tagging_mode", "untagged")]) tbl.set("Vlan2|Ethernet0", fvs) diff --git a/tests/test_vrf.py b/tests/test_vrf.py index da0d07217ffb..9f3431ee6a83 100644 --- a/tests/test_vrf.py +++ b/tests/test_vrf.py @@ -14,18 +14,18 @@ def create_entry(tbl, key, pairs): time.sleep(1) -def create_entry_tbl(db, table, separator, key, pairs): - tbl = swsscommon.Table(db, table, separator) +def create_entry_tbl(db, table, key, pairs): + tbl = swsscommon.Table(db, table) create_entry(tbl, key, pairs) -def create_entry_pst(db, table, separator, key, pairs): +def create_entry_pst(db, table, key, pairs): tbl = swsscommon.ProducerStateTable(db, table) create_entry(tbl, key, pairs) -def delete_entry_tbl(db, table, separator, key): - tbl = swsscommon.Table(db, table, separator) +def delete_entry_tbl(db, table, key): + tbl = swsscommon.Table(db, table) tbl._del(key) time.sleep(1) @@ -71,11 +71,7 @@ def vrf_create(asic_db, conf_db, vrf_name, attributes, expected_attributes): attributes = [('empty', 'empty')] # create the VRF entry in Config DB - create_entry_tbl( - conf_db, - "VRF", '|', vrf_name, - attributes, - ) + create_entry_tbl(conf_db, "VRF", vrf_name, attributes) # check that the vrf entry was created assert how_many_entries_exist(asic_db, "ASIC_STATE:SAI_OBJECT_TYPE_VIRTUAL_ROUTER") == 2, "The vrf wasn't created" @@ -101,10 +97,7 @@ def vrf_create(asic_db, conf_db, vrf_name, attributes, expected_attributes): def vrf_remove(asic_db, conf_db, vrf_name, state): # delete the created vrf entry - delete_entry_tbl( - conf_db, - "VRF", '|', vrf_name, - ) + delete_entry_tbl(conf_db, "VRF", vrf_name) # check that the vrf entry was removed assert how_many_entries_exist(asic_db, "ASIC_STATE:SAI_OBJECT_TYPE_VIRTUAL_ROUTER") == 1, "The vrf wasn't removed" @@ -115,11 +108,7 @@ def vrf_remove(asic_db, conf_db, vrf_name, state): def vrf_update(asic_db, conf_db, vrf_name, attributes, expected_attributes, state): # update the VRF entry in Config DB - create_entry_tbl( - conf_db, - "VRF", '|', vrf_name, - attributes, - ) + create_entry_tbl(conf_db, "VRF", vrf_name, attributes) # check correctness of the created attributes is_vrf_attributes_correct(