diff --git a/orchagent/flex_counter/flowcounterrouteorch.cpp b/orchagent/flex_counter/flowcounterrouteorch.cpp index 96c989182a..adcdf5fe4b 100644 --- a/orchagent/flex_counter/flowcounterrouteorch.cpp +++ b/orchagent/flex_counter/flowcounterrouteorch.cpp @@ -304,7 +304,7 @@ void FlowCounterRouteOrch::onAddMiscRouteEntry(sai_object_id_t vrf_id, const sai return; } - IpPrefix ip_prefix = copy(ip_pfx); + IpPrefix ip_prefix = convert(ip_pfx); onAddMiscRouteEntry(vrf_id, ip_prefix, add_to_cache); } @@ -350,7 +350,7 @@ void FlowCounterRouteOrch::onRemoveMiscRouteEntry(sai_object_id_t vrf_id, const return; } - IpPrefix ip_prefix = copy(ip_pfx); + IpPrefix ip_prefix = convert(ip_pfx); onRemoveMiscRouteEntry(vrf_id, ip_prefix, remove_from_cache); } diff --git a/orchagent/flex_counter/flowcounterrouteorch.h b/orchagent/flex_counter/flowcounterrouteorch.h index 5553d0a7ee..1ef0452d4a 100644 --- a/orchagent/flex_counter/flowcounterrouteorch.h +++ b/orchagent/flex_counter/flowcounterrouteorch.h @@ -10,6 +10,8 @@ #include #include +#define ROUTE_FLOW_COUNTER_FLEX_COUNTER_GROUP "ROUTE_FLOW_COUNTER" + struct RoutePattern { RoutePattern(const std::string& input_vrf_name, sai_object_id_t vrf, IpPrefix prefix, size_t max_match_count) diff --git a/orchagent/routeorch.h b/orchagent/routeorch.h index fd6fd0920e..68b0823a1b 100644 --- a/orchagent/routeorch.h +++ b/orchagent/routeorch.h @@ -16,9 +16,6 @@ #include "bulker.h" #include "fgnhgorch.h" #include -#include -#include -#include /* Maximum next hop group number */ #define NHGRP_MAX_SIZE 128 @@ -26,7 +23,6 @@ #define EUI64_INTF_ID_LEN 8 #define LOOPBACK_PREFIX "Loopback" -#define ROUTE_FLOW_COUNTER_FLEX_COUNTER_GROUP "ROUTE_FLOW_COUNTER" struct NextHopGroupMemberEntry { @@ -219,7 +215,6 @@ class RouteOrch : public Orch, public Subject unsigned int getNhgCount() { return m_nextHopGroupCount; } unsigned int getMaxNhgCount() { return m_maxNextHopGroupCount; } - void increaseNextHopGroupCount(); void decreaseNextHopGroupCount(); bool checkNextHopGroupCount(); diff --git a/orchagent/swssnet.h b/orchagent/swssnet.h index 58c737a2e4..85de208455 100644 --- a/orchagent/swssnet.h +++ b/orchagent/swssnet.h @@ -106,7 +106,7 @@ static int getPrefixLenFromAddr(const uint8_t *addr, int len) } -inline static IpPrefix copy(const sai_ip_prefix_t& src) +inline static IpPrefix convert(const sai_ip_prefix_t& src) { ip_addr_t ip; switch(src.addr_family) diff --git a/tests/mock_tests/swssnet_ut.cpp b/tests/mock_tests/swssnet_ut.cpp index 9f5b571b16..8b0c03d4d7 100644 --- a/tests/mock_tests/swssnet_ut.cpp +++ b/tests/mock_tests/swssnet_ut.cpp @@ -8,32 +8,32 @@ namespace swssnet_test SwssNetTest() {} }; - TEST_F(SwssNetTest, CopySAIPrefixToSONiCPrefix) + TEST_F(SwssNetTest, CovertSAIPrefixToSONiCPrefix) { IpPrefix ip_prefix("1.2.3.4/24"); sai_ip_prefix_t sai_prefix; swss::copy(sai_prefix, ip_prefix); - IpPrefix ip_prefix_copied = swss::copy(sai_prefix); + IpPrefix ip_prefix_copied = swss::convert(sai_prefix); ASSERT_EQ("1.2.3.4/24", ip_prefix_copied.to_string()); IpPrefix ip_prefix1("1.2.3.4/32"); swss::copy(sai_prefix, ip_prefix1); - ip_prefix_copied = swss::copy(sai_prefix); + ip_prefix_copied = swss::convert(sai_prefix); ASSERT_EQ("1.2.3.4/32", ip_prefix_copied.to_string()); IpPrefix ip_prefix2("0.0.0.0/0"); swss::copy(sai_prefix, ip_prefix2); - ip_prefix_copied = swss::copy(sai_prefix); + ip_prefix_copied = swss::convert(sai_prefix); ASSERT_EQ("0.0.0.0/0", ip_prefix_copied.to_string()); IpPrefix ip_prefix3("2000::1/128"); swss::copy(sai_prefix, ip_prefix3); - ip_prefix_copied = swss::copy(sai_prefix); + ip_prefix_copied = swss::convert(sai_prefix); ASSERT_EQ("2000::1/128", ip_prefix_copied.to_string()); IpPrefix ip_prefix4("::/0"); swss::copy(sai_prefix, ip_prefix4); - ip_prefix_copied = swss::copy(sai_prefix); + ip_prefix_copied = swss::convert(sai_prefix); ASSERT_EQ("::/0", ip_prefix_copied.to_string()); } }