Implementation change of getting server ip

changes:
   - Implementation change of getting server ip using socket
   - Removed:
       Create A Session With ClientID
       Get Session Information By ClientID
       Verify A Session Created With ClientID

Change-Id: I5c3c6554173cd028580f7f5ecca088626f72a21a
Signed-off-by: Sushil Singh <susilsi7@in.ibm.com>
diff --git a/lib/bmc_network_utils.py b/lib/bmc_network_utils.py
index af29b9d..d73a1e1 100644
--- a/lib/bmc_network_utils.py
+++ b/lib/bmc_network_utils.py
@@ -25,15 +25,13 @@
     r"""
     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()
-    stdout = subprocess.check_output("ip addr show", shell=True)
-    stdout = stdout.decode("utf-8")
-    ip_list = re.findall(ip_regex, stdout)
+    stdout = subprocess.check_output(['hostname', '--all-fqdns'], shell=True)
+    host_fqdns = stdout.decode("utf-8").strip()
+    ip_address = socket.gethostbyname(str(host_fqdns))
+    ip_list.append(ip_address)
 
     return ip_list
 
diff --git a/openpower/ext_interfaces/test_client_identifier.robot b/openpower/ext_interfaces/test_client_identifier.robot
index 8a9b231..686dfed 100644
--- a/openpower/ext_interfaces/test_client_identifier.robot
+++ b/openpower/ext_interfaces/test_client_identifier.robot
@@ -6,6 +6,7 @@
 Resource          ../../lib/openbmc_ffdc.robot
 Resource          ../../lib/resource.robot
 Resource          ../../lib/bmc_redfish_utils.robot
+Resource          ../../lib/external_intf/management_console_utils.robot
 Library           ../../lib/bmc_network_utils.py
 Library           ../../lib/gen_robot_valid.py
 
@@ -80,73 +81,6 @@
 
 *** Keywords ***
 
-Create A Session With ClientID
-    [Documentation]  Create redifish session with client id.
-    [Arguments]  ${client_id}
-
-    # Description of argument(s):
-    # client_id    This client id can contain string value
-    #              (e.g. 12345, "EXTERNAL-CLIENT").
-
-    @{session_list}=  Create List
-    &{tmp_dict}=  Create Dictionary
-
-    FOR  ${client}  IN  @{client_id}
-      ${resp}=  Redfish Login  kwargs= "Oem":{"OpenBMC" : {"ClientID":"${client}"}}
-      Append To List  ${session_list}  ${resp}
-    END
-
-    [Return]  ${session_list}
-
-
-Get Session Information By ClientID
-    [Documentation]  Get session information by client id.
-    [Arguments]  ${client_id}  ${session_ids}
-
-    FOR  ${session}  IN  @{session_ids}
-       Return From Keyword If  '${client_id}' == '${session["Oem"]["OpenBMC"]["ClientID"]}'  ${session["Id"]}
-    END
-
-    [Return]  ${EMPTY}
-
-
-Verify A Session Created With ClientID
-    [Documentation]  Verify session created with client id.
-    [Arguments]  ${client_ids}  ${session_ids}
-
-    # Description of argument(s):
-    # client_id    External client name.
-    # session_id   This value is a session id.
-
-    # {
-    #   "@odata.id": "/redfish/v1/SessionService/Sessions/H8q2ZKucSJ",
-    #   "@odata.type": "#Session.v1_0_2.Session",
-    #   "Description": "Manager User Session",
-    #   "Id": "H8q2ZKucSJ",
-    #   "Name": "User Session",
-    #   "Oem": {
-    #   "OpenBMC": {
-    #  "@odata.type": "#OemSession.v1_0_0.Session",
-    #  "ClientID": "",
-    #  "ClientOriginIP": "::ffff:x.x.x.x"
-    #       }
-    #     },
-    #   "UserName": "root"
-    # }
-
-    FOR  ${client}  IN  @{client_ids}
-      ${session_id}=  Get Session Information By ClientID  ${client}  ${session_ids}
-      ${sessions}=  Redfish.Get Properties  /redfish/v1/SessionService/Sessions/${session_id}
-      Rprint Vars  sessions
-      @{words} =  Split String  ${sessions["ClientOriginIPAddress"]}  :
-      ${ip_address}=  Get Running System IP
-      Set Test Variable  ${temp_ipaddr}  ${words}[-1]
-      Valid Value  client  ['${sessions["Oem"]["OpenBMC"]["ClientID"]}']
-      Valid Value  sessions["Id"]  ['${session_id}']
-      Valid Value  temp_ipaddr  ${ip_address}
-    END
-
-
 Create And Verify Session ClientID
     [Documentation]  Create redifish session with client id and verify it remain same.
     [Arguments]  ${client_id}  ${reboot_flag}=False