Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sonic-swss]: Added flap counter and last flap time functionality. #928

Open
wants to merge 49 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
fe3b4fc
Added flap counter, last flap time and clear the flap count feature
prprakas Jun 12, 2019
4e0d0a1
Changes in sonic-swss submodule to support NAT feature.
AkhileshSamineni Sep 18, 2019
29bb539
Added neighsync changes to support warm reboot for NAT.
AkhileshSamineni Sep 23, 2019
b53c888
Loopback related changes for NAT.
AkhileshSamineni Oct 14, 2019
fd733b8
Removed the Orchagent and Natsyncd related files as those are covered…
AkhileshSamineni Nov 11, 2019
5b09c41
Removed pytest related files and added those to PR #1125
AkhileshSamineni Nov 13, 2019
904e80b
Corrected Makefile.am change.
AkhileshSamineni Nov 13, 2019
d750132
Fix for string compilation issue
AkhileshSamineni Nov 13, 2019
ae6eb80
Compilation fix to pick proper ACL Table name - CFG_ACL_TABLE_TABLE_NAME
AkhileshSamineni Nov 13, 2019
ed405bf
Addressed review comments
AkhileshSamineni Nov 20, 2019
4028803
Added missed check
AkhileshSamineni Nov 20, 2019
3fcfea3
Fix in cleanup.
AkhileshSamineni Nov 21, 2019
2086ad2
Fixed compilation issue after forced push.
AkhileshSamineni Dec 10, 2019
72750ac
Natsyncd changes in sonic-swss submodule to support NAT feature.
AkhileshSamineni Nov 11, 2019
e4b7724
Addressed Review comments
AkhileshSamineni Nov 15, 2019
3ca530c
Addressed review comments
AkhileshSamineni Nov 20, 2019
88fe411
Orchagent changes in sonic-swss submodule to support NAT feature.
AkhileshSamineni Nov 11, 2019
e8b9dab
Added aclorch changes for "do_not_nat" action.
AkhileshSamineni Nov 12, 2019
f59ec87
Fixed compilation issue.
AkhileshSamineni Nov 15, 2019
8246acb
Removed debug framework change to avoid compilation error
AkhileshSamineni Nov 15, 2019
346f59a
Addressed review comments.
AkhileshSamineni Nov 21, 2019
ff2c78c
Added changes to verify the NAT is supported before setting nat zone.
AkhileshSamineni Nov 21, 2019
3d2b900
Addressed review comments and added 'nat miss' traps in copp json.
AkhileshSamineni Nov 23, 2019
946e53d
Fixed compilation issue.
AkhileshSamineni Nov 24, 2019
f9a8302
Addressed review comments.
AkhileshSamineni Nov 27, 2019
63ebb3a
Added platform changes to avoid nexthop traching in OA.
AkhileshSamineni Dec 9, 2019
3350b85
Added pytest testcases for NAT.
AkhileshSamineni Dec 9, 2019
286ca21
Fixed compilation issue.
AkhileshSamineni Dec 10, 2019
982abd6
Fixed compilation issue after forced push.
AkhileshSamineni Dec 10, 2019
5ad47af
Merge branch 'master' into natorch_changes_in_sonic
AkhileshSamineni Dec 21, 2019
85036df
Merge pull request #1059 from AkhileshSamineni/nat_changes_in_sonic
rlhui Jan 16, 2020
f24081b
[AclOrch] add validation for check CRM (#1082)
chaoskao Jan 17, 2020
d507a93
[aclorch] Validate that provided IN/OUT_PORTS are physical interfaces…
daall Jan 17, 2020
419d9d2
Fix bug: shellquote the inner string (#1168)
qiluo-msft Jan 17, 2020
bbd77fc
Merge pull request #1126 from AkhileshSamineni/natsyncd_changes_in_sonic
rlhui Jan 19, 2020
ea8b1da
Merge pull request #1125 from AkhileshSamineni/natorch_changes_in_sonic
rlhui Jan 19, 2020
698ca2a
[portsorch] Refactor portsorch to use FlexCounterManager to setup por…
daall Jan 21, 2020
10f091d
[vs tests] Disable NAT tests to unblock Jenkins (#1179)
daall Jan 23, 2020
51315c1
[debugcounterorch] Add checks for supported counter types and drop re…
daall Jan 26, 2020
3732e74
[cfgmgr] clear loopback and vrf in kernel if not warmstart (#1141)
Jan 26, 2020
b453797
[Teamdmgrd]Fix "teamd cannot start when port channel was down before …
shine4chen Jan 27, 2020
97a22ca
[vs tests] Mark VLAN and warm reboot tests as xfail (#1183)
daall Jan 27, 2020
97abec5
[restore_neighbors.py] build arp packet with correct hwsrc and psrc (…
stepanblyschak Jan 28, 2020
faab3e1
remove the obsoleted platforms build links (#1169)
sujinmkang Jan 28, 2020
a35afac
[portsorch] use ingress/egress disable for LAG member enable/disable …
stepanblyschak Jan 28, 2020
9594de0
Enable MIRRORv6 for BFN platform (#1177)
msosyak Jan 28, 2020
4628a5a
[vs tests] Refactor fdb_update tests to be consistent with vs test su…
daall Jan 28, 2020
55b7a1b
[qosorch]: Remove Init Color ACLs (#1084)
zhenggen-xu Jan 28, 2020
24245c0
Merge branch 'master' into feature_1
lguohan Jan 28, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ cfgmgr/vlanmgrd
cfgmgr/vrfmgrd
cfgmgr/nbrmgrd
cfgmgr/vxlanmgrd
cfgmgr/natmgrd
neighsyncd/neighsyncd
portsyncd/portsyncd
natsyncd/natsyncd
orchagent/orchagent
orchagent/routeresync
orchagent/orchagent_restart_check
Expand Down
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SUBDIRS = fpmsyncd neighsyncd portsyncd orchagent swssconfig cfgmgr tests
SUBDIRS = fpmsyncd neighsyncd portsyncd natsyncd orchagent swssconfig cfgmgr tests

if HAVE_LIBTEAM
SUBDIRS += teamsyncd
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
Broadcom[![Broadcom](https://sonic-jenkins.westus2.cloudapp.azure.com/job/broadcom/job/sonic-swss-build/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/broadcom/job/sonic-swss-build/)
Mellanox[![Mellanox](https://sonic-jenkins.westus2.cloudapp.azure.com/job/mellanox/job/sonic-swss-build/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/mellanox/job/sonic-swss-build/)
VS[![VS](https://sonic-jenkins.westus2.cloudapp.azure.com/job/vs/job/sonic-swss-build/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/vs/job/sonic-swss-build/)

# SONiC - SWitch State Service - SWSS
Expand Down
9 changes: 7 additions & 2 deletions cfgmgr/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
INCLUDES = -I $(top_srcdir) -I $(top_srcdir)/orchagent -I $(top_srcdir)/warmrestart
INCLUDES = -I $(top_srcdir) -I $(top_srcdir)/orchagent -I $(top_srcdir)/warmrestart -I $(top_srcdir)/orchagent/flex_counter
CFLAGS_SAI = -I /usr/include/sai
LIBNL_CFLAGS = -I/usr/include/libnl3
LIBNL_LIBS = -lnl-genl-3 -lnl-route-3 -lnl-3

bin_PROGRAMS = vlanmgrd teammgrd portmgrd intfmgrd buffermgrd vrfmgrd nbrmgrd vxlanmgrd sflowmgrd
bin_PROGRAMS = vlanmgrd teammgrd portmgrd intfmgrd buffermgrd vrfmgrd nbrmgrd vxlanmgrd sflowmgrd natmgrd

if DEBUG
DBGFLAGS = -ggdb -DDEBUG
Expand Down Expand Up @@ -55,3 +55,8 @@ sflowmgrd_SOURCES = sflowmgrd.cpp sflowmgr.cpp $(top_srcdir)/orchagent/orch.cpp
sflowmgrd_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
sflowmgrd_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
sflowmgrd_LDADD = -lswsscommon

natmgrd_SOURCES = natmgrd.cpp natmgr.cpp $(top_srcdir)/orchagent/orch.cpp $(top_srcdir)/orchagent/request_parser.cpp shellcmd.h
natmgrd_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
natmgrd_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
natmgrd_LDADD = -lswsscommon
42 changes: 42 additions & 0 deletions cfgmgr/intfmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "intfmgr.h"
#include "exec.h"
#include "shellcmd.h"
#include "warm_restart.h"

using namespace std;
using namespace swss;
Expand All @@ -29,6 +30,10 @@ IntfMgr::IntfMgr(DBConnector *cfgDb, DBConnector *appDb, DBConnector *stateDb, c
m_stateIntfTable(stateDb, STATE_INTERFACE_TABLE_NAME),
m_appIntfTableProducer(appDb, APP_INTF_TABLE_NAME)
{
if (!WarmStart::isWarmStart())
{
flushLoopbackIntfs();
}
}

void IntfMgr::setIntfIp(const string &alias, const string &opCmd,
Expand Down Expand Up @@ -107,6 +112,28 @@ void IntfMgr::delLoopbackIntf(const string &alias)
}
}

void IntfMgr::flushLoopbackIntfs()
{
stringstream cmd;
string res;

cmd << IP_CMD << " link show type dummy | grep -o '" << LOOPBACK_PREFIX << "[^:]*'";

int ret = swss::exec(cmd.str(), res);
if (ret)
{
SWSS_LOG_DEBUG("Command '%s' failed with rc %d", cmd.str().c_str(), ret);
return;
}

auto aliases = tokenize(res, '\n');
for (string &alias : aliases)
{
SWSS_LOG_NOTICE("Remove loopback device %s", alias.c_str());
delLoopbackIntf(alias);
}
}

int IntfMgr::getIntfIpCount(const string &alias)
{
stringstream cmd;
Expand Down Expand Up @@ -390,6 +417,7 @@ bool IntfMgr::doIntfGeneralTask(const vector<string>& keys,
string vrf_name = "";
string mtu = "";
string adminStatus = "";
string nat_zone = "";
for (auto idx : data)
{
const auto &field = fvField(idx);
Expand All @@ -404,6 +432,11 @@ bool IntfMgr::doIntfGeneralTask(const vector<string>& keys,
{
adminStatus = value;
}

if (field == "nat_zone")
{
nat_zone = value;
}
}

if (op == SET_COMMAND)
Expand Down Expand Up @@ -431,6 +464,15 @@ bool IntfMgr::doIntfGeneralTask(const vector<string>& keys,
{
addLoopbackIntf(alias);
}
else
{
/* Set nat zone */
if (!nat_zone.empty())
{
FieldValueTuple fvTuple("nat_zone", nat_zone);
data.push_back(fvTuple);
}
}

if (!vrf_name.empty())
{
Expand Down
1 change: 1 addition & 0 deletions cfgmgr/intfmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class IntfMgr : public Orch
int getIntfIpCount(const std::string &alias);
void addLoopbackIntf(const std::string &alias);
void delLoopbackIntf(const std::string &alias);
void flushLoopbackIntfs(void);

void addHostSubIntf(const std::string&intf, const std::string &subIntf, const std::string &vlan);
void setHostSubIntfMtu(const std::string &subIntf, const std::string &mtu);
Expand Down
4 changes: 4 additions & 0 deletions cfgmgr/intfmgrd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "intfmgr.h"
#include <fstream>
#include <iostream>
#include "warm_restart.h"

using namespace std;
using namespace swss;
Expand Down Expand Up @@ -52,6 +53,9 @@ int main(int argc, char **argv)
DBConnector appDb("APPL_DB", 0);
DBConnector stateDb("STATE_DB", 0);

WarmStart::initialize("intfmgrd", "swss");
WarmStart::checkWarmStart("intfmgrd", "swss");

IntfMgr intfmgr(&cfgDb, &appDb, &stateDb, cfg_intf_tables);

// TODO: add tables in stateDB which interface depends on to monitor list
Expand Down
Loading