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

Changes in swss-utilities submodule to support NAT feature. #645

Merged
merged 11 commits into from
Jan 29, 2020
25 changes: 25 additions & 0 deletions clear/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,5 +374,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 @@ -17,6 +17,7 @@

import aaa
import mlnx
import nat

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

Expand Down Expand Up @@ -347,6 +348,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 @@ -375,7 +377,8 @@ def _reset_failed_services():
'snmp',
'swss',
'syncd',
'teamd'
'teamd',
'nat'
]

for service in services_to_reset:
Expand All @@ -398,6 +401,7 @@ def _restart_services():
'pmon',
'lldp',
'hostcfgd',
'nat'
]
if asic_type == 'mellanox' and 'pmon' in services_to_restart:
services_to_restart.remove('pmon')
Expand Down Expand Up @@ -429,6 +433,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