Skip to content

Commit

Permalink
Merge pull request #1059 from AkhileshSamineni/nat_changes_in_sonic
Browse files Browse the repository at this point in the history
Natmgrd changes in sonic-swss sub module to support NAT feature.
  • Loading branch information
rlhui authored Jan 16, 2020
2 parents 1eac91e + 2086ad2 commit 85036df
Show file tree
Hide file tree
Showing 7 changed files with 7,951 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ cfgmgr/vlanmgrd
cfgmgr/vrfmgrd
cfgmgr/nbrmgrd
cfgmgr/vxlanmgrd
cfgmgr/natmgrd
neighsyncd/neighsyncd
portsyncd/portsyncd
orchagent/orchagent
Expand Down
7 changes: 6 additions & 1 deletion cfgmgr/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ 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
15 changes: 15 additions & 0 deletions cfgmgr/intfmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,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 +405,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 +437,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
Loading

0 comments on commit 85036df

Please sign in to comment.