aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/common
diff options
context:
space:
mode:
authorMytnyk, Volodymyr <volodymyrx.mytnyk@intel.com>2018-05-31 10:03:10 +0100
committerMytnyk, Volodymyr <volodymyrx.mytnyk@intel.com>2018-06-22 15:05:53 +0100
commit7c2d0fbab9f4bbcbe53d229425642c26edc92492 (patch)
tree76e5a48b2d64b1ff76c64034f03d0e9ef5ab2874 /yardstick/common
parent9e33d405f33273c26b89f2ecdc49e42f1b560f02 (diff)
Configure ACL via static file
This patch allows user to configure ACL/vFW SampleVNF ACL via configuration file provided in TC definition. The Yardstick applies the rules to SampleVNF from specified config file + rules generated by Yardstick (default rules). The example of SampleVNF ACL CLI commands generated/applied by Yardstick can be found at (using default ACL config file): ACL VNF ACL CLI commands: acl/tc_heat_rfc2544_ipv4_1rule_1flow_64B_trex.yaml http://paste.openstack.org/show/723303/ vFW VNF ACL CLI commands: vfw/tc_heat_rfc2544_ipv4_1rule_1flow_64B_trex.yaml http://paste.openstack.org/show/723304/ Change-Id: I76a630261a982083b628e3985fc3bec14ca495db Signed-off-by: Mytnyk, Volodymyr <volodymyrx.mytnyk@intel.com> (cherry picked from commit 3fdca97ff5053770161059a34a95fd39463eaecd)
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 0c6272c14..98c870bf8 100644
--- a/yardstick/common/exceptions.py
+++ b/yardstick/common/exceptions.py
@@ -196,3 +196,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))