Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
736dc3b
Remove redudnant mention of platform cisco-8000 (#856)
VenkatCisco Jul 7, 2021
8d63f15
Changes for tunnel counters
dgsudharsan Jul 8, 2021
84fa50a
Revert "[vs]: Start syncd by passing context configuration file and g…
SuvarnaMeenakshi Jul 11, 2021
6fe1e75
[syncd] Fix fdb flood queue size limit check (#857)
kcudnik Jul 13, 2021
8123e32
[VS] Fix context config guid on RealObjectIdManager (#847)
kcudnik Jul 13, 2021
539fdcd
Add function to refresh macsec sa stat (#861)
Pterosaur Jul 14, 2021
216e549
Fixed Popen args in physyncd_spawn() (#860)
akokhan Jul 15, 2021
c7ffecc
Tunnel counters #2
dgsudharsan Jul 15, 2021
b7e93be
Fixing build
dgsudharsan Jul 17, 2021
c20321c
[meta] Allow objects with the same key exist on different switches (#…
kcudnik Jul 21, 2021
ab80b0e
[syncd] Clean up log messages and add performance timer for bulk rout…
kcudnik Jul 21, 2021
00ccc95
Ported Marvell armhf build on x86 for debian buster to use cross-comp…
gregshpit Jul 21, 2021
7c0cbf8
Addressing code review comments
dgsudharsan Jul 29, 2021
ff631f4
[sairedis] Add context config fields conflict check (#874)
kcudnik Jul 30, 2021
c5e76c7
Update .gitignore (#870)
kcudnik Jul 30, 2021
f6b9878
[meta] Use pragma once in serialize header (#873)
kcudnik Jul 30, 2021
0035df7
[sairedis] Fix thread run flag on close (#872)
kcudnik Jul 30, 2021
6921d99
[tests] Fix error code check (#871)
kcudnik Jul 30, 2021
0d5f82f
[syncd] Fix status succes on bulk fallback (#867)
kcudnik Jul 30, 2021
f50dba7
[syncd] Fix access coldvid table per switch (#866)
kcudnik Jul 30, 2021
f56a39e
[sairedis] Record create, remove and set response in sync mode (#869)
kcudnik Jul 30, 2021
2000aeb
Clean codes (#876)
wendani Aug 2, 2021
e2c9590
[vslib] Clean Sai interface include (#880)
kcudnik Aug 4, 2021
2481a3f
Deprecate python module in favor to pyext (#882)
kcudnik Aug 4, 2021
6a5f379
[meta] Fix vlan set test (#879)
kcudnik Aug 4, 2021
3830b97
[sairedis] Add comment api to recorder (#883)
kcudnik Aug 6, 2021
73714ec
[syncd] Add event name to timer watchdog (#868)
kcudnik Aug 6, 2021
d929337
Not modifying poll interval logic since it is handled in a different PR
dgsudharsan Aug 7, 2021
0e66921
Merge branch 'master' of github.com:Azure/sonic-sairedis into evpn_vl…
dgsudharsan Aug 7, 2021
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
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,24 @@ syncd/syncd
syncd/syncd_request_shutdown
tests/syncd
tests/vssyncd
saiasiccmp/saiasiccmp
tests/tests
tests/testclient

# Temporary files #
###################
**/*~
**/*.rec
**/*.swp
**/*.swo
**/*.gcda
**/*.gcno

tests/applyview.log
tests/sai_warmboot.bin.bak
tests/sai_warmboot.bin
tests/[0-9]*

pyext/py2/pysairedis.py
pyext/py3/pysairedis.py
pyext/pysairedis.py
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SUBDIRS = meta lib vslib python pyext
SUBDIRS = meta lib vslib pyext

if SYNCD
SUBDIRS += syncd saiplayer saidump saidiscovery saisdkdump saiasiccmp tests
Expand Down
9 changes: 6 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ AC_ARG_ENABLE(redis-test,
esac],[rtest=false])
AM_CONDITIONAL(RTEST, test x$rtest = xtrue)

AM_CONDITIONAL(ARCH64, test `getconf LONG_BIT` = "64")
if test x$CONFIGURED_ARCH = xarmhf && test x$CROSS_BUILD_ENVIRON = xy; then
AM_CONDITIONAL(ARCH64, false)
else
AM_CONDITIONAL(ARCH64, test `getconf LONG_BIT` = "64")
fi

AC_PATH_PROGS(SWIG, [swig3.0 swig])

Expand Down Expand Up @@ -164,5 +168,4 @@ AC_OUTPUT(Makefile
tests/Makefile
pyext/Makefile
pyext/py2/Makefile
pyext/py3/Makefile
python/setup.py)
pyext/py3/Makefile)
2 changes: 2 additions & 0 deletions lib/inc/ContextConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ namespace sairedis
void insert(
_In_ std::shared_ptr<SwitchConfig> config);

bool hasConflict(
_In_ std::shared_ptr<const ContextConfig> ctx) const;

public: // TODO to private

Expand Down
11 changes: 11 additions & 0 deletions lib/inc/Recorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ namespace sairedis
_In_ sai_status_t status,
_In_ const std::vector<swss::FieldValueTuple>& arguments);

void recordGenericResponse(
_In_ sai_status_t status);

public: // create ENTRY

SAI_REDIS_RECORDER_DECLARE_RECORD_CREATE(fdb_entry);
Expand Down Expand Up @@ -263,6 +266,11 @@ namespace sairedis
_In_ uint32_t objectCount,
_In_ const sai_status_t *objectStatuses);

void recordBulkGenericResponse(
_In_ sai_status_t status,
_In_ uint32_t objectCount,
_In_ const sai_status_t *objectStatuses);

public: // SAI query interface API

void recordFlushFdbEntries(
Expand Down Expand Up @@ -371,6 +379,9 @@ namespace sairedis

void requestLogRotate();

void recordComment(
_In_ const std::string& comment);

public: // static helper functions

static std::string getTimestamp();
Expand Down
52 changes: 52 additions & 0 deletions lib/src/ContextConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,55 @@ void ContextConfig::insert(

m_scc->insert(config);
}

bool ContextConfig::hasConflict(
_In_ std::shared_ptr<const ContextConfig> ctx) const
{
SWSS_LOG_ENTER();

if (m_guid == ctx->m_guid)
{
SWSS_LOG_ERROR("guid %u conflict", m_guid);
return true;
}

if (m_name == ctx->m_name)
{
SWSS_LOG_ERROR("name %s conflict", m_name.c_str());
return true;
}

if (m_dbAsic == ctx->m_dbAsic)
{
SWSS_LOG_ERROR("dbAsic %s conflict", m_dbAsic.c_str());
return true;
}

if (m_dbCounters == ctx->m_dbCounters)
{
SWSS_LOG_ERROR("dbCounters %s conflict", m_dbCounters.c_str());
return true;
}

if (m_dbFlex == ctx->m_dbFlex)
{
SWSS_LOG_ERROR("dbFlex %s conflict", m_dbFlex.c_str());
return true;
}

// state database can be shared

if (m_zmqEndpoint == ctx->m_zmqEndpoint)
{
SWSS_LOG_ERROR("zmqEndpoint %s conflict", m_zmqEndpoint.c_str());
return true;
}

if (m_zmqNtfEndpoint == ctx->m_zmqNtfEndpoint)
{
SWSS_LOG_ERROR("zmqNtfEndpoint %s conflict", m_zmqNtfEndpoint.c_str());
return true;
}

return false;
}
12 changes: 11 additions & 1 deletion lib/src/ContextConfigContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ void ContextConfigContainer::insert(
{
SWSS_LOG_ENTER();

for (auto& c: m_map)
{
if (c.second->hasConflict(contextConfig))
{
SWSS_LOG_THROW("context config with guid %u have conflicts with guid %u",
contextConfig->m_guid,
c.second->m_guid);
}
}

m_map[contextConfig->m_guid] = contextConfig;
}

Expand Down Expand Up @@ -159,7 +169,7 @@ std::set<std::shared_ptr<ContextConfig>> ContextConfigContainer::getAllContextCo

std::set<std::shared_ptr<ContextConfig>> set;

for (auto&item: m_map)
for (auto& item: m_map)
{
set.insert(item.second);
}
Expand Down
44 changes: 44 additions & 0 deletions lib/src/Recorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1117,3 +1117,47 @@ void Recorder::recordStats(

m_recordStats = enable;
}


void Recorder::recordGenericResponse(
_In_ sai_status_t status)
{
SWSS_LOG_ENTER();

if (status != SAI_STATUS_SUCCESS)
{
// record only when response is not success

recordLine("E|" + sai_serialize_status(status));
}
}

void Recorder::recordBulkGenericResponse(
_In_ sai_status_t status,
_In_ uint32_t objectCount,
_In_ const sai_status_t *objectStatuses)
{
SWSS_LOG_ENTER();

if (status != SAI_STATUS_SUCCESS)
{
// record only when response is not success

std::string statuses = "";

for (uint32_t i = 0; i < objectCount; i++)
{
statuses += "|" + sai_serialize_status(objectStatuses[i]);
}

recordLine("E|" + sai_serialize_status(status) + "|" + statuses);
}
}

void Recorder::recordComment(
_In_ const std::string& comment)
{
SWSS_LOG_ENTER();

recordLine("#|" + comment);
}
11 changes: 10 additions & 1 deletion lib/src/RedisRemoteSaiInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@ sai_status_t RedisRemoteSaiInterface::create(

auto hwinfo = getHardwareInfo(attr_count, attr_list);

if (hwinfo.size())
{
m_recorder->recordComment("SAI_SWITCH_ATTR_SWITCH_HARDWARE_INFO=" + hwinfo);
}

switchId = m_virtualObjectIdManager->allocateNewSwitchObjectId(hwinfo);

*objectId = switchId;
Expand Down Expand Up @@ -742,6 +747,8 @@ sai_status_t RedisRemoteSaiInterface::waitForResponse(

auto status = m_communicationChannel->wait(REDIS_ASIC_STATE_COMMAND_GETRESPONSE, kco);

m_recorder->recordGenericResponse(status);

return status;
}

Expand Down Expand Up @@ -1337,7 +1344,7 @@ sai_status_t RedisRemoteSaiInterface::waitForBulkResponse(

if (values.size () != object_count)
{
SWSS_LOG_THROW("wrong number of counters, got %zu, expected %u", values.size(), object_count);
SWSS_LOG_THROW("wrong number of statuses, got %zu, expected %u", values.size(), object_count);
}

// deserialize statuses for all objects
Expand All @@ -1347,6 +1354,8 @@ sai_status_t RedisRemoteSaiInterface::waitForBulkResponse(
sai_deserialize_status(fvField(values[idx]), object_statuses[idx]);
}

m_recorder->recordBulkGenericResponse(status, object_count, object_statuses);

return status;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/src/ServerSai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ sai_status_t ServerSai::uninitialize(void)
{
SWSS_LOG_NOTICE("end server thread begin");

m_runServerThread = true;
m_runServerThread = false;

m_serverThreadThreadShouldEndEvent.notify();

Expand Down
11 changes: 10 additions & 1 deletion meta/AttrKeyMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,19 @@ bool AttrKeyMap::attrKeyExists(
}

std::string AttrKeyMap::constructKey(
_In_ sai_object_id_t switchId,
_In_ const sai_object_meta_key_t& metaKey,
_In_ uint32_t attrCount,
_In_ const sai_attribute_t* attrList)
{
SWSS_LOG_ENTER();

if (switchId == SAI_NULL_OBJECT_ID)
{
SWSS_LOG_THROW("switchId is NULL for %s",
sai_serialize_object_meta_key(metaKey).c_str());
}

// Use map to make sure that keys will be always sorted by attr id.

std::map<int32_t, std::string> keys;
Expand Down Expand Up @@ -133,7 +140,9 @@ std::string AttrKeyMap::constructKey(
keys[md->attrid] = name;
}

std::string key;
// switch ID is added, since same key pattern is allowed on different switch objects

std::string key = sai_serialize_object_id(switchId) + ";";

for (auto& k: keys)
{
Expand Down
1 change: 1 addition & 0 deletions meta/AttrKeyMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ namespace saimeta
* @brief Construct key based on attributes marked as keys.
*/
static std::string constructKey(
_In_ sai_object_id_t switchId,
_In_ const sai_object_meta_key_t& metaKey,
_In_ uint32_t attrCount,
_In_ const sai_attribute_t* attrList);
Expand Down
8 changes: 5 additions & 3 deletions meta/Meta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5052,7 +5052,7 @@ sai_status_t Meta::meta_generic_validation_create(

if (haskeys)
{
std::string key = AttrKeyMap::constructKey(meta_key, attr_count, attr_list);
std::string key = AttrKeyMap::constructKey(switch_id, meta_key, attr_count, attr_list);

// since we didn't created oid yet, we don't know if attribute key exists, check all
if (m_attrKeys.attrKeyExists(key))
Expand Down Expand Up @@ -6951,7 +6951,7 @@ void Meta::meta_generic_validation_post_create(
{
auto mKey = sai_serialize_object_meta_key(meta_key);

auto attrKey = AttrKeyMap::constructKey(meta_key, attr_count, attr_list);
auto attrKey = AttrKeyMap::constructKey(switch_id, meta_key, attr_count, attr_list);

m_attrKeys.insert(mKey, attrKey);
}
Expand Down Expand Up @@ -7914,7 +7914,9 @@ void Meta::populate(
{
auto mKey = sai_serialize_object_meta_key(mk);

auto attrKey = AttrKeyMap::constructKey(mk, attr_count, attr_list);
auto switchId = switchIdQuery(mk.objectkey.key.object_id);

auto attrKey = AttrKeyMap::constructKey(switchId, mk, attr_count, attr_list);

m_attrKeys.insert(mKey, attrKey);
}
Expand Down
5 changes: 1 addition & 4 deletions meta/sai_serialize.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#ifndef __SAI_SERIALIZE__
#define __SAI_SERIALIZE__
#pragma once

extern "C" {
#include "sai.h"
Expand Down Expand Up @@ -386,5 +385,3 @@ sai_redis_notify_syncd_t sai_deserialize_redis_notify_syncd(
void sai_deserialize_redis_communication_mode(
_In_ const std::string& s,
_Out_ sai_redis_communication_mode_t& value);

#endif // __SAI_SERIALIZE__
8 changes: 5 additions & 3 deletions meta/tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1470,7 +1470,7 @@ void test_vlan_set()
META_ASSERT_FAIL(status);

SWSS_LOG_NOTICE("set is null");
status = g_meta->set(SAI_OBJECT_TYPE_VLAN, vlan_id, &attr);
status = g_meta->set(SAI_OBJECT_TYPE_VLAN, vlan_id, &vlan);
META_ASSERT_FAIL(status);

SWSS_LOG_NOTICE("attr is null");
Expand Down Expand Up @@ -2956,11 +2956,13 @@ void test_construct_key()

meta_key.objecttype = SAI_OBJECT_TYPE_PORT;

std::string key = AttrKeyMap::constructKey(meta_key, 1, &attr);
sai_object_id_t switchId = 0x21000000000000;

std::string key = AttrKeyMap::constructKey(switchId, meta_key, 1, &attr);

SWSS_LOG_NOTICE("constructed key: %s", key.c_str());

META_ASSERT_TRUE(key == "SAI_PORT_ATTR_HW_LANE_LIST:1,2,3,4;");
META_ASSERT_TRUE(key == "oid:0x21000000000000;SAI_PORT_ATTR_HW_LANE_LIST:1,2,3,4;");
}

static sai_object_id_t create_scheduler_group(
Expand Down
19 changes: 0 additions & 19 deletions python/Makefile

This file was deleted.

Loading