Skip to content

Commit

Permalink
[mirrororch]: Enable mirror session destination to point into VLAN (s…
Browse files Browse the repository at this point in the history
…onic-net#595)

* [mirrororch]: Enable mirror session destination to point into VLAN

- Add FdbUpdate notification when manually inserting/removing FDB
  entries

- Refactor MirrorOrch so that it supports:
  1. create mirror session pointing to VLAN
  2. destination port move to VLAN/non-VALN
  3. destination port move to LAG
  Remove unnecessary variables in MirrorEntry

- Add destination IP to the NextHopUpdate message

- Add subnset routes for route observers

Signed-off-by: Shu0T1an ChenG <shuche@microsoft.com>

* [MirrorOrch]: Update comments and fix updateSessionType function issue

* [test]: Update test_mirror.py
  • Loading branch information
Shuotian Cheng authored Sep 6, 2018
1 parent 29722e1 commit cbc5a05
Show file tree
Hide file tree
Showing 9 changed files with 1,094 additions and 456 deletions.
15 changes: 15 additions & 0 deletions orchagent/fdborch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,12 @@ bool FdbOrch::addFdbEntry(const FdbEntry& entry, const string& port_name, const

gCrmOrch->incCrmResUsedCounter(CrmResourceType::CRM_FDB_ENTRY);

FdbUpdate update = {entry, port, true};
for (auto observer: m_observers)
{
observer->update(SUBJECT_TYPE_FDB_CHANGE, &update);
}

return true;
}

Expand Down Expand Up @@ -485,5 +491,14 @@ bool FdbOrch::removeFdbEntry(const FdbEntry& entry)

gCrmOrch->decCrmResUsedCounter(CrmResourceType::CRM_FDB_ENTRY);

Port port;
m_portsOrch->getPortByBridgePortId(entry.bv_id, port);

FdbUpdate update = {entry, port, false};
for (auto observer: m_observers)
{
observer->update(SUBJECT_TYPE_FDB_CHANGE, &update);
}

return true;
}
23 changes: 23 additions & 0 deletions orchagent/intfsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "logger.h"
#include "swssnet.h"
#include "tokenize.h"
#include "routeorch.h"
#include "crmorch.h"
#include "bufferorch.h"

Expand All @@ -20,6 +21,7 @@ extern sai_neighbor_api_t* sai_neighbor_api;

extern sai_object_id_t gSwitchId;
extern PortsOrch *gPortsOrch;
extern RouteOrch *gRouteOrch;
extern CrmOrch *gCrmOrch;
extern BufferOrch *gBufferOrch;

Expand Down Expand Up @@ -78,6 +80,23 @@ bool IntfsOrch::setRouterIntfsMtu(Port &port)
return true;
}

set<IpPrefix> IntfsOrch:: getSubnetRoutes()
{
SWSS_LOG_ENTER();

set<IpPrefix> subnet_routes;

for (auto it = m_syncdIntfses.begin(); it != m_syncdIntfses.end(); it++)
{
for (auto prefix : it->second.ip_addresses)
{
subnet_routes.emplace(prefix);
}
}

return subnet_routes;
}

void IntfsOrch::doTask(Consumer &consumer)
{
SWSS_LOG_ENTER();
Expand Down Expand Up @@ -386,6 +405,8 @@ void IntfsOrch::addSubnetRoute(const Port &port, const IpPrefix &ip_prefix)
{
gCrmOrch->incCrmResUsedCounter(CrmResourceType::CRM_IPV6_ROUTE);
}

gRouteOrch->notifyNextHopChangeObservers(ip_prefix, IpAddresses(), true);
}

void IntfsOrch::removeSubnetRoute(const Port &port, const IpPrefix &ip_prefix)
Expand Down Expand Up @@ -416,6 +437,8 @@ void IntfsOrch::removeSubnetRoute(const Port &port, const IpPrefix &ip_prefix)
{
gCrmOrch->decCrmResUsedCounter(CrmResourceType::CRM_IPV6_ROUTE);
}

gRouteOrch->notifyNextHopChangeObservers(ip_prefix, IpAddresses(), false);
}

void IntfsOrch::addIp2MeRoute(const IpPrefix &ip_prefix)
Expand Down
1 change: 1 addition & 0 deletions orchagent/intfsorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class IntfsOrch : public Orch
void decreaseRouterIntfsRefCount(const string&);

bool setRouterIntfsMtu(Port &port);
std::set<IpPrefix> getSubnetRoutes();
private:
IntfsTable m_syncdIntfses;
void doTask(Consumer &consumer);
Expand Down
Loading

0 comments on commit cbc5a05

Please sign in to comment.