From 1f4a1d76bd9cd3e8865911840ab8e47c0ba221f1 Mon Sep 17 00:00:00 2001 From: Kamil Cudnik Date: Tue, 24 Sep 2019 10:42:13 +0200 Subject: [PATCH] Add warm boot support with removed/created port (#515) * Add warm boot support with removed/created port * Fix aspell * Update sai_warmboot.bin location to local folder --- syncd/syncd.cpp | 32 +++++-- syncd/syncd_applyview.cpp | 41 ++++++++- syncd/syncd_hard_reinit.cpp | 2 +- syncd/syncd_saiswitch.cpp | 139 ++++++++++++++++++++++++++++-- syncd/syncd_saiswitch.h | 45 +++++++++- tests/aspell.en.pws | 1 + tests/brcm.pl | 30 +++++++ tests/brcm/remove_create_port.rec | 12 ++- tests/brcm/remove_port.rec | 8 ++ tests/brcm/vsprofile.ini | 5 +- tests/brcm/wb_port_create_a.rec | 22 +++++ tests/brcm/wb_port_create_b.rec | 13 +++ tests/brcm/wb_port_remove_a.rec | 18 ++++ tests/brcm/wb_port_remove_b.rec | 13 +++ tests/mlnx/vsprofile.ini | 4 +- vslib/src/sai_vs_port.cpp | 61 ++++++++++++- 16 files changed, 424 insertions(+), 22 deletions(-) create mode 100644 tests/brcm/wb_port_create_a.rec create mode 100644 tests/brcm/wb_port_create_b.rec create mode 100644 tests/brcm/wb_port_remove_a.rec create mode 100644 tests/brcm/wb_port_remove_b.rec diff --git a/syncd/syncd.cpp b/syncd/syncd.cpp index 9038a7220941..f1065e0383ae 100644 --- a/syncd/syncd.cpp +++ b/syncd/syncd.cpp @@ -1257,6 +1257,7 @@ void get_port_related_objects( void post_port_remove( _In_ std::shared_ptr sw, + _In_ sai_object_id_t port_rid, _In_ const std::vector& relatedRids) { SWSS_LOG_ENTER(); @@ -1307,16 +1308,16 @@ void post_port_remove( sai_object_type_t ot = redis_sai_object_type_query(vid); - std::string key = sai_serialize_object_type(ot) + ":" + str_vid; + std::string key = ASIC_STATE_TABLE + std::string(":") + sai_serialize_object_type(ot) + ":" + str_vid; SWSS_LOG_INFO("removing ASIC DB key: %s", key.c_str()); g_redisClient->del(key); } - SWSS_LOG_NOTICE("post port remove actions succeeded"); + sw->onPostPortRemove(port_rid); - // TODO lane map must be updated (for warm boot) + SWSS_LOG_NOTICE("post port remove actions succeeded"); } void post_port_create( @@ -1328,7 +1329,7 @@ void post_port_create( sw->onPostPortCreate(port_rid, port_vid); - // TODO lane map must be updated (for warm boot) + SWSS_LOG_NOTICE("post port create actions succeeded"); } sai_status_t handle_generic( @@ -1560,7 +1561,7 @@ sai_status_t handle_generic( if (object_type == SAI_OBJECT_TYPE_PORT) { - post_port_remove(switches.at(switch_vid), related); + post_port_remove(switches.at(switch_vid), rid, related); } } } @@ -2418,6 +2419,16 @@ sai_status_t processEventInInitViewMode( { case SAI_COMMON_API_CREATE: + if (object_type == SAI_OBJECT_TYPE_PORT) + { + // reason for this is that if user will create port, + // new port is not actually created so when for example + // querying new queues for new created port, there are + // not there, since no actual port create was issued on + // the ASIC + SWSS_LOG_THROW("port object can't be created in init view mode"); + } + if (info->isnonobjectid) { /* @@ -2450,6 +2461,17 @@ sai_status_t processEventInInitViewMode( case SAI_COMMON_API_REMOVE: + if (object_type == SAI_OBJECT_TYPE_PORT) + { + // reason for this is that if user will remove port, actual + // resources for it wont be release, lanes would be still + // occupied and there is extra logic required in post port + // remove which clears OIDs (ipgs,queues,SGs) from redis db + // that are automatically removed by vendor SAI, and comparison + // logic don't support that + SWSS_LOG_THROW("port object can't be removed in init view mode"); + } + if (object_type == SAI_OBJECT_TYPE_SWITCH) { /* diff --git a/syncd/syncd_applyview.cpp b/syncd/syncd_applyview.cpp index 6c6b9889a0a3..e4a68d53e2cd 100644 --- a/syncd/syncd_applyview.cpp +++ b/syncd/syncd_applyview.cpp @@ -6985,6 +6985,7 @@ void populateExistingObjects( auto sw = switches.begin()->second; auto coldBootDiscoveredVids = sw->getColdBootDiscoveredVids(); + auto warmBootDiscoveredVids = sw->getWarmBootDiscoveredVids(); /* * If some objects that are existing objects on switch are not present in @@ -7058,9 +7059,47 @@ void populateExistingObjects( * NOTE: If we are here, then this RID exists only in current view, and * if this object contains any OID attributes, discovery logic queried * them so they are also existing in current view. + * + * Also in warm boot, when user removed port, and then created some new + * ports, new QUEUEs, IPGs and SGs will be created automatically by + * SAI. Those new created objects mot likely will have different RID + * values then previous instances for given port. Those values should + * also be copied to temporary view, since they will not exist on cold + * boot discovered VIDs. If not, then comparison logic will try to remove + * them which is not what we want. + * + * This is tricky scenario, and there could be some issues also when + * other object types would be created by user. */ - if (coldBootDiscoveredVids.find(vid) == coldBootDiscoveredVids.end()) + bool performColdCheck = true; + + if (warmBootDiscoveredVids.find(vid) != warmBootDiscoveredVids.end()) + { + sai_object_type_t ot = redis_sai_object_type_query(vid); + + switch (ot) + { + case SAI_OBJECT_TYPE_QUEUE: + case SAI_OBJECT_TYPE_INGRESS_PRIORITY_GROUP: + case SAI_OBJECT_TYPE_SCHEDULER_GROUP: + + // TODO this case may require adjustment, if user will do a + // warm boot then remove/add some ports and make another + // warm boot, it may happen that current logic will be + // confused which of those objects are from previous warm + // boot or second one, need better way to mark changes to + // those objects in redis DB between warm boots + + performColdCheck = false; + + break; + default: + break; + } + } + + if (performColdCheck && coldBootDiscoveredVids.find(vid) == coldBootDiscoveredVids.end()) { SWSS_LOG_INFO("object is not on default existing list: %s RID %s VID %s", sai_serialize_object_type(sai_object_type_query(rid)).c_str(), diff --git a/syncd/syncd_hard_reinit.cpp b/syncd/syncd_hard_reinit.cpp index 3133e992a908..10d19a8a8e9d 100644 --- a/syncd/syncd_hard_reinit.cpp +++ b/syncd/syncd_hard_reinit.cpp @@ -1349,7 +1349,7 @@ void performWarmRestart() * Perform all get operations on existing switch. */ - auto sw = switches[switch_vid] = std::make_shared(switch_vid, switch_rid); + auto sw = switches[switch_vid] = std::make_shared(switch_vid, switch_rid, true); g_switch_rid = switch_rid; g_switch_vid = switch_vid; diff --git a/syncd/syncd_saiswitch.cpp b/syncd/syncd_saiswitch.cpp index ad585b6508a3..148d0469a857 100644 --- a/syncd/syncd_saiswitch.cpp +++ b/syncd/syncd_saiswitch.cpp @@ -7,6 +7,8 @@ #include #include +const int maxLanesPerPort = 8; + /* * NOTE: all those methods could be implemented inside SaiSwitch class so then * we could skip using switch_id in params and even they could be public then. @@ -148,18 +150,16 @@ std::unordered_map SaiSwitch::saiGetHardwareLaneM * addressed in future. */ - const int lanesPerPort = 8; - for (const auto &port_rid : portList) { - sai_uint32_t lanes[lanesPerPort]; + sai_uint32_t lanes[maxLanesPerPort]; memset(lanes, 0, sizeof(lanes)); sai_attribute_t attr; attr.id = SAI_PORT_ATTR_HW_LANE_LIST; - attr.value.u32list.count = lanesPerPort; + attr.value.u32list.count = maxLanesPerPort; attr.value.u32list.list = lanes; sai_status_t status = sai_metadata_sai_port_api->get_port_attribute(port_rid, 1, &attr); @@ -1059,6 +1059,13 @@ std::set SaiSwitch::getColdBootDiscoveredVids() const return discoveredVids; } +std::set SaiSwitch::getWarmBootDiscoveredVids() const +{ + SWSS_LOG_ENTER(); + + return m_warmBootDiscoveredVids; +} + void SaiSwitch::redisSaveColdBootDiscoveredVids() const { SWSS_LOG_ENTER(); @@ -1224,6 +1231,21 @@ sai_object_id_t SaiSwitch::getDefaultValueForOidAttr( return ita->second; } +void SaiSwitch::helperPopulateWarmBootVids() +{ + SWSS_LOG_ENTER(); + + if (!m_warmBoot) + return; + + for (sai_object_id_t rid: m_discovered_rids) + { + sai_object_id_t vid = translate_rid_to_vid(rid, m_switch_vid); + + m_warmBootDiscoveredVids.insert(vid); + } +} + /* * NOTE: If real ID will change during hard restarts, then we need to remap all * VID/RID, but we can only do that if we will save entire tree with all @@ -1232,7 +1254,9 @@ sai_object_id_t SaiSwitch::getDefaultValueForOidAttr( SaiSwitch::SaiSwitch( _In_ sai_object_id_t switch_vid, - _In_ sai_object_id_t switch_rid) + _In_ sai_object_id_t switch_rid, + _In_ bool warmBoot): + m_warmBoot(warmBoot) { SWSS_LOG_ENTER(); @@ -1263,9 +1287,68 @@ SaiSwitch::SaiSwitch( helperLoadColdVids(); + helperPopulateWarmBootVids(); + saiGetMacAddress(m_default_mac_address); } +std::vector SaiSwitch::saiGetPortLanes( + _In_ sai_object_id_t port_rid) +{ + SWSS_LOG_ENTER(); + + std::vector lanes; + + lanes.resize(maxLanesPerPort); + + sai_attribute_t attr; + + attr.id = SAI_PORT_ATTR_HW_LANE_LIST; + attr.value.u32list.count = maxLanesPerPort; + attr.value.u32list.list = lanes.data(); + + sai_status_t status = sai_metadata_sai_port_api->get_port_attribute(port_rid, 1, &attr); + + if (status != SAI_STATUS_SUCCESS) + { + SWSS_LOG_THROW("failed to get hardware lane list port RID %s: %s", + sai_serialize_object_id(port_rid).c_str(), + sai_serialize_status(status).c_str()); + } + + if (attr.value.u32list.count == 0) + { + SWSS_LOG_THROW("switch returned lane count ZERO for port RID %s", + sai_serialize_object_id(port_rid).c_str()); + } + + lanes.resize(attr.value.u32list.count); + + return lanes; +} + +void SaiSwitch::redisUpdatePortLaneMap( + _In_ sai_object_id_t port_rid) +{ + SWSS_LOG_ENTER(); + + auto lanes = saiGetPortLanes(port_rid); + + for (uint32_t lane: lanes) + { + std::string strLane = sai_serialize_number(lane); + std::string strPortId = sai_serialize_object_id(port_rid); + + auto key = getRedisLanesKey(); + + g_redisClient->hset(key, strLane, strPortId); + } + + SWSS_LOG_NOTICE("added %zu lanes to redis lane map for port RID %s", + lanes.size(), + sai_serialize_object_id(port_rid).c_str()); +} + void SaiSwitch::onPostPortCreate( _In_ sai_object_id_t port_rid, _In_ sai_object_id_t port_vid) @@ -1282,7 +1365,8 @@ void SaiSwitch::onPostPortCreate( m_discovered_rids.insert(discovered.begin(), discovered.end()); - SWSS_LOG_NOTICE("putting ALL new discovered objects to redis"); + SWSS_LOG_NOTICE("putting ALL new discovered objects to redis for port %s", + sai_serialize_object_id(port_vid).c_str()); for (sai_object_id_t rid: discovered) { @@ -1296,5 +1380,48 @@ void SaiSwitch::onPostPortCreate( redisSetDummyAsicStateForRealObjectId(rid); } + + redisUpdatePortLaneMap(port_rid); } +void SaiSwitch::onPostPortRemove( + _In_ sai_object_id_t port_rid) +{ + SWSS_LOG_ENTER(); + + int removed = 0; + + // key - lane number, value - port RID + auto map = redisGetLaneMap(); + + for (auto& kv: map) + { + if (kv.second == port_rid) + { + auto key = getRedisLanesKey(); + + std::string strLane = sai_serialize_number(kv.first); + + g_redisClient->hdel(key, strLane); + + removed++; + } + } + + SWSS_LOG_NOTICE("removed %u lanes from redis lane map for port RID %s", + removed, + sai_serialize_object_id(port_rid).c_str()); + + if (removed == 0) + { + SWSS_LOG_THROW("NO LANES found in redis lane map for given port RID %s", + sai_serialize_object_id(port_rid).c_str()); + } +} + +bool SaiSwitch::isWarmBoot() const +{ + SWSS_LOG_ENTER(); + + return m_warmBoot; +} diff --git a/syncd/syncd_saiswitch.h b/syncd/syncd_saiswitch.h index 271fec8dbfb3..39cde84360c6 100644 --- a/syncd/syncd_saiswitch.h +++ b/syncd/syncd_saiswitch.h @@ -27,7 +27,8 @@ class SaiSwitch SaiSwitch( _In_ sai_object_id_t switch_vid, - _In_ sai_object_id_t switch_rid); + _In_ sai_object_id_t switch_rid, + _In_ bool warmBoot = false); /* * Methods. @@ -183,6 +184,13 @@ class SaiSwitch */ std::set getColdBootDiscoveredVids() const; + /** + * @brief Get warm boot discovered VIDs. + * + * @return Set of warm boot discovered VIDs after warm boot. + */ + std::set getWarmBootDiscoveredVids() const; + /** * @brief On post port create. * @@ -194,6 +202,15 @@ class SaiSwitch _In_ sai_object_id_t port_rid, _In_ sai_object_id_t port_vid); + /** + * @brief On post port remove. + * + * Performs actions after port remove. Will remove lanes associated + * with port from redis lane map. + */ + void onPostPortRemove( + _In_ sai_object_id_t port_rid); + private: /* @@ -270,6 +287,16 @@ class SaiSwitch std::unordered_map saiGetHardwareLaneMap() const; + /** + * @brief Get port lanes for specific port. + * + * @param port_rid Port RID for which lanes should be retrieved. + * + * @returns Lanes vector. + */ + std::vector saiGetPortLanes( + _In_ sai_object_id_t port_rid); + /** * @brief Get MAC address. * @@ -314,6 +341,14 @@ class SaiSwitch */ void redisSaveColdBootDiscoveredVids() const; + /** + * @brief Update lane map for specific port. + * + * @param port_rid Port RID for which lane map should be updated + */ + void redisUpdatePortLaneMap( + _In_ sai_object_id_t port_rid); + /* * Helper Methods. */ @@ -353,6 +388,8 @@ class SaiSwitch void helperLoadColdVids(); + void helperPopulateWarmBootVids(); + /* * Other Methods. */ @@ -360,6 +397,8 @@ class SaiSwitch std::string getRedisLanesKey() const; std::string getRedisHiddenKey() const; + bool isWarmBoot() const; + /** * @brief Default oid map. * @@ -380,6 +419,10 @@ class SaiSwitch std::unordered_map> m_defaultOidMap; std::set m_coldBootDiscoveredVids; + + std::set m_warmBootDiscoveredVids; + + bool m_warmBoot; }; extern std::map> switches; diff --git a/tests/aspell.en.pws b/tests/aspell.en.pws index c78e22cdaf47..ec357f88bbf0 100644 --- a/tests/aspell.en.pws +++ b/tests/aspell.en.pws @@ -90,6 +90,7 @@ INSEG ip IP IPG +IPGs ipgs ipmc IPv diff --git a/tests/brcm.pl b/tests/brcm.pl index 9a7c5db194d6..9e140ccf1595 100755 --- a/tests/brcm.pl +++ b/tests/brcm.pl @@ -490,8 +490,38 @@ sub test_acl_counter2 play "acl_counter2.rec", 0; } +sub test_brcm_warm_boot_port_remove +{ + fresh_start; + + play "wb_port_remove_a.rec"; + + request_warm_shutdown; + start_syncd_warm; + + play "wb_port_remove_b.rec"; + + request_warm_shutdown; +} + +sub test_brcm_warm_boot_port_create +{ + fresh_start; + + play "wb_port_create_a.rec"; + + request_warm_shutdown; + start_syncd_warm; + + play "wb_port_create_b.rec"; + + request_warm_shutdown; +} + # RUN TESTS +test_brcm_warm_boot_port_remove; +test_brcm_warm_boot_port_create; test_remove_port; test_remove_create_port; test_acl_counter2; diff --git a/tests/brcm/remove_create_port.rec b/tests/brcm/remove_create_port.rec index 2fddb6089513..2c0c4c38001f 100644 --- a/tests/brcm/remove_create_port.rec +++ b/tests/brcm/remove_create_port.rec @@ -3,9 +3,19 @@ 2017-06-14.01:55:46.555975|c|SAI_OBJECT_TYPE_SWITCH:oid:0x21000000000000|SAI_SWITCH_ATTR_INIT_SWITCH=true 2017-06-14.01:56:05.520538|g|SAI_OBJECT_TYPE_SWITCH:oid:0x21000000000000|SAI_SWITCH_ATTR_PORT_LIST=32:oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0 2017-06-14.01:56:05.525938|G|SAI_STATUS_SUCCESS|SAI_SWITCH_ATTR_PORT_LIST=32:oid:0x1000000000002,oid:0x1000000000003,oid:0x1000000000004,oid:0x1000000000005,oid:0x1000000000006,oid:0x1000000000007,oid:0x1000000000008,oid:0x1000000000009,oid:0x100000000000a,oid:0x100000000000b,oid:0x100000000000c,oid:0x100000000000d,oid:0x100000000000e,oid:0x100000000000f,oid:0x1000000000010,oid:0x1000000000011,oid:0x1000000000012,oid:0x1000000000013,oid:0x1000000000014,oid:0x1000000000015,oid:0x1000000000016,oid:0x1000000000017,oid:0x1000000000018,oid:0x1000000000019,oid:0x100000000001a,oid:0x100000000001b,oid:0x100000000001c,oid:0x100000000001d,oid:0x100000000001e,oid:0x100000000001f,oid:0x1000000000020,oid:0x1000000000021 +2018-08-06.22:34:50.344893|g|SAI_OBJECT_TYPE_SWITCH:oid:0x21000000000000|SAI_SWITCH_ATTR_DEFAULT_1Q_BRIDGE_ID=oid:0x0|SAI_SWITCH_ATTR_DEFAULT_VLAN_ID=oid:0x0 +2018-08-06.22:34:50.345605|G|SAI_STATUS_SUCCESS|SAI_SWITCH_ATTR_DEFAULT_1Q_BRIDGE_ID=oid:0x39000000000001|SAI_SWITCH_ATTR_DEFAULT_VLAN_ID=oid:0x26000000000001 +2018-08-06.22:34:50.345660|g|SAI_OBJECT_TYPE_VLAN:oid:0x26000000000001|SAI_VLAN_ATTR_MEMBER_LIST=32:oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0 +2018-08-06.22:34:50.347858|G|SAI_STATUS_SUCCESS|SAI_VLAN_ATTR_MEMBER_LIST=32:oid:0x27000000000002,oid:0x27000000000003,oid:0x27000000000004,oid:0x27000000000005,oid:0x27000000000006,oid:0x27000000000007,oid:0x27000000000008,oid:0x27000000000009,oid:0x2700000000000a,oid:0x2700000000000b,oid:0x2700000000000c,oid:0x2700000000000d,oid:0x2700000000000e,oid:0x2700000000000f,oid:0x27000000000010,oid:0x27000000000011,oid:0x27000000000012,oid:0x27000000000013,oid:0x27000000000014,oid:0x27000000000015,oid:0x27000000000016,oid:0x27000000000017,oid:0x27000000000018,oid:0x27000000000019,oid:0x2700000000001a,oid:0x2700000000001b,oid:0x2700000000001c,oid:0x2700000000001d,oid:0x2700000000001e,oid:0x2700000000001f,oid:0x27000000000020,oid:0x27000000000021 +2018-08-06.22:34:50.351789|g|SAI_OBJECT_TYPE_BRIDGE:oid:0x39000000000001|SAI_BRIDGE_ATTR_PORT_LIST=32:oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0 +2018-08-06.22:34:50.355829|G|SAI_STATUS_SUCCESS|SAI_BRIDGE_ATTR_PORT_LIST=32:oid:0x3a000000000002,oid:0x3a000000000003,oid:0x3a000000000004,oid:0x3a000000000005,oid:0x3a000000000006,oid:0x3a000000000007,oid:0x3a000000000008,oid:0x3a000000000009,oid:0x3a00000000000a,oid:0x3a00000000000b,oid:0x3a00000000000c,oid:0x3a00000000000d,oid:0x3a00000000000e,oid:0x3a00000000000f,oid:0x3a000000000010,oid:0x3a000000000011,oid:0x3a000000000012,oid:0x3a000000000013,oid:0x3a000000000014,oid:0x3a000000000015,oid:0x3a000000000016,oid:0x3a000000000017,oid:0x3a000000000018,oid:0x3a000000000019,oid:0x3a00000000001a,oid:0x3a00000000001b,oid:0x3a00000000001c,oid:0x3a00000000001d,oid:0x3a00000000001e,oid:0x3a00000000001f,oid:0x3a000000000020,oid:0x3a000000000021 +2018-08-06.22:34:50.347983|r|SAI_OBJECT_TYPE_VLAN_MEMBER:oid:0x27000000000002 +2018-08-06.22:34:50.360742|r|SAI_OBJECT_TYPE_BRIDGE_PORT:oid:0x3a000000000002 2017-06-14.01:56:11.535437|r|SAI_OBJECT_TYPE_PORT:oid:0x1000000000002 2017-06-14.01:56:05.520538|g|SAI_OBJECT_TYPE_SWITCH:oid:0x21000000000000|SAI_SWITCH_ATTR_PORT_LIST=31:oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0 2017-06-14.01:56:05.525938|G|SAI_STATUS_SUCCESS|SAI_SWITCH_ATTR_PORT_LIST=31:oid:0x1000000000003,oid:0x1000000000004,oid:0x1000000000005,oid:0x1000000000006,oid:0x1000000000007,oid:0x1000000000008,oid:0x1000000000009,oid:0x100000000000a,oid:0x100000000000b,oid:0x100000000000c,oid:0x100000000000d,oid:0x100000000000e,oid:0x100000000000f,oid:0x1000000000010,oid:0x1000000000011,oid:0x1000000000012,oid:0x1000000000013,oid:0x1000000000014,oid:0x1000000000015,oid:0x1000000000016,oid:0x1000000000017,oid:0x1000000000018,oid:0x1000000000019,oid:0x100000000001a,oid:0x100000000001b,oid:0x100000000001c,oid:0x100000000001d,oid:0x100000000001e,oid:0x100000000001f,oid:0x1000000000020,oid:0x1000000000021 -2017-06-14.01:56:11.535437|r|SAI_OBJECT_TYPE_PORT:oid:0x1000000000003 +2017-06-14.01:56:11.535437|c|SAI_OBJECT_TYPE_PORT:oid:0x1000000000022|SAI_PORT_ATTR_HW_LANE_LIST=2:200,201|SAI_PORT_ATTR_SPEED=10000 +2017-06-14.01:56:11.535437|c|SAI_OBJECT_TYPE_PORT:oid:0x1000000000023|SAI_PORT_ATTR_HW_LANE_LIST=1:202|SAI_PORT_ATTR_SPEED=10000 +2017-06-14.01:56:11.535437|c|SAI_OBJECT_TYPE_PORT:oid:0x1000000000024|SAI_PORT_ATTR_HW_LANE_LIST=1:203|SAI_PORT_ATTR_SPEED=10000 2017-06-14.01:56:06.151337|a|APPLY_VIEW 2017-06-14.01:56:06.156740|A|SAI_STATUS_SUCCESS diff --git a/tests/brcm/remove_port.rec b/tests/brcm/remove_port.rec index 572a55b797e2..df81c4067f1b 100644 --- a/tests/brcm/remove_port.rec +++ b/tests/brcm/remove_port.rec @@ -13,6 +13,14 @@ 2017-06-14.01:56:34.471663|c|SAI_OBJECT_TYPE_BUFFER_PROFILE:oid:0x19000000000624|SAI_BUFFER_PROFILE_ATTR_POOL_ID=oid:0x1800000000061f|SAI_BUFFER_PROFILE_ATTR_RESERVED_BUFFER_SIZE=1518|SAI_BUFFER_PROFILE_ATTR_THRESHOLD_MODE=SAI_BUFFER_PROFILE_THRESHOLD_MODE_DYNAMIC|SAI_BUFFER_PROFILE_ATTR_SHARED_DYNAMIC_TH=1 2017-06-14.01:56:34.473539|s|SAI_OBJECT_TYPE_INGRESS_PRIORITY_GROUP:oid:0x1a000000000044|SAI_INGRESS_PRIORITY_GROUP_ATTR_BUFFER_PROFILE=oid:0x19000000000624 2017-06-14.01:56:34.473539|s|SAI_OBJECT_TYPE_INGRESS_PRIORITY_GROUP:oid:0x1a000000000044|SAI_INGRESS_PRIORITY_GROUP_ATTR_BUFFER_PROFILE=oid:0x0 +2018-08-06.22:34:50.344893|g|SAI_OBJECT_TYPE_SWITCH:oid:0x21000000000000|SAI_SWITCH_ATTR_DEFAULT_1Q_BRIDGE_ID=oid:0x0|SAI_SWITCH_ATTR_DEFAULT_VLAN_ID=oid:0x0 +2018-08-06.22:34:50.345605|G|SAI_STATUS_SUCCESS|SAI_SWITCH_ATTR_DEFAULT_1Q_BRIDGE_ID=oid:0x39000000000001|SAI_SWITCH_ATTR_DEFAULT_VLAN_ID=oid:0x26000000000001 +2018-08-06.22:34:50.345660|g|SAI_OBJECT_TYPE_VLAN:oid:0x26000000000001|SAI_VLAN_ATTR_MEMBER_LIST=32:oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0 +2018-08-06.22:34:50.347858|G|SAI_STATUS_SUCCESS|SAI_VLAN_ATTR_MEMBER_LIST=32:oid:0x27000000000002,oid:0x27000000000003,oid:0x27000000000004,oid:0x27000000000005,oid:0x27000000000006,oid:0x27000000000007,oid:0x27000000000008,oid:0x27000000000009,oid:0x2700000000000a,oid:0x2700000000000b,oid:0x2700000000000c,oid:0x2700000000000d,oid:0x2700000000000e,oid:0x2700000000000f,oid:0x27000000000010,oid:0x27000000000011,oid:0x27000000000012,oid:0x27000000000013,oid:0x27000000000014,oid:0x27000000000015,oid:0x27000000000016,oid:0x27000000000017,oid:0x27000000000018,oid:0x27000000000019,oid:0x2700000000001a,oid:0x2700000000001b,oid:0x2700000000001c,oid:0x2700000000001d,oid:0x2700000000001e,oid:0x2700000000001f,oid:0x27000000000020,oid:0x27000000000021 +2018-08-06.22:34:50.351789|g|SAI_OBJECT_TYPE_BRIDGE:oid:0x39000000000001|SAI_BRIDGE_ATTR_PORT_LIST=32:oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0 +2018-08-06.22:34:50.355829|G|SAI_STATUS_SUCCESS|SAI_BRIDGE_ATTR_PORT_LIST=32:oid:0x3a000000000002,oid:0x3a000000000003,oid:0x3a000000000004,oid:0x3a000000000005,oid:0x3a000000000006,oid:0x3a000000000007,oid:0x3a000000000008,oid:0x3a000000000009,oid:0x3a00000000000a,oid:0x3a00000000000b,oid:0x3a00000000000c,oid:0x3a00000000000d,oid:0x3a00000000000e,oid:0x3a00000000000f,oid:0x3a000000000010,oid:0x3a000000000011,oid:0x3a000000000012,oid:0x3a000000000013,oid:0x3a000000000014,oid:0x3a000000000015,oid:0x3a000000000016,oid:0x3a000000000017,oid:0x3a000000000018,oid:0x3a000000000019,oid:0x3a00000000001a,oid:0x3a00000000001b,oid:0x3a00000000001c,oid:0x3a00000000001d,oid:0x3a00000000001e,oid:0x3a00000000001f,oid:0x3a000000000020,oid:0x3a000000000021 +2018-08-06.22:34:50.347983|r|SAI_OBJECT_TYPE_VLAN_MEMBER:oid:0x27000000000002 +2018-08-06.22:34:50.360742|r|SAI_OBJECT_TYPE_BRIDGE_PORT:oid:0x3a000000000002 2017-06-14.01:56:11.535437|r|SAI_OBJECT_TYPE_PORT:oid:0x1000000000002 2017-06-14.01:56:11.535437|c|SAI_OBJECT_TYPE_PORT:oid:0x1000000000022|SAI_PORT_ATTR_SPEED=10000|SAI_PORT_ATTR_HW_LANE_LIST=1:202 2017-06-14.01:56:11.535437|c|SAI_OBJECT_TYPE_PORT:oid:0x1000000000023|SAI_PORT_ATTR_SPEED=10000|SAI_PORT_ATTR_HW_LANE_LIST=1:203 diff --git a/tests/brcm/vsprofile.ini b/tests/brcm/vsprofile.ini index 9ee3cc075d3e..2704aeecfcc4 100644 --- a/tests/brcm/vsprofile.ini +++ b/tests/brcm/vsprofile.ini @@ -1,4 +1,5 @@ -SAI_WARM_BOOT_READ_FILE=/var/cache/sai_warmboot.bin -SAI_WARM_BOOT_WRITE_FILE=/var/cache/sai_warmboot.bin +SAI_WARM_BOOT_READ_FILE=./sai_warmboot.bin +SAI_WARM_BOOT_WRITE_FILE=./sai_warmboot.bin SAI_VS_SWITCH_TYPE=SAI_VS_SWITCH_TYPE_BCM56850 SAI_VS_INTERFACE_LANE_MAP_FILE=brcm/lanemap.ini +#SAI_VS_INTERFACE_LANE_MAP_FILE=brcm/lane66.ini diff --git a/tests/brcm/wb_port_create_a.rec b/tests/brcm/wb_port_create_a.rec new file mode 100644 index 000000000000..fa5282e229d4 --- /dev/null +++ b/tests/brcm/wb_port_create_a.rec @@ -0,0 +1,22 @@ +2017-06-14.01:55:46.543987|a|INIT_VIEW +2017-06-14.01:55:46.551164|A|SAI_STATUS_SUCCESS +2017-06-14.01:55:46.555975|c|SAI_OBJECT_TYPE_SWITCH:oid:0x21000000000000|SAI_SWITCH_ATTR_INIT_SWITCH=true +2017-06-14.01:56:05.520538|g|SAI_OBJECT_TYPE_SWITCH:oid:0x21000000000000|SAI_SWITCH_ATTR_PORT_LIST=32:oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0 +2017-06-14.01:56:05.525938|G|SAI_STATUS_SUCCESS|SAI_SWITCH_ATTR_PORT_LIST=32:oid:0x1000000000002,oid:0x1000000000003,oid:0x1000000000004,oid:0x1000000000005,oid:0x1000000000006,oid:0x1000000000007,oid:0x1000000000008,oid:0x1000000000009,oid:0x100000000000a,oid:0x100000000000b,oid:0x100000000000c,oid:0x100000000000d,oid:0x100000000000e,oid:0x100000000000f,oid:0x1000000000010,oid:0x1000000000011,oid:0x1000000000012,oid:0x1000000000013,oid:0x1000000000014,oid:0x1000000000015,oid:0x1000000000016,oid:0x1000000000017,oid:0x1000000000018,oid:0x1000000000019,oid:0x100000000001a,oid:0x100000000001b,oid:0x100000000001c,oid:0x100000000001d,oid:0x100000000001e,oid:0x100000000001f,oid:0x1000000000020,oid:0x1000000000021 +2018-08-06.22:34:50.344893|g|SAI_OBJECT_TYPE_SWITCH:oid:0x21000000000000|SAI_SWITCH_ATTR_DEFAULT_1Q_BRIDGE_ID=oid:0x0|SAI_SWITCH_ATTR_DEFAULT_VLAN_ID=oid:0x0 +2018-08-06.22:34:50.345605|G|SAI_STATUS_SUCCESS|SAI_SWITCH_ATTR_DEFAULT_1Q_BRIDGE_ID=oid:0x39000000000001|SAI_SWITCH_ATTR_DEFAULT_VLAN_ID=oid:0x26000000000001 +2018-08-06.22:34:50.345660|g|SAI_OBJECT_TYPE_VLAN:oid:0x26000000000001|SAI_VLAN_ATTR_MEMBER_LIST=32:oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0 +2018-08-06.22:34:50.347858|G|SAI_STATUS_SUCCESS|SAI_VLAN_ATTR_MEMBER_LIST=32:oid:0x27000000000002,oid:0x27000000000003,oid:0x27000000000004,oid:0x27000000000005,oid:0x27000000000006,oid:0x27000000000007,oid:0x27000000000008,oid:0x27000000000009,oid:0x2700000000000a,oid:0x2700000000000b,oid:0x2700000000000c,oid:0x2700000000000d,oid:0x2700000000000e,oid:0x2700000000000f,oid:0x27000000000010,oid:0x27000000000011,oid:0x27000000000012,oid:0x27000000000013,oid:0x27000000000014,oid:0x27000000000015,oid:0x27000000000016,oid:0x27000000000017,oid:0x27000000000018,oid:0x27000000000019,oid:0x2700000000001a,oid:0x2700000000001b,oid:0x2700000000001c,oid:0x2700000000001d,oid:0x2700000000001e,oid:0x2700000000001f,oid:0x27000000000020,oid:0x27000000000021 +2018-08-06.22:34:50.351789|g|SAI_OBJECT_TYPE_BRIDGE:oid:0x39000000000001|SAI_BRIDGE_ATTR_PORT_LIST=32:oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0 +2018-08-06.22:34:50.355829|G|SAI_STATUS_SUCCESS|SAI_BRIDGE_ATTR_PORT_LIST=32:oid:0x3a000000000002,oid:0x3a000000000003,oid:0x3a000000000004,oid:0x3a000000000005,oid:0x3a000000000006,oid:0x3a000000000007,oid:0x3a000000000008,oid:0x3a000000000009,oid:0x3a00000000000a,oid:0x3a00000000000b,oid:0x3a00000000000c,oid:0x3a00000000000d,oid:0x3a00000000000e,oid:0x3a00000000000f,oid:0x3a000000000010,oid:0x3a000000000011,oid:0x3a000000000012,oid:0x3a000000000013,oid:0x3a000000000014,oid:0x3a000000000015,oid:0x3a000000000016,oid:0x3a000000000017,oid:0x3a000000000018,oid:0x3a000000000019,oid:0x3a00000000001a,oid:0x3a00000000001b,oid:0x3a00000000001c,oid:0x3a00000000001d,oid:0x3a00000000001e,oid:0x3a00000000001f,oid:0x3a000000000020,oid:0x3a000000000021 +2018-08-06.22:34:50.347983|r|SAI_OBJECT_TYPE_VLAN_MEMBER:oid:0x27000000000002 +2018-08-06.22:34:50.360742|r|SAI_OBJECT_TYPE_BRIDGE_PORT:oid:0x3a000000000002 +2017-06-14.01:56:11.535437|r|SAI_OBJECT_TYPE_PORT:oid:0x1000000000002 +2017-06-14.01:56:11.535437|c|SAI_OBJECT_TYPE_PORT:oid:0x1000000000022|SAI_PORT_ATTR_SPEED=10000|SAI_PORT_ATTR_HW_LANE_LIST=1:202 +2017-06-14.01:56:11.535437|c|SAI_OBJECT_TYPE_PORT:oid:0x1000000000023|SAI_PORT_ATTR_SPEED=10000|SAI_PORT_ATTR_HW_LANE_LIST=1:203 +2017-06-14.01:56:11.535437|c|SAI_OBJECT_TYPE_PORT:oid:0x1000000000024|SAI_PORT_ATTR_SPEED=10000|SAI_PORT_ATTR_HW_LANE_LIST=1:204 +2017-06-14.01:56:11.535437|c|SAI_OBJECT_TYPE_PORT:oid:0x1000000000025|SAI_PORT_ATTR_SPEED=10000|SAI_PORT_ATTR_HW_LANE_LIST=1:205 +2017-06-14.01:56:05.520538|g|SAI_OBJECT_TYPE_SWITCH:oid:0x21000000000000|SAI_SWITCH_ATTR_PORT_LIST=35:oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0 +2017-06-14.01:56:05.525938|G|SAI_STATUS_SUCCESS|SAI_SWITCH_ATTR_PORT_LIST=35:oid:0x1000000000003,oid:0x1000000000004,oid:0x1000000000005,oid:0x1000000000006,oid:0x1000000000007,oid:0x1000000000008,oid:0x1000000000009,oid:0x100000000000a,oid:0x100000000000b,oid:0x100000000000c,oid:0x100000000000d,oid:0x100000000000e,oid:0x100000000000f,oid:0x1000000000010,oid:0x1000000000011,oid:0x1000000000012,oid:0x1000000000013,oid:0x1000000000014,oid:0x1000000000015,oid:0x1000000000016,oid:0x1000000000017,oid:0x1000000000018,oid:0x1000000000019,oid:0x100000000001a,oid:0x100000000001b,oid:0x100000000001c,oid:0x100000000001d,oid:0x100000000001e,oid:0x100000000001f,oid:0x1000000000020,oid:0x1000000000021,oid:0x1000000000022,oid:0x1000000000023,oid:0x1000000000024,oid:0x1000000000025 +2017-06-14.01:56:06.151337|a|APPLY_VIEW +2017-06-14.01:56:06.156740|A|SAI_STATUS_SUCCESS diff --git a/tests/brcm/wb_port_create_b.rec b/tests/brcm/wb_port_create_b.rec new file mode 100644 index 000000000000..e41f47c3ff6a --- /dev/null +++ b/tests/brcm/wb_port_create_b.rec @@ -0,0 +1,13 @@ +2017-06-14.01:55:46.543987|a|INIT_VIEW +2017-06-14.01:55:46.551164|A|SAI_STATUS_SUCCESS +2017-06-14.01:55:46.555975|c|SAI_OBJECT_TYPE_SWITCH:oid:0x21000000000000|SAI_SWITCH_ATTR_INIT_SWITCH=true +2017-06-14.01:56:05.520538|g|SAI_OBJECT_TYPE_SWITCH:oid:0x21000000000000|SAI_SWITCH_ATTR_PORT_LIST=35:oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0 +2017-06-14.01:56:05.525938|G|SAI_STATUS_SUCCESS|SAI_SWITCH_ATTR_PORT_LIST=35:oid:0x1000000000003,oid:0x1000000000004,oid:0x1000000000005,oid:0x1000000000006,oid:0x1000000000007,oid:0x1000000000008,oid:0x1000000000009,oid:0x100000000000a,oid:0x100000000000b,oid:0x100000000000c,oid:0x100000000000d,oid:0x100000000000e,oid:0x100000000000f,oid:0x1000000000010,oid:0x1000000000011,oid:0x1000000000012,oid:0x1000000000013,oid:0x1000000000014,oid:0x1000000000015,oid:0x1000000000016,oid:0x1000000000017,oid:0x1000000000018,oid:0x1000000000019,oid:0x100000000001a,oid:0x100000000001b,oid:0x100000000001c,oid:0x100000000001d,oid:0x100000000001e,oid:0x100000000001f,oid:0x1000000000020,oid:0x1000000000021,oid:0x1000000000022,oid:0x1000000000023,oid:0x1000000000024,oid:0x1000000000025 +2018-08-06.22:34:50.344893|g|SAI_OBJECT_TYPE_SWITCH:oid:0x21000000000000|SAI_SWITCH_ATTR_DEFAULT_1Q_BRIDGE_ID=oid:0x0|SAI_SWITCH_ATTR_DEFAULT_VLAN_ID=oid:0x0 +2018-08-06.22:34:50.345605|G|SAI_STATUS_SUCCESS|SAI_SWITCH_ATTR_DEFAULT_1Q_BRIDGE_ID=oid:0x39000000000001|SAI_SWITCH_ATTR_DEFAULT_VLAN_ID=oid:0x26000000000001 +2018-08-06.22:34:50.345660|g|SAI_OBJECT_TYPE_VLAN:oid:0x26000000000001|SAI_VLAN_ATTR_MEMBER_LIST=32:oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0 +2018-08-06.22:34:50.347858|G|SAI_STATUS_SUCCESS|SAI_VLAN_ATTR_MEMBER_LIST=31:oid:0x27000000000003,oid:0x27000000000004,oid:0x27000000000005,oid:0x27000000000006,oid:0x27000000000007,oid:0x27000000000008,oid:0x27000000000009,oid:0x2700000000000a,oid:0x2700000000000b,oid:0x2700000000000c,oid:0x2700000000000d,oid:0x2700000000000e,oid:0x2700000000000f,oid:0x27000000000010,oid:0x27000000000011,oid:0x27000000000012,oid:0x27000000000013,oid:0x27000000000014,oid:0x27000000000015,oid:0x27000000000016,oid:0x27000000000017,oid:0x27000000000018,oid:0x27000000000019,oid:0x2700000000001a,oid:0x2700000000001b,oid:0x2700000000001c,oid:0x2700000000001d,oid:0x2700000000001e,oid:0x2700000000001f,oid:0x27000000000020,oid:0x27000000000021 +2018-08-06.22:34:50.351789|g|SAI_OBJECT_TYPE_BRIDGE:oid:0x39000000000001|SAI_BRIDGE_ATTR_PORT_LIST=32:oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0 +2018-08-06.22:34:50.355829|G|SAI_STATUS_SUCCESS|SAI_BRIDGE_ATTR_PORT_LIST=31:oid:0x3a000000000003,oid:0x3a000000000004,oid:0x3a000000000005,oid:0x3a000000000006,oid:0x3a000000000007,oid:0x3a000000000008,oid:0x3a000000000009,oid:0x3a00000000000a,oid:0x3a00000000000b,oid:0x3a00000000000c,oid:0x3a00000000000d,oid:0x3a00000000000e,oid:0x3a00000000000f,oid:0x3a000000000010,oid:0x3a000000000011,oid:0x3a000000000012,oid:0x3a000000000013,oid:0x3a000000000014,oid:0x3a000000000015,oid:0x3a000000000016,oid:0x3a000000000017,oid:0x3a000000000018,oid:0x3a000000000019,oid:0x3a00000000001a,oid:0x3a00000000001b,oid:0x3a00000000001c,oid:0x3a00000000001d,oid:0x3a00000000001e,oid:0x3a00000000001f,oid:0x3a000000000020,oid:0x3a000000000021 +2017-06-14.01:56:06.151337|a|APPLY_VIEW +2017-06-14.01:56:06.156740|A|SAI_STATUS_SUCCESS diff --git a/tests/brcm/wb_port_remove_a.rec b/tests/brcm/wb_port_remove_a.rec new file mode 100644 index 000000000000..01f594fcfbee --- /dev/null +++ b/tests/brcm/wb_port_remove_a.rec @@ -0,0 +1,18 @@ +2017-06-14.01:55:46.543987|a|INIT_VIEW +2017-06-14.01:55:46.551164|A|SAI_STATUS_SUCCESS +2017-06-14.01:55:46.555975|c|SAI_OBJECT_TYPE_SWITCH:oid:0x21000000000000|SAI_SWITCH_ATTR_INIT_SWITCH=true +2017-06-14.01:56:05.520538|g|SAI_OBJECT_TYPE_SWITCH:oid:0x21000000000000|SAI_SWITCH_ATTR_PORT_LIST=32:oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0 +2017-06-14.01:56:05.525938|G|SAI_STATUS_SUCCESS|SAI_SWITCH_ATTR_PORT_LIST=32:oid:0x1000000000002,oid:0x1000000000003,oid:0x1000000000004,oid:0x1000000000005,oid:0x1000000000006,oid:0x1000000000007,oid:0x1000000000008,oid:0x1000000000009,oid:0x100000000000a,oid:0x100000000000b,oid:0x100000000000c,oid:0x100000000000d,oid:0x100000000000e,oid:0x100000000000f,oid:0x1000000000010,oid:0x1000000000011,oid:0x1000000000012,oid:0x1000000000013,oid:0x1000000000014,oid:0x1000000000015,oid:0x1000000000016,oid:0x1000000000017,oid:0x1000000000018,oid:0x1000000000019,oid:0x100000000001a,oid:0x100000000001b,oid:0x100000000001c,oid:0x100000000001d,oid:0x100000000001e,oid:0x100000000001f,oid:0x1000000000020,oid:0x1000000000021 +2018-08-06.22:34:50.344893|g|SAI_OBJECT_TYPE_SWITCH:oid:0x21000000000000|SAI_SWITCH_ATTR_DEFAULT_1Q_BRIDGE_ID=oid:0x0|SAI_SWITCH_ATTR_DEFAULT_VLAN_ID=oid:0x0 +2018-08-06.22:34:50.345605|G|SAI_STATUS_SUCCESS|SAI_SWITCH_ATTR_DEFAULT_1Q_BRIDGE_ID=oid:0x39000000000001|SAI_SWITCH_ATTR_DEFAULT_VLAN_ID=oid:0x26000000000001 +2018-08-06.22:34:50.345660|g|SAI_OBJECT_TYPE_VLAN:oid:0x26000000000001|SAI_VLAN_ATTR_MEMBER_LIST=32:oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0 +2018-08-06.22:34:50.347858|G|SAI_STATUS_SUCCESS|SAI_VLAN_ATTR_MEMBER_LIST=32:oid:0x27000000000002,oid:0x27000000000003,oid:0x27000000000004,oid:0x27000000000005,oid:0x27000000000006,oid:0x27000000000007,oid:0x27000000000008,oid:0x27000000000009,oid:0x2700000000000a,oid:0x2700000000000b,oid:0x2700000000000c,oid:0x2700000000000d,oid:0x2700000000000e,oid:0x2700000000000f,oid:0x27000000000010,oid:0x27000000000011,oid:0x27000000000012,oid:0x27000000000013,oid:0x27000000000014,oid:0x27000000000015,oid:0x27000000000016,oid:0x27000000000017,oid:0x27000000000018,oid:0x27000000000019,oid:0x2700000000001a,oid:0x2700000000001b,oid:0x2700000000001c,oid:0x2700000000001d,oid:0x2700000000001e,oid:0x2700000000001f,oid:0x27000000000020,oid:0x27000000000021 +2018-08-06.22:34:50.351789|g|SAI_OBJECT_TYPE_BRIDGE:oid:0x39000000000001|SAI_BRIDGE_ATTR_PORT_LIST=32:oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0 +2018-08-06.22:34:50.355829|G|SAI_STATUS_SUCCESS|SAI_BRIDGE_ATTR_PORT_LIST=32:oid:0x3a000000000002,oid:0x3a000000000003,oid:0x3a000000000004,oid:0x3a000000000005,oid:0x3a000000000006,oid:0x3a000000000007,oid:0x3a000000000008,oid:0x3a000000000009,oid:0x3a00000000000a,oid:0x3a00000000000b,oid:0x3a00000000000c,oid:0x3a00000000000d,oid:0x3a00000000000e,oid:0x3a00000000000f,oid:0x3a000000000010,oid:0x3a000000000011,oid:0x3a000000000012,oid:0x3a000000000013,oid:0x3a000000000014,oid:0x3a000000000015,oid:0x3a000000000016,oid:0x3a000000000017,oid:0x3a000000000018,oid:0x3a000000000019,oid:0x3a00000000001a,oid:0x3a00000000001b,oid:0x3a00000000001c,oid:0x3a00000000001d,oid:0x3a00000000001e,oid:0x3a00000000001f,oid:0x3a000000000020,oid:0x3a000000000021 +2018-08-06.22:34:50.347983|r|SAI_OBJECT_TYPE_VLAN_MEMBER:oid:0x27000000000002 +2018-08-06.22:34:50.360742|r|SAI_OBJECT_TYPE_BRIDGE_PORT:oid:0x3a000000000002 +2017-06-14.01:56:11.535437|r|SAI_OBJECT_TYPE_PORT:oid:0x1000000000002 +2017-06-14.01:56:05.520538|g|SAI_OBJECT_TYPE_SWITCH:oid:0x21000000000000|SAI_SWITCH_ATTR_PORT_LIST=31:oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0 +2017-06-14.01:56:05.525938|G|SAI_STATUS_SUCCESS|SAI_SWITCH_ATTR_PORT_LIST=31:oid:0x1000000000003,oid:0x1000000000004,oid:0x1000000000005,oid:0x1000000000006,oid:0x1000000000007,oid:0x1000000000008,oid:0x1000000000009,oid:0x100000000000a,oid:0x100000000000b,oid:0x100000000000c,oid:0x100000000000d,oid:0x100000000000e,oid:0x100000000000f,oid:0x1000000000010,oid:0x1000000000011,oid:0x1000000000012,oid:0x1000000000013,oid:0x1000000000014,oid:0x1000000000015,oid:0x1000000000016,oid:0x1000000000017,oid:0x1000000000018,oid:0x1000000000019,oid:0x100000000001a,oid:0x100000000001b,oid:0x100000000001c,oid:0x100000000001d,oid:0x100000000001e,oid:0x100000000001f,oid:0x1000000000020,oid:0x1000000000021 +2017-06-14.01:56:06.151337|a|APPLY_VIEW +2017-06-14.01:56:06.156740|A|SAI_STATUS_SUCCESS diff --git a/tests/brcm/wb_port_remove_b.rec b/tests/brcm/wb_port_remove_b.rec new file mode 100644 index 000000000000..4323e366f7da --- /dev/null +++ b/tests/brcm/wb_port_remove_b.rec @@ -0,0 +1,13 @@ +2017-06-14.01:55:46.543987|a|INIT_VIEW +2017-06-14.01:55:46.551164|A|SAI_STATUS_SUCCESS +2017-06-14.01:55:46.555975|c|SAI_OBJECT_TYPE_SWITCH:oid:0x21000000000000|SAI_SWITCH_ATTR_INIT_SWITCH=true +2017-06-14.01:56:05.520538|g|SAI_OBJECT_TYPE_SWITCH:oid:0x21000000000000|SAI_SWITCH_ATTR_PORT_LIST=31:oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0 +2017-06-14.01:56:05.525938|G|SAI_STATUS_SUCCESS|SAI_SWITCH_ATTR_PORT_LIST=31:oid:0x1000000000003,oid:0x1000000000004,oid:0x1000000000005,oid:0x1000000000006,oid:0x1000000000007,oid:0x1000000000008,oid:0x1000000000009,oid:0x100000000000a,oid:0x100000000000b,oid:0x100000000000c,oid:0x100000000000d,oid:0x100000000000e,oid:0x100000000000f,oid:0x1000000000010,oid:0x1000000000011,oid:0x1000000000012,oid:0x1000000000013,oid:0x1000000000014,oid:0x1000000000015,oid:0x1000000000016,oid:0x1000000000017,oid:0x1000000000018,oid:0x1000000000019,oid:0x100000000001a,oid:0x100000000001b,oid:0x100000000001c,oid:0x100000000001d,oid:0x100000000001e,oid:0x100000000001f,oid:0x1000000000020,oid:0x1000000000021 +2018-08-06.22:34:50.344893|g|SAI_OBJECT_TYPE_SWITCH:oid:0x21000000000000|SAI_SWITCH_ATTR_DEFAULT_1Q_BRIDGE_ID=oid:0x0|SAI_SWITCH_ATTR_DEFAULT_VLAN_ID=oid:0x0 +2018-08-06.22:34:50.345605|G|SAI_STATUS_SUCCESS|SAI_SWITCH_ATTR_DEFAULT_1Q_BRIDGE_ID=oid:0x39000000000001|SAI_SWITCH_ATTR_DEFAULT_VLAN_ID=oid:0x26000000000001 +2018-08-06.22:34:50.345660|g|SAI_OBJECT_TYPE_VLAN:oid:0x26000000000001|SAI_VLAN_ATTR_MEMBER_LIST=32:oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0 +2018-08-06.22:34:50.347858|G|SAI_STATUS_SUCCESS|SAI_VLAN_ATTR_MEMBER_LIST=31:oid:0x27000000000003,oid:0x27000000000004,oid:0x27000000000005,oid:0x27000000000006,oid:0x27000000000007,oid:0x27000000000008,oid:0x27000000000009,oid:0x2700000000000a,oid:0x2700000000000b,oid:0x2700000000000c,oid:0x2700000000000d,oid:0x2700000000000e,oid:0x2700000000000f,oid:0x27000000000010,oid:0x27000000000011,oid:0x27000000000012,oid:0x27000000000013,oid:0x27000000000014,oid:0x27000000000015,oid:0x27000000000016,oid:0x27000000000017,oid:0x27000000000018,oid:0x27000000000019,oid:0x2700000000001a,oid:0x2700000000001b,oid:0x2700000000001c,oid:0x2700000000001d,oid:0x2700000000001e,oid:0x2700000000001f,oid:0x27000000000020,oid:0x27000000000021 +2018-08-06.22:34:50.351789|g|SAI_OBJECT_TYPE_BRIDGE:oid:0x39000000000001|SAI_BRIDGE_ATTR_PORT_LIST=32:oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0 +2018-08-06.22:34:50.355829|G|SAI_STATUS_SUCCESS|SAI_BRIDGE_ATTR_PORT_LIST=31:oid:0x3a000000000003,oid:0x3a000000000004,oid:0x3a000000000005,oid:0x3a000000000006,oid:0x3a000000000007,oid:0x3a000000000008,oid:0x3a000000000009,oid:0x3a00000000000a,oid:0x3a00000000000b,oid:0x3a00000000000c,oid:0x3a00000000000d,oid:0x3a00000000000e,oid:0x3a00000000000f,oid:0x3a000000000010,oid:0x3a000000000011,oid:0x3a000000000012,oid:0x3a000000000013,oid:0x3a000000000014,oid:0x3a000000000015,oid:0x3a000000000016,oid:0x3a000000000017,oid:0x3a000000000018,oid:0x3a000000000019,oid:0x3a00000000001a,oid:0x3a00000000001b,oid:0x3a00000000001c,oid:0x3a00000000001d,oid:0x3a00000000001e,oid:0x3a00000000001f,oid:0x3a000000000020,oid:0x3a000000000021 +2017-06-14.01:56:06.151337|a|APPLY_VIEW +2017-06-14.01:56:06.156740|A|SAI_STATUS_SUCCESS diff --git a/tests/mlnx/vsprofile.ini b/tests/mlnx/vsprofile.ini index ef90f45ebc47..6f84b07eabe3 100644 --- a/tests/mlnx/vsprofile.ini +++ b/tests/mlnx/vsprofile.ini @@ -1,3 +1,3 @@ -SAI_WARM_BOOT_READ_FILE=/var/cache/sai_warmboot.bin -SAI_WARM_BOOT_WRITE_FILE=/var/cache/sai_warmboot.bin +SAI_WARM_BOOT_READ_FILE=./sai_warmboot.bin +SAI_WARM_BOOT_WRITE_FILE=./sai_warmboot.bin SAI_VS_SWITCH_TYPE=SAI_VS_SWITCH_TYPE_MLNX2700 diff --git a/vslib/src/sai_vs_port.cpp b/vslib/src/sai_vs_port.cpp index c41861bd3124..6456bc5e8cfa 100644 --- a/vslib/src/sai_vs_port.cpp +++ b/vslib/src/sai_vs_port.cpp @@ -296,6 +296,48 @@ bool vs_check_object_default_state( return true; } +bool vs_check_port_reference_count( + _In_ sai_object_id_t port_id, + _In_ const ObjectHash& objectHash) +{ + SWSS_LOG_ENTER(); + + // TODO currently when switch is initialized, there is no metadata yet + // and objects are created without reference count, this needs to be + // addressed in refactoring metadata and meta_create_oid to correct + // count references, but now we need to check if port is used in any + // bridge port (and bridge port in any vlan member), after metadata + // refactor this function can be removed. + + // check if port is used on any bridge port object (only switch init one + // matters, user created bridge ports will have correct reference count + + auto& bridgePorts = objectHash.at(SAI_OBJECT_TYPE_BRIDGE_PORT); + + auto* meta = sai_metadata_get_attr_metadata(SAI_OBJECT_TYPE_BRIDGE_PORT, SAI_BRIDGE_PORT_ATTR_PORT_ID); + + for (auto& bp: bridgePorts) + { + for (auto&attr: bp.second) + { + if (attr.first != meta->attridname) + continue; // not this attribute + + if (attr.second->getAttr()->value.oid == port_id) + { + SWSS_LOG_ERROR("port id %s is in use on bridge port %s", + sai_serialize_object_id(port_id).c_str(), + bp.first.c_str()); + + return false; + } + } + } + + return true; +} + + bool vs_check_object_list_default_state( _Out_ const std::vector& objlist) { @@ -353,6 +395,17 @@ sai_status_t vs_check_port_dependencies( SWSS_LOG_NOTICE("port %s found, for removal", sai_serialize_object_id(port_id).c_str()); + // check port reference count on bridge port + + if (!vs_check_port_reference_count(port_id, g_switch_state_map.at(switch_id)->objectHash)) + { + SWSS_LOG_ERROR("port %s reference count IS NOT ZERO, can't remove, remove dependencies first", + sai_serialize_object_id(port_id).c_str()); + + return SAI_STATUS_FAILURE; + } + + // obtain objects to examine std::vector queues; @@ -395,9 +448,11 @@ sai_status_t vs_check_port_dependencies( dep.insert(dep.end(), ipgs.begin(), ipgs.end()); dep.insert(dep.end(), sg.begin(), sg.end()); - // TODO there may be issues with bridge ports created on that port if they - // are not removed before port remove, this needs to be addressed for warm - // boot support + // BRIDGE PORT (and also VLAN MEMBER using that bridge port) must be + // removed before removing port itself, since bridge port holds reference + // to port being removed. + + // bridge ports and vlan members must be removed before port can be removed return SAI_STATUS_SUCCESS; }