diff options
author | Abhijit Sinha <abhijit.sinha@intel.com> | 2018-06-22 13:24:20 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2018-06-22 13:24:20 +0000 |
commit | c8a3679b57eafd2c7855dc82bd028308fa92f4e2 (patch) | |
tree | e6fe6a727a77a80cadf636ee9fe00a4628494b38 /yardstick/common | |
parent | aeb3cd61b405335684ca3a2228c4df236c064b45 (diff) | |
parent | 3fdca97ff5053770161059a34a95fd39463eaecd (diff) |
Merge "Configure ACL via static file"
Diffstat (limited to 'yardstick/common')
-rw-r--r-- | yardstick/common/exceptions.py | 9 | ||||
-rw-r--r-- | yardstick/common/utils.py | 13 |
2 files changed, 22 insertions, 0 deletions
diff --git a/yardstick/common/exceptions.py b/yardstick/common/exceptions.py index 954d655cb..f2d2e95c1 100644 --- a/yardstick/common/exceptions.py +++ b/yardstick/common/exceptions.py @@ -313,3 +313,12 @@ class IxNetworkFieldNotPresentInStackItem(YardstickException): class SLAValidationError(YardstickException): message = '%(case_name)s SLA validation failed. Error: %(error_msg)s' + + +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 5b44ce0e2..f9fe0e336 100644 --- a/yardstick/common/utils.py +++ b/yardstick/common/utils.py @@ -306,6 +306,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)) |