Skip to content

Commit 6ff9ebe

Browse files
authored
Merge branch 'master' into state_activated_rq
2 parents f08baaa + a0bd39e commit 6ff9ebe

File tree

4 files changed

+77
-4
lines changed

4 files changed

+77
-4
lines changed

.azure-pipelines/test-docker-sonic-vs-template.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ jobs:
4444
- job:
4545
displayName: vstest
4646
timeoutInMinutes: ${{ parameters.timeout }}
47-
${{ if parameters.archive_gcov }}:
48-
variables:
47+
variables:
48+
isAsan: ${{ parameters.asan }}
49+
${{ if parameters.archive_gcov }}:
4950
DIFF_COVER_CHECK_THRESHOLD: 80
5051
DIFF_COVER_ENABLE: 'true'
5152
DIFF_COVER_COVERAGE_FILES: Cobertura.xml
@@ -159,6 +160,11 @@ jobs:
159160
displayName: "Run vs tests"
160161
continueOnError: ${{ parameters.asan }}
161162
163+
- script: |
164+
echo "##vso[task.setvariable variable=TestsRun]Yes"
165+
condition: succeededOrFailed()
166+
displayName: 'Record Test Status'
167+
162168
- script: |
163169
set -ex
164170
reportgenerator -reporttypes:Cobertura -reports:tests/*coverage.xml -targetdir:.
@@ -179,7 +185,7 @@ jobs:
179185
inputs:
180186
testResultsFiles: '**/*_tr.xml'
181187
testRunTitle: vstest
182-
condition: succeeded()
188+
condition: and(eq(variables['TestsRun'], 'Yes'), ne(variables['isAsan'], 'true'))
183189

184190
- script: |
185191
cp -r tests/log $(Build.ArtifactStagingDirectory)/

orchagent/neighorch.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ extern string gMySwitchType;
2323
extern int32_t gVoqMySwitchId;
2424
extern BfdOrch *gBfdOrch;
2525
extern size_t gMaxBulkSize;
26+
extern string gMyHostName;
2627

2728
const int neighorch_pri = 30;
2829

@@ -1839,7 +1840,9 @@ void NeighOrch::doVoqSystemNeighTask(Consumer &consumer)
18391840

18401841
string alias = key.substr(0, found);
18411842

1842-
if(gIntfsOrch->isLocalSystemPortIntf(alias))
1843+
size_t pos = alias.find('|');
1844+
std::string port_hostname = (pos != std::string::npos) ? alias.substr(0, pos) : alias;
1845+
if(gIntfsOrch->isLocalSystemPortIntf(alias) || (gMySwitchType == "voq" && gMyHostName == port_hostname))
18431846
{
18441847
//Synced local neighbor. Skip
18451848
it = consumer.m_toSync.erase(it);

orchagent/portsorch.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5703,6 +5703,16 @@ void PortsOrch::doLagMemberTask(Consumer &consumer)
57035703
Port lag, port;
57045704
if (!getPort(lag_alias, lag))
57055705
{
5706+
if (gMySwitchType == "voq")
5707+
{
5708+
size_t pos = lag_alias.find('|');
5709+
std::string port_hostname = (pos != std::string::npos) ? lag_alias.substr(0, pos) : lag_alias;
5710+
if (gMyHostName == port_hostname)
5711+
{
5712+
it = consumer.m_toSync.erase(it);
5713+
continue;
5714+
}
5715+
}
57065716
SWSS_LOG_INFO("Failed to locate LAG %s", lag_alias.c_str());
57075717
it++;
57085718
continue;

tests/mock_tests/portsorch_ut.cpp

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3093,6 +3093,60 @@ namespace portsorch_test
30933093
ts.clear();
30943094
}
30953095

3096+
/* This test passes an incorrect LAG entry and verifies that this entry is not
3097+
* erased from the consumer table.
3098+
*/
3099+
TEST_F(PortsOrchTest, LagMemberCanNotBeLocated)
3100+
{
3101+
Table portTable = Table(m_app_db.get(), APP_PORT_TABLE_NAME);
3102+
Table lagTable = Table(m_app_db.get(), APP_LAG_TABLE_NAME);
3103+
Table lagMemberTable = Table(m_app_db.get(), APP_LAG_MEMBER_TABLE_NAME);
3104+
3105+
// Get SAI default ports to populate DB
3106+
auto ports = ut_helper::getInitialSaiPorts();
3107+
3108+
/*
3109+
* Next we will prepare some configuration data to be consumed by PortsOrch
3110+
* 32 Ports, 1 LAG, 1 port is an invalid LAG member.
3111+
*/
3112+
3113+
// Populate pot table with SAI ports
3114+
for (const auto &it : ports)
3115+
{
3116+
portTable.set(it.first, it.second);
3117+
}
3118+
3119+
// Set PortConfigDone
3120+
portTable.set("PortConfigDone", { { "count", to_string(ports.size()) } });
3121+
portTable.set("PortInitDone", { { } });
3122+
lagTable.set("PortChannel999",
3123+
{
3124+
{"admin_status", "up"},
3125+
{"mtu", "9100"}
3126+
}
3127+
);
3128+
3129+
// Add invalid lag member
3130+
lagMemberTable.set(
3131+
std::string("InvalidLagMember") + lagMemberTable.getTableNameSeparator() + ports.begin()->first,
3132+
{ {"status", "enabled"} });
3133+
3134+
// refill consumer
3135+
gPortsOrch->addExistingData(&portTable);
3136+
gPortsOrch->addExistingData(&lagTable);
3137+
gPortsOrch->addExistingData(&lagMemberTable);
3138+
3139+
static_cast<Orch *>(gPortsOrch)->doTask();
3140+
3141+
// verify there is a pending task to do.
3142+
vector<string> ts;
3143+
auto exec = gPortsOrch->getExecutor(APP_LAG_MEMBER_TABLE_NAME);
3144+
auto consumer = static_cast<Consumer*>(exec);
3145+
ts.clear();
3146+
consumer->dumpPendingTasks(ts);
3147+
ASSERT_FALSE(ts.empty());
3148+
}
3149+
30963150
/* This test checks that a LAG member validation happens on orchagent level
30973151
* and no SAI call is executed in case a port requested to be a LAG member
30983152
* is already a LAG member.

0 commit comments

Comments
 (0)