Skip to content

Commit f5c6fd2

Browse files
authored
Merge branch 'master' into srv6_pt_midpoint
2 parents 6cc0bae + 1ff6160 commit f5c6fd2

File tree

3 files changed

+21
-23
lines changed

3 files changed

+21
-23
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ jobs:
107107
# install packages for vs test
108108
sudo apt-get install -y net-tools bridge-utils vlan
109109
sudo apt-get install -y python3-pip
110-
sudo pip3 install pytest==4.6.2 attrs==19.1.0 exabgp==4.0.10 distro==1.5.0 docker>=4.4.1 redis==3.3.4 flaky==3.7.0
110+
sudo pip3 install pytest==4.6.2 attrs==19.1.0 exabgp==4.0.10 distro==1.5.0 docker>=4.4.1 redis==3.3.4 flaky==3.7.0 requests==2.31.0
111111
sudo pip3 install lcov_cobertura
112112
displayName: "Install dependencies"
113113

orchagent/portsorch.cpp

+19-21
Original file line numberDiff line numberDiff line change
@@ -1641,7 +1641,7 @@ void PortsOrch::initHostTxReadyState(Port &port)
16411641

16421642
if (hostTxReady.empty())
16431643
{
1644-
setHostTxReady(port.m_port_id, "false");
1644+
setHostTxReady(port, "false");
16451645
SWSS_LOG_NOTICE("initialize host_tx_ready as false for port %s",
16461646
port.m_alias.c_str());
16471647
}
@@ -1661,7 +1661,7 @@ bool PortsOrch::setPortAdminStatus(Port &port, bool state)
16611661
/* Update the host_tx_ready to false before setting admin_state, when admin state is false */
16621662
if (!state && !m_cmisModuleAsicSyncSupported)
16631663
{
1664-
setHostTxReady(port.m_port_id, "false");
1664+
setHostTxReady(port, "false");
16651665
SWSS_LOG_NOTICE("Set admin status DOWN host_tx_ready to false for port %s",
16661666
port.m_alias.c_str());
16671667
}
@@ -1675,7 +1675,7 @@ bool PortsOrch::setPortAdminStatus(Port &port, bool state)
16751675

16761676
if (!m_cmisModuleAsicSyncSupported)
16771677
{
1678-
setHostTxReady(port.m_port_id, "false");
1678+
setHostTxReady(port, "false");
16791679
}
16801680
task_process_status handle_status = handleSaiSetStatus(SAI_API_PORT, status);
16811681
if (handle_status != task_success)
@@ -1687,34 +1687,26 @@ bool PortsOrch::setPortAdminStatus(Port &port, bool state)
16871687
bool gbstatus = setGearboxPortsAttr(port, SAI_PORT_ATTR_ADMIN_STATE, &state);
16881688
if (gbstatus != true && !m_cmisModuleAsicSyncSupported)
16891689
{
1690-
setHostTxReady(port.m_port_id, "false");
1690+
setHostTxReady(port, "false");
16911691
SWSS_LOG_NOTICE("Set host_tx_ready to false as gbstatus is false "
16921692
"for port %s", port.m_alias.c_str());
16931693
}
16941694

16951695
/* Update the state table for host_tx_ready*/
16961696
if (state && (gbstatus == true) && (status == SAI_STATUS_SUCCESS) && !m_cmisModuleAsicSyncSupported)
16971697
{
1698-
setHostTxReady(port.m_port_id, "true");
1698+
setHostTxReady(port, "true");
16991699
SWSS_LOG_NOTICE("Set admin status UP host_tx_ready to true for port %s",
17001700
port.m_alias.c_str());
17011701
}
17021702

17031703
return true;
17041704
}
17051705

1706-
void PortsOrch::setHostTxReady(sai_object_id_t portId, const std::string &status)
1706+
void PortsOrch::setHostTxReady(Port port, const std::string &status)
17071707
{
1708-
Port p;
1709-
1710-
if (!getPort(portId, p))
1711-
{
1712-
SWSS_LOG_ERROR("Failed to get port object for port id 0x%" PRIx64, portId);
1713-
return;
1714-
}
1715-
1716-
SWSS_LOG_NOTICE("Setting host_tx_ready status = %s, alias = %s, port_id = 0x%" PRIx64, status.c_str(), p.m_alias.c_str(), portId);
1717-
m_portStateTable.hset(p.m_alias, "host_tx_ready", status);
1708+
SWSS_LOG_NOTICE("Setting host_tx_ready status = %s, alias = %s, port_id = 0x%" PRIx64, status.c_str(), port.m_alias.c_str(), port.m_port_id);
1709+
m_portStateTable.hset(port.m_alias, "host_tx_ready", status);
17181710
}
17191711

17201712
bool PortsOrch::getPortAdminStatus(sai_object_id_t id, bool &up)
@@ -3287,7 +3279,7 @@ void PortsOrch::updateDbPortFlapCount(Port& port, sai_port_oper_status_t pstatus
32873279
vector<FieldValueTuple> tuples;
32883280
FieldValueTuple tuple("flap_count", std::to_string(port.m_flap_count));
32893281
tuples.push_back(tuple);
3290-
3282+
32913283
auto now = std::chrono::system_clock::now();
32923284
std::time_t now_c = std::chrono::system_clock::to_time_t(now);
32933285
if (pstatus == SAI_PORT_OPER_STATUS_DOWN)
@@ -3297,8 +3289,8 @@ void PortsOrch::updateDbPortFlapCount(Port& port, sai_port_oper_status_t pstatus
32973289
std::strftime(buffer, sizeof(buffer), "%a %b %d %H:%M:%S %Y", std::gmtime(&now_c));
32983290
FieldValueTuple tuple("last_down_time", buffer);
32993291
tuples.push_back(tuple);
3300-
}
3301-
else if (pstatus == SAI_PORT_OPER_STATUS_UP)
3292+
}
3293+
else if (pstatus == SAI_PORT_OPER_STATUS_UP)
33023294
{
33033295
char buffer[32];
33043296
// Format: Www Mmm dd hh:mm:ss yyyy
@@ -5765,7 +5757,7 @@ bool PortsOrch::initializePort(Port &port)
57655757
string hostTxReadyStr = hostTxReadyVal ? "true" : "false";
57665758

57675759
SWSS_LOG_DEBUG("Received host_tx_ready current status: port_id: 0x%" PRIx64 " status: %s", port.m_port_id, hostTxReadyStr.c_str());
5768-
setHostTxReady(port.m_port_id, hostTxReadyStr);
5760+
setHostTxReady(port, hostTxReadyStr);
57695761
}
57705762

57715763
/*
@@ -7944,7 +7936,13 @@ void PortsOrch::doTask(NotificationConsumer &consumer)
79447936
sai_deserialize_port_host_tx_ready_ntf(data, switch_id, port_id, host_tx_ready_status);
79457937
SWSS_LOG_DEBUG("Recieved host_tx_ready notification for port 0x%" PRIx64, port_id);
79467938

7947-
setHostTxReady(port_id, host_tx_ready_status == SAI_PORT_HOST_TX_READY_STATUS_READY ? "true" : "false");
7939+
Port p;
7940+
if (!getPort(port_id, p))
7941+
{
7942+
SWSS_LOG_ERROR("Failed to get port object for port id 0x%" PRIx64, port_id);
7943+
return;
7944+
}
7945+
setHostTxReady(p, host_tx_ready_status == SAI_PORT_HOST_TX_READY_STATUS_READY ? "true" : "false");
79487946
}
79497947

79507948
}

orchagent/portsorch.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ class PortsOrch : public Orch, public Subject
413413

414414
bool setSaiHostTxSignal(const Port &port, bool enable);
415415

416-
void setHostTxReady(sai_object_id_t portId, const std::string &status);
416+
void setHostTxReady(Port port, const std::string &status);
417417
// Get supported speeds on system side
418418
bool isSpeedSupported(const std::string& alias, sai_object_id_t port_id, sai_uint32_t speed);
419419
void getPortSupportedSpeeds(const std::string& alias, sai_object_id_t port_id, PortSupportedSpeeds &supported_speeds);

0 commit comments

Comments
 (0)