Drop pycodestyle for code style checking in favor of black. Black is much faster, stable PEP8 compliant code style checker offering also automatic formatting. It aims to be very stable and produce smallest diffs. It's used by many small and big projects. Running checkstyle with black takes a few seconds with a terse output. Thus, test-checkstyle-diff is no longer necessary. Expand scope of checkstyle to all python files in the repo, replacing test-checkstyle with checkstyle-python. Also, fixstyle-python is now available for automatic style formatting. Note: python virtualenv has been consolidated in test/Makefile, test/requirements*.txt which will eventually be moved to a central location. This is required to simply the automated generation of docker executor images in the CI. Type: improvement Change-Id: I022a326603485f58585e879ac0f697fceefbc9c8 Signed-off-by: Klement Sekera <klement.sekera@gmail.com> Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
26 lines
1.1 KiB
Python
Executable File
26 lines
1.1 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
import ipaddress
|
|
import argparse
|
|
|
|
parser = argparse.ArgumentParser(description="Generate NAT plugin config.")
|
|
parser.add_argument(
|
|
"static_map_num", metavar="N", type=int, nargs=1, help="number of static mappings"
|
|
)
|
|
args = parser.parse_args()
|
|
|
|
file_name = "nat_static_%s" % (args.static_map_num[0])
|
|
outfile = open(file_name, "w")
|
|
|
|
outfile.write("set int ip address TenGigabitEthernet4/0/0 172.16.2.1/24\n")
|
|
outfile.write("set int ip address TenGigabitEthernet4/0/1 173.16.1.1/24\n")
|
|
outfile.write("set int state TenGigabitEthernet4/0/0 up\n")
|
|
outfile.write("set int state TenGigabitEthernet4/0/1 up\n")
|
|
outfile.write("ip route add 2.2.0.0/16 via 173.16.1.2 TenGigabitEthernet4/0/1\n")
|
|
outfile.write("ip route add 10.0.0.0/24 via 172.16.2.2 TenGigabitEthernet4/0/0\n")
|
|
outfile.write("set int nat44 in TenGigabitEthernet4/0/0 out TenGigabitEthernet4/0/1\n")
|
|
|
|
for i in range(0, args.static_map_num[0]):
|
|
local = str(ipaddress.IPv4Address("10.0.0.3") + i)
|
|
external = str(ipaddress.IPv4Address("173.16.1.3") + i)
|
|
outfile.write("nat44 add static mapping local %s external %s\n" % (local, external))
|