Skip to content

Commit

Permalink
Merge remote-tracking branch 'https://github.com/sonic-net/sonic-sair…
Browse files Browse the repository at this point in the history
…edis upstream/master'
  • Loading branch information
JunhongMao committed Oct 3, 2023
2 parents 20a83df + 9263397 commit d795b61
Show file tree
Hide file tree
Showing 34 changed files with 224 additions and 8 deletions.
2 changes: 1 addition & 1 deletion SAI
Submodule SAI updated 107 files
15 changes: 14 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,17 @@ CXXFLAGS="$SAVED_FLAGS"

AC_SUBST(CXXFLAGS_COMMON)

AC_ARG_WITH(extra-libsai-ldflags,
[ --with-extra-libsai-ldflags=FLAGS
extra libsai.so flags for vendor library],
[AC_SUBST(EXTRA_LIBSAI_LDFLAGS, "${withval}")])

AC_SUBST(SAIINC, "-I\$(top_srcdir)/SAI/inc -I\$(top_srcdir)/SAI/experimental -I\$(top_srcdir)/SAI/meta")

AM_COND_IF([SYNCD], [
AM_COND_IF([SAIVS], [], [
SAVED_FLAGS="$CXXFLAGS"
CXXFLAGS="-Xlinker --no-as-needed -lsai -I$srcdir/SAI/inc -I$srcdir/SAI/experimental -I$srcdir/SAI/meta"
CXXFLAGS="-Xlinker --no-as-needed -lsai -I$srcdir/SAI/inc -I$srcdir/SAI/experimental -I$srcdir/SAI/meta $EXTRA_LIBSAI_LDFLAGS"
AC_CHECK_FUNCS(sai_query_api_version, [
AC_MSG_CHECKING([SAI headers API version and library version check])
AC_TRY_RUN([
Expand Down Expand Up @@ -259,6 +264,14 @@ AC_CHECK_FUNCS(sai_bulk_object_clear_stats sai_bulk_object_get_stats)
CXXFLAGS="$SAVED_FLAGS"
])

AC_DEFINE([SAIREDIS_GIT_REVISION],
"[m4_esyscmd([echo -n $(git rev-parse --short HEAD || echo 0000000)])]",
[sairedis git revision information])

AC_DEFINE([SAI_GIT_REVISION],
"[m4_esyscmd([echo -n $(cd SAI && git rev-parse --short HEAD || echo 0000000)])]",
[SAI git revision information])

AC_OUTPUT(Makefile
meta/Makefile
lib/Makefile
Expand Down
4 changes: 3 additions & 1 deletion lib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ libsairedis_la_SOURCES = \
sai_redis_ipsec.cpp \
sai_redis_my_mac.cpp \
sai_redis_ars.cpp \
sai_redis_ars_profile.cpp
sai_redis_ars_profile.cpp \
sai_redis_twamp.cpp \
sai_redis_dash_meter.cpp

libSaiRedis_a_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS)
libSaiRedis_a_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) $(CODE_COVERAGE_CXXFLAGS)
Expand Down
4 changes: 4 additions & 0 deletions lib/RedisRemoteSaiInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include "meta/PerformanceIntervalTimer.h"
#include "meta/Globals.h"

#include "config.h"

#include <inttypes.h>

using namespace sairedis;
Expand All @@ -37,6 +39,8 @@ RedisRemoteSaiInterface::RedisRemoteSaiInterface(
{
SWSS_LOG_ENTER();

SWSS_LOG_NOTICE("sairedis git revision %s, SAI git revision: %s", SAIREDIS_GIT_REVISION, SAI_GIT_REVISION);

m_initialized = false;

initialize(0, nullptr);
Expand Down
2 changes: 2 additions & 0 deletions lib/sai_redis.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ PRIVATE extern const sai_vlan_api_t redis_vlan_api;
PRIVATE extern const sai_wred_api_t redis_wred_api;
PRIVATE extern const sai_my_mac_api_t redis_my_mac_api;
PRIVATE extern const sai_ipsec_api_t redis_ipsec_api;
PRIVATE extern const sai_twamp_api_t redis_twamp_api;
PRIVATE extern const sai_dash_meter_api_t redis_dash_meter_api;

PRIVATE extern std::shared_ptr<sairedis::SaiInterface> redis_sai;

Expand Down
2 changes: 2 additions & 0 deletions lib/sai_redis_acl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ REDIS_GENERIC_QUAD(ACL_COUNTER,acl_counter);
REDIS_GENERIC_QUAD(ACL_RANGE,acl_range);
REDIS_GENERIC_QUAD(ACL_TABLE_GROUP,acl_table_group);
REDIS_GENERIC_QUAD(ACL_TABLE_GROUP_MEMBER,acl_table_group_member);
REDIS_GENERIC_QUAD(ACL_TABLE_CHAIN_GROUP,acl_table_chain_group)

const sai_acl_api_t redis_acl_api = {

Expand All @@ -15,4 +16,5 @@ const sai_acl_api_t redis_acl_api = {
REDIS_GENERIC_QUAD_API(acl_range)
REDIS_GENERIC_QUAD_API(acl_table_group)
REDIS_GENERIC_QUAD_API(acl_table_group_member)
REDIS_GENERIC_QUAD_API(acl_table_chain_group)
};
28 changes: 28 additions & 0 deletions lib/sai_redis_dash_meter.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include "sai_redis.h"

REDIS_GENERIC_QUAD(METER_BUCKET, meter_bucket);
REDIS_BULK_CREATE(METER_BUCKET, meter_buckets);
REDIS_BULK_REMOVE(METER_BUCKET, meter_buckets);

REDIS_GENERIC_QUAD(METER_BUCKET, meter_policy);
REDIS_BULK_CREATE(METER_BUCKET, meter_policys);
REDIS_BULK_REMOVE(METER_BUCKET, meter_policys);

REDIS_GENERIC_QUAD(METER_BUCKET, meter_rule);
REDIS_BULK_CREATE(METER_BUCKET, meter_rules);
REDIS_BULK_REMOVE(METER_BUCKET, meter_rules);

const sai_dash_meter_api_t redis_dash_meter_api = {

REDIS_GENERIC_QUAD_API(meter_bucket)
redis_bulk_create_meter_buckets,
redis_bulk_remove_meter_buckets,

REDIS_GENERIC_QUAD_API(meter_policy)
redis_bulk_create_meter_policys,
redis_bulk_remove_meter_policys,

REDIS_GENERIC_QUAD_API(meter_rule)
redis_bulk_create_meter_rules,
redis_bulk_remove_meter_rules,
};
2 changes: 2 additions & 0 deletions lib/sai_redis_interfacequery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,13 @@ static sai_apis_t redis_apis = {
API(generic_programmable),
API(ars),
API(ars_profile),
API(twamp),
API(bmtor),
API(dash_acl),
API(dash_direction_lookup),
API(dash_eni),
API(dash_inbound_routing),
API(dash_meter),
API(dash_outbound_ca_to_pa),
API(dash_outbound_routing),
API(dash_vnet),
Expand Down
2 changes: 2 additions & 0 deletions lib/sai_redis_nexthop.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#include "sai_redis.h"

REDIS_GENERIC_QUAD(NEXT_HOP,next_hop);
REDIS_BULK_QUAD(NEXT_HOP,next_hop);

const sai_next_hop_api_t redis_next_hop_api = {

REDIS_GENERIC_QUAD_API(next_hop)
REDIS_BULK_QUAD_API(next_hop)
};
2 changes: 2 additions & 0 deletions lib/sai_redis_port.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ REDIS_GENERIC_QUAD(PORT_CONNECTOR,port_connector);
REDIS_GENERIC_STATS(PORT,port);
REDIS_GENERIC_STATS(PORT_POOL,port_pool);
REDIS_BULK_QUAD(PORT, ports);
REDIS_BULK_QUAD(PORT_SERDES, port_serdeses);

const sai_port_api_t redis_port_api = {

Expand All @@ -28,4 +29,5 @@ const sai_port_api_t redis_port_api = {
REDIS_GENERIC_QUAD_API(port_connector)
REDIS_GENERIC_QUAD_API(port_serdes)
REDIS_BULK_QUAD_API(ports)
REDIS_BULK_QUAD_API(port_serdeses)
};
2 changes: 2 additions & 0 deletions lib/sai_redis_router_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

REDIS_GENERIC_QUAD(ROUTER_INTERFACE,router_interface);
REDIS_GENERIC_STATS(ROUTER_INTERFACE,router_interface);
REDIS_BULK_QUAD(ROUTER_INTERFACE,router_interfaces);

const sai_router_interface_api_t redis_router_interface_api = {

REDIS_GENERIC_QUAD_API(router_interface)
REDIS_GENERIC_STATS_API(router_interface)
REDIS_BULK_QUAD_API(router_interfaces)
};
9 changes: 9 additions & 0 deletions lib/sai_redis_twamp.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include "sai_redis.h"

REDIS_GENERIC_QUAD(TWAMP_SESSION,twamp_session);
REDIS_GENERIC_STATS(TWAMP_SESSION,twamp_session);

const sai_twamp_api_t redis_twamp_api = {
REDIS_GENERIC_QUAD_API(twamp_session)
REDIS_GENERIC_STATS_API(twamp_session)
};
13 changes: 13 additions & 0 deletions meta/Meta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,13 @@ sai_status_t Meta::objectTypeGetAvailability(

break;

case SAI_ATTR_VALUE_TYPE_OBJECT_ID:
{
sai_object_type_t ot = objectTypeQuery(attrList[idx].value.oid);
PARAMETER_CHECK_OBJECT_TYPE_VALID(ot);
PARAMETER_CHECK_OID_EXISTS(attrList[idx].value.oid, ot);
break;
}
default:

META_LOG_THROW(*mdp, "value type %s not supported yet, FIXME!",
Expand Down Expand Up @@ -3793,6 +3800,12 @@ sai_status_t Meta::meta_generic_validation_create(
// maybe we can let it go here?
if (attrs.find(md.attrid) != attrs.end())
{
if (md.isconditionrelaxed)
{
META_LOG_WARN(md, "conditional, but condition was not met, this attribute is not required, but passed (relaxed condition)");
continue;
}

META_LOG_ERROR(md, "conditional, but condition was not met, this attribute is not required, but passed");

return SAI_STATUS_INVALID_PARAMETER;
Expand Down
12 changes: 12 additions & 0 deletions meta/SaiSerialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,18 @@ sai_status_t transfer_attribute(
RETURN_ON_ERROR(transfer_list(src_attr.value.ipprefixlist, dst_attr.value.ipprefixlist, countOnly));
break;

case SAI_ATTR_VALUE_TYPE_PORT_FREQUENCY_OFFSET_PPM_LIST:
RETURN_ON_ERROR(transfer_list(src_attr.value.portfrequencyoffsetppmlist, dst_attr.value.portfrequencyoffsetppmlist, countOnly));
break;

case SAI_ATTR_VALUE_TYPE_PORT_SNR_LIST:
RETURN_ON_ERROR(transfer_list(src_attr.value.portsnrlist, dst_attr.value.portsnrlist, countOnly));
break;

case SAI_ATTR_VALUE_TYPE_ACL_CHAIN_LIST:
RETURN_ON_ERROR(transfer_list(src_attr.value.aclchainlist, dst_attr.value.aclchainlist, countOnly));
break;

default:
SWSS_LOG_THROW("sai attr value %s is not implemented, FIXME", sai_serialize_attr_value_type(serialization_type).c_str());
}
Expand Down
2 changes: 1 addition & 1 deletion saidiscovery/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ saidiscovery_SOURCES = saidiscovery.cpp
saidiscovery_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS)
saidiscovery_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) $(CODE_COVERAGE_CXXFLAGS)
saidiscovery_LDADD = -lhiredis -lswsscommon $(top_srcdir)/syncd/libSyncd.a $(SAILIB) -lpthread \
-L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta -lzmq $(CODE_COVERAGE_LIBS)
-L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta -lzmq $(CODE_COVERAGE_LIBS) $(EXTRA_LIBSAI_LDFLAGS)
2 changes: 1 addition & 1 deletion saisdkdump/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ endif
saisdkdump_SOURCES = saisdkdump.cpp
saisdkdump_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS)
saisdkdump_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) $(CODE_COVERAGE_CXXFLAGS)
saisdkdump_LDADD = -lhiredis -lswsscommon $(SAILIB) -lpthread -L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta -lzmq $(CODE_COVERAGE_LIBS)
saisdkdump_LDADD = -lhiredis -lswsscommon $(SAILIB) -lpthread -L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta -lzmq $(CODE_COVERAGE_LIBS) $(EXTRA_LIBSAI_LDFLAGS)
2 changes: 1 addition & 1 deletion syncd/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ endif
syncd_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS)
syncd_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) $(CODE_COVERAGE_CXXFLAGS) $(CFLAGS_ASAN)
syncd_LDADD = libSyncd.a $(top_srcdir)/lib/libSaiRedis.a -L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta \
-ldl -lhiredis -lswsscommon $(SAILIB) -lpthread -lzmq $(CODE_COVERAGE_LIBS)
-ldl -lhiredis -lswsscommon $(SAILIB) -lpthread -lzmq $(CODE_COVERAGE_LIBS) $(EXTRA_LIBSAI_LDFLAGS)
syncd_LDFLAGS = $(LDFLAGS_ASAN) -rdynamic

if SAITHRIFT
Expand Down
2 changes: 1 addition & 1 deletion syncd/SaiDiscovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ void SaiDiscovery::setApiLogLevel(

if (status == SAI_STATUS_SUCCESS)
{
SWSS_LOG_NOTICE("Setting SAI loglevel %s on %s",
SWSS_LOG_INFO("setting SAI loglevel %s on %s",
sai_serialize_log_level(logLevel).c_str(),
sai_serialize_api((sai_api_t)api).c_str());
}
Expand Down
3 changes: 3 additions & 0 deletions syncd/SwitchNotifications.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,14 @@ namespace syncd
.on_ipsec_sa_status_change = nullptr,
.on_nat_event = &Slot<context>::onNatEvent,
.on_packet_event = nullptr,
.on_port_host_tx_ready = nullptr,
.on_port_state_change = &Slot<context>::onPortStateChange,
.on_queue_pfc_deadlock = &Slot<context>::onQueuePfcDeadlock,
.on_switch_asic_sdk_health_event = nullptr,
.on_switch_shutdown_request = &Slot<context>::onSwitchShutdownRequest,
.on_switch_state_change = &Slot<context>::onSwitchStateChange,
.on_tam_event = nullptr,
.on_twamp_session_event = nullptr,
}) { }

virtual ~Slot() {}
Expand Down
4 changes: 4 additions & 0 deletions syncd/Syncd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

#include "vslib/saivs.h"

#include "config.h"

#include <unistd.h>
#include <inttypes.h>

Expand Down Expand Up @@ -63,6 +65,8 @@ Syncd::Syncd(
{
SWSS_LOG_ENTER();

SWSS_LOG_NOTICE("sairedis git revision %s, SAI git revision: %s", SAIREDIS_GIT_REVISION, SAI_GIT_REVISION);

setSaiApiLogLevel();

SWSS_LOG_NOTICE("command line: %s", m_commandLineOptions->getCommandLineString().c_str());
Expand Down
9 changes: 9 additions & 0 deletions tests/BCM56850.pl
Original file line number Diff line number Diff line change
Expand Up @@ -811,8 +811,17 @@ sub test_acl_counter_match
}
}

sub test_relaxed
{
fresh_start;

play "relaxed.rec";
play "relaxed.rec", 0;
}

# RUN TESTS

test_relaxed;
test_acl_counter_match;
test_neighbor_lag;
test_lag_member;
Expand Down
14 changes: 14 additions & 0 deletions tests/BCM56850/relaxed.rec
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
2018-11-14.19:34:17.416379|a|INIT_VIEW
2018-11-14.19:34:17.419035|A|SAI_STATUS_SUCCESS
2018-11-14.19:34:17.420345|c|SAI_OBJECT_TYPE_SWITCH:oid:0x21000000000000|SAI_SWITCH_ATTR_INIT_SWITCH=true
2018-11-14.19:34:17.420634|g|SAI_OBJECT_TYPE_SWITCH:oid:0x21000000000000|SAI_SWITCH_ATTR_DEFAULT_VIRTUAL_ROUTER_ID=oid:0x0
2018-11-14.19:34:26.138403|G|SAI_STATUS_SUCCESS|SAI_SWITCH_ATTR_DEFAULT_VIRTUAL_ROUTER_ID=oid:0x3000000000022
2018-11-14.19:34:26.138714|c|SAI_OBJECT_TYPE_ROUTER_INTERFACE:oid:0x600000000058a|SAI_ROUTER_INTERFACE_ATTR_VIRTUAL_ROUTER_ID=oid:0x3000000000022|SAI_ROUTER_INTERFACE_ATTR_TYPE=SAI_ROUTER_INTERFACE_TYPE_LOOPBACK
2018-11-14.19:34:26.147205|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
2018-11-14.19:34:26.151676|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-11-14.19:34:27.462885|c|SAI_OBJECT_TYPE_ROUTER_INTERFACE:oid:0x60000000005d7|SAI_ROUTER_INTERFACE_ATTR_VIRTUAL_ROUTER_ID=oid:0x3000000000022|SAI_ROUTER_INTERFACE_ATTR_TYPE=SAI_ROUTER_INTERFACE_TYPE_LOOPBACK
2018-11-14.19:34:27.463151|c|SAI_OBJECT_TYPE_TUNNEL:oid:0x2a0000000005d8|SAI_TUNNEL_ATTR_TYPE=SAI_TUNNEL_TYPE_IPINIP|SAI_TUNNEL_ATTR_OVERLAY_INTERFACE=oid:0x60000000005d7|SAI_TUNNEL_ATTR_UNDERLAY_INTERFACE=oid:0x600000000058a|SAI_TUNNEL_ATTR_DECAP_ECN_MODE=SAI_TUNNEL_DECAP_ECN_MODE_COPY_FROM_OUTER|SAI_TUNNEL_ATTR_DECAP_TTL_MODE=SAI_TUNNEL_TTL_MODE_PIPE_MODEL|SAI_TUNNEL_ATTR_DECAP_DSCP_MODE=SAI_TUNNEL_DSCP_MODE_PIPE_MODEL
2018-11-14.19:34:27.463380|c|SAI_OBJECT_TYPE_TUNNEL_TERM_TABLE_ENTRY:oid:0x2b0000000005d9|SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_VR_ID=oid:0x3000000000022|SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_TYPE=SAI_TUNNEL_TERM_TABLE_ENTRY_TYPE_P2MP|SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_TUNNEL_TYPE=SAI_TUNNEL_TYPE_IPINIP|SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_ACTION_TUNNEL_ID=oid:0x2a0000000005d8|SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_DST_IP=10.0.0.0|SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_SRC_IP=0.0.0.0
2018-11-14.19:34:27.463380|c|SAI_OBJECT_TYPE_TUNNEL_TERM_TABLE_ENTRY:oid:0x2b0000000005da|SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_VR_ID=oid:0x3000000000022|SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_TYPE=SAI_TUNNEL_TERM_TABLE_ENTRY_TYPE_MP2MP|SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_TUNNEL_TYPE=SAI_TUNNEL_TYPE_IPINIP|SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_ACTION_TUNNEL_ID=oid:0x2a0000000005d8|SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_DST_IP=10.0.0.0|SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_SRC_IP=0.0.0.0
2018-11-14.19:34:26.317753|a|APPLY_VIEW
2018-11-14.19:34:26.319120|A|SAI_STATUS_SUCCESS
26 changes: 26 additions & 0 deletions unittest/meta/TestMetaDash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,26 @@ static void remove_eni(Meta &m, sai_object_id_t eni)
EXPECT_EQ(SAI_STATUS_SUCCESS, m.remove((sai_object_type_t)SAI_OBJECT_TYPE_ENI, eni));
}

TEST(Meta, dash_get_availability)
{
Meta m(std::make_shared<MetaTestSaiInterface>());

sai_object_id_t switchid = create_switch(m);

sai_attribute_t attr;
attr.id = SAI_DASH_ACL_RULE_ATTR_DASH_ACL_GROUP_ID;
attr.value.oid = 0;

uint64_t count = 0;
EXPECT_EQ(SAI_STATUS_INVALID_PARAMETER, m.objectTypeGetAvailability(switchid, (sai_object_type_t)SAI_OBJECT_TYPE_DASH_ACL_RULE, 1, &attr, &count));

attr.id = SAI_DASH_ACL_RULE_ATTR_DASH_ACL_GROUP_ID;
attr.value.oid = 0xFFFFFFF;

EXPECT_EQ(SAI_STATUS_INVALID_PARAMETER, m.objectTypeGetAvailability(switchid, (sai_object_type_t)SAI_OBJECT_TYPE_DASH_ACL_RULE, 1, &attr, &count));
}


TEST(Meta, quad_dash_direction_lookup)
{
Meta m(std::make_shared<MetaTestSaiInterface>());
Expand Down Expand Up @@ -714,6 +734,12 @@ TEST(Meta, quad_dash_acl_rule)
attr.value.s32 = SAI_DASH_ACL_RULE_ACTION_DENY_AND_CONTINUE;
EXPECT_EQ(SAI_STATUS_SUCCESS, m.set((sai_object_type_t)SAI_OBJECT_TYPE_DASH_ACL_RULE, acl, &attr));

attr.id = SAI_DASH_ACL_RULE_ATTR_DASH_ACL_GROUP_ID;
attr.value.oid = acl;
uint64_t count = 0;

EXPECT_EQ(SAI_STATUS_SUCCESS, m.objectTypeGetAvailability(switchid, (sai_object_type_t)SAI_OBJECT_TYPE_DASH_ACL_RULE, 1, &attr, &count));

EXPECT_EQ(SAI_STATUS_SUCCESS, m.remove((sai_object_type_t)SAI_OBJECT_TYPE_DASH_ACL_RULE, acl));
remove_counter(m, counter);
EXPECT_EQ(SAI_STATUS_SUCCESS, m.remove((sai_object_type_t)SAI_OBJECT_TYPE_DASH_ACL_GROUP, group));
Expand Down
3 changes: 3 additions & 0 deletions unittest/meta/TestSaiSerialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ TEST(SaiSerialize, sai_serialize_attr_value)
case SAI_ATTR_VALUE_TYPE_SEGMENT_LIST:
case SAI_ATTR_VALUE_TYPE_TLV_LIST:
case SAI_ATTR_VALUE_TYPE_MAP_LIST:
case SAI_ATTR_VALUE_TYPE_PORT_FREQUENCY_OFFSET_PPM_LIST:
case SAI_ATTR_VALUE_TYPE_PORT_SNR_LIST:
case SAI_ATTR_VALUE_TYPE_ACL_CHAIN_LIST:
continue;

default:
Expand Down
4 changes: 3 additions & 1 deletion vslib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ libsaivs_la_SOURCES = \
sai_vs_my_mac.cpp \
sai_vs_ipsec.cpp \
sai_vs_ars.cpp \
sai_vs_ars_profile.cpp
sai_vs_ars_profile.cpp \
sai_vs_twamp.cpp \
sai_vs_dash_meter.cpp

libSaiVS_a_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS)
libSaiVS_a_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) $(CODE_COVERAGE_CXXFLAGS)
Expand Down
Loading

0 comments on commit d795b61

Please sign in to comment.