Added a new test case for network interfaces.
- Verifies that the os network interfaces are configured/up.
Change-Id: I3e2da7c07348412223368aa35300e6f150463e16
Signed-off-by: Joy Onyerikwu <onyekachukwu.joy.onyerikwu@ibm.com>
diff --git a/syslib/utils_os.robot b/syslib/utils_os.robot
index d18dd20..942d26e 100755
--- a/syslib/utils_os.robot
+++ b/syslib/utils_os.robot
@@ -566,3 +566,11 @@
${clean_string} = Set Variable If '${last_char}' == ','
... ${trimmed_string} ${clean_string}
[Return] ${clean_string}
+
+
+Get OS Network Interface Names
+ [Documentation] Return a list of interface names on the OS.
+
+ ${stdout} ${stderr} ${rc}= OS Execute Command ls /sys/class/net
+ @{interface_names}= Split String ${stdout}
+ [Return] @{interface_names}
diff --git a/systest/verify_network_interfaces.robot b/systest/verify_network_interfaces.robot
new file mode 100644
index 0000000..0a84f3f
--- /dev/null
+++ b/systest/verify_network_interfaces.robot
@@ -0,0 +1,30 @@
+*** Settings ***
+
+Documentation Verify that the OS network interfaces are configured and
+... stable.
+
+# TEST PARAMETERS:
+# OS_HOST The OS host name or IP address.
+# OS_USERNAME The OS user name.
+# OS_PASSWORD The OS Host password.
+# FAIL_ON_LINK_DOWN If set to 1, the test will exit if
+# a link is down. Default is 1.
+
+Resource ../syslib/utils_install.robot
+
+*** Variables ***
+${FAIL_ON_LINK_DOWN} 1
+
+
+*** Test Cases ***
+Verify Network Interfaces
+ [Documentation] Verify the states of all system interfaces.
+ [Tags] Verify_Network_Interfaces
+
+ Rprintn
+ @{interface_names}= Get OS Network Interface Names
+ :FOR ${interface_name} IN @{interface_names}
+ \ ${ethtool_dict}= Get OS Ethtool ${interface_name}
+ \ Run Keyword If ${FAIL_ON__LINK_DOWN} == 1
+ \ ... Should Be Equal ${ethtool_dict['link_detected']} yes
+ \ ... msg=Link ${interface} is down.