Skip to content

Commit

Permalink
Merge branch 'sonic-net:master' into dev-logrotate-config
Browse files Browse the repository at this point in the history
  • Loading branch information
fastiuk authored Apr 27, 2024
2 parents bc2c3cd + 5a73792 commit f7750ee
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 5 deletions.
29 changes: 29 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,35 @@ stages:
artifact_name: sonic-swss-common.arm64
debian_version: ${{ parameters.debian_version }}

- stage: BuildBookworm
dependsOn: BuildArm
condition: succeeded('BuildArm')
jobs:
- template: .azure-pipelines/build-template.yml
parameters:
arch: amd64
sonic_slave: sonic-slave-bookworm:$(BUILD_BRANCH)
artifact_name: sonic-swss-common-bookworm
debian_version: ${{ parameters.debian_version }}

- template: .azure-pipelines/build-template.yml
parameters:
arch: armhf
timeout: 180
pool: sonicbld-armhf
sonic_slave: sonic-slave-bookworm-armhf:$(BUILD_BRANCH)
artifact_name: sonic-swss-common-bookworm.armhf
debian_version: ${{ parameters.debian_version }}

- template: .azure-pipelines/build-template.yml
parameters:
arch: arm64
timeout: 180
pool: sonicbld-arm64
sonic_slave: sonic-slave-bookworm-arm64:$(BUILD_BRANCH)
artifact_name: sonic-swss-common-bookworm.arm64
debian_version: ${{ parameters.debian_version }}

- stage: BuildSairedis
dependsOn: Build
condition: succeeded('Build')
Expand Down
2 changes: 1 addition & 1 deletion common/asyncdbupdater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void AsyncDBUpdater::dbUpdateThread()
pthread_setschedprio(pthread_self(), min_priority + 1);

// Follow same logic in ConsumerStateTable: every received data will write to 'table'.
DBConnector db(m_db->getDbName(), 0, true);
DBConnector db(m_db->getDbName(), 0, true, m_db->getDBKey());
Table table(&db, m_tableName);
std::mutex cvMutex;
std::unique_lock<std::mutex> cvLock(cvMutex);
Expand Down
16 changes: 16 additions & 0 deletions common/configdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,22 @@ class ConfigDBConnector_Native : public SonicV2Connector_Native
std::string m_db_name;
};

#if defined(SWIG) && defined(SWIGGO)
%insert(go_wrapper) %{

type ConfigDBConnector struct {
ConfigDBConnector_Native
}

func NewConfigDBConnector(a ...interface{}) *ConfigDBConnector {
return &ConfigDBConnector{
NewConfigDBConnector_Native(a...),
}
}
%}
#endif


#if defined(SWIG) && defined(SWIGPYTHON)
%pythoncode %{
## Note: diamond inheritance, reusing functions in both classes
Expand Down
2 changes: 2 additions & 0 deletions common/dbconnector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,8 @@ void DBConnector::select(DBConnector *db)
DBConnector::DBConnector(const DBConnector &other)
: RedisContext(other)
, m_dbId(other.m_dbId)
, m_dbName(other.m_dbName)
, m_key(other.m_key)
{
select(this);
}
Expand Down
2 changes: 1 addition & 1 deletion common/pubsub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ MessageResultPair PubSub::get_message_internal(double timeout, bool interrupt_on
}

Selectable *selected;
int rc = m_select.select(&selected, int(timeout), interrupt_on_signal);
int rc = m_select.select(&selected, int(timeout * 1000), interrupt_on_signal);
ret.first = rc;
switch (rc)
{
Expand Down
5 changes: 5 additions & 0 deletions common/pubsub.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ class PubSub : protected RedisSelect
public:
explicit PubSub(DBConnector *other);

/**
* @brief Get published message
* @param timeout Get message timeout in seconds
* @param interrupt_on_signal Interrupt when reseive EINTR signal
*/
std::map<std::string, std::string> get_message(double timeout = 0.0, bool interrupt_on_signal = false);
std::map<std::string, std::string> listen_message(bool interrupt_on_signal = false);

Expand Down
16 changes: 16 additions & 0 deletions common/schema.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ namespace swss {
#define APP_ROUTE_TABLE_NAME "ROUTE_TABLE"
#define APP_LABEL_ROUTE_TABLE_NAME "LABEL_ROUTE_TABLE"
#define APP_TUNNEL_DECAP_TABLE_NAME "TUNNEL_DECAP_TABLE"
#define APP_TUNNEL_DECAP_TERM_TABLE_NAME "TUNNEL_DECAP_TERM_TABLE"
#define APP_TUNNEL_ROUTE_TABLE_NAME "TUNNEL_ROUTE_TABLE"
#define APP_FDB_TABLE_NAME "FDB_TABLE"
#define APP_PFC_WD_TABLE_NAME "PFC_WD_TABLE"
Expand All @@ -54,10 +55,17 @@ namespace swss {
#define APP_P4RT_WCMP_GROUP_TABLE_NAME "FIXED_WCMP_GROUP_TABLE"
#define APP_P4RT_IPV4_TABLE_NAME "FIXED_IPV4_TABLE"
#define APP_P4RT_IPV6_TABLE_NAME "FIXED_IPV6_TABLE"
#define APP_P4RT_IPV4_MULTICAST_TABLE_NAME "FIXED_IPV4_MULTICAST_TABLE"
#define APP_P4RT_IPV6_MULTICAST_TABLE_NAME "FIXED_IPV6_MULTICAST_TABLE"
#define APP_P4RT_ACL_TABLE_DEFINITION_NAME "ACL_TABLE_DEFINITION_TABLE"
#define APP_P4RT_MIRROR_SESSION_TABLE_NAME "FIXED_MIRROR_SESSION_TABLE"
#define APP_P4RT_L3_ADMIT_TABLE_NAME "FIXED_L3_ADMIT_TABLE"
#define APP_P4RT_TUNNEL_TABLE_NAME "FIXED_TUNNEL_TABLE"
#define APP_P4RT_MULTICAST_ROUTER_INTERFACE_TABLE_NAME "FIXED_MULTICAST_ROUTER_INTERFACE_TABLE"
#define APP_P4RT_REPLICATION_IP_MULTICAST_TABLE_NAME "REPLICATION_IP_MULTICAST_TABLE"
#define APP_P4RT_REPLICATION_L2_MULTICAST_TABLE_NAME "REPLICATION_L2_MULTICAST_TABLE"
#define APP_P4RT_IPV6_TUNNEL_TERMINATION_TABLE_NAME "FIXED_IPV6_TUNNEL_TERMINATION_TABLE"
#define APP_P4RT_DISABLE_VLAN_CHECKS_TABLE_NAME "FIXED_DISABLE_VLAN_CHECKS_TABLE"

#define APP_COPP_TABLE_NAME "COPP_TABLE"
#define APP_VRF_TABLE_NAME "VRF_TABLE"
Expand Down Expand Up @@ -417,6 +425,7 @@ namespace swss {
#define CFG_PEER_SWITCH_TABLE_NAME "PEER_SWITCH"

#define CFG_TUNNEL_TABLE_NAME "TUNNEL"
#define CFG_SUBNET_DECAP_TABLE_NAME "SUBNET_DECAP"

#define CFG_SYSTEM_PORT_TABLE_NAME "SYSTEM_PORT"
#define CFG_VOQ_INBAND_INTERFACE_TABLE_NAME "VOQ_INBAND_INTERFACE"
Expand All @@ -440,6 +449,8 @@ namespace swss {

#define CFG_SAG_TABLE_NAME "SAG"

#define CFG_SUPPRESS_ASIC_SDK_HEALTH_EVENT_NAME "SUPPRESS_ASIC_SDK_HEALTH_EVENT"

/***** STATE DATABASE *****/

#define STATE_SWITCH_CAPABILITY_TABLE_NAME "SWITCH_CAPABILITY"
Expand Down Expand Up @@ -504,6 +515,9 @@ namespace swss {
#define STATE_BUFFER_PROFILE_TABLE_NAME "BUFFER_PROFILE_TABLE"
#define STATE_DHCPv6_COUNTER_TABLE_NAME "DHCPv6_COUNTER_TABLE"

#define STATE_TUNNEL_DECAP_TABLE_NAME "TUNNEL_DECAP_TABLE"
#define STATE_TUNNEL_DECAP_TERM_TABLE_NAME "TUNNEL_DECAP_TERM_TABLE"

#define STATE_BFD_SESSION_TABLE_NAME "BFD_SESSION_TABLE"
#define STATE_ROUTE_TABLE_NAME "ROUTE_TABLE"
#define STATE_VNET_RT_TUNNEL_TABLE_NAME "VNET_ROUTE_TUNNEL_TABLE"
Expand All @@ -515,6 +529,8 @@ namespace swss {

#define STATE_TRANSCEIVER_INFO_TABLE_NAME "TRANSCEIVER_INFO"

#define STATE_ASIC_SDK_HEALTH_EVENT_TABLE_NAME "ASIC_SDK_HEALTH_EVENT_TABLE"

// ACL table and ACL rule table
#define STATE_ACL_TABLE_TABLE_NAME "ACL_TABLE_TABLE"
#define STATE_ACL_RULE_TABLE_NAME "ACL_RULE_TABLE"
Expand Down
8 changes: 7 additions & 1 deletion common/status_code_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ enum class StatusCode
SWSS_RC_IN_USE,
SWSS_RC_INTERNAL,
SWSS_RC_UNIMPLEMENTED,
SWSS_RC_NOT_EXECUTED,
SWSS_RC_FAILED_PRECONDITION,
SWSS_RC_UNKNOWN,
};

Expand All @@ -36,6 +38,8 @@ static const std::map<StatusCode, std::string> statusCodeMapping = {
{StatusCode::SWSS_RC_IN_USE, "SWSS_RC_IN_USE"},
{StatusCode::SWSS_RC_INTERNAL, "SWSS_RC_INTERNAL"},
{StatusCode::SWSS_RC_UNIMPLEMENTED, "SWSS_RC_UNIMPLEMENTED"},
{StatusCode::SWSS_RC_NOT_EXECUTED, "SWSS_RC_NOT_EXECUTED"},
{StatusCode::SWSS_RC_FAILED_PRECONDITION, "SWSS_RC_FAILED_PRECONDITION"},
{StatusCode::SWSS_RC_UNKNOWN, "SWSS_RC_UNKNOWN"},
};

Expand All @@ -52,6 +56,8 @@ static const std::map<std::string, StatusCode> StatusCodeLookup = {
{"SWSS_RC_IN_USE", StatusCode::SWSS_RC_IN_USE},
{"SWSS_RC_INTERNAL", StatusCode::SWSS_RC_INTERNAL},
{"SWSS_RC_UNIMPLEMENTED", StatusCode::SWSS_RC_UNIMPLEMENTED},
{"SWSS_RC_NOT_EXECUTED", StatusCode::SWSS_RC_NOT_EXECUTED},
{"SWSS_RC_FAILED_PRECONDITION", StatusCode::SWSS_RC_FAILED_PRECONDITION},
{"SWSS_RC_UNKNOWN", StatusCode::SWSS_RC_UNKNOWN},
};

Expand All @@ -73,4 +79,4 @@ static inline StatusCode strToStatusCode(const std::string &status)
return StatusCodeLookup.at(status);
}

} // namespace swss
} // namespace swss
4 changes: 2 additions & 2 deletions sonic-db-cli/sonic-db-cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ string handleSingleOperation(
try
{
auto db_id = SonicDBConfig::getDbId(db_name, netns);
if (useUnixSocket && db_name != "redis_chassis.server")
if (useUnixSocket && host != "redis_chassis.server")
{
auto db_socket = SonicDBConfig::getDbSock(db_name, netns);
message += db_name + ": Connection refused";
Expand Down Expand Up @@ -380,4 +380,4 @@ string getCommandName(vector<string>& commands)
}

return boost::to_upper_copy<string>(commands[0]);
}
}

0 comments on commit f7750ee

Please sign in to comment.