Skip to content

Commit 047638f

Browse files
shi-suShi Su
authored andcommitted
[vnetorch] Add ECMP support for vnet tunnel routes (sonic-net#1960)
What I did Add functions to create/remove next hop groups for vnet tunnel routes. Count the reference count of next hop groups to create and remove as needed. Share the counter of next hop groups with routeorch. Add vs test Why I did it To add support for overlay ECMP. How I verified it Verify ECMP groups are properly created and removed with the functions. Verify vs test passes
1 parent 9008a01 commit 047638f

6 files changed

Lines changed: 639 additions & 59 deletions

File tree

orchagent/nexthopkey.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ struct NextHopKey
6868
mac_address = keys[3];
6969
}
7070

71+
NextHopKey(const IpAddress &ip, const MacAddress &mac, const uint32_t &vni, bool overlay_nh) : ip_address(ip), alias(""), vni(vni), mac_address(mac){}
72+
7173
const std::string to_string() const
7274
{
7375
return ip_address.to_string() + NH_DELIMITER + alias;

orchagent/routeorch.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2186,3 +2186,17 @@ bool RouteOrch::removeOverlayNextHops(sai_object_id_t vrf_id, const NextHopGroup
21862186
return true;
21872187
}
21882188

2189+
void RouteOrch::increaseNextHopGroupCount()
2190+
{
2191+
m_nextHopGroupCount ++;
2192+
}
2193+
2194+
void RouteOrch::decreaseNextHopGroupCount()
2195+
{
2196+
m_nextHopGroupCount --;
2197+
}
2198+
2199+
bool RouteOrch::checkNextHopGroupCount()
2200+
{
2201+
return m_nextHopGroupCount < m_maxNextHopGroupCount;
2202+
}

orchagent/routeorch.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,10 @@ class RouteOrch : public Orch, public Subject
137137
bool createFineGrainedNextHopGroup(sai_object_id_t &next_hop_group_id, vector<sai_attribute_t> &nhg_attrs);
138138
bool removeFineGrainedNextHopGroup(sai_object_id_t &next_hop_group_id);
139139

140+
void increaseNextHopGroupCount();
141+
void decreaseNextHopGroupCount();
142+
bool checkNextHopGroupCount();
143+
140144
private:
141145
SwitchOrch *m_switchOrch;
142146
NeighOrch *m_neighOrch;

0 commit comments

Comments
 (0)