|
| 1 | +#!/usr/bin/python |
| 2 | +# script to create the config JSON input for the system tests |
| 3 | +import os |
| 4 | +import json |
| 5 | +import argparse |
| 6 | + |
| 7 | +parser = argparse.ArgumentParser() |
| 8 | +parser.add_argument("-scheduler", default='docker', help="Scheduler used, if any") |
| 9 | +parser.add_argument("-swarm_var", default='', help="Swarm host variable") |
| 10 | +parser.add_argument("-platform", default='vagrant', help="Vagrant/baremetal") |
| 11 | +parser.add_argument("-product", default='netplugin', help="netplugin/volplugin") |
| 12 | +parser.add_argument("-contiv_l3", default=0, help="Running in L3 mode") |
| 13 | +parser.add_argument("-key_file", default="/home/admin/.ssh/id_rsa", help="file path of key_file") |
| 14 | +parser.add_argument("-binpath", default="/opt/gopath/bin", help="GOBIN path") |
| 15 | +parser.add_argument("-hostips", default="192.168.2.10,192.168.2.11,192.168.2.12", help="Host IPs in the system") |
| 16 | +parser.add_argument("-hostnames", default="admin,admin,admin", help="Usernames on the hosts") |
| 17 | + |
| 18 | +parser.add_argument("-aci_mode", default='off', help="Running in ACI mode") |
| 19 | +parser.add_argument("-short", default=False, help="Shorter version of system tests") |
| 20 | +parser.add_argument("-containers", default=3, help="Number of containers for each test") |
| 21 | +parser.add_argument("-iterations", default=3, help="Number of iterations for each test") |
| 22 | +parser.add_argument("-enableDNS", default=False, help="Enabling DNS") |
| 23 | +parser.add_argument("-contiv_cluster_store", default="etcd://localhost:2379", help="cluster info") |
| 24 | +parser.add_argument("-datainterface", default="eth2", help="Data interface") |
| 25 | +parser.add_argument("-mgmtinterface", default="eth1", help="Control interface") |
| 26 | +parser.add_argument("-vlan", default="1120-1150", help="vlan range") |
| 27 | +parser.add_argument("-vxlan", default="1-10000", help="vxlan range") |
| 28 | +parser.add_argument("-subnet", default="10.1.1.0/24", help="subnet for ACI testing") |
| 29 | +parser.add_argument("-gateway", default="10.1.1.254", help="gateway for ACI testing") |
| 30 | +parser.add_argument("-network", default="TestNet", help="network name for ACI testing") |
| 31 | +parser.add_argument("-tenant", default="TestTenant", help="tenant name for ACI testing") |
| 32 | +parser.add_argument("-encap", default="vlan", help="encapsulation for ACI testing") |
| 33 | + |
| 34 | +args = parser.parse_args() |
| 35 | +data = {} |
| 36 | +data['scheduler'] = args.scheduler |
| 37 | +data['swarm_variable'] = args.swarm_var |
| 38 | +data['platform'] = args.platform |
| 39 | +data['product'] = args.product |
| 40 | +data['aci_mode'] = args.aci_mode |
| 41 | +data['short'] = args.short |
| 42 | +data['containers'] = args.containers |
| 43 | +data['iterations'] = args.iterations |
| 44 | +data['enableDNS'] = args.enableDNS |
| 45 | +data['contiv_cluster_store'] = args.contiv_cluster_store |
| 46 | +data['contiv_l3'] = args.contiv_l3 |
| 47 | +data['key_file'] = args.key_file |
| 48 | +data['binpath'] = args.binpath |
| 49 | +data['hostips'] = args.hostips |
| 50 | +data['hostusernames'] = args.hostnames |
| 51 | +data['dataInterface'] = args.datainterface |
| 52 | +data['mgmtInterface'] = args.mgmtinterface |
| 53 | +data['vlan'] = args.vlan |
| 54 | +data['vxlan'] = args.vxlan |
| 55 | +data['subnet'] = args.subnet |
| 56 | +data['gateway'] = args.gateway |
| 57 | +data['network'] = args.network |
| 58 | +data['tenant'] = args.tenant |
| 59 | +data['encap'] = args.encap |
| 60 | + |
| 61 | +filepath = os.environ['GOPATH'] + '/src/github.com/contiv/netplugin/test/systemtests/cfg.json' |
| 62 | +with open(filepath, 'w') as outfile: |
| 63 | + print "Generating the config file: " + filepath |
| 64 | + json.dump(data, outfile) |
| 65 | + |
| 66 | +os._exit(0) |
0 commit comments