Enable test cases for host's network settings
What test cases are added
- Added test cases to set static and dhcp setting using REST
- Added test cases to set static and dhcp setting using IPMI
- Added test case to clear settings using IPMI
- Added test cases to set invalid settings using both REST and IPMI
Resolves openbmc/openbmc-test-automation#48
Change-Id: Ia9ac56ad884318de703406d070aa7985474fab05
Signed-off-by: Rahul Maheshwari <rahulmaheshwari@in.ibm.com>
diff --git a/lib/utilities.py b/lib/utilities.py
index 980d06b..f316b3b 100755
--- a/lib/utilities.py
+++ b/lib/utilities.py
@@ -3,7 +3,23 @@
from robot.libraries.BuiltIn import BuiltIn
import imp
import string
+import random
+def random_mac():
+ r"""
+ Return random mac address in the following format.
+ Example: 00:01:6C:80:02:78
+ """
+ return ":".join(map(lambda x: "%02x" % x, (random.randint(0x00, 0xff)
+ for _ in range(6))))
+
+def random_ip():
+ r"""
+ Return random ip address in the following format.
+ Example: 9.3.128.100
+ """
+ return ".".join(map(str, (random.randint(0, 255)
+ for _ in range(4))))
def get_sensor(module_name, value):
m = imp.load_source('module.name', module_name)