summaryrefslogtreecommitdiffstats
path: root/deploy/get_conf.py
diff options
context:
space:
mode:
authorZhijiang Hu <hu.zhijiang@zte.com.cn>2016-12-20 07:29:16 +0000
committerGerrit Code Review <gerrit@opnfv.org>2016-12-20 07:29:16 +0000
commitd5df56b8ef5d5967e471db482d09fac36afc449a (patch)
treeffda79a1f00c54ef81f854b38037f18cec4d5dc9 /deploy/get_conf.py
parent3dce9ea92689ace8b88c3996b28adc09d3ab8197 (diff)
parent0b57e3be28f1b42d7cea436feb04fbcdf83e8484 (diff)
Merge "implement deploy on virthal pod"
Diffstat (limited to 'deploy/get_conf.py')
-rwxr-xr-xdeploy/get_conf.py50
1 files changed, 30 insertions, 20 deletions
diff --git a/deploy/get_conf.py b/deploy/get_conf.py
index 5ce9806b..eaac8b17 100755
--- a/deploy/get_conf.py
+++ b/deploy/get_conf.py
@@ -23,7 +23,9 @@ def decorator_mk(types):
result = {}
for item in item_list:
ret = func(item)
- if ret:
+ if ret.keys()[0] in result:
+ result[ret.keys()[0]].append(ret.values()[0][0])
+ else:
result.update(ret)
return result
return wrapter
@@ -33,20 +35,24 @@ def decorator_mk(types):
@decorator_mk('networks')
def network(network=None):
net_plane = network.get('name', '')
+ if net_plane == "TENANT":
+ net_plane = "physnet1"
network.pop('name')
map = {}
map[net_plane] = network
return map
-@decorator_mk('hosts')
-def interface(host=None):
- interface = host.get('interface', '')
- map = {}
- for k in interface:
- for v in k['logic']:
- map[v['name']] = {'ip': v['ip'], 'phynic': k['phynic']}
- return map
+@decorator_mk('interfaces')
+def interface(interface=None):
+ net_name = interface.get('name', '')
+ if net_name == "TENANT":
+ net_name = "physnet1"
+ interface_name = interface.get('interface', '')
+ map2 = {}
+ map = {'ip': '', 'name': net_name}
+ map2[interface_name] = [map]
+ return map2
@decorator_mk('hosts')
@@ -70,23 +76,27 @@ def host(host=None):
def network_config_parse(s, dha_file):
network_map = network(s)
vip = s.get('internal_vip')
- return network_map, vip
+ interface_map = interface(s)
+ return network_map, vip, interface_map
def dha_config_parse(s, dha_file):
- host_interface_map = interface(s)
host_role_map = role(s)
- host_ip_passwd_map = host(s)
- return host_interface_map, host_role_map, host_ip_passwd_map
+ hosts_name = []
+ for name in host_role_map:
+ hosts_name.append(name)
+ return hosts_name
def config(dha_file, network_file):
data = init(dha_file)
- host_interface_map, host_role_map, host_ip_passwd_map = \
- dha_config_parse(data, dha_file)
+ hosts_name = dha_config_parse(data, dha_file)
data = init(network_file)
- network_map, vip = network_config_parse(data, network_file)
- for k in host_interface_map:
- host_interface_map[k].update(network_map[k])
- return host_interface_map, host_role_map, \
- host_ip_passwd_map, network_map, vip
+ network_map, vip, interface_map = network_config_parse(data, network_file)
+ for interface_name in interface_map:
+ for name in interface_map[interface_name]:
+ if name.get('name', None) == 'MANAGEMENT':
+ name['ip'] = network_map.get(
+ 'MANAGEMENT', None).get(
+ 'ip_ranges', None)[0].get('start', None)
+ return interface_map, hosts_name, network_map, vip