From 72516235b180728389ed3b9bb9e18e9c67c5a283 Mon Sep 17 00:00:00 2001 From: Nazarii Hnydyn Date: Thu, 10 Aug 2023 16:48:42 +0300 Subject: [PATCH] [ppi]: General code cleanup: remove unused methods. (#2867) - What I did Removed unused code - Why I did it To complete code cleanup - How I verified it UT tests VS tests Signed-off-by: Nazarii Hnydyn --- orchagent/p4orch/tests/fake_portorch.cpp | 5 -- orchagent/portsorch.cpp | 68 ------------------------ orchagent/portsorch.h | 1 - 3 files changed, 74 deletions(-) diff --git a/orchagent/p4orch/tests/fake_portorch.cpp b/orchagent/p4orch/tests/fake_portorch.cpp index 93b654c5e7..14138ea8d6 100644 --- a/orchagent/p4orch/tests/fake_portorch.cpp +++ b/orchagent/p4orch/tests/fake_portorch.cpp @@ -493,11 +493,6 @@ bool PortsOrch::setDistributionOnLagMember(Port &lagMember, bool enableDistribut return true; } -bool PortsOrch::addPort(const PortConfig &port) -{ - return true; -} - sai_status_t PortsOrch::removePort(sai_object_id_t port_id) { return SAI_STATUS_SUCCESS; diff --git a/orchagent/portsorch.cpp b/orchagent/portsorch.cpp index c6919a20e8..3b1e2b557f 100755 --- a/orchagent/portsorch.cpp +++ b/orchagent/portsorch.cpp @@ -2917,74 +2917,6 @@ void PortsOrch::updateDbPortOperStatus(const Port& port, sai_port_oper_status_t m_portTable->set(port.m_alias, tuples); } -bool PortsOrch::addPort(const PortConfig &port) -{ - SWSS_LOG_ENTER(); - - if (!port.speed.is_set || !port.lanes.is_set) - { - /* - speed and lane list are mandatory attributes for the initial create_port call - This check is required because the incoming notifs may not be atomic - */ - return true; - } - - vector lanes(port.lanes.value.begin(), port.lanes.value.end()); - - sai_attribute_t attr; - vector attrs; - - attr.id = SAI_PORT_ATTR_SPEED; - attr.value.u32 = port.speed.value; - attrs.push_back(attr); - - attr.id = SAI_PORT_ATTR_HW_LANE_LIST; - attr.value.u32list.list = lanes.data(); - attr.value.u32list.count = static_cast(lanes.size()); - attrs.push_back(attr); - - if (port.autoneg.is_set) - { - attr.id = SAI_PORT_ATTR_AUTO_NEG_MODE; - attr.value.booldata = port.autoneg.value; - attrs.push_back(attr); - } - - if (port.fec.is_set) - { - attr.id = SAI_PORT_ATTR_FEC_MODE; - attr.value.s32 = port.fec.value; - attrs.push_back(attr); - } - - sai_object_id_t port_id; - sai_status_t status = sai_port_api->create_port(&port_id, gSwitchId, static_cast(attrs.size()), attrs.data()); - if (status != SAI_STATUS_SUCCESS) - { - SWSS_LOG_ERROR("Failed to create port with the speed %u, rv:%d", port.speed.value, status); - task_process_status handle_status = handleSaiCreateStatus(SAI_API_PORT, status); - if (handle_status != task_success) - { - return parseHandleSaiStatusFailure(handle_status); - } - } - - m_portListLaneMap[port.lanes.value] = port_id; - m_portCount++; - - // newly created ports might be put in the default vlan so remove all ports from - // the default vlan. - if (gMySwitchType == "voq") { - removeDefaultVlanMembers(); - removeDefaultBridgePorts(); - } - - SWSS_LOG_NOTICE("Create port %" PRIx64 " with the speed %u", port_id, port.speed.value); - - return true; -} - sai_status_t PortsOrch::removePort(sai_object_id_t port_id) { SWSS_LOG_ENTER(); diff --git a/orchagent/portsorch.h b/orchagent/portsorch.h index 5c5800a654..00246bff3d 100755 --- a/orchagent/portsorch.h +++ b/orchagent/portsorch.h @@ -364,7 +364,6 @@ class PortsOrch : public Orch, public Subject bool setCollectionOnLagMember(Port &lagMember, bool enableCollection); bool setDistributionOnLagMember(Port &lagMember, bool enableDistribution); - bool addPort(const PortConfig &port); sai_status_t removePort(sai_object_id_t port_id); bool initPort(const PortConfig &port); void deInitPort(string alias, sai_object_id_t port_id);