Skip to content

Commit

Permalink
Changes in swss-utilities submodule to support NAT feature. (#645)
Browse files Browse the repository at this point in the history
Signed-off-by: [email protected]
  • Loading branch information
lguohan committed Feb 3, 2020
1 parent 5214a8d commit 6b23f19
Show file tree
Hide file tree
Showing 12 changed files with 2,514 additions and 1 deletion.
25 changes: 25 additions & 0 deletions clear/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,5 +380,30 @@ def line(linenum):
cmd = "consutil clear " + str(linenum)
run_command(cmd)

#
# 'nat' group ("clear nat ...")
#

@cli.group(cls=AliasedGroup, default_if_no_args=False)
def nat():
"""Clear the nat info"""
pass

# 'statistics' subcommand ("clear nat statistics")
@nat.command()
def statistics():
""" Clear all NAT statistics """

cmd = "natclear -s"
run_command(cmd)

# 'translations' subcommand ("clear nat translations")
@nat.command()
def translations():
""" Clear all NAT translations """

cmd = "natclear -t"
run_command(cmd)

if __name__ == '__main__':
cli()
8 changes: 7 additions & 1 deletion config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import aaa
import mlnx
import nat

CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help', '-?'])

Expand Down Expand Up @@ -404,6 +405,7 @@ def _stop_services():
'pmon',
'bgp',
'hostcfgd',
'nat'
]
if asic_type == 'mellanox' and 'pmon' in services_to_stop:
services_to_stop.remove('pmon')
Expand Down Expand Up @@ -432,7 +434,8 @@ def _reset_failed_services():
'snmp',
'swss',
'syncd',
'teamd'
'teamd',
'nat'
]

for service in services_to_reset:
Expand All @@ -455,6 +458,7 @@ def _restart_services():
'pmon',
'lldp',
'hostcfgd',
'nat',
'sflow',
]
if asic_type == 'mellanox' and 'pmon' in services_to_restart:
Expand Down Expand Up @@ -487,6 +491,8 @@ def config():
exit("Root privileges are required for this operation")
config.add_command(aaa.aaa)
config.add_command(aaa.tacacs)
# === Add NAT Configuration ==========
config.add_command(nat.nat)

@config.command()
@click.option('-y', '--yes', is_flag=True, callback=_abort_if_false,
Expand Down
Loading

0 comments on commit 6b23f19

Please sign in to comment.