Automation fix for ifconfig command

Changes:
   - New implementaion uses socket module to get the ip address.

Change-Id: I9529b987057f93449e0570571eb5b324487c2eac
Signed-off-by: Sushil Singh <susilsi7@in.ibm.com>
diff --git a/lib/bmc_network_utils.py b/lib/bmc_network_utils.py
index c2ea9f8..9b08a5a 100644
--- a/lib/bmc_network_utils.py
+++ b/lib/bmc_network_utils.py
@@ -18,18 +18,24 @@
 import json
 import bmc_ssh_utils as bsu
 
-ip_regex = r"\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}"
 
-
-def get_hostname():
+def get_running_system_ip():
     r"""
-    Get the host name of server from which robot code is running.
+    Get the IP address of server from which robot code is running.
 
+    Example of getaddrinfo:
+
+    [(<AddressFamily.AF_INET: X>, <SocketKind.SOCK_STREAM: X>, X, '', ('XX.XX.XX.XX', port)),]
     """
 
+    ip_list = list()
     host_name = socket.gethostname()
+    temp_ip_list = socket.getaddrinfo(host_name, 80)
+    for item in temp_ip_list:
+        ip_addr = item[-1][0]
+        ip_list.insert(0, ip_addr)
 
-    return host_name
+    return ip_list
 
 
 def netmask_prefix_length(netmask):