From: velandy Date: Wed, 15 Mar 2017 21:43:58 +0000 (+0100) Subject: Merge "Fix metadata initialization" X-Git-Tag: v2.0.0~35 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=450a57139e1a23f9176c25e0126ce69b183c8233;hp=36e477dc4a09f2fadc9c6d087da66ca7866e327e;p=osm%2FSO.git Merge "Fix metadata initialization" --- diff --git a/rwlaunchpad/test/launchpad.py b/rwlaunchpad/test/launchpad.py index 0ec3d188..98680ba5 100755 --- a/rwlaunchpad/test/launchpad.py +++ b/rwlaunchpad/test/launchpad.py @@ -572,9 +572,17 @@ def main(argv=sys.argv[1:]): northbound_listing="cli_launchpad_schema_listing.txt", netconf_trace_override=True) - confd_ip = socket.gethostbyname(socket.gethostname()) + # Search for externally accessible IP address with netifaces + gateways = netifaces.gateways() + # Check for default route facing interface and then get its ip address + if 'default' in gateways: + interface = gateways['default'][netifaces.AF_INET][1] + confd_ip = netifaces.ifaddresses(interface)[netifaces.AF_INET][0]['addr'] + else: + # no default gateway. Revert to 127.0.0.1 + confd_ip = "127.0.0.1" # TODO: This need to be changed when launchpad starts running on multiple VMs - rift.vcs.logger.configure_sink(config_file=None, confd_ip="127.0.0.1") + rift.vcs.logger.configure_sink(config_file=None, confd_ip=confd_ip) # Start the prepared system system.start()