summaryrefslogtreecommitdiffstats
path: root/ci/genDeploymentConfig.py
diff options
context:
space:
mode:
authorNarinder Gupta <narinder.gupta@canonical.com>2017-02-05 08:24:01 -0600
committerNarinder Gupta <narinder.gupta@canonical.com>2017-02-05 08:55:45 -0600
commitfe8f6531947ae65939e977117f9b281fbe14bed3 (patch)
treef6a45dac9d3870bef73cc0cf46a39ab43f1a1323 /ci/genDeploymentConfig.py
parentedf35e6c820e613ae73999189ed7e4b98c3a4e7d (diff)
cleanup task.
Change-Id: I287e80899225c611752117ab29f079de7ba25f58 Signed-off-by: Narinder Gupta <narinder.gupta@canonical.com>
Diffstat (limited to 'ci/genDeploymentConfig.py')
-rw-r--r--ci/genDeploymentConfig.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/ci/genDeploymentConfig.py b/ci/genDeploymentConfig.py
index eecdd2f2..0a21fffa 100644
--- a/ci/genDeploymentConfig.py
+++ b/ci/genDeploymentConfig.py
@@ -14,6 +14,9 @@ from distutils.version import LooseVersion, StrictVersion
import os
import yaml
import subprocess
+import socket
+import fcntl
+import struct
#
# Parse parameters
@@ -59,6 +62,21 @@ def load_yaml(filepath):
except yaml.YAMLError as exc:
print(exc)
+
+def get_ip_address(ifname):
+ """Get local IP"""
+ s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+ return socket.inet_ntoa(fcntl.ioctl(
+ s.fileno(),
+ 0x8915, # SIOCGIFADDR
+ struct.pack('256s', bytes(ifname.encode('utf-8')[:15]))
+ )[20:24])
+
+
+#
+# Config import
+#
+
#
# Config import
#
@@ -79,7 +97,8 @@ for storage in config['opnfv']['storage']:
# Add some OS environment variables
config['os'] = {'home': HOME,
'user': USER,
- }
+ 'brAdmIP': get_ip_address(config['opnfv']['spaces_dict']
+ ['admin']['bridge'])}
# Prepare interface-enable, more easy to do it here
ifnamelist = set()