From f39f6aaa970cab0fa01977f979894664748a5a50 Mon Sep 17 00:00:00 2001 From: rpmarvell Date: Wed, 4 Dec 2024 12:10:48 -0800 Subject: [PATCH] VS cleanup --- tests/MRVLTL7.pl | 23 ------ tests/MRVLTL7/lanemap.ini | 34 -------- tests/MRVLTL7/query_stats_capability.rec | 8 -- tests/MRVLTL7/vsprofile.ini | 3 - tests/Makefile.am | 2 +- unittest/vslib/Makefile.am | 3 +- unittest/vslib/TestSwitchMrvlTL7.cpp | 99 ------------------------ vslib/Makefile.am | 1 - vslib/SwitchConfig.cpp | 7 +- vslib/SwitchConfig.h | 4 +- vslib/SwitchMrvlTL7.cpp | 53 ------------- vslib/SwitchMrvlTL7.h | 32 -------- vslib/VirtualSwitchSaiInterface.cpp | 6 -- vslib/saivs.h | 1 - 14 files changed, 4 insertions(+), 272 deletions(-) delete mode 100755 tests/MRVLTL7.pl delete mode 100644 tests/MRVLTL7/lanemap.ini delete mode 100644 tests/MRVLTL7/query_stats_capability.rec delete mode 100644 tests/MRVLTL7/vsprofile.ini delete mode 100644 unittest/vslib/TestSwitchMrvlTL7.cpp delete mode 100644 vslib/SwitchMrvlTL7.cpp delete mode 100644 vslib/SwitchMrvlTL7.h diff --git a/tests/MRVLTL7.pl b/tests/MRVLTL7.pl deleted file mode 100755 index 64c79a277..000000000 --- a/tests/MRVLTL7.pl +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/perl - -BEGIN { push @INC,'.'; } - -use strict; -use warnings; -use diagnostics; - -use utils; - -sub test_mrvl_query_stats_capability -{ - fresh_start; - - play "query_stats_capability.rec"; -} - - -# RUN TESTS - -test_mrvl_query_stats_capability; - -kill_syncd; diff --git a/tests/MRVLTL7/lanemap.ini b/tests/MRVLTL7/lanemap.ini deleted file mode 100644 index a59777233..000000000 --- a/tests/MRVLTL7/lanemap.ini +++ /dev/null @@ -1,34 +0,0 @@ -; comment -# comment -eth0:29,30,31,32 -eth1:25,26,27,28 -eth2:37,38,39,40 -eth3:33,34,35,36 -eth4:41,42,43,44 -eth5:45,46,47,48 -eth6:5,6,7,8 -eth7:1,2,3,4 -eth8:9,10,11,12 -eth9:13,14,15,16 -eth10:21,22,23,24 -eth11:17,18,19,20 -eth12:249,50,51,52 -eth13:353,54,55,56 -eth14:461,62,63,64 -eth15:557,58,59,60 -eth16:665,66,67,68 -eth17:769,70,71,72 -eth18:877,78,79,80 -eth19:973,74,75,76 -eth20:105,106,107,108 -eth21:109,110,111,112 -eth22:117,118,119,120 -eth23:113,114,115,116 -eth24:121,122,123,124 -eth25:125,126,127,128 -eth26:85,86,87,88 -eth27:81,82,83,84 -eth28:89,90,91,92 -eth29:93,94,95,96 -eth30:97,98,99,100 -eth31:101,102,103,104 diff --git a/tests/MRVLTL7/query_stats_capability.rec b/tests/MRVLTL7/query_stats_capability.rec deleted file mode 100644 index 8b38ca06f..000000000 --- a/tests/MRVLTL7/query_stats_capability.rec +++ /dev/null @@ -1,8 +0,0 @@ -2023-06-02.20:39:45.430445|a|INIT_VIEW -2023-06-02.20:39:45.430645|A|SAI_STATUS_SUCCESS -2023-06-02.20:39:45.630445|q|stats_capability_query|SAI_OBJECT_TYPE_SWITCH:oid:0x21000000000000|OBJECT_TYPE=SAI_OBJECT_TYPE_QUEUE|LIST_SIZE=1 -2023-06-02.20:39:45.630943|Q|stats_capability_query|SAI_STATUS_BUFFER_OVERFLOW|{"count":12,"list":null} -2023-06-02.20:40:55.525325|q|stats_capability|SAI_OBJECT_TYPE_SWITCH:oid:0x21000000000000|OBJECT_TYPE=SAI_OBJECT_TYPE_QUEUE|LIST_SIZE=12 -2023-06-02.20:40:55.525773|Q|stats_capability|SAI_STATUS_SUCCESS|{"count":12,"list":[{"stat_enum":"SAI_QUEUE_STAT_PACKETS","stat_modes":["SAI_STATS_MODE_READ"]},{"stat_enum":"SAI_QUEUE_STAT_BYTES","stat_modes":["SAI_STATS_MODE_READ"]},{"stat_enum":"SAI_QUEUE_STAT_DROPPED_PACKETS","stat_modes":["SAI_STATS_MODE_READ"]},{"stat_enum":"SAI_QUEUE_STAT_DROPPED_BYTES","stat_modes":["SAI_STATS_MODE_READ"]},{"stat_enum":"SAI_QUEUE_STAT_CURR_OCCUPANCY_BYTES","stat_modes":["SAI_STATS_MODE_READ"]},{"stat_enum":"SAI_QUEUE_STAT_WATERMARK_BYTES","stat_modes":["SAI_STATS_MODE_READ"]},{"stat_enum":"SAI_QUEUE_STAT_SHARED_CURR_OCCUPANCY_BYTES","stat_modes":["SAI_STATS_MODE_READ"]},{"stat_enum":"SAI_QUEUE_STAT_SHARED_WATERMARK_BYTES","stat_modes":["SAI_STATS_MODE_READ_AND_CLEAR"]},{"stat_enum":"SAI_QUEUE_STAT_WRED_ECN_MARKED_PACKETS","stat_modes":["SAI_STATS_MODE_READ"]},{"stat_enum":"SAI_QUEUE_STAT_WRED_ECN_MARKED_BYTES","stat_modes":["SAI_STATS_MODE_READ"]},{"stat_enum":"268435457","stat_modes":["SAI_STATS_MODE_READ"]},{"stat_enum":"268435458","stat_modes":["SAI_STATS_MODE_READ"]}]} -2023-06-02.20:40:55.632903|a|APPLY_VIEW -2023-06-02.20:40:55.633001|A|SAI_STATUS_SUCCESS diff --git a/tests/MRVLTL7/vsprofile.ini b/tests/MRVLTL7/vsprofile.ini deleted file mode 100644 index 5487d0742..000000000 --- a/tests/MRVLTL7/vsprofile.ini +++ /dev/null @@ -1,3 +0,0 @@ -SAI_WARM_BOOT_READ_FILE=./sai_warmboot.bin -SAI_WARM_BOOT_WRITE_FILE=./sai_warmboot.bin -SAI_VS_SWITCH_TYPE=SAI_VS_SWITCH_TYPE_MRVLTL7 diff --git a/tests/Makefile.am b/tests/Makefile.am index 8fd153733..882ef26da 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -33,4 +33,4 @@ testdash_gtest_LDADD = -lgtest -lhiredis -lswsscommon -lpthread \ $(top_srcdir)/lib/libsairedis.la $(top_srcdir)/syncd/libSyncd.a \ -L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta -lzmq $(CODE_COVERAGE_LIBS) -TESTS = checksaiapi.sh aspellcheck.pl conflictnames.pl swsslogentercheck.sh checkwhitespace.sh tests BCM56850.pl MLNX2700.pl BCM56971B0.pl NVDAMBF2H536C.pl MRVLTL7.pl testdash_gtest +TESTS = checksaiapi.sh aspellcheck.pl conflictnames.pl swsslogentercheck.sh checkwhitespace.sh tests BCM56850.pl MLNX2700.pl BCM56971B0.pl NVDAMBF2H536C.pl testdash_gtest diff --git a/unittest/vslib/Makefile.am b/unittest/vslib/Makefile.am index fa7e8f4fe..092bcf046 100644 --- a/unittest/vslib/Makefile.am +++ b/unittest/vslib/Makefile.am @@ -46,8 +46,7 @@ tests_SOURCES = main.cpp \ TestMACsecManager.cpp \ TestSwitchStateBase.cpp \ TestSai.cpp \ - TestVirtualSwitchSaiInterface.cpp \ - TestSwitchMrvlTL7.cpp + TestVirtualSwitchSaiInterface.cpp tests_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) -fno-access-control tests_LDADD = $(LDADD_GTEST) $(top_srcdir)/vslib/libSaiVS.a -lhiredis -lswsscommon -lnl-genl-3 -lnl-nf-3 -lnl-route-3 -lnl-3 \ diff --git a/unittest/vslib/TestSwitchMrvlTL7.cpp b/unittest/vslib/TestSwitchMrvlTL7.cpp deleted file mode 100644 index 58e6c792d..000000000 --- a/unittest/vslib/TestSwitchMrvlTL7.cpp +++ /dev/null @@ -1,99 +0,0 @@ -#include "SwitchMrvlTL7.h" - -#include "meta/sai_serialize.h" - -#include - -#include - -using namespace saivs; - -TEST(SwitchMrvlTL7, ctr) -{ - auto sc = std::make_shared(0, ""); - auto signal = std::make_shared(); - auto eventQueue = std::make_shared(signal); - - // TODO: Should the switch type be changed when new API is available? - sc->m_saiSwitchType = SAI_SWITCH_TYPE_NPU; - sc->m_switchType = SAI_VS_SWITCH_TYPE_MRVLTL7; - sc->m_bootType = SAI_VS_BOOT_TYPE_COLD; - sc->m_useTapDevice = false; - sc->m_laneMap = LaneMap::getDefaultLaneMap(0); - sc->m_eventQueue = eventQueue; - - auto scc = std::make_shared(); - - scc->insert(sc); - - SwitchMrvlTL7 sw( - 0x2100000000, - std::make_shared(0, scc), - sc); - - SwitchMrvlTL7 sw2( - 0x2100000000, - std::make_shared(0, scc), - sc, - nullptr); - - sai_attribute_t attr; - - attr.id = SAI_SWITCH_ATTR_INIT_SWITCH; - attr.value.booldata = true; - - EXPECT_EQ(sw.initialize_default_objects(1, &attr), SAI_STATUS_SUCCESS); -} -TEST(SwitchMrvlTL7, test_stats_query_capability) -{ - auto sc = std::make_shared(0, ""); - auto signal = std::make_shared(); - auto eventQueue = std::make_shared(signal); - - sc->m_saiSwitchType = SAI_SWITCH_TYPE_NPU; - sc->m_switchType = SAI_VS_SWITCH_TYPE_MRVLTL7; - sc->m_bootType = SAI_VS_BOOT_TYPE_COLD; - sc->m_useTapDevice = false; - sc->m_laneMap = LaneMap::getDefaultLaneMap(0); - sc->m_eventQueue = eventQueue; - - auto scc = std::make_shared(); - - scc->insert(sc); - - SwitchMrvlTL7 sw( - 0x2100000000, - std::make_shared(0, scc), - sc); - - sai_stat_capability_t capability_list[51]; - sai_stat_capability_list_t stats_capability; - stats_capability.count = 38; - stats_capability.list = capability_list; - /* Get queue stats capability */ - EXPECT_EQ(sw.queryStatsCapability(0x2100000000, - SAI_OBJECT_TYPE_QUEUE, - &stats_capability), - SAI_STATUS_BUFFER_OVERFLOW); - stats_capability.count = 51; - - EXPECT_EQ(sw.queryStatsCapability(0x2100000000, - SAI_OBJECT_TYPE_PORT, - &stats_capability), - SAI_STATUS_SUCCESS); - - /* Get port stats capability */ - stats_capability.count = 1; - EXPECT_EQ(sw.queryStatsCapability(0x2100000000, - SAI_OBJECT_TYPE_PORT, - &stats_capability), - SAI_STATUS_BUFFER_OVERFLOW); - stats_capability.count = 51; - - EXPECT_EQ(sw.queryStatsCapability(0x2100000000, - SAI_OBJECT_TYPE_PORT, - &stats_capability), - SAI_STATUS_SUCCESS); - -} - diff --git a/vslib/Makefile.am b/vslib/Makefile.am index d4554913f..ab6b68a31 100644 --- a/vslib/Makefile.am +++ b/vslib/Makefile.am @@ -50,7 +50,6 @@ libSaiVS_a_SOURCES = \ Switch.cpp \ SwitchMLNX2700.cpp \ SwitchNvdaMBF2H536C.cpp \ - SwitchMrvlTL7.cpp \ SwitchStateBase.cpp \ SwitchStateBaseFdb.cpp \ SwitchStateBaseHostif.cpp \ diff --git a/vslib/SwitchConfig.cpp b/vslib/SwitchConfig.cpp index 1aa29082f..33ba09834 100644 --- a/vslib/SwitchConfig.cpp +++ b/vslib/SwitchConfig.cpp @@ -90,10 +90,6 @@ bool SwitchConfig::parseSwitchType( */ switchType = SAI_VS_SWITCH_TYPE_NVDA_MBF2H536C; } - else if (st == SAI_VALUE_VS_SWITCH_TYPE_MRVLTL7) - { - switchType = SAI_VS_SWITCH_TYPE_MRVLTL7; - } else { std::vector vals { @@ -102,8 +98,7 @@ bool SwitchConfig::parseSwitchType( SAI_VALUE_VS_SWITCH_TYPE_BCM56971B0, SAI_VALUE_VS_SWITCH_TYPE_MLNX2700, SAI_VALUE_VS_SWITCH_TYPE_NVDA_MBF2H536C, - SAI_VALUE_VS_SWITCH_TYPE_DPU_SIMU_2P, - SAI_VALUE_VS_SWITCH_TYPE_MRVLTL7 + SAI_VALUE_VS_SWITCH_TYPE_DPU_SIMU_2P }; SWSS_LOG_ERROR("unknown switch type: '%s', expected (%s)", diff --git a/vslib/SwitchConfig.h b/vslib/SwitchConfig.h index 5e5ba96b6..e3cc3b266 100644 --- a/vslib/SwitchConfig.h +++ b/vslib/SwitchConfig.h @@ -26,9 +26,7 @@ namespace saivs SAI_VS_SWITCH_TYPE_MLNX2700, - SAI_VS_SWITCH_TYPE_NVDA_MBF2H536C, - - SAI_VS_SWITCH_TYPE_MRVLTL7, + SAI_VS_SWITCH_TYPE_NVDA_MBF2H536C } sai_vs_switch_type_t; diff --git a/vslib/SwitchMrvlTL7.cpp b/vslib/SwitchMrvlTL7.cpp deleted file mode 100644 index 386820d97..000000000 --- a/vslib/SwitchMrvlTL7.cpp +++ /dev/null @@ -1,53 +0,0 @@ -#include "SwitchMrvlTL7.h" - -#include "swss/logger.h" -#include "meta/sai_serialize.h" - -using namespace saivs; - -SwitchMrvlTL7::SwitchMrvlTL7( - _In_ sai_object_id_t switch_id, - _In_ std::shared_ptr manager, - _In_ std::shared_ptr config): - SwitchStateBase(switch_id, manager, config) -{ - SWSS_LOG_ENTER(); - - // empty -} - -SwitchMrvlTL7::SwitchMrvlTL7( - _In_ sai_object_id_t switch_id, - _In_ std::shared_ptr manager, - _In_ std::shared_ptr config, - _In_ std::shared_ptr warmBootState): - SwitchStateBase(switch_id, manager, config, warmBootState) -{ - SWSS_LOG_ENTER(); - - // empty -} - -sai_status_t SwitchMrvlTL7::initialize_default_objects( - _In_ uint32_t attr_count, - _In_ const sai_attribute_t *attr_list) -{ - SWSS_LOG_ENTER(); - - CHECK_STATUS(set_switch_mac_address()); - CHECK_STATUS(create_cpu_port()); - CHECK_STATUS(create_default_vlan()); - CHECK_STATUS(create_default_virtual_router()); - CHECK_STATUS(create_default_stp_instance()); - CHECK_STATUS(create_default_1q_bridge()); - CHECK_STATUS(create_default_trap_group()); - CHECK_STATUS(create_ports()); - CHECK_STATUS(set_port_list()); - CHECK_STATUS(create_bridge_ports()); - CHECK_STATUS(create_vlan_members()); - CHECK_STATUS(set_switch_default_attributes()); - CHECK_STATUS(set_static_crm_values()); - - return SAI_STATUS_SUCCESS; -} - diff --git a/vslib/SwitchMrvlTL7.h b/vslib/SwitchMrvlTL7.h deleted file mode 100644 index c24ff45b0..000000000 --- a/vslib/SwitchMrvlTL7.h +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once - -#include "SwitchStateBase.h" - -namespace saivs -{ - class SwitchMrvlTL7: - public SwitchStateBase - { - public: - - SwitchMrvlTL7( - _In_ sai_object_id_t switch_id, - _In_ std::shared_ptr manager, - _In_ std::shared_ptr config); - - SwitchMrvlTL7( - _In_ sai_object_id_t switch_id, - _In_ std::shared_ptr manager, - _In_ std::shared_ptr config, - _In_ std::shared_ptr warmBootState); - - virtual ~SwitchMrvlTL7() = default; - - public: - - virtual sai_status_t initialize_default_objects( - _In_ uint32_t attr_count, - _In_ const sai_attribute_t *attr_list); - - }; -} diff --git a/vslib/VirtualSwitchSaiInterface.cpp b/vslib/VirtualSwitchSaiInterface.cpp index bcc6155d3..b940bc794 100644 --- a/vslib/VirtualSwitchSaiInterface.cpp +++ b/vslib/VirtualSwitchSaiInterface.cpp @@ -15,7 +15,6 @@ #include "SwitchBCM56971B0.h" #include "SwitchMLNX2700.h" #include "SwitchNvdaMBF2H536C.h" -#include "SwitchMrvlTL7.h" #include @@ -602,11 +601,6 @@ std::shared_ptr VirtualSwitchSaiInterface::init_switch( m_switchStateMap[switch_id] = std::make_shared(switch_id, m_realObjectIdManager, config, warmBootState); break; - case SAI_VS_SWITCH_TYPE_MRVLTL7: - - m_switchStateMap[switch_id] = std::make_shared(switch_id, m_realObjectIdManager, config, warmBootState); - break; - default: SWSS_LOG_WARN("unknown switch type: %d", config->m_switchType); diff --git a/vslib/saivs.h b/vslib/saivs.h index 236c2c361..a68da6e84 100644 --- a/vslib/saivs.h +++ b/vslib/saivs.h @@ -92,7 +92,6 @@ extern "C" { #define SAI_VALUE_VS_SWITCH_TYPE_MLNX2700 "SAI_VS_SWITCH_TYPE_MLNX2700" #define SAI_VALUE_VS_SWITCH_TYPE_NVDA_MBF2H536C "SAI_VS_SWITCH_TYPE_NVDA_MBF2H536C" #define SAI_VALUE_VS_SWITCH_TYPE_DPU_SIMU_2P "SAI_VS_SWITCH_TYPE_DPU_SIMU_2P" -#define SAI_VALUE_VS_SWITCH_TYPE_MRVLTL7 "SAI_VS_SWITCH_TYPE_MRVLTL7" /* * Values for SAI_KEY_BOOT_TYPE (defined in saiswitch.h)