summaryrefslogtreecommitdiffstats
path: root/xci/playbooks/dynamic_inventory.py
diff options
context:
space:
mode:
Diffstat (limited to 'xci/playbooks/dynamic_inventory.py')
-rwxr-xr-xxci/playbooks/dynamic_inventory.py20
1 files changed, 14 insertions, 6 deletions
diff --git a/xci/playbooks/dynamic_inventory.py b/xci/playbooks/dynamic_inventory.py
index 8f498742..552a1337 100755
--- a/xci/playbooks/dynamic_inventory.py
+++ b/xci/playbooks/dynamic_inventory.py
@@ -39,10 +39,15 @@ class XCIInventory(object):
self.opnfv_networks = {}
self.opnfv_networks['opnfv'] = {}
- self.opnfv_networks['opnfv']['admin'] = '172.29.236.10'
- self.opnfv_networks['opnfv']['public'] = '192.168.122.2'
- self.opnfv_networks['opnfv']['private'] = '172.29.240.10'
- self.opnfv_networks['opnfv']['storage'] = '172.29.244.10'
+ self.opnfv_networks['opnfv']['admin'] = {}
+ self.opnfv_networks['opnfv']['admin']['address'] = '172.29.236.10/22'
+ self.opnfv_networks['opnfv']['public'] = {}
+ self.opnfv_networks['opnfv']['public']['address'] = '192.168.122.2/24'
+ self.opnfv_networks['opnfv']['public']['gateway'] = '192.168.122.1'
+ self.opnfv_networks['opnfv']['private'] = {}
+ self.opnfv_networks['opnfv']['private']['address'] = '172.29.240.10/22'
+ self.opnfv_networks['opnfv']['storage'] = {}
+ self.opnfv_networks['opnfv']['storage']['address'] = '172.29.244.10/24'
self.read_pdf_idf()
@@ -95,9 +100,12 @@ class XCIInventory(object):
self.add_hostvar(hostname, 'ansible_host', native_vlan_if[0]['address'])
host_networks[hostname] = {}
# And now record the rest of the information
- for network in idf['idf']['net_config'].keys():
+ for network, ndata in idf['idf']['net_config'].items():
network_interface_num = idf['idf']['net_config'][network]['interface']
- host_networks[hostname][network] = pdf_host_info['interfaces'][int(network_interface_num)]['address']
+ host_networks[hostname][network] = {}
+ host_networks[hostname][network]['address'] = pdf_host_info['interfaces'][int(network_interface_num)]['address'] + "/" + str(ndata['mask'])
+ if 'gateway' in ndata.keys():
+ host_networks[hostname][network]['gateway'] = str(ndata['gateway']) + "/" + str(ndata['mask'])
host_networks.update(self.opnfv_networks)