XYZ Network: Base test automation

This change includes:
    1. Validating IP address.
    2. Validating Prefix length value.
    3. Validating route details.
    4. Validating MAC address.

This resolves openbmc/openbmc-test-automation#684

Change-Id: Idec61d70c42d796c825985e13fa0814c4a95f2c2
Signed-off-by: Prashanth Katti <prkatti1@in.ibm.com>
diff --git a/lib/bmc_network_utils.robot b/lib/bmc_network_utils.robot
index 3ea269f..231fbff 100644
--- a/lib/bmc_network_utils.robot
+++ b/lib/bmc_network_utils.robot
@@ -41,3 +41,58 @@
     Should Be Equal  ${bmc_mac_addr}  ${mac_address}  ignore_case=True
 
 ###############################################################################
+
+Get BMC IP Info
+    [Documentation]  Get system IP address and prefix length.
+
+    Open Connection And Login
+
+    # Get system IP address and prefix length details using "ip addr"
+    # Sample Output of "ip addr":
+    # 1: eth0: <BROADCAST,MULTIAST> mtu 1500 qdisc mq state UP qlen 1000
+    #     link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
+    #     inet xx.xx.xx.xx/24 brd xx.xx.xx.xx scope global eth0
+
+    ${cmd_output}=  Execute Command On BMC  /sbin/ip addr | grep eth0
+
+    # Get line having IP address details.
+    ${lines}=  Get Lines Containing String  ${cmd_output}  inet
+
+    # List IP address details.
+    @{ip_components}=  Split To Lines  ${lines}
+
+    @{ip_data}=  Create List
+
+    # Get all IP addresses and prefix lengths on system.
+    :FOR  ${ip_component}  IN  @{ip_components}
+    \  @{if_info}=  Split String  ${ip_component}
+    \  ${ip_n_prefix}=  Get From List  ${if_info}  1
+    \  Append To List  ${ip_data}  ${ip_n_prefix}
+
+    [Return]  ${ip_data}
+
+Get BMC Route Info
+    [Documentation]  Get system route info.
+
+    Open Connection And Login
+
+    # Sample output of "ip route":
+    # default via xx.xx.xx.x dev eth0
+    # xx.xx.xx.0/23 dev eth0  src xx.xx.xx.xx
+    # xx.xx.xx.0/24 dev eth0  src xx.xx.xx.xx
+
+    ${cmd_output}=  Execute Command On BMC  /sbin/ip route
+
+    [Return]  ${cmd_output}
+
+Get BMC MAC Address
+    [Documentation]  Get system MAC address.
+
+    Open Connection And Login
+
+    # Sample output of "ip addr | grep ether":
+    # link/ether xx.xx.xx.xx.xx.xx brd ff:ff:ff:ff:ff:ff
+
+    ${cmd_output}=  Execute Command On BMC  /sbin/ip addr | grep ether
+
+    [Return]  ${cmd_output}