Skip to content

Commit

Permalink
Merge branch 'master' into upgrade-docker-sonic-vs-to-bookworm
Browse files Browse the repository at this point in the history
  • Loading branch information
saiarcot895 authored Dec 5, 2024
2 parents 80b8325 + 8ba9448 commit d824822
Show file tree
Hide file tree
Showing 75 changed files with 3,208 additions and 290 deletions.
2 changes: 1 addition & 1 deletion .azure-pipelines/build-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ jobs:
gcov_dirs=$(find . -path "*.libs*gcda" | xargs dirname | sort -u | cut -c"3-")
for dir in ${gcov_dirs}; do
source_dir=$(dirname $dir)
output_file="coverage-$source_dir.json"
output_file=$(echo "coverage-$source_dir.json"| tr '/' '-')
gcovr --exclude-unreachable-branches --json-pretty -o $output_file --object-directory $source_dir $dir
done
gcovr -r ./ -e ".*/SAI/.*" -e ".+/json.hpp" -e "swss/.+" -e ".*/.libs/.*" -e ".*/debian/.*" --exclude-unreachable-branches --json-pretty -o coverage-all.json
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches:
- 'master'
- '202[0-9][0-9][0-9]'
pull_request_target:
pull_request:
branches:
- 'master'
- '202[0-9][0-9][0-9]'
Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:
libyang-dev \
libzmq3-dev \
libzmq5 \
swig3.0 \
swig4.0 \
libpython2.7-dev \
libgtest-dev \
libgmock-dev \
Expand Down Expand Up @@ -89,6 +89,7 @@ jobs:
- if: matrix.language == 'cpp'
name: Build repository
run: |
gcc -v
./autogen.sh
DEB_BUILD_OPTIONS=nocheck \
SWSS_COMMON_INC="$(dirname $GITHUB_WORKSPACE)/usr/include" \
Expand Down
2 changes: 1 addition & 1 deletion SAI
Submodule SAI updated 60 files
+1 −0 .gitignore
+3 −1 Makefile
+1 −0 doc/ACL/SAI-Proposal-ACL-1.md
+85 −0 doc/ECMP/NextHopGroup_with_members.md
+80 −0 doc/IP-Multicast/MulticastNextHopRewrite.md
+1,484 −0 doc/SAI-Counter-enhancement-hld.md
+160 −0 doc/SAI-Proposal-HW-FRR.md
+425 −0 doc/SAI-Proposal-Prefix-Compression.md
+72 −0 doc/SAI_1.14.0_ReleaseNotes.md
+206 −0 doc/Samplepacket/SAI-Proposal-Samplepacket_truncation.md
+136 −0 experimental/saiexperimentaldashappliance.h
+9 −0 experimental/saiexperimentaldashdirectionlookup.h
+27 −0 experimental/saiexperimentaldasheni.h
+947 −0 experimental/saiexperimentaldashflow.h
+58 −4 experimental/saiexperimentaldashha.h
+144 −74 experimental/saiexperimentaldashmeter.h
+217 −8 experimental/saiexperimentaldashtunnel.h
+6 −0 experimental/saiextensions.h
+6 −0 experimental/saiswitchextensions.h
+191 −1 experimental/saitypesextensions.h
+1 −0 inc/sai.h
+70 −2 inc/saiacl.h
+22 −0 inc/saibfd.h
+44 −0 inc/saibridge.h
+46 −0 inc/saibuffer.h
+42 −0 inc/saicounter.h
+7 −0 inc/saihostif.h
+22 −0 inc/saiicmpecho.h
+1 −1 inc/saiipmcgroup.h
+44 −0 inc/saiipsec.h
+55 −0 inc/saimacsec.h
+4 −2 inc/sainexthop.h
+49 −0 inc/sainexthopgroup.h
+15 −0 inc/saiobject.h
+31 −0 inc/saipolicer.h
+104 −0 inc/saiport.h
+313 −0 inc/saiprefixcompression.h
+31 −8 inc/saiqueue.h
+31 −0 inc/sairouterinterface.h
+21 −0 inc/saisamplepacket.h
+9 −0 inc/saischeduler.h
+38 −1 inc/saisrv6.h
+22 −0 inc/saiswitch.h
+22 −0 inc/saitunnel.h
+22 −0 inc/saitwamp.h
+178 −2 inc/saitypes.h
+9 −0 inc/saiudf.h
+1 −1 inc/saiversion.h
+22 −0 inc/saivlan.h
+5 −2 meta/Makefile
+2 −0 meta/acronyms.txt
+5 −0 meta/aspell.en.pws
+48 −0 meta/attrversion.sh
+2 −1 meta/gensairpc.pl
+87 −2 meta/parse.pl
+23 −0 meta/saimetadatatypes.h
+30 −0 meta/saisanitycheck.c
+1 −1 meta/saiserializetest.c
+2 −1 meta/structs.pl
+10 −2 meta/style.pm
6 changes: 5 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ AX_ADD_AM_MACRO_STATIC([])

AM_CONDITIONAL(SONIC_ASIC_PLATFORM_BAREFOOT, test x$CONFIGURED_PLATFORM = xbarefoot)
AM_CONDITIONAL(SONIC_ASIC_PLATFORM_BROADCOM, test x$CONFIGURED_PLATFORM = xbroadcom)
AM_CONDITIONAL(SONIC_ASIC_PLATFORM_MELLANOX, test x$CONFIGURED_PLATFORM = xmellanox)

AM_COND_IF([SONIC_ASIC_PLATFORM_MELLANOX],
AC_DEFINE([MELLANOX], [1], [Define to 1 on Mellanox Platform]))

AC_ARG_ENABLE(debug,
[ --enable-debug turn on debugging],
Expand Down Expand Up @@ -144,7 +148,7 @@ fi
AM_CONDITIONAL(ASAN_ENABLED, test x$asan_enabled = xtrue)
AM_CONDITIONAL(PYTHON2, test x$python2 = xtrue)

AC_PATH_PROGS(SWIG, [swig3.0 swig])
AC_PATH_PROGS(SWIG, [swig4.0 swig3.0 swig])

CXXFLAGS_COMMON=""
CXXFLAGS_COMMON+=" -ansi"
Expand Down
7 changes: 7 additions & 0 deletions debian/libsaimetadata-dev.install
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
meta/sai*.h usr/include/sai
meta/Sai*.h usr/include/sai
meta/Meta.h usr/include/sai
meta/AttrKeyMap.h usr/include/sai
meta/MetaKeyHasher.h usr/include/sai
meta/OidRefCounter.h usr/include/sai
meta/PortRelatedSet.h usr/include/sai
meta/Notification*.h usr/include/sai
meta/Globals.h usr/include/sai
SAI/meta/sai*.h usr/include/sai
usr/lib/*/libsaimetadata.so
usr/lib/*/libsaimeta.so
11 changes: 11 additions & 0 deletions lib/Recorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,17 @@ void Recorder::recordGenericSet(
recordLine("s|" + key + "|" + Globals::joinFieldValues(arguments));
}

void Recorder::recordGenericCounterPolling(
_In_ const std::string& key,
_In_ const std::vector<swss::FieldValueTuple>& arguments)
{
SWSS_LOG_ENTER();

// lower case 'p' stands for counter Polling

recordLine("p|" + key + "|" + Globals::joinFieldValues(arguments));
}

void Recorder::recordGenericSetResponse(
_In_ sai_status_t status)
{
Expand Down
83 changes: 14 additions & 69 deletions lib/Recorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,28 @@ extern "C" {
#include "swss/table.h"

#include "sairedis.h"
#include "meta/SaiInterface.h"

#include <string>
#include <fstream>
#include <vector>

#define SAI_REDIS_RECORDER_DECLARE_RECORD_REMOVE(ot) \
void recordRemove( \
#define SAI_REDIS_RECORDER_DECLARE_RECORD_REMOVE(X,ot) \
void recordRemove( \
_In_ const sai_ ## ot ## _t* ot);

#define SAI_REDIS_RECORDER_DECLARE_RECORD_CREATE(ot) \
#define SAI_REDIS_RECORDER_DECLARE_RECORD_CREATE(X,ot) \
void recordCreate( \
_In_ const sai_ ## ot ## _t* ot, \
_In_ uint32_t attr_count, \
_In_ const sai_attribute_t *attr_list);

#define SAI_REDIS_RECORDER_DECLARE_RECORD_SET(ot) \
#define SAI_REDIS_RECORDER_DECLARE_RECORD_SET(X,ot) \
void recordSet( \
_In_ const sai_ ## ot ## _t* ot, \
_In_ const sai_attribute_t *attr);

#define SAI_REDIS_RECORDER_DECLARE_RECORD_GET(ot) \
#define SAI_REDIS_RECORDER_DECLARE_RECORD_GET(X,ot) \
void recordGet( \
_In_ const sai_ ## ot ## _t* ot, \
_In_ uint32_t attr_count, \
Expand Down Expand Up @@ -162,82 +163,26 @@ namespace sairedis

public: // create ENTRY

SAI_REDIS_RECORDER_DECLARE_RECORD_CREATE(fdb_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_CREATE(inseg_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_CREATE(ipmc_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_CREATE(l2mc_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_CREATE(mcast_fdb_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_CREATE(neighbor_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_CREATE(route_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_CREATE(nat_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_CREATE(my_sid_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_CREATE(direction_lookup_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_CREATE(eni_ether_address_map_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_CREATE(vip_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_CREATE(inbound_routing_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_CREATE(pa_validation_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_CREATE(outbound_routing_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_CREATE(outbound_ca_to_pa_entry);
SAIREDIS_DECLARE_EVERY_ENTRY(SAI_REDIS_RECORDER_DECLARE_RECORD_CREATE);

public: // remove ENTRY

SAI_REDIS_RECORDER_DECLARE_RECORD_REMOVE(fdb_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_REMOVE(inseg_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_REMOVE(ipmc_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_REMOVE(l2mc_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_REMOVE(mcast_fdb_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_REMOVE(neighbor_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_REMOVE(route_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_REMOVE(nat_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_REMOVE(my_sid_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_REMOVE(direction_lookup_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_REMOVE(eni_ether_address_map_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_REMOVE(vip_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_REMOVE(inbound_routing_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_REMOVE(pa_validation_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_REMOVE(outbound_routing_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_REMOVE(outbound_ca_to_pa_entry);
SAIREDIS_DECLARE_EVERY_ENTRY(SAI_REDIS_RECORDER_DECLARE_RECORD_REMOVE);

public: // set ENTRY

SAI_REDIS_RECORDER_DECLARE_RECORD_SET(fdb_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_SET(inseg_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_SET(ipmc_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_SET(l2mc_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_SET(mcast_fdb_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_SET(neighbor_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_SET(route_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_SET(nat_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_SET(my_sid_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_SET(direction_lookup_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_SET(eni_ether_address_map_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_SET(vip_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_SET(inbound_routing_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_SET(pa_validation_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_SET(outbound_routing_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_SET(outbound_ca_to_pa_entry);
SAIREDIS_DECLARE_EVERY_ENTRY(SAI_REDIS_RECORDER_DECLARE_RECORD_SET);

public: // get ENTRY

SAI_REDIS_RECORDER_DECLARE_RECORD_GET(fdb_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_GET(inseg_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_GET(ipmc_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_GET(l2mc_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_GET(mcast_fdb_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_GET(neighbor_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_GET(route_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_GET(nat_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_GET(my_sid_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_GET(direction_lookup_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_GET(eni_ether_address_map_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_GET(vip_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_GET(inbound_routing_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_GET(pa_validation_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_GET(outbound_routing_entry);
SAI_REDIS_RECORDER_DECLARE_RECORD_GET(outbound_ca_to_pa_entry);
SAIREDIS_DECLARE_EVERY_ENTRY(SAI_REDIS_RECORDER_DECLARE_RECORD_GET);

public: // SAI stats API

void recordGenericCounterPolling(
_In_ const std::string& key,
_In_ const std::vector<swss::FieldValueTuple>& arguments);

void recordGenericGetStats(
_In_ sai_object_type_t object_type,
_In_ sai_object_id_t object_id,
Expand Down
19 changes: 17 additions & 2 deletions lib/RedisRemoteSaiInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ sai_status_t RedisRemoteSaiInterface::notifyCounterGroupOperations(
emplaceStrings(flexCounterGroupParam->plugin_name, flexCounterGroupParam->plugins, entries);
emplaceStrings(FLEX_COUNTER_STATUS_FIELD, flexCounterGroupParam->operation, entries);

m_recorder->recordGenericSet(key, entries);
m_recorder->recordGenericCounterPolling(key, entries);

m_communicationChannel->set(key,
entries,
Expand Down Expand Up @@ -607,7 +607,7 @@ sai_status_t RedisRemoteSaiInterface::notifyCounterOperations(
command = REDIS_FLEX_COUNTER_COMMAND_STOP_POLL;
}

m_recorder->recordGenericSet(key, entries);
m_recorder->recordGenericCounterPolling(key, entries);
m_communicationChannel->set(key, entries, command);

return waitForResponse(SAI_COMMON_API_SET);
Expand Down Expand Up @@ -2049,6 +2049,21 @@ sai_switch_notifications_t RedisRemoteSaiInterface::syncProcessNotification(
return { };
}

bool RedisRemoteSaiInterface::containsSwitch(
_In_ sai_object_id_t switchId) const
{
SWSS_LOG_ENTER();

if (!m_switchContainer->contains(switchId))
{
SWSS_LOG_INFO("context %s failed to find switch %s",
m_contextConfig->m_name.c_str(), sai_serialize_object_id(switchId).c_str());
return false;
}

return true;
}

const std::map<sai_object_id_t, swss::TableDump>& RedisRemoteSaiInterface::getTableDump() const
{
SWSS_LOG_ENTER();
Expand Down
3 changes: 3 additions & 0 deletions lib/RedisRemoteSaiInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,9 @@ namespace sairedis

const std::map<sai_object_id_t, swss::TableDump>& getTableDump() const;

bool containsSwitch(
_In_ sai_object_id_t switchId) const;

private: // QUAD API helpers

sai_status_t create(
Expand Down
12 changes: 9 additions & 3 deletions lib/Sai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,19 @@ sai_status_t Sai::set(

// skip metadata if attribute is redis extension attribute

// TODO this is setting on all contexts, but maybe we want one specific?
// and do set on all if objectId == NULL

bool success = true;

// Setting on all contexts if objectType != SAI_OBJECT_TYPE_SWITCH or objectId == NULL
for (auto& kvp: m_contextMap)
{
if (objectType == SAI_OBJECT_TYPE_SWITCH && objectId != SAI_NULL_OBJECT_ID)
{
if (!kvp.second->m_redisSai->containsSwitch(objectId))
{
continue;
}
}

sai_status_t status = kvp.second->m_redisSai->set(objectType, objectId, attr);

success &= (status == SAI_STATUS_SUCCESS);
Expand Down
Loading

0 comments on commit d824822

Please sign in to comment.