From 1e7e312528ebeedf478aefd0e7317b56c119cc1c Mon Sep 17 00:00:00 2001 From: Jeremy Mordkoff Date: Wed, 15 Mar 2017 21:23:22 +0000 Subject: [PATCH] Bug-144 -- set the URL for loganalyzer Signed-off-by: Jeremy Mordkoff --- rwlaunchpad/test/launchpad.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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() -- 2.25.1