Skip to content

Commit

Permalink
Merge branch 'master' into aggVoq
Browse files Browse the repository at this point in the history
  • Loading branch information
prsunny committed Jun 4, 2024
2 parents 789eafb + fff544e commit 3a54c41
Show file tree
Hide file tree
Showing 50 changed files with 2,501 additions and 139 deletions.
1 change: 1 addition & 0 deletions .azure-pipelines/build-docker-sonic-vs-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ jobs:
artifact: ${{ parameters.sairedis_artifact_name }}
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/${{ parameters.sairedis_artifact_branch }}'
allowPartiallySucceededBuilds: true
path: $(Build.ArtifactStagingDirectory)/download/sairedis
patterns: |
${{ parameters.sairedis_artifact_pattern }}/libsaivs_*.deb
Expand Down
2 changes: 1 addition & 1 deletion .azure-pipelines/build-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ parameters:
- name: pool
type: string
values:
- sonicbld
- sonicbld-1es
- sonicbld-armhf
- sonicbld-arm64
- default
Expand Down
2 changes: 1 addition & 1 deletion .azure-pipelines/gcov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ parameters:
- name: pool
type: string
values:
- sonicbld
- sonicbld-1es
- default
default: default

Expand Down
3 changes: 2 additions & 1 deletion .azure-pipelines/test-docker-sonic-vs-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ jobs:
sudo apt-add-repository https://packages.microsoft.com/ubuntu/20.04/prod
sudo apt-get update
sudo apt-get install -y dotnet-sdk-7.0
sudo dotnet tool install dotnet-reportgenerator-globaltool --tool-path /usr/bin
sudo dotnet tool install dotnet-reportgenerator-globaltool --tool-path /usr/bin 2>&1 | tee log.log || grep 'already installed' log.log
rm log.log
displayName: "Install .NET CORE"
- script: |
Expand Down
6 changes: 3 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ stages:
- template: .azure-pipelines/build-template.yml
parameters:
arch: amd64
pool: sonicbld
pool: sonicbld-1es
sonic_slave: sonic-slave-bullseye
common_lib_artifact_name: common-lib
swss_common_artifact_name: sonic-swss-common
Expand All @@ -56,7 +56,7 @@ stages:
- template: .azure-pipelines/build-template.yml
parameters:
arch: amd64
pool: sonicbld
pool: sonicbld-1es
sonic_slave: sonic-slave-bullseye
common_lib_artifact_name: common-lib
swss_common_artifact_name: sonic-swss-common
Expand Down Expand Up @@ -99,7 +99,7 @@ stages:
- template: .azure-pipelines/build-template.yml
parameters:
arch: amd64
pool: sonicbld
pool: sonicbld-1es
sonic_slave: sonic-slave-bookworm
common_lib_artifact_name: common-lib
swss_common_artifact_name: sonic-swss-common-bookworm
Expand Down
7 changes: 7 additions & 0 deletions cfgmgr/fabricmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ void FabricMgr::doTask(Consumer &consumer)
string monPollThreshRecovery, monPollThreshIsolation;
string isolateStatus;
string alias, lanes;
string enable;
std::vector<FieldValueTuple> field_values;
string value;

Expand All @@ -66,6 +67,12 @@ void FabricMgr::doTask(Consumer &consumer)
monPollThreshIsolation = fvValue(i);
writeConfigToAppDb(key, "monPollThreshIsolation", monPollThreshIsolation);
}
else if (fvField(i) == "monState")
{
SWSS_LOG_INFO("Enable fabric monitoring setting in appl_db.");
enable = fvValue(i);
writeConfigToAppDb(key, "monState", enable);
}
else if (fvField(i) == "alias")
{
alias = fvValue(i);
Expand Down
2 changes: 1 addition & 1 deletion cfgmgr/fabricmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class FabricMgr : public Orch
private:
Table m_cfgFabricMonitorTable;
Table m_cfgFabricPortTable;
Table m_appFabricMonitorTable;
ProducerStateTable m_appFabricMonitorTable;
ProducerStateTable m_appFabricPortTable;

void doTask(Consumer &consumer);
Expand Down
2 changes: 1 addition & 1 deletion lib/recorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ void RecWriter::record(const std::string& val)
{
return ;
}
record_ofs << swss::getTimestamp() << "|" << val << std::endl;
if (isRotate())
{
setRotate(false);
logfileReopen();
}
record_ofs << swss::getTimestamp() << "|" << val << std::endl;
}


Expand Down
126 changes: 121 additions & 5 deletions orchagent/fabricportsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,36 @@ FabricPortsOrch::FabricPortsOrch(DBConnector *appl_db, vector<table_name_with_pr

auto debug_executor = new ExecutableTimer(m_debugTimer, this, "FABRIC_DEBUG_POLL");
Orch::addExecutor(debug_executor);
m_debugTimer->start();
bool fabricPortMonitor = checkFabricPortMonState();
if (fabricPortMonitor)
{
m_debugTimer->start();
SWSS_LOG_INFO("Fabric monitor starts at init time");
}
}

bool FabricPortsOrch::checkFabricPortMonState()
{
bool enabled = false;
std::vector<FieldValueTuple> constValues;
bool setCfgVal = m_applMonitorConstTable->get("FABRIC_MONITOR_DATA", constValues);
if (!setCfgVal)
{
return enabled;
}
SWSS_LOG_INFO("FabricPortsOrch::checkFabricPortMonState starts");
for (auto cv : constValues)
{
if (fvField(cv) == "monState")
{
if (fvValue(cv) == "enable")
{
enabled = true;
return enabled;
}
}
}
return enabled;
}

int FabricPortsOrch::getFabricPortList()
Expand Down Expand Up @@ -516,6 +545,7 @@ void FabricPortsOrch::updateFabricDebugCounters()
int autoIsolated = 0;
int cfgIsolated = 0;
int isolated = 0;
int origIsolated = 0;
string lnkStatus = "down";
string testState = "product";

Expand Down Expand Up @@ -614,6 +644,12 @@ void FabricPortsOrch::updateFabricDebugCounters()
if (fvField(val) == "AUTO_ISOLATED")
{
autoIsolated = to_uint<uint8_t>(valuePt);
SWSS_LOG_INFO("port %s currently autoisolated: %s", key.c_str(),valuePt.c_str());
continue;
}
if (fvField(val) == "ISOLATED")
{
origIsolated = to_uint<uint8_t>(valuePt);
SWSS_LOG_INFO("port %s currently isolated: %s", key.c_str(),valuePt.c_str());
continue;
}
Expand Down Expand Up @@ -787,6 +823,36 @@ void FabricPortsOrch::updateFabricDebugCounters()
}
// if "ISOLATED" is true, Call SAI api here to actually isolated the link
// if "ISOLATED" is false, Call SAP api to actually unisolate the link

if (origIsolated != isolated)
{
sai_attribute_t attr;
attr.id = SAI_PORT_ATTR_FABRIC_ISOLATE;
bool setVal = false;
if (isolated == 1)
{
setVal = true;
}
attr.value.booldata = setVal;
SWSS_LOG_NOTICE("Set fabric port %d with isolate %d ", lane, isolated);
if (m_fabricLanePortMap.find(lane) == m_fabricLanePortMap.end())
{
SWSS_LOG_NOTICE("NOT find fabric lane %d ", lane);
}
else
{
sai_status_t status = sai_port_api->set_port_attribute(m_fabricLanePortMap[lane], &attr);
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Failed to set admin status");
}
SWSS_LOG_NOTICE("Set fabric port %d state done %d ", lane, isolated);
}
}
else
{
SWSS_LOG_INFO( "Same isolation status for %d", lane);
}
}
else
{
Expand Down Expand Up @@ -1188,7 +1254,12 @@ void FabricPortsOrch::doTask()

void FabricPortsOrch::doFabricPortTask(Consumer &consumer)
{
SWSS_LOG_NOTICE("FabricPortsOrch::doFabricPortTask");
if (!checkFabricPortMonState())
{
SWSS_LOG_INFO("doFabricPortTask returns early due to feature disabled");
return;
}
SWSS_LOG_INFO("FabricPortsOrch::doFabricPortTask starts");
auto it = consumer.m_toSync.begin();
while (it != consumer.m_toSync.end())
{
Expand Down Expand Up @@ -1275,9 +1346,6 @@ void FabricPortsOrch::doFabricPortTask(Consumer &consumer)
}
SWSS_LOG_NOTICE("key %s alias %s isolateStatus %s lanes %s",
key.c_str(), alias.c_str(), isolateStatus.c_str(), lanes.c_str());
// Call SAI api to isolate/unisolate the link here.
// Isolate the link if isolateStatus is True.
// Unisolate the link if isolateStatus is False.

if (isolateStatus == "False")
{
Expand Down Expand Up @@ -1338,6 +1406,26 @@ void FabricPortsOrch::doFabricPortTask(Consumer &consumer)
// AUTO_ISOLATED 0
m_stateTable->hset(state_key, "AUTO_ISOLATED",
m_defaultAutoIsolated.c_str());

sai_attribute_t attr;
attr.id = SAI_PORT_ATTR_FABRIC_ISOLATE;
bool setVal = false;
attr.value.booldata = setVal;
SWSS_LOG_NOTICE("Set port %s to unisolate %s ", alias.c_str(), isolateStatus.c_str());
int idx = stoi(lanes);
if (m_fabricLanePortMap.find(idx) == m_fabricLanePortMap.end())
{
SWSS_LOG_NOTICE("NOT find %s alias. ", alias.c_str());
}
else
{
sai_status_t status = sai_port_api->set_port_attribute(m_fabricLanePortMap[idx], &attr);
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Failed to set admin status");
}
SWSS_LOG_NOTICE( "Set Port %s unisolation state done", alias.c_str());
}
}
}
}
Expand All @@ -1350,11 +1438,38 @@ void FabricPortsOrch::doTask(Consumer &consumer)
SWSS_LOG_NOTICE("doTask from FabricPortsOrch");

string table_name = consumer.getTableName();
SWSS_LOG_INFO("Table name: %s", table_name.c_str());

if (table_name == APP_FABRIC_MONITOR_PORT_TABLE_NAME)
{
doFabricPortTask(consumer);
}
if (table_name == APP_FABRIC_MONITOR_DATA_TABLE_NAME)
{
SWSS_LOG_INFO("doTask for APP_FABRIC_MONITOR_DATA_TABLE_NAME");
auto it = consumer.m_toSync.begin();
while (it != consumer.m_toSync.end())
{
KeyOpFieldsValuesTuple t = it->second;
for (auto i : kfvFieldsValues(t))
{
if (fvField(i) == "monState")
{
if (fvValue(i) == "enable")
{
m_debugTimer->start();
SWSS_LOG_INFO("debugTimer started");
}
else
{
m_debugTimer->stop();
SWSS_LOG_INFO("debugTimer stopped");
}
}
}
it = consumer.m_toSync.erase(it);
}
}
}

void FabricPortsOrch::doTask(swss::SelectableTimer &timer)
Expand Down Expand Up @@ -1384,6 +1499,7 @@ void FabricPortsOrch::doTask(swss::SelectableTimer &timer)

if (m_getFabricPortListDone)
{
SWSS_LOG_INFO("Fabric monitor enabled");
updateFabricDebugCounters();
updateFabricCapacity();
updateFabricRate();
Expand Down
1 change: 1 addition & 0 deletions orchagent/fabricportsorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class FabricPortsOrch : public Orch, public Subject
void updateFabricPortState();
void updateFabricDebugCounters();
void updateFabricCapacity();
bool checkFabricPortMonState();
void updateFabricRate();

void doTask() override;
Expand Down
52 changes: 49 additions & 3 deletions orchagent/intfsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ void IntfsOrch::doTask(Consumer &consumer)
bool mpls = false;
string vlan = "";
string loopbackAction = "";

string oper_status ="";
for (auto idx : data)
{
const auto &field = fvField(idx);
Expand Down Expand Up @@ -807,6 +807,10 @@ void IntfsOrch::doTask(Consumer &consumer)
{
loopbackAction = value;
}
else if (field == "oper_status")
{
oper_status = value;
}
}

if (alias == "eth0" || alias == "docker0")
Expand Down Expand Up @@ -860,7 +864,19 @@ void IntfsOrch::doTask(Consumer &consumer)
it = consumer.m_toSync.erase(it);
continue;
}

if(table_name == CHASSIS_APP_SYSTEM_INTERFACE_TABLE_NAME)
{
if(isRemoteSystemPortIntf(alias))
{
SWSS_LOG_INFO("Handle remote systemport intf %s, oper status %s", alias.c_str(), oper_status.c_str());
bool isUp = (oper_status == "up") ? true : false;
if (!gNeighOrch->ifChangeInformRemoteNextHop(alias, isUp))
{
SWSS_LOG_WARN("Unable to update the nexthop for port %s, oper status %s", alias.c_str(), oper_status.c_str());
}

}
}
//Voq Inband interface config processing
if(inband_type.size() && !ip_prefix_in_key)
{
Expand Down Expand Up @@ -1656,7 +1672,10 @@ void IntfsOrch::voqSyncAddIntf(string &alias)
return;
}

FieldValueTuple nullFv ("NULL", "NULL");

string oper_status = port.m_oper_status == SAI_PORT_OPER_STATUS_UP ? "up" : "down";

FieldValueTuple nullFv ("oper_status", oper_status);
vector<FieldValueTuple> attrs;
attrs.push_back(nullFv);

Expand Down Expand Up @@ -1696,3 +1715,30 @@ void IntfsOrch::voqSyncDelIntf(string &alias)
m_tableVoqSystemInterfaceTable->del(alias);
}

void IntfsOrch::voqSyncIntfState(string &alias, bool isUp)
{
Port port;
string port_alias;
if(gPortsOrch->getPort(alias, port))
{
if (port.m_type == Port::LAG)
{
if (port.m_system_lag_info.switch_id != gVoqMySwitchId)
{
return;
}
port_alias = port.m_system_lag_info.alias;
}
else
{
if(port.m_system_port_info.type == SAI_SYSTEM_PORT_TYPE_REMOTE)
{
return;
}
port_alias = port.m_system_port_info.alias;
}
SWSS_LOG_NOTICE("Syncing system interface state %s for port %s", isUp ? "up" : "down", port_alias.c_str());
m_tableVoqSystemInterfaceTable->hset(port_alias, "oper_status", isUp ? "up" : "down");
}

}

0 comments on commit 3a54c41

Please sign in to comment.