Skip to content

Commit f502c32

Browse files
authored
[vnetorch] Add ECMP support for vnet tunnel routes (#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 5f8ebfa commit f502c32

File tree

6 files changed

+640
-59
lines changed

6 files changed

+640
-59
lines changed

orchagent/nexthopkey.h

+2
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ struct NextHopKey
8282
weight = 0;
8383
}
8484

85+
NextHopKey(const IpAddress &ip, const MacAddress &mac, const uint32_t &vni, bool overlay_nh) : ip_address(ip), alias(""), vni(vni), mac_address(mac){}
86+
8587
const std::string to_string() const
8688
{
8789
std::string str = formatMplsNextHop();

orchagent/routeorch.cpp

+15
Original file line numberDiff line numberDiff line change
@@ -2335,3 +2335,18 @@ bool RouteOrch::removeOverlayNextHops(sai_object_id_t vrf_id, const NextHopGroup
23352335

23362336
return true;
23372337
}
2338+
2339+
void RouteOrch::increaseNextHopGroupCount()
2340+
{
2341+
m_nextHopGroupCount ++;
2342+
}
2343+
2344+
void RouteOrch::decreaseNextHopGroupCount()
2345+
{
2346+
m_nextHopGroupCount --;
2347+
}
2348+
2349+
bool RouteOrch::checkNextHopGroupCount()
2350+
{
2351+
return m_nextHopGroupCount < m_maxNextHopGroupCount;
2352+
}

orchagent/routeorch.h

+4
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,10 @@ class RouteOrch : public Orch, public Subject
205205

206206
unsigned int getNhgCount() { return m_nextHopGroupCount; }
207207
unsigned int getMaxNhgCount() { return m_maxNextHopGroupCount; }
208+
209+
void increaseNextHopGroupCount();
210+
void decreaseNextHopGroupCount();
211+
bool checkNextHopGroupCount();
208212

209213
private:
210214
SwitchOrch *m_switchOrch;

0 commit comments

Comments
 (0)