Skip to content

Commit 6b23f19

Browse files
committed
Changes in swss-utilities submodule to support NAT feature. (sonic-net#645)
Signed-off-by: [email protected]
1 parent 5214a8d commit 6b23f19

File tree

12 files changed

+2514
-1
lines changed

12 files changed

+2514
-1
lines changed

clear/main.py

+25
Original file line numberDiff line numberDiff line change
@@ -380,5 +380,30 @@ def line(linenum):
380380
cmd = "consutil clear " + str(linenum)
381381
run_command(cmd)
382382

383+
#
384+
# 'nat' group ("clear nat ...")
385+
#
386+
387+
@cli.group(cls=AliasedGroup, default_if_no_args=False)
388+
def nat():
389+
"""Clear the nat info"""
390+
pass
391+
392+
# 'statistics' subcommand ("clear nat statistics")
393+
@nat.command()
394+
def statistics():
395+
""" Clear all NAT statistics """
396+
397+
cmd = "natclear -s"
398+
run_command(cmd)
399+
400+
# 'translations' subcommand ("clear nat translations")
401+
@nat.command()
402+
def translations():
403+
""" Clear all NAT translations """
404+
405+
cmd = "natclear -t"
406+
run_command(cmd)
407+
383408
if __name__ == '__main__':
384409
cli()

config/main.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import aaa
2121
import mlnx
22+
import nat
2223

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

@@ -404,6 +405,7 @@ def _stop_services():
404405
'pmon',
405406
'bgp',
406407
'hostcfgd',
408+
'nat'
407409
]
408410
if asic_type == 'mellanox' and 'pmon' in services_to_stop:
409411
services_to_stop.remove('pmon')
@@ -432,7 +434,8 @@ def _reset_failed_services():
432434
'snmp',
433435
'swss',
434436
'syncd',
435-
'teamd'
437+
'teamd',
438+
'nat'
436439
]
437440

438441
for service in services_to_reset:
@@ -455,6 +458,7 @@ def _restart_services():
455458
'pmon',
456459
'lldp',
457460
'hostcfgd',
461+
'nat',
458462
'sflow',
459463
]
460464
if asic_type == 'mellanox' and 'pmon' in services_to_restart:
@@ -487,6 +491,8 @@ def config():
487491
exit("Root privileges are required for this operation")
488492
config.add_command(aaa.aaa)
489493
config.add_command(aaa.tacacs)
494+
# === Add NAT Configuration ==========
495+
config.add_command(nat.nat)
490496

491497
@config.command()
492498
@click.option('-y', '--yes', is_flag=True, callback=_abort_if_false,

0 commit comments

Comments
 (0)