From: Jeremy Mordkoff Date: Wed, 15 Mar 2017 21:23:22 +0000 (+0000) Subject: Bug-144 -- set the URL for loganalyzer X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fv1.1;p=osm%2FSO.git Bug-144 -- set the URL for loganalyzer Signed-off-by: Jeremy Mordkoff --- 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()