diff options
author | Matus Fabian <matfabia@cisco.com> | 2017-09-27 04:44:08 -0700 |
---|---|---|
committer | Dave Wallace <dwallacelf@gmail.com> | 2017-12-18 17:18:22 +0000 |
commit | e4d12836515765a6f7c6a2f67dbacbdef2975024 (patch) | |
tree | a8f5bcbd3c0b2df388f6a42103f87ccca2654fc1 /src/plugins/nat/extras/nat_static_gen_cfg.py | |
parent | ff9f040e630510b5254eafa0df35d7e6fb16ffc3 (diff) |
NAT: Add performance testing TRex scripts and config (VPP-832)
Change-Id: I149a20f183b836db4c32fb4e4a8438b3a14c1c26
Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'src/plugins/nat/extras/nat_static_gen_cfg.py')
-rwxr-xr-x | src/plugins/nat/extras/nat_static_gen_cfg.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/plugins/nat/extras/nat_static_gen_cfg.py b/src/plugins/nat/extras/nat_static_gen_cfg.py new file mode 100755 index 00000000000..ff6312aecf6 --- /dev/null +++ b/src/plugins/nat/extras/nat_static_gen_cfg.py @@ -0,0 +1,25 @@ +#! /usr/bin/python +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(u'10.0.0.3') + i) + external = str(ipaddress.IPv4Address(u'173.16.1.3') + i) + outfile.write('nat44 add static mapping local %s external %s\n' % (local, external)) + |