From 7114352002c4d70673bc4c79a71413a101864164 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Fri, 7 Sep 2018 13:40:24 -0700 Subject: [PATCH] Store mirror session state in StateDB (#609) * Store mirror state in StateDB * Add MIRROR_SESSION_VLAN_HEADER_VALID * Fix setSessionStatus on MIRROR_SESSION_STATUS * Fix test * (comment) * Fix deactivateSession storing * Add test --- orchagent/aclorch.cpp | 2 +- orchagent/mirrororch.cpp | 83 ++++++++++++++++++++++----------- orchagent/mirrororch.h | 13 ++++-- orchagent/orchdaemon.cpp | 4 +- tests/conftest.py | 4 +- tests/test_mirror.py | 99 ++++++++++++++++++++-------------------- 6 files changed, 120 insertions(+), 85 deletions(-) diff --git a/orchagent/aclorch.cpp b/orchagent/aclorch.cpp index 0c6a3b6e5ab0..5e3cf05f5ca3 100644 --- a/orchagent/aclorch.cpp +++ b/orchagent/aclorch.cpp @@ -961,7 +961,7 @@ bool AclRuleMirror::create() bool state = false; sai_object_id_t oid = SAI_NULL_OBJECT_ID; - if (!m_pMirrorOrch->getSessionState(m_sessionName, state)) + if (!m_pMirrorOrch->getSessionStatus(m_sessionName, state)) { throw runtime_error("Failed to get mirror session state"); } diff --git a/orchagent/mirrororch.cpp b/orchagent/mirrororch.cpp index d448b690373b..fccf5e2367cd 100644 --- a/orchagent/mirrororch.cpp +++ b/orchagent/mirrororch.cpp @@ -4,21 +4,26 @@ #include #include +#include "sai_serialize.h" #include "orch.h" #include "logger.h" #include "swssnet.h" #include "converter.h" #include "mirrororch.h" -#define MIRROR_SESSION_STATUS "status" -#define MIRROR_SESSION_STATUS_ACTIVE "active" -#define MIRROR_SESSION_STATUS_INACTIVE "inactive" -#define MIRROR_SESSION_SRC_IP "src_ip" -#define MIRROR_SESSION_DST_IP "dst_ip" -#define MIRROR_SESSION_GRE_TYPE "gre_type" -#define MIRROR_SESSION_DSCP "dscp" -#define MIRROR_SESSION_TTL "ttl" -#define MIRROR_SESSION_QUEUE "queue" +#define MIRROR_SESSION_STATUS "status" +#define MIRROR_SESSION_STATUS_ACTIVE "active" +#define MIRROR_SESSION_STATUS_INACTIVE "inactive" +#define MIRROR_SESSION_SRC_IP "src_ip" +#define MIRROR_SESSION_DST_IP "dst_ip" +#define MIRROR_SESSION_GRE_TYPE "gre_type" +#define MIRROR_SESSION_DSCP "dscp" +#define MIRROR_SESSION_TTL "ttl" +#define MIRROR_SESSION_QUEUE "queue" +#define MIRROR_SESSION_DST_MAC_ADDRESS "dst_mac" +#define MIRROR_SESSION_MONITOR_PORT "monitor_port" +#define MIRROR_SESSION_ROUTE_PREFIX "route_prefix" +#define MIRROR_SESSION_VLAN_HEADER_VALID "vlan_header_valid" #define MIRROR_SESSION_DEFAULT_VLAN_PRI 0 #define MIRROR_SESSION_DEFAULT_VLAN_CFI 0 @@ -56,14 +61,14 @@ MirrorEntry::MirrorEntry(const string& platform) : nexthopInfo.prefix = IpPrefix("0.0.0.0/0"); } -MirrorOrch::MirrorOrch(TableConnector appDbConnector, TableConnector confDbConnector, +MirrorOrch::MirrorOrch(TableConnector stateDbConnector, TableConnector confDbConnector, PortsOrch *portOrch, RouteOrch *routeOrch, NeighOrch *neighOrch, FdbOrch *fdbOrch) : Orch(confDbConnector.first, confDbConnector.second), m_portsOrch(portOrch), m_routeOrch(routeOrch), m_neighOrch(neighOrch), m_fdbOrch(fdbOrch), - m_mirrorTableProducer(appDbConnector.first, appDbConnector.second) + m_mirrorTable(stateDbConnector.first, stateDbConnector.second) { m_portsOrch->attach(this); m_neighOrch->attach(this); @@ -121,7 +126,7 @@ bool MirrorOrch::sessionExists(const string& name) return m_syncdMirrors.find(name) != m_syncdMirrors.end(); } -bool MirrorOrch::getSessionState(const string& name, bool& state) +bool MirrorOrch::getSessionStatus(const string& name, bool& state) { SWSS_LOG_ENTER(); @@ -294,22 +299,45 @@ void MirrorOrch::deleteEntry(const string& name) SWSS_LOG_NOTICE("Removed mirror session %s", name.c_str()); } -bool MirrorOrch::setSessionState(const string& name, MirrorEntry& session) +void MirrorOrch::setSessionState(const string& name, const MirrorEntry& session, const string& attr) { SWSS_LOG_ENTER(); SWSS_LOG_INFO("Setting mirroring sessions %s state\n", name.c_str()); vector fvVector; + string value; + if (attr.empty() || attr == MIRROR_SESSION_STATUS) + { + value = session.status ? MIRROR_SESSION_STATUS_ACTIVE : MIRROR_SESSION_STATUS_INACTIVE; + fvVector.emplace_back(MIRROR_SESSION_STATUS, value); + } - string status = session.status ? MIRROR_SESSION_STATUS_ACTIVE : MIRROR_SESSION_STATUS_INACTIVE; + if (attr.empty() || attr == MIRROR_SESSION_MONITOR_PORT) + { + value = sai_serialize_object_id(session.neighborInfo.portId); + fvVector.emplace_back(MIRROR_SESSION_MONITOR_PORT, value); + } - FieldValueTuple t(MIRROR_SESSION_STATUS, status); - fvVector.push_back(t); + if (attr.empty() || attr == MIRROR_SESSION_DST_MAC_ADDRESS) + { + value = session.neighborInfo.mac.to_string(); + fvVector.emplace_back(MIRROR_SESSION_DST_MAC_ADDRESS, value); + } - m_mirrorTableProducer.set(name, fvVector); + if (attr.empty() || attr == MIRROR_SESSION_ROUTE_PREFIX) + { + value = session.nexthopInfo.prefix.to_string(); + fvVector.emplace_back(MIRROR_SESSION_ROUTE_PREFIX, value); + } - return true; + if (attr.empty() || attr == MIRROR_SESSION_VLAN_HEADER_VALID) + { + value = to_string(session.neighborInfo.port.m_type == Port::VLAN); + fvVector.emplace_back(MIRROR_SESSION_VLAN_HEADER_VALID, value); + } + + m_mirrorTable.set(name, fvVector); } bool MirrorOrch::getNeighborInfo(const string& name, MirrorEntry& session) @@ -533,11 +561,7 @@ bool MirrorOrch::activateSession(const string& name, MirrorEntry& session) } session.status = true; - - if (!setSessionState(name, session)) - { - throw runtime_error("Failed to test session state"); - } + setSessionState(name, session); MirrorSessionUpdate update = { name, true }; notify(SUBJECT_TYPE_MIRROR_SESSION_CHANGE, static_cast(&update)); @@ -566,10 +590,8 @@ bool MirrorOrch::deactivateSession(const string& name, MirrorEntry& session) session.status = false; - if (!setSessionState(name, session)) - { - throw runtime_error("Failed to test session state"); - } + // Store whole state into StateDB, since it is far from that frequent it's durable + setSessionState(name, session); SWSS_LOG_NOTICE("Deactive mirror session %s", name.c_str()); @@ -597,6 +619,8 @@ bool MirrorOrch::updateSessionDstMac(const string& name, MirrorEntry& session) SWSS_LOG_NOTICE("Update mirror session %s destination MAC to %s", name.c_str(), session.neighborInfo.mac.to_string().c_str()); + setSessionState(name, session, MIRROR_SESSION_DST_MAC_ADDRESS); + return true; } @@ -625,6 +649,7 @@ bool MirrorOrch::updateSessionDstPort(const string& name, MirrorEntry& session) SWSS_LOG_NOTICE("Update mirror session %s monitor port to %s", name.c_str(), port.m_alias.c_str()); + setSessionState(name, session, MIRROR_SESSION_MONITOR_PORT); return true; } @@ -682,6 +707,8 @@ bool MirrorOrch::updateSessionType(const string& name, MirrorEntry& session) SWSS_LOG_NOTICE("Update mirror session %s VLAN to %s", name.c_str(), session.neighborInfo.port.m_alias.c_str()); + setSessionState(name, session, MIRROR_SESSION_VLAN_HEADER_VALID); + return true; } @@ -705,6 +732,8 @@ void MirrorOrch::updateNextHop(const NextHopUpdate& update) session.nexthopInfo.prefix = update.prefix; + setSessionState(name, session, MIRROR_SESSION_ROUTE_PREFIX); + // This is the ECMP scenario that the new next hop group contains the previous // next hop. There is no need to update this session's monitor port. if (update.nexthopGroup != IpAddresses() && diff --git a/orchagent/mirrororch.h b/orchagent/mirrororch.h index a783c2a0c999..076f6b20260c 100644 --- a/orchagent/mirrororch.h +++ b/orchagent/mirrororch.h @@ -20,7 +20,7 @@ /* * Contains session data specified by user in config file * and data required for MAC address and port resolution - * */ + */ struct MirrorEntry { bool status; @@ -69,7 +69,7 @@ class MirrorOrch : public Orch, public Observer, public Subject void update(SubjectType, void *); bool sessionExists(const string&); - bool getSessionState(const string&, bool&); + bool getSessionStatus(const string&, bool&); bool getSessionOid(const string&, sai_object_id_t&); bool increaseRefCount(const string&); bool decreaseRefCount(const string&); @@ -80,7 +80,7 @@ class MirrorOrch : public Orch, public Observer, public Subject NeighOrch *m_neighOrch; FdbOrch *m_fdbOrch; - Table m_mirrorTableProducer; + Table m_mirrorTable; MirrorTable m_syncdMirrors; @@ -93,7 +93,12 @@ class MirrorOrch : public Orch, public Observer, public Subject bool updateSessionDstMac(const string&, MirrorEntry&); bool updateSessionDstPort(const string&, MirrorEntry&); bool updateSessionType(const string&, MirrorEntry&); - bool setSessionState(const string&, MirrorEntry&); + + /* + * Store mirror session state in StateDB + * attr is the field name will be stored, if empty then all fields will be stored + */ + void setSessionState(const std::string& name, const MirrorEntry& session, const std::string& attr = ""); bool getNeighborInfo(const string&, MirrorEntry&); void updateNextHop(const NextHopUpdate&); diff --git a/orchagent/orchdaemon.cpp b/orchagent/orchdaemon.cpp index ee219178a2b6..007b6d8d039a 100644 --- a/orchagent/orchdaemon.cpp +++ b/orchagent/orchdaemon.cpp @@ -101,9 +101,9 @@ bool OrchDaemon::init() }; gBufferOrch = new BufferOrch(m_configDb, buffer_tables); - TableConnector appDbMirrorSession(m_applDb, APP_MIRROR_SESSION_TABLE_NAME); + TableConnector stateDbMirrorSession(m_stateDb, APP_MIRROR_SESSION_TABLE_NAME); TableConnector confDbMirrorSession(m_configDb, CFG_MIRROR_SESSION_TABLE_NAME); - MirrorOrch *mirror_orch = new MirrorOrch(appDbMirrorSession, confDbMirrorSession, gPortsOrch, gRouteOrch, gNeighOrch, gFdbOrch); + MirrorOrch *mirror_orch = new MirrorOrch(stateDbMirrorSession, confDbMirrorSession, gPortsOrch, gRouteOrch, gNeighOrch, gFdbOrch); VRFOrch *vrf_orch = new VRFOrch(m_configDb, CFG_VRF_TABLE_NAME); TableConnector confDbAclTable(m_configDb, CFG_ACL_TABLE_NAME); diff --git a/tests/conftest.py b/tests/conftest.py index 013b0cefa2f9..a57d396315b2 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -186,6 +186,7 @@ def __init__(self, name=None): network_mode="container:%s" % self.ctn_sw.name, volumes={ self.mount: { 'bind': '/var/run/redis', 'mode': 'rw' } }) + self.appldb = None try: self.ctn.exec_run("sysctl -w net.ipv6.conf.all.disable_ipv6=0") self.check_ready() @@ -196,7 +197,8 @@ def __init__(self, name=None): raise def destroy(self): - del self.appldb + if self.appldb: + del self.appldb if self.cleanup: self.ctn.remove(force=True) self.ctn_sw.remove(force=True) diff --git a/tests/test_mirror.py b/tests/test_mirror.py index 221122c23ad5..6ad4cf418138 100644 --- a/tests/test_mirror.py +++ b/tests/test_mirror.py @@ -87,18 +87,14 @@ def remove_mirror_session(self, name): time.sleep(1) def get_mirror_session_status(self, name): - status = "" - # TODO: the status of mirror session will be moved to state database - tbl = swsscommon.Table(self.pdb, "MIRROR_SESSION") + return self.get_mirror_session_state(name)["status"] + + def get_mirror_session_state(self, name): + tbl = swsscommon.Table(self.sdb, "MIRROR_SESSION") (status, fvs) = tbl.get(name) assert status == True - assert len(fvs) == 1 - for fv in fvs: - if fv[0] == "status": - status = fv[1] - else: - assert False - return status + assert len(fvs) > 0 + return { fv[0]: fv[1] for fv in fvs } def test_MirrorAddRemove(self, dvs): @@ -119,23 +115,26 @@ def test_MirrorAddRemove(self, dvs): # create mirror session self.create_mirror_session(session, "1.1.1.1", "2.2.2.2", "0x6558", "8", "100", "0") - assert self.get_mirror_session_status(session) == "inactive" + assert self.get_mirror_session_state(session)["status"] == "inactive" # bring up Ethernet16 self.set_interface_status("Ethernet16", "up") - assert self.get_mirror_session_status(session) == "inactive" + assert self.get_mirror_session_state(session)["status"] == "inactive" # add IP address to Ethernet16 self.add_ip_address("Ethernet16", "10.0.0.0/31") - assert self.get_mirror_session_status(session) == "inactive" + assert self.get_mirror_session_state(session)["status"] == "inactive" # add neighbor to Ethernet16 self.add_neighbor("Ethernet16", "10.0.0.1", "02:04:06:08:10:12") - assert self.get_mirror_session_status(session) == "inactive" + assert self.get_mirror_session_state(session)["status"] == "inactive" # add route to mirror destination via 10.0.0.1 self.add_route(dvs, "2.2.2.2", "10.0.0.1") - assert self.get_mirror_session_status(session) == "active" + assert self.get_mirror_session_state(session)["status"] == "active" + assert self.get_mirror_session_state(session)["monitor_port"] == dvs.asicdb.portnamemap["Ethernet16"] + assert self.get_mirror_session_state(session)["dst_mac"] == "02:04:06:08:10:12" + assert self.get_mirror_session_state(session)["route_prefix"] == "2.2.2.2/32" # check asic database tbl = swsscommon.Table(self.adb, "ASIC_STATE:SAI_OBJECT_TYPE_MIRROR_SESSION") @@ -173,19 +172,19 @@ def test_MirrorAddRemove(self, dvs): # remove route self.remove_route(dvs, "2.2.2.2") - assert self.get_mirror_session_status(session) == "inactive" + assert self.get_mirror_session_state(session)["status"] == "inactive" # remove neighbor self.remove_neighbor("Ethernet16", "10.0.0.1") - assert self.get_mirror_session_status(session) == "inactive" + assert self.get_mirror_session_state(session)["status"] == "inactive" # remove IP address self.remove_ip_address("Ethernet16", "10.0.0.0/31") - assert self.get_mirror_session_status(session) == "inactive" + assert self.get_mirror_session_state(session)["status"] == "inactive" # bring down Ethernet16 self.set_interface_status("Ethernet16", "down") - assert self.get_mirror_session_status(session) == "inactive" + assert self.get_mirror_session_state(session)["status"] == "inactive" # remove mirror session self.remove_mirror_session(session) @@ -247,7 +246,7 @@ def test_MirrorToVlanAddRemove(self, dvs): # create mirror session self.create_mirror_session(session, "5.5.5.5", "6.6.6.6", "0x6558", "8", "100", "0") - assert self.get_mirror_session_status(session) == "inactive" + assert self.get_mirror_session_state(session)["status"] == "inactive" # create vlan; create vlan member self.create_vlan(dvs, "6") @@ -259,15 +258,15 @@ def test_MirrorToVlanAddRemove(self, dvs): # add ip address to vlan 6 self.add_ip_address("Vlan6", "6.6.6.0/24") - assert self.get_mirror_session_status(session) == "inactive" + assert self.get_mirror_session_state(session)["status"] == "inactive" # create neighbor to vlan 6 self.add_neighbor("Vlan6", "6.6.6.6", "66:66:66:66:66:66") - assert self.get_mirror_session_status(session) == "inactive" + assert self.get_mirror_session_state(session)["status"] == "inactive" # create fdb entry to ethernet4 self.create_fdb("6", "66-66-66-66-66-66", "Ethernet4") - assert self.get_mirror_session_status(session) == "active" + assert self.get_mirror_session_state(session)["status"] == "active" # check asic database tbl = swsscommon.Table(self.adb, "ASIC_STATE:SAI_OBJECT_TYPE_MIRROR_SESSION") @@ -315,15 +314,15 @@ def test_MirrorToVlanAddRemove(self, dvs): # remove fdb entry self.remove_fdb("6", "66-66-66-66-66-66") - assert self.get_mirror_session_status(session) == "inactive" + assert self.get_mirror_session_state(session)["status"] == "inactive" # remove neighbor self.remove_neighbor("Vlan6", "6.6.6.6") - assert self.get_mirror_session_status(session) == "inactive" + assert self.get_mirror_session_state(session)["status"] == "inactive" # remove ip address self.remove_ip_address("Vlan6", "6.6.6.0/24") - assert self.get_mirror_session_status(session) == "inactive" + assert self.get_mirror_session_state(session)["status"] == "inactive" # bring down vlan and member self.set_interface_status("Ethernet4", "down") @@ -384,7 +383,7 @@ def test_MirrorToLagAddRemove(self, dvs): # create mirror session self.create_mirror_session(session, "10.10.10.10", "11.11.11.11", "0x6558", "8", "100", "0") - assert self.get_mirror_session_status(session) == "inactive" + assert self.get_mirror_session_state(session)["status"] == "inactive" # create port channel; create port channel member self.create_port_channel(dvs, "008") @@ -396,11 +395,11 @@ def test_MirrorToLagAddRemove(self, dvs): # add ip address to port channel 008 self.add_ip_address("PortChannel008", "11.11.11.0/24") - assert self.get_mirror_session_status(session) == "inactive" + assert self.get_mirror_session_state(session)["status"] == "inactive" # create neighbor to port channel 008 self.add_neighbor("PortChannel008", "11.11.11.11", "88:88:88:88:88:88") - assert self.get_mirror_session_status(session) == "active" + assert self.get_mirror_session_state(session)["status"] == "active" # check asic database tbl = swsscommon.Table(self.adb, "ASIC_STATE:SAI_OBJECT_TYPE_MIRROR_SESSION") @@ -416,11 +415,11 @@ def test_MirrorToLagAddRemove(self, dvs): # remove neighbor self.remove_neighbor("PortChannel008", "11.11.11.11") - assert self.get_mirror_session_status(session) == "inactive" + assert self.get_mirror_session_state(session)["status"] == "inactive" # remove ip address self.remove_ip_address("PortChannel008", "11.11.11.0/24") - assert self.get_mirror_session_status(session) == "inactive" + assert self.get_mirror_session_state(session)["status"] == "inactive" # bring down port channel and port channel member self.set_interface_status("PortChannel008", "down") @@ -456,14 +455,14 @@ def test_MirrorDestMoveVlan(self, dvs): # create mirror session self.create_mirror_session(session, "7.7.7.7", "8.8.8.8", "0x6558", "8", "100", "0") - assert self.get_mirror_session_status(session) == "inactive" + assert self.get_mirror_session_state(session)["status"] == "inactive" # bring up port; add ip; add neighbor; add route self.set_interface_status("Ethernet32", "up") self.add_ip_address("Ethernet32", "80.0.0.0/31") self.add_neighbor("Ethernet32", "80.0.0.1", "02:04:06:08:10:12") self.add_route(dvs, "8.8.0.0/16", "80.0.0.1") - assert self.get_mirror_session_status(session) == "active" + assert self.get_mirror_session_state(session)["status"] == "active" # check monitor port tbl = swsscommon.Table(self.adb, "ASIC_STATE:SAI_OBJECT_TYPE_MIRROR_SESSION") @@ -482,19 +481,19 @@ def test_MirrorDestMoveVlan(self, dvs): self.create_vlan_member("9", "Ethernet48") self.set_interface_status("Vlan9", "up") self.set_interface_status("Ethernet48", "up") - assert self.get_mirror_session_status(session) == "active" + assert self.get_mirror_session_state(session)["status"] == "active" # add ip address to vlan 9 self.add_ip_address("Vlan9", "8.8.8.0/24") - assert self.get_mirror_session_status(session) == "inactive" + assert self.get_mirror_session_state(session)["status"] == "inactive" # create neighbor to vlan 9 self.add_neighbor("Vlan9", "8.8.8.8", "88:88:88:88:88:88") - assert self.get_mirror_session_status(session) == "inactive" + assert self.get_mirror_session_state(session)["status"] == "inactive" # create fdb entry to ethernet48 self.create_fdb("9", "88-88-88-88-88-88", "Ethernet48") - assert self.get_mirror_session_status(session) == "active" + assert self.get_mirror_session_state(session)["status"] == "active" # check monitor port tbl = swsscommon.Table(self.adb, "ASIC_STATE:SAI_OBJECT_TYPE_MIRROR_SESSION") @@ -518,15 +517,15 @@ def test_MirrorDestMoveVlan(self, dvs): # mirror session move round 2 # remove fdb entry self.remove_fdb("9", "88-88-88-88-88-88") - assert self.get_mirror_session_status(session) == "inactive" + assert self.get_mirror_session_state(session)["status"] == "inactive" # remove neighbor self.remove_neighbor("Vlan9", "8.8.8.8") - assert self.get_mirror_session_status(session) == "inactive" + assert self.get_mirror_session_state(session)["status"] == "inactive" # remove ip address self.remove_ip_address("Vlan9", "8.8.8.0/24") - assert self.get_mirror_session_status(session) == "active" + assert self.get_mirror_session_state(session)["status"] == "active" # check monitor port tbl = swsscommon.Table(self.adb, "ASIC_STATE:SAI_OBJECT_TYPE_MIRROR_SESSION") @@ -574,14 +573,14 @@ def test_MirrorDestMoveLag(self, dvs): # create mirror session self.create_mirror_session(session, "12.12.12.12", "13.13.13.13", "0x6558", "8", "100", "0") - assert self.get_mirror_session_status(session) == "inactive" + assert self.get_mirror_session_state(session)["status"] == "inactive" # bring up port; add ip; add neighbor; add route self.set_interface_status("Ethernet64", "up") self.add_ip_address("Ethernet64", "100.0.0.0/31") self.add_neighbor("Ethernet64", "100.0.0.1", "02:04:06:08:10:12") self.add_route(dvs, "13.13.0.0/16", "100.0.0.1") - assert self.get_mirror_session_status(session) == "active" + assert self.get_mirror_session_state(session)["status"] == "active" # check monitor port tbl = swsscommon.Table(self.adb, "ASIC_STATE:SAI_OBJECT_TYPE_MIRROR_SESSION") @@ -604,11 +603,11 @@ def test_MirrorDestMoveLag(self, dvs): # add ip address to port channel 080; create neighbor to port channel 080 self.add_ip_address("PortChannel080", "200.0.0.0/31") self.add_neighbor("PortChannel080", "200.0.0.1", "12:10:08:06:04:02") - assert self.get_mirror_session_status(session) == "active" + assert self.get_mirror_session_state(session)["status"] == "active" # add route self.add_route(dvs, "13.13.13.0/24", "200.0.0.1") - assert self.get_mirror_session_status(session) == "active" + assert self.get_mirror_session_state(session)["status"] == "active" # check monitor port tbl = swsscommon.Table(self.adb, "ASIC_STATE:SAI_OBJECT_TYPE_MIRROR_SESSION") @@ -624,12 +623,12 @@ def test_MirrorDestMoveLag(self, dvs): # mirror session move round 2 # remove port channel member self.remove_port_channel_member("080", "Ethernet32") - assert self.get_mirror_session_status(session) == "inactive" + assert self.get_mirror_session_state(session)["status"] == "inactive" # mirror session move round 3 # create port channel member self.create_port_channel_member("080", "Ethernet32") - assert self.get_mirror_session_status(session) == "active" + assert self.get_mirror_session_state(session)["status"] == "active" # check monitor port tbl = swsscommon.Table(self.adb, "ASIC_STATE:SAI_OBJECT_TYPE_MIRROR_SESSION") @@ -645,7 +644,7 @@ def test_MirrorDestMoveLag(self, dvs): # mirror session move round 4 # remove route self.remove_route(dvs, "13.13.13.0/24") - assert self.get_mirror_session_status(session) == "active" + assert self.get_mirror_session_state(session)["status"] == "active" port_oid = "" # check monitor port @@ -668,14 +667,14 @@ def test_MirrorDestMoveLag(self, dvs): self.set_interface_status("PortChannel080", "down") self.remove_port_channel_member("080", "Ethernet32") self.remove_port_channel(dvs, "080") - assert self.get_mirror_session_status(session) == "active" + assert self.get_mirror_session_state(session)["status"] == "active" # remove route; remove neighbor; remove ip; bring down port self.remove_route(dvs, "13.13.0.0/16") self.remove_neighbor("Ethernet64", "100.0.0.1") self.remove_ip_address("Ethernet64", "100.0.0.0/31") self.set_interface_status("Ethernet64", "down") - assert self.get_mirror_session_status(session) == "inactive" + assert self.get_mirror_session_state(session)["status"] == "inactive" # remove mirror session self.remove_mirror_session(session) @@ -727,7 +726,7 @@ def test_AclBindMirror(self, dvs): # create mirror session self.create_mirror_session(session, "3.3.3.3", "4.4.4.4", "0x6558", "8", "100", "0") - assert self.get_mirror_session_status(session) == "active" + assert self.get_mirror_session_state(session)["status"] == "active" # assert mirror session in asic database tbl = swsscommon.Table(self.adb, "ASIC_STATE:SAI_OBJECT_TYPE_MIRROR_SESSION")