From 0b908d5d0b0e77c366f39f258f0a3f6a54bfe304 Mon Sep 17 00:00:00 2001 From: Myron Sosyak Date: Thu, 13 Dec 2018 17:53:07 +0000 Subject: Add IxNetwork L3 scenario implementation Protocol interfaces are creating with config from pod file Static IP configuration are creating from testcase flow options JIRA: YARDSTICK-1570 Change-Id: I74cde67b5084d5b65d09934fe8fce7760b5ea461 Signed-off-by: Myron Sosyak --- yardstick/common/exceptions.py | 4 ++++ yardstick/common/utils.py | 11 +++++++++++ 2 files changed, 15 insertions(+) (limited to 'yardstick/common') diff --git a/yardstick/common/exceptions.py b/yardstick/common/exceptions.py index 5e0df973a..f62f02f18 100644 --- a/yardstick/common/exceptions.py +++ b/yardstick/common/exceptions.py @@ -405,6 +405,10 @@ class IxNetworkFieldNotPresentInStackItem(YardstickException): message = 'Field "%(field_name)s" not present in stack item %(stack_item)s' +class IncorrectFlowOption(YardstickException): + message = 'Flow option {option} for {link} is incorrect' + + class SLAValidationError(YardstickException): message = '%(case_name)s SLA validation failed. Error: %(error_msg)s' diff --git a/yardstick/common/utils.py b/yardstick/common/utils.py index 51313ef47..9eba896e2 100644 --- a/yardstick/common/utils.py +++ b/yardstick/common/utils.py @@ -293,6 +293,17 @@ def make_ipv4_address(ip_addr): return ipaddress.IPv4Address(six.text_type(ip_addr)) +def get_ip_range_count(iprange): + start_range, end_range = iprange.split("-") + start = int(make_ipv4_address(start_range)) + end = int(make_ipv4_address(end_range)) + return end - start + + +def get_ip_range_start(iprange): + return str(make_ipv4_address(iprange.split("-")[0])) + + def safe_ip_address(ip_addr): """ get ip address version v6 or v4 """ try: -- cgit 1.2.3-korg