Update the voltha code to make use of the interface option and add
a new voltha swarm file.
Change-Id: Icf2bd5a35aea3a8aa55de58acb56bfa6f4b34e0d
diff --git a/common/utils/nethelpers.py b/common/utils/nethelpers.py
index b79d2b0..a082eeb 100644
--- a/common/utils/nethelpers.py
+++ b/common/utils/nethelpers.py
@@ -22,7 +22,6 @@
import netifaces as ni
-
def get_my_primary_interface():
gateways = ni.gateways()
assert 'default' in gateways, \
@@ -36,10 +35,13 @@
def get_my_primary_local_ipv4(ifname=None):
- ifname = get_my_primary_interface() if ifname is None else ifname
- addresses = ni.ifaddresses(ifname)
- ipv4 = addresses[AF_INET][0]['addr']
- return ipv4
+ try:
+ ifname = get_my_primary_interface() if ifname is None else ifname
+ addresses = ni.ifaddresses(ifname)
+ ipv4 = addresses[AF_INET][0]['addr']
+ return ipv4
+ except Exception as e:
+ return None
if __name__ == '__main__':