Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sonic sairedis changes for SAI SRV6 and SAI refpoint update to v1.9.0 #937

Merged
merged 16 commits into from
Sep 24, 2021
2 changes: 1 addition & 1 deletion SAI
Submodule SAI updated 71 files
+22 −0 .gitignore
+10 −11 azure-pipelines.yml
+211 −0 doc/ECMP/Class-Based-Forwarding.md
+104 −0 doc/FEC/FEC-configuration.md
+261 −0 doc/IPsec/SAI_IPsec_API_Proposal.md
+ doc/IPsec/figures/ipsecFig1.png
+ doc/IPsec/figures/ipsecFig2.png
+ doc/IPsec/figures/ipsecFig3.png
+ doc/IPsec/figures/ipsecFig4.png
+ doc/IPsec/figures/ipsecFig5.png
+ doc/IPsec/figures/ipsecFig6.png
+22 −0 doc/My-Mac.md
+479 −0 doc/SAI-IPv6-Segment-Routing-Update.md
+178 −0 doc/SAI_1.7.1_ReleaseNotes.md
+ doc/behavioral model/pipeline_v9.vsdx
+ doc/figures/SRv6_Endpoint_behavioral_model.png
+ doc/figures/SRv6_Headend_behavioral_model.png
+ doc/macsec-gearbox/Auto_Negotiated_FEC.png
+190 −0 doc/macsec-gearbox/Copper_PHY_Attributes_Proposal.md
+63 −0 doc/macsec-gearbox/PAI_Auto_Negotiated_FEC.md
+63 −0 doc/recycle_port.md
+7 −3 inc/sai.h
+301 −289 inc/saiacl.h
+2 −2 inc/saibfd.h
+3 −6 inc/saibridge.h
+14 −0 inc/saidebugcounter.h
+34 −34 inc/saihash.h
+38 −1 inc/saihostif.h
+1 −1 inc/saiipmcgroup.h
+1,020 −0 inc/saiipsec.h
+1 −1 inc/saiisolationgroup.h
+1 −1 inc/sail2mcgroup.h
+1 −1 inc/saimirror.h
+13 −0 inc/saimpls.h
+172 −0 inc/saimymac.h
+2 −2 inc/sainat.h
+7 −75 inc/sainexthop.h
+123 −7 inc/sainexthopgroup.h
+4 −0 inc/saiobject.h
+374 −31 inc/saiport.h
+6 −0 inc/saiqosmap.h
+1 −1 inc/sairpfgroup.h
+0 −168 inc/saisegmentroute.h
+567 −0 inc/saisrv6.h
+172 −8 inc/saiswitch.h
+3 −3 inc/saitam.h
+89 −6 inc/saitunnel.h
+22 −1 inc/saitypes.h
+2 −2 inc/saiversion.h
+14 −9 meta/Makefile
+29 −17 meta/acronyms.txt
+243 −0 meta/ancestry.pl
+10 −0 meta/aspell.en.pws
+115 −0 meta/checkancestry.sh
+38 −0 meta/checkenumlock.sh
+29 −1 meta/checkheaders.pl
+234 −17 meta/parse.pl
+60 −4 meta/saimetadatatypes.h
+212 −84 meta/saimetadatautils.c
+27 −1 meta/saimetadatautils.h
+602 −58 meta/saisanitycheck.c
+38 −10 meta/saiserialize.c
+52 −0 meta/saiserialize.h
+66 −18 meta/saiserializetest.c
+2 −2 meta/serialize.pm
+74 −15 meta/style.pm
+187 −7 meta/utils.pm
+3 −1 test/Makefile
+2 −1 test/basic_router/Makefile
+2 −2 test/sai_ut/Makefile
+2 −1 test/saithrift/Makefile
73 changes: 73 additions & 0 deletions lib/ClientSai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1179,6 +1179,38 @@ sai_status_t ClientSai::bulkCreate(
object_statuses);
}

sai_status_t ClientSai::bulkCreate(
_In_ uint32_t object_count,
_In_ const sai_my_sid_entry_t* my_sid_entry,
_In_ const uint32_t *attr_count,
_In_ const sai_attribute_t **attr_list,
_In_ sai_bulk_op_error_mode_t mode,
_Out_ sai_status_t *object_statuses)
{
MUTEX();
SWSS_LOG_ENTER();
REDIS_CHECK_API_INITIALIZED();

// TODO support mode

std::vector<std::string> serialized_object_ids;

// on create vid is put in db by syncd
for (uint32_t idx = 0; idx < object_count; idx++)
{
std::string str_object_id = sai_serialize_my_sid_entry(my_sid_entry[idx]);
serialized_object_ids.push_back(str_object_id);
}

return bulkCreate(
SAI_OBJECT_TYPE_MY_SID_ENTRY,
serialized_object_ids,
attr_count,
attr_list,
mode,
object_statuses);
}

// BULK CREATE HELPERS

sai_status_t ClientSai::bulkCreate(
Expand Down Expand Up @@ -1335,6 +1367,26 @@ sai_status_t ClientSai::bulkRemove(
return bulkRemove(SAI_OBJECT_TYPE_FDB_ENTRY, serializedObjectIds, mode, object_statuses);
}

sai_status_t ClientSai::bulkRemove(
_In_ uint32_t object_count,
_In_ const sai_my_sid_entry_t *my_sid_entry,
_In_ sai_bulk_op_error_mode_t mode,
_Out_ sai_status_t *object_statuses)
{
MUTEX();
SWSS_LOG_ENTER();
REDIS_CHECK_API_INITIALIZED();

std::vector<std::string> serializedObjectIds;

for (uint32_t idx = 0; idx < object_count; idx++)
{
serializedObjectIds.emplace_back(sai_serialize_my_sid_entry(my_sid_entry[idx]));
}

return bulkRemove(SAI_OBJECT_TYPE_MY_SID_ENTRY, serializedObjectIds, mode, object_statuses);
}

// BULK REMOVE HELPERS

sai_status_t ClientSai::bulkRemove(
Expand Down Expand Up @@ -1485,6 +1537,27 @@ sai_status_t ClientSai::bulkSet(
return bulkSet(SAI_OBJECT_TYPE_FDB_ENTRY, serializedObjectIds, attr_list, mode, object_statuses);
}

sai_status_t ClientSai::bulkSet(
_In_ uint32_t object_count,
_In_ const sai_my_sid_entry_t *my_sid_entry,
_In_ const sai_attribute_t *attr_list,
_In_ sai_bulk_op_error_mode_t mode,
_Out_ sai_status_t *object_statuses)
{
MUTEX();
SWSS_LOG_ENTER();
REDIS_CHECK_API_INITIALIZED();

std::vector<std::string> serializedObjectIds;

for (uint32_t idx = 0; idx < object_count; idx++)
{
serializedObjectIds.emplace_back(sai_serialize_my_sid_entry(my_sid_entry[idx]));
}

return bulkSet(SAI_OBJECT_TYPE_MY_SID_ENTRY, serializedObjectIds, attr_list, mode, object_statuses);
}

// BULK SET HELPERS

sai_status_t ClientSai::bulkSet(
Expand Down
6 changes: 4 additions & 2 deletions lib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ libsairedis_la_SOURCES = \
sai_redis_samplepacket.cpp \
sai_redis_scheduler.cpp \
sai_redis_schedulergroup.cpp \
sai_redis_segmentroute.cpp \
sai_redis_srv6.cpp \
sai_redis_stp.cpp \
sai_redis_switch.cpp \
sai_redis_system_port.cpp \
Expand All @@ -74,7 +74,9 @@ libsairedis_la_SOURCES = \
sai_redis_udf.cpp \
sai_redis_virtual_router.cpp \
sai_redis_vlan.cpp \
sai_redis_wred.cpp
sai_redis_wred.cpp \
sai_redis_ipsec.cpp \
sai_redis_my_mac.cpp

libSaiRedis_a_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS)
libSaiRedis_a_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) $(CODE_COVERAGE_CXXFLAGS)
Expand Down
5 changes: 4 additions & 1 deletion lib/Recorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ namespace sairedis
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);

public: // remove ENTRY

Expand All @@ -181,6 +182,7 @@ namespace sairedis
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);

public: // set ENTRY

Expand All @@ -192,6 +194,7 @@ namespace sairedis
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);

public: // get ENTRY

Expand All @@ -203,7 +206,7 @@ namespace sairedis
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);

public: // SAI stats API

Expand Down
67 changes: 67 additions & 0 deletions lib/RedisRemoteSaiInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1390,6 +1390,24 @@ sai_status_t RedisRemoteSaiInterface::bulkRemove(
return bulkRemove(SAI_OBJECT_TYPE_FDB_ENTRY, serializedObjectIds, mode, object_statuses);
}

sai_status_t RedisRemoteSaiInterface::bulkRemove(
_In_ uint32_t object_count,
_In_ const sai_my_sid_entry_t *my_sid_entry,
_In_ sai_bulk_op_error_mode_t mode,
_Out_ sai_status_t *object_statuses)
{
SWSS_LOG_ENTER();

std::vector<std::string> serializedObjectIds;

for (uint32_t idx = 0; idx < object_count; idx++)
{
serializedObjectIds.emplace_back(sai_serialize_my_sid_entry(my_sid_entry[idx]));
}

return bulkRemove(SAI_OBJECT_TYPE_MY_SID_ENTRY, serializedObjectIds, mode, object_statuses);
}

sai_status_t RedisRemoteSaiInterface::bulkSet(
_In_ sai_object_type_t object_type,
_In_ uint32_t object_count,
Expand Down Expand Up @@ -1486,6 +1504,25 @@ sai_status_t RedisRemoteSaiInterface::bulkSet(
return bulkSet(SAI_OBJECT_TYPE_FDB_ENTRY, serializedObjectIds, attr_list, mode, object_statuses);
}

sai_status_t RedisRemoteSaiInterface::bulkSet(
_In_ uint32_t object_count,
_In_ const sai_my_sid_entry_t *my_sid_entry,
_In_ const sai_attribute_t *attr_list,
_In_ sai_bulk_op_error_mode_t mode,
_Out_ sai_status_t *object_statuses)
{
SWSS_LOG_ENTER();

std::vector<std::string> serializedObjectIds;

for (uint32_t idx = 0; idx < object_count; idx++)
{
serializedObjectIds.emplace_back(sai_serialize_my_sid_entry(my_sid_entry[idx]));
}

return bulkSet(SAI_OBJECT_TYPE_MY_SID_ENTRY, serializedObjectIds, attr_list, mode, object_statuses);
}

sai_status_t RedisRemoteSaiInterface::bulkSet(
_In_ sai_object_type_t object_type,
_In_ const std::vector<std::string> &serialized_object_ids,
Expand Down Expand Up @@ -1765,6 +1802,36 @@ sai_status_t RedisRemoteSaiInterface::bulkCreate(
object_statuses);
}

sai_status_t RedisRemoteSaiInterface::bulkCreate(
_In_ uint32_t object_count,
_In_ const sai_my_sid_entry_t* my_sid_entry,
_In_ const uint32_t *attr_count,
_In_ const sai_attribute_t **attr_list,
_In_ sai_bulk_op_error_mode_t mode,
_Out_ sai_status_t *object_statuses)
{
SWSS_LOG_ENTER();

// TODO support mode

std::vector<std::string> serialized_object_ids;

// on create vid is put in db by syncd
for (uint32_t idx = 0; idx < object_count; idx++)
{
std::string str_object_id = sai_serialize_my_sid_entry(my_sid_entry[idx]);
serialized_object_ids.push_back(str_object_id);
}

return bulkCreate(
SAI_OBJECT_TYPE_MY_SID_ENTRY,
serialized_object_ids,
attr_count,
attr_list,
mode,
object_statuses);
}

sai_status_t RedisRemoteSaiInterface::notifySyncd(
_In_ sai_object_id_t switchId,
_In_ sai_redis_notify_syncd_t redisNotifySyncd)
Expand Down
54 changes: 54 additions & 0 deletions lib/ServerSai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,25 @@ sai_status_t ServerSai::processBulkCreateEntry(
}
break;

case SAI_OBJECT_TYPE_MY_SID_ENTRY:
{
std::vector<sai_my_sid_entry_t> entries(object_count);

for (uint32_t it = 0; it < object_count; it++)
{
sai_deserialize_my_sid_entry(objectIds[it], entries[it]);
}

status = m_sai->bulkCreate(
object_count,
entries.data(),
attr_counts.data(),
attr_lists.data(),
mode,
statuses.data());
}
break;

default:
return SAI_STATUS_NOT_SUPPORTED;
}
Expand Down Expand Up @@ -1345,6 +1364,23 @@ sai_status_t ServerSai::processBulkRemoveEntry(
}
break;

case SAI_OBJECT_TYPE_MY_SID_ENTRY:
{
std::vector<sai_my_sid_entry_t> entries(object_count);

for (uint32_t it = 0; it < object_count; it++)
{
sai_deserialize_my_sid_entry(objectIds[it], entries[it]);
}

status = m_sai->bulkRemove(
object_count,
entries.data(),
mode,
statuses.data());
}
break;

default:
return SAI_STATUS_NOT_SUPPORTED;
}
Expand Down Expand Up @@ -1447,6 +1483,24 @@ sai_status_t ServerSai::processBulkSetEntry(
}
break;

case SAI_OBJECT_TYPE_MY_SID_ENTRY:
{
std::vector<sai_my_sid_entry_t> entries(object_count);

for (uint32_t it = 0; it < object_count; it++)
{
sai_deserialize_my_sid_entry(objectIds[it], entries[it]);
}

status = m_sai->bulkSet(
object_count,
entries.data(),
attr_lists.data(),
mode,
statuses.data());
}
break;

default:
return SAI_STATUS_NOT_SUPPORTED;
}
Expand Down
4 changes: 3 additions & 1 deletion lib/sai_redis.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ PRIVATE extern const sai_rpf_group_api_t redis_rpf_group_api;
PRIVATE extern const sai_samplepacket_api_t redis_samplepacket_api;
PRIVATE extern const sai_scheduler_api_t redis_scheduler_api;
PRIVATE extern const sai_scheduler_group_api_t redis_scheduler_group_api;
PRIVATE extern const sai_segmentroute_api_t redis_segmentroute_api;
PRIVATE extern const sai_srv6_api_t redis_srv6_api;
PRIVATE extern const sai_stp_api_t redis_stp_api;
PRIVATE extern const sai_switch_api_t redis_switch_api;
PRIVATE extern const sai_system_port_api_t redis_system_port_api;
Expand All @@ -58,6 +58,8 @@ PRIVATE extern const sai_udf_api_t redis_udf_api;
PRIVATE extern const sai_virtual_router_api_t redis_virtual_router_api;
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 std::shared_ptr<sairedis::SaiInterface> redis_sai;

Expand Down
4 changes: 3 additions & 1 deletion lib/sai_redis_interfacequery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ static sai_apis_t redis_apis = {
API(mcast_fdb),
API(bridge),
API(tam),
API(segmentroute),
API(srv6),
API(mpls),
API(dtel),
API(bfd),
Expand All @@ -77,6 +77,8 @@ static sai_apis_t redis_apis = {
API(debug_counter),
API(macsec),
API(system_port),
API(my_mac),
API(ipsec),
API(bmtor),
};

Expand Down
16 changes: 16 additions & 0 deletions lib/sai_redis_ipsec.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include "sai_redis.h"

REDIS_GENERIC_QUAD(IPSEC,ipsec);
REDIS_GENERIC_QUAD(IPSEC_PORT,ipsec_port);
REDIS_GENERIC_QUAD(IPSEC_SA,ipsec_sa);
REDIS_GENERIC_STATS(IPSEC_PORT,ipsec_port);
REDIS_GENERIC_STATS(IPSEC_SA,ipsec_sa);

const sai_ipsec_api_t redis_ipsec_api = {

REDIS_GENERIC_QUAD_API(ipsec)
REDIS_GENERIC_QUAD_API(ipsec_port)
REDIS_GENERIC_STATS_API(ipsec_port)
REDIS_GENERIC_QUAD_API(ipsec_sa)
REDIS_GENERIC_STATS_API(ipsec_sa)
};
8 changes: 8 additions & 0 deletions lib/sai_redis_my_mac.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include "sai_redis.h"

REDIS_GENERIC_QUAD(MY_MAC,my_mac);

const sai_my_mac_api_t redis_my_mac_api = {

REDIS_GENERIC_QUAD_API(my_mac)
};
2 changes: 2 additions & 0 deletions lib/sai_redis_nexthopgroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ REDIS_BULK_CREATE(NEXT_HOP_GROUP_MEMBER,next_hop_group_members);
REDIS_BULK_REMOVE(NEXT_HOP_GROUP_MEMBER,next_hop_group_members);
REDIS_GENERIC_QUAD(NEXT_HOP_GROUP,next_hop_group);
REDIS_GENERIC_QUAD(NEXT_HOP_GROUP_MEMBER,next_hop_group_member);
REDIS_GENERIC_QUAD(NEXT_HOP_GROUP_MAP,next_hop_group_map);

const sai_next_hop_group_api_t redis_next_hop_group_api = {

Expand All @@ -12,4 +13,5 @@ const sai_next_hop_group_api_t redis_next_hop_group_api = {

redis_bulk_create_next_hop_group_members,
redis_bulk_remove_next_hop_group_members,
REDIS_GENERIC_QUAD_API(next_hop_group_map)
};
Loading