Get the radius ip for the docker network if appropriate before defaulting to bridge ip
Change-Id: I0d80b6a7fa246aef5aca161e346dc56bd060f1cc
diff --git a/src/test/setup/cord-test.py b/src/test/setup/cord-test.py
index 90004cb..7afc2d8 100755
--- a/src/test/setup/cord-test.py
+++ b/src/test/setup/cord-test.py
@@ -491,7 +491,7 @@
##Start Radius container
radius = Radius(prefix = Container.IMAGE_PREFIX, update = update_map['radius'],
network = test_manifest.docker_network)
- radius_ip = radius.ip()
+ radius_ip = radius.ip(network = test_manifest.docker_network)
print('Radius server running with IP %s' %radius_ip)
@@ -742,7 +742,7 @@
if radius_ip is None:
radius = Radius(prefix = Container.IMAGE_PREFIX, update = update_map['radius'],
network = test_manifest.docker_network)
- radius_ip = radius.ip()
+ radius_ip = radius.ip(network = test_manifest.docker_network)
print('Radius server running with IP %s' %radius_ip)
diff --git a/src/test/utils/CordContainer.py b/src/test/utils/CordContainer.py
index 908ef1b..29d1d8c 100644
--- a/src/test/utils/CordContainer.py
+++ b/src/test/utils/CordContainer.py
@@ -140,11 +140,13 @@
def img_exists(self):
return self.image_name in [ctn['RepoTags'][0] if ctn['RepoTags'] else '' for ctn in self.dckr.images()]
- def ip(self):
+ def ip(self, network = None):
cnt_list = filter(lambda c: c['Names'][0] == '/{}'.format(self.name), self.dckr.containers())
#if not cnt_list:
# cnt_list = filter(lambda c: c['Image'] == self.image_name, self.dckr.containers())
cnt_settings = cnt_list.pop()
+ if network is not None and cnt_settings['NetworkSettings']['Networks'].has_key(network):
+ return cnt_settings['NetworkSettings']['Networks'][network]['IPAddress']
return cnt_settings['NetworkSettings']['Networks']['bridge']['IPAddress']
@classmethod