From abd5b952f42f429f6f1b59f3f7822cc92da0f6f6 Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Mon, 23 Jul 2018 17:00:52 +0100 Subject: Add IP mask to IxNetwork configuration Assign the IP mask to IxNetwork configuration, depending on the IP range provided by the user in the traffic profile. In case of single IP, a default mask will be provided: - IP_VERSION_4_MASK = 24 - IP_VERSION_6_MASK = 64 JIRA: YARDSTICK-1351 Change-Id: I029473ab8b9966a76cf559ffef53b34ca11462ad Signed-off-by: Rodolfo Alonso Hernandez --- .../libs/ixia_libs/test_ixnet_api.py | 47 +++++----------------- .../traffic_profile/test_ixia_rfc2544.py | 16 ++++++++ 2 files changed, 26 insertions(+), 37 deletions(-) (limited to 'yardstick/tests/unit/network_services') diff --git a/yardstick/tests/unit/network_services/libs/ixia_libs/test_ixnet_api.py b/yardstick/tests/unit/network_services/libs/ixia_libs/test_ixnet_api.py index afa4cc3dc..458ea0f12 100644 --- a/yardstick/tests/unit/network_services/libs/ixia_libs/test_ixnet_api.py +++ b/yardstick/tests/unit/network_services/libs/ixia_libs/test_ixnet_api.py @@ -36,25 +36,12 @@ TRAFFIC_PARAMETERS = { 'outer_l3': { 'count': 512, 'dscp': 0, - 'dstip4': '152.16.40.20', 'proto': 'udp', - 'srcip4': '152.16.100.20', - 'ttl': 32 - }, - 'outer_l3v4': { - 'dscp': 0, - 'dstip4': '152.16.40.20', - 'proto': 'udp', - 'srcip4': '152.16.100.20', - 'ttl': 32 - }, - 'outer_l3v6': { - 'count': 1024, - 'dscp': 0, - 'dstip4': '152.16.100.20', - 'proto': 'udp', - 'srcip4': '152.16.40.20', - 'ttl': 32 + 'ttl': 32, + 'dstip': '152.16.40.20', + 'srcip': '152.16.100.20', + 'dstmask': 24, + 'srcmask': 24 }, 'outer_l4': { 'dstport': '2001', @@ -74,26 +61,12 @@ TRAFFIC_PARAMETERS = { 'outer_l3': { 'count': 1024, 'dscp': 0, - 'dstip4': '152.16.100.20', - 'proto': 'udp', - 'srcip4': '152.16.40.20', - 'ttl': 32 - }, - 'outer_l3v4': { - 'count': 1024, - 'dscp': 0, - 'dstip4': '152.16.100.20', - 'proto': 'udp', - 'srcip4': '152.16.40.20', - 'ttl': 32 - }, - 'outer_l3v6': { - 'count': 1024, - 'dscp': 0, - 'dstip4': '152.16.100.20', 'proto': 'udp', - 'srcip4': '152.16.40.20', - 'ttl': 32 + 'ttl': 32, + 'dstip': '2001::10', + 'srcip': '2021::10', + 'dstmask': 64, + 'srcmask': 64 }, 'outer_l4': { 'dstport': '1234', diff --git a/yardstick/tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py b/yardstick/tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py index 4ea19a121..1a33304a5 100644 --- a/yardstick/tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py +++ b/yardstick/tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py @@ -446,6 +446,22 @@ class TestIXIARFC2544Profile(unittest.TestCase): r_f_c2544_profile = ixia_rfc2544.IXIARFC2544Profile(t_profile_data) self.assertEqual(12345678, r_f_c2544_profile.rate) + def test__get_ip_and_mask_range(self): + ip_range = '1.2.0.2-1.2.255.254' + r_f_c2544_profile = ixia_rfc2544.IXIARFC2544Profile( + self.TRAFFIC_PROFILE) + ip, mask = r_f_c2544_profile._get_ip_and_mask(ip_range) + self.assertEqual('1.2.0.2', ip) + self.assertEqual(16, mask) + + def test__get_ip_and_mask_single(self): + ip_range = '192.168.1.10' + r_f_c2544_profile = ixia_rfc2544.IXIARFC2544Profile( + self.TRAFFIC_PROFILE) + ip, mask = r_f_c2544_profile._get_ip_and_mask(ip_range) + self.assertEqual('192.168.1.10', ip) + self.assertIsNone(mask) + def test__get_ixia_traffic_profile_default_args(self): r_f_c2544_profile = ixia_rfc2544.IXIARFC2544Profile( self.TRAFFIC_PROFILE) -- cgit 1.2.3-korg