summaryrefslogtreecommitdiffstats
path: root/yardstick/common
diff options
context:
space:
mode:
authorEmma Foley <emma.l.foley@intel.com>2018-06-22 16:45:56 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-06-22 16:45:56 +0000
commitb9820283f7aaa8dc10484a0006ee4fc569e71f07 (patch)
treee8be808b3dd41d6d4f2e90248caa476fb1ae645d /yardstick/common
parent3f3063363291b312f8c002086463a211338c1ae4 (diff)
parent7c2d0fbab9f4bbcbe53d229425642c26edc92492 (diff)
Merge "Configure ACL via static file" into stable/fraser
Diffstat (limited to 'yardstick/common')
-rw-r--r--yardstick/common/exceptions.py9
-rw-r--r--yardstick/common/utils.py13
2 files changed, 22 insertions, 0 deletions
diff --git a/yardstick/common/exceptions.py b/yardstick/common/exceptions.py
index f5e923f4d..c78fecc2c 100644
--- a/yardstick/common/exceptions.py
+++ b/yardstick/common/exceptions.py
@@ -212,3 +212,12 @@ class UploadOpenrcError(ApiServerError):
class UpdateOpenrcError(ApiServerError):
message = 'Update openrc ERROR!'
+
+
+class AclMissingActionArguments(YardstickException):
+ message = ('Missing ACL action parameter '
+ '[action=%(action_name)s parameter=%(action_param)s]')
+
+
+class AclUknownActionTemplate(YardstickException):
+ message = 'No ACL CLI template found for "%(action_name)s" action'
diff --git a/yardstick/common/utils.py b/yardstick/common/utils.py
index 44cc92a7c..864e6258e 100644
--- a/yardstick/common/utils.py
+++ b/yardstick/common/utils.py
@@ -302,6 +302,19 @@ def get_ip_version(ip_addr):
return address.version
+def make_ip_addr(ip, mask):
+ """
+ :param ip[str]: ip adddress
+ :param mask[str]: /24 prefix of 255.255.255.0 netmask
+ :return: IPv4Interface object
+ """
+ try:
+ return ipaddress.ip_interface(six.text_type('/'.join([ip, mask])))
+ except (TypeError, ValueError):
+ # None so we can skip later
+ return None
+
+
def ip_to_hex(ip_addr, separator=''):
try:
address = ipaddress.ip_address(six.text_type(ip_addr))