Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
jobs:
analyze:
name: Analyze
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
permissions:
actions: read
contents: read
Expand Down Expand Up @@ -55,11 +55,11 @@ jobs:
libzmq3-dev \
libzmq5 \
swig4.0 \
libpython2.7-dev \
libpython3-dev \
libgtest-dev \
libgmock-dev \
libboost1.71-dev \
libboost-serialization1.71-dev \
libboost-dev \
libboost-serialization-dev \
dh-exec \
doxygen \
cdbs \
Expand All @@ -69,8 +69,7 @@ jobs:
autoconf-archive \
uuid-dev \
libjansson-dev \
nlohmann-json3-dev \
python
nlohmann-json3-dev

- if: matrix.language == 'cpp'
name: Build sonic-swss-common
Expand All @@ -79,7 +78,7 @@ jobs:
git clone https://github.com/sonic-net/sonic-swss-common
pushd sonic-swss-common
./autogen.sh
dpkg-buildpackage -rfakeroot -us -uc -b -j$(nproc)
dpkg-buildpackage -rfakeroot -us -uc -b -Pnoyangmod,nopython2 -j$(nproc)
popd
dpkg-deb -x libswsscommon_${SWSSCOMMON_VER}_amd64.deb $(dirname $GITHUB_WORKSPACE)
dpkg-deb -x libswsscommon-dev_${SWSSCOMMON_VER}_amd64.deb $(dirname $GITHUB_WORKSPACE)
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
path = SAI
url = https://github.com/opencomputeproject/SAI.git
ignore = dirty
branch = v1.3
branch = v1.16
2 changes: 1 addition & 1 deletion SAI
Submodule SAI updated 93 files
+1 −0 .gitignore
+1 −1 Makefile
+7 −0 azure-pipelines.yml
+9 −0 custom/README.md
+85 −0 doc/ECMP/NextHopGroup_with_members.md
+164 −0 doc/Hash/SAI-Proposal-Hashing-Mechanism-for-Efficient-RoCE-Traffic-Distribution.md
+29 −0 doc/IP-Multicast/MulticastWithMembers.md
+88 −0 doc/SAI-Proposal-Global-PTP-Configuration.md
+217 −0 doc/SAI-Proposal-Hash-Algorithm-Round-Robin.md
+241 −0 doc/SAI-Proposal-Mirror-session-encap-type.md
+48 −0 doc/SAI-Proposal-Packet-Trimming.md
+425 −0 doc/SAI-Proposal-Prefix-Compression.md
+53 −0 doc/SAI_1.15.1_ReleaseNotes.md
+320 −0 doc/SyncE/SAI-Proposal-SyncE.md
+ doc/SyncE/SyncE_hardware_diagram.jpg
+391 −0 doc/TAM/SAI-TAM-enhancements.md
+22 −0 doc/custom-headers/README.md
+56 −0 doc/custom-headers/saicustom.h
+136 −0 doc/custom-headers/saicustomone.h
+67 −0 doc/custom-headers/saiportcustom.h
+57 −0 doc/custom-headers/saiswitchcustom.h
+56 −0 doc/custom-headers/saitypescustom.h
+ doc/figures/Hash_based.png
+ doc/figures/Random.png
+ doc/figures/Round_robin.png
+ doc/figures/Round_robin_with_weights.png
+ doc/figures/trim-TC.png
+621 −0 doc/tunnel/SAI-Proposal-EVPN-Multihoming.md
+ doc/tunnel/figures/sai_evpnmh_df.png
+ doc/tunnel/figures/sai_evpnmh_failover.png
+ doc/tunnel/figures/sai_evpnmh_singleactive.png
+ doc/tunnel/figures/sai_evpnmh_splithorizon.png
+ doc/tunnel/figures/sai_evpnmh_unicast.png
+1 −1 experimental/saiexperimentaldashappliance.h
+3 −0 experimental/saiexperimentaldashdirectionlookup.h
+29 −0 experimental/saiexperimentaldasheni.h
+35 −8 experimental/saiexperimentaldashflow.h
+9 −0 experimental/saiexperimentaldashha.h
+12 −0 experimental/saiexperimentaldashoutboundcatopa.h
+352 −0 experimental/saiexperimentaldashoutboundportmap.h
+376 −0 experimental/saiexperimentaldashtrustedvni.h
+217 −8 experimental/saiexperimentaldashtunnel.h
+6 −0 experimental/saiextensions.h
+63 −1 experimental/saitypesextensions.h
+8 −0 inc/sai.h
+124 −3 inc/saiacl.h
+21 −1 inc/saibfd.h
+74 −1 inc/saibridge.h
+6 −0 inc/saihash.h
+10 −3 inc/saihostif.h
+20 −0 inc/saiipmcgroup.h
+19 −0 inc/sailag.h
+11 −0 inc/saimacsec.h
+32 −0 inc/saimirror.h
+5 −2 inc/sainexthop.h
+69 −0 inc/sainexthopgroup.h
+17 −0 inc/saiobject.h
+0 −0 inc/saipoe.h
+9 −0 inc/saipolicer.h
+40 −0 inc/saiport.h
+313 −0 inc/saiprefixcompression.h
+26 −0 inc/sairouterinterface.h
+9 −0 inc/saischeduler.h
+120 −1 inc/saiswitch.h
+187 −0 inc/saisynce.h
+83 −0 inc/saitam.h
+72 −0 inc/saitypes.h
+9 −0 inc/saiudf.h
+2 −2 inc/saiversion.h
+41 −0 inc/saivlan.h
+1 −0 meta/Doxyfile
+1 −0 meta/Doxyfile.compat
+7 −5 meta/Makefile
+4 −0 meta/acronyms.txt
+1 −0 meta/ancestry.1f2bca1.history
+0 −1 meta/ancestry.825c835.history
+5 −0 meta/aspell.en.pws
+48 −0 meta/attrversion.sh
+2 −2 meta/checkancestry.sh
+1 −1 meta/checkheaders.pl
+2 −2 meta/checkstructs.sh
+10 −1 meta/gensairpc.pl
+179 −14 meta/parse.pl
+24 −4 meta/sai_rpc_frontend.cpp
+33 −0 meta/saimetadatatypes.h
+254 −15 meta/saisanitycheck.c
+1 −0 meta/structs.5f75d99.history
+0 −1 meta/structs.825c835.history
+2 −0 meta/style.pm
+2 −2 meta/templates/sai_rpc_server_helper_functions.tt
+52 −9 meta/test.pm
+19 −4 meta/utils.pm
+3 −3 test/saithriftv2/Makefile
143 changes: 127 additions & 16 deletions meta/Meta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

#include <inttypes.h>

#include <boost/algorithm/string/join.hpp>

#include <set>

// TODO add validation for all oids belong to the same switch
Expand Down Expand Up @@ -3093,6 +3095,25 @@ sai_status_t Meta::meta_sai_validate_pa_validation_entry(
return SAI_STATUS_SUCCESS;
}

sai_status_t Meta::meta_sai_validate_outbound_port_map_port_range_entry(
_In_ const sai_outbound_port_map_port_range_entry_t* outbound_port_map_entry,
_In_ bool create,
_In_ bool get)
{
SWSS_LOG_ENTER();

if (outbound_port_map_entry == NULL)
{
SWSS_LOG_ERROR("outbound_port_map_entry pointer is NULL");

return SAI_STATUS_INVALID_PARAMETER;
}

// TODO FIX ME

return SAI_STATUS_NOT_IMPLEMENTED;
}

sai_status_t Meta::meta_sai_validate_outbound_routing_entry(
_In_ const sai_outbound_routing_entry_t* outbound_routing_entry,
_In_ bool create,
Expand Down Expand Up @@ -3139,6 +3160,44 @@ sai_status_t Meta::meta_sai_validate_outbound_routing_entry(
return SAI_STATUS_SUCCESS;
}

sai_status_t Meta::meta_sai_validate_global_trusted_vni_entry(
_In_ const sai_global_trusted_vni_entry_t* global_trusted_vni_entry,
_In_ bool create,
_In_ bool get)
{
SWSS_LOG_ENTER();

if (global_trusted_vni_entry == NULL)
{
SWSS_LOG_ERROR("global_trusted_vni_entry pointer is NULL");

return SAI_STATUS_INVALID_PARAMETER;
}

// TODO FIX ME

return SAI_STATUS_NOT_IMPLEMENTED;
}

sai_status_t Meta::meta_sai_validate_eni_trusted_vni_entry(
_In_ const sai_eni_trusted_vni_entry_t* eni_trusted_vni_entry,
_In_ bool create,
_In_ bool get)
{
SWSS_LOG_ENTER();

if (eni_trusted_vni_entry == NULL)
{
SWSS_LOG_ERROR("eni_trusted_vni_entry pointer is NULL");

return SAI_STATUS_INVALID_PARAMETER;
}

// TODO FIX ME

return SAI_STATUS_NOT_IMPLEMENTED;
}

sai_status_t Meta::meta_sai_validate_outbound_ca_to_pa_entry(
_In_ const sai_outbound_ca_to_pa_entry_t* outbound_ca_to_pa_entry,
_In_ bool create,
Expand Down Expand Up @@ -3223,6 +3282,25 @@ sai_status_t Meta::meta_sai_validate_meter_bucket_entry(
return SAI_STATUS_NOT_IMPLEMENTED;
}

sai_status_t Meta::meta_sai_validate_prefix_compression_entry(
_In_ const sai_prefix_compression_entry_t* prefix_compression_entry,
_In_ bool create,
_In_ bool get)
{
SWSS_LOG_ENTER();

if (prefix_compression_entry == NULL)
{
SWSS_LOG_ERROR("prefix_compression_entry pointer is NULL");

return SAI_STATUS_INVALID_PARAMETER;
}

// TODO FIX ME

return SAI_STATUS_NOT_IMPLEMENTED;
}

sai_status_t Meta::meta_generic_validation_create(
_In_ const sai_object_meta_key_t& meta_key,
_In_ sai_object_id_t switch_id,
Expand Down Expand Up @@ -6744,24 +6822,14 @@ void Meta::meta_sai_on_port_state_change_single(

auto ot = objectTypeQuery(data.port_id);

bool valid = false;
bool valid = isPortObjectIdValid(ot);

switch (ot)
if (!valid)
{
// TODO hardcoded types, must advance SAI repository commit to get metadata for this
case SAI_OBJECT_TYPE_PORT:
case SAI_OBJECT_TYPE_BRIDGE_PORT:
case SAI_OBJECT_TYPE_LAG:

valid = true;
break;

default:

SWSS_LOG_ERROR("data.port_id %s has unexpected type: %s, expected PORT, BRIDGE_PORT or LAG",
sai_serialize_object_id(data.port_id).c_str(),
sai_serialize_object_type(ot).c_str());
break;
SWSS_LOG_ERROR("data.port_id %s has unexpected type: %s, expected: %s",
sai_serialize_object_id(data.port_id).c_str(),
sai_serialize_object_type(ot).c_str(),
boost::algorithm::join(getValidPortObjectTypes(), ",").c_str());
}

if (valid && !m_oids.objectReferenceExists(data.port_id))
Expand Down Expand Up @@ -7181,3 +7249,46 @@ void Meta::populate(
}
}
}

bool Meta::isPortObjectIdValid(
_In_ sai_object_type_t object_type)
{
SWSS_LOG_ENTER();

auto members = sai_metadata_struct_members_sai_port_oper_status_notification_t;

for (size_t i = 0; members[i]; i++)
{
auto* mb = members[i];

if (mb->membername != std::string("port_id"))
continue;

for (size_t idx = 0; idx < mb->allowedobjecttypeslength; idx++)
{
if (mb->allowedobjecttypes[idx] == object_type)
return true;
}

return false;
}

SWSS_LOG_THROW("port_id member not found on sai_port_oper_status_notification");
}

std::vector<std::string> Meta::getValidPortObjectTypes()
{
SWSS_LOG_ENTER();

auto md = sai_metadata_enum_sai_object_type_t;

std::vector<std::string> v;

for (size_t i = 0; i < md.valuescount; i++)
{
if (isPortObjectIdValid((sai_object_type_t)md.values[i]))
v.push_back(md.valuesshortnames[i]);
}

return v;
}
25 changes: 25 additions & 0 deletions meta/Meta.h
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,11 @@ namespace saimeta
static bool is_ipv6_mask_valid(
_In_ const uint8_t* mask);

static bool isPortObjectIdValid(
_In_ sai_object_type_t object_type);

static std::vector<std::string> getValidPortObjectTypes();

private: // unit tests helpers

bool meta_unittests_get_and_erase_set_readonly_flag(
Expand Down Expand Up @@ -544,11 +549,26 @@ namespace saimeta
_In_ bool create,
_In_ bool get = false);

sai_status_t meta_sai_validate_outbound_port_map_port_range_entry(
_In_ const sai_outbound_port_map_port_range_entry_t* outbound_port_map_entry,
_In_ bool create,
_In_ bool get = false);

sai_status_t meta_sai_validate_outbound_routing_entry(
_In_ const sai_outbound_routing_entry_t* outbound_routing_entry,
_In_ bool create,
_In_ bool get = false);

sai_status_t meta_sai_validate_global_trusted_vni_entry(
_In_ const sai_global_trusted_vni_entry_t* global_trusted_vni_entry,
_In_ bool create,
_In_ bool get = false);

sai_status_t meta_sai_validate_eni_trusted_vni_entry(
_In_ const sai_eni_trusted_vni_entry_t* eni_trusted_vni_entry,
_In_ bool create,
_In_ bool get = false);

sai_status_t meta_sai_validate_outbound_ca_to_pa_entry(
_In_ const sai_outbound_ca_to_pa_entry_t* outbound_ca_to_pa_entry,
_In_ bool create,
Expand All @@ -564,6 +584,11 @@ namespace saimeta
_In_ bool create,
_In_ bool get = false);

sai_status_t meta_sai_validate_prefix_compression_entry(
_In_ const sai_prefix_compression_entry_t* prefix_compression_entry,
_In_ bool create,
_In_ bool get = false);

public:

/*
Expand Down
17 changes: 17 additions & 0 deletions meta/SaiInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,3 +378,20 @@ sai_status_t SaiInterface::clearStats(

return SAI_STATUS_NOT_IMPLEMENTED;
}

std::shared_ptr<SaiOptions> SaiInterface::getOptions(
_In_ const std::string& key)
{
SWSS_LOG_ENTER();

return m_optionsMap[key];
}

void SaiInterface::setOptions(
_In_ const std::string& key,
_In_ std::shared_ptr<SaiOptions> options)
{
SWSS_LOG_ENTER();

m_optionsMap[key] = options;
}
19 changes: 19 additions & 0 deletions meta/SaiInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ extern "C" {
#include "saimetadata.h"
}

#include "SaiOptions.h"

#include <map>
#include <memory>
#include <string>

#define SAIREDIS_DECLARE_EVERY_ENTRY(_X) \
SAI_METADATA_DECLARE_EVERY_ENTRY(_X)

Expand Down Expand Up @@ -345,5 +351,18 @@ namespace sairedis

virtual sai_log_level_t logGet(
_In_ sai_api_t api);

public: // non SAI API - options helper

std::shared_ptr<SaiOptions> getOptions(
_In_ const std::string& key);

void setOptions(
_In_ const std::string& key,
_In_ std::shared_ptr<SaiOptions> options);

private:

std::map<std::string, std::shared_ptr<SaiOptions>> m_optionsMap;
};
}
11 changes: 11 additions & 0 deletions meta/SaiOptions.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#pragma once

namespace sairedis
{
class SaiOptions
{
public:

virtual ~SaiOptions() = default;
};
}
Loading
Loading