aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/tests/unit/network_services/libs/ixia_libs/test_ixnet_api.py
diff options
context:
space:
mode:
authorMyron Sosyak <myronx.sosyak@intel.com>2018-08-02 14:34:03 +0100
committerMyron Sosyak <myronx.sosyak@intel.com>2018-08-02 14:34:53 +0100
commitda33d374ef656da0648059439f2e28a0bfe2f13a (patch)
treec96e3af6721822c5a3a232d1abeec92d31bdc53f /yardstick/tests/unit/network_services/libs/ixia_libs/test_ixnet_api.py
parent0b7647a5a6c85a8a1762ec4482004107989c8550 (diff)
Add UDP ports configuration to IXIA traffic profile
- Implemented handling of UDP source and destination ports from IXIA traffic profile. - UDP ports can be defined as a single value or as a random range. Ports range is configured with two parameters 'fixed_bits' and 'mask_bits'. - For example '8-48' range definition will create a repeatable pattern of four values that fall within the range of 8 and 56. JIRA: YARDSTICK-1363 Change-Id: I0ace722f6be843ea79c3d3f4de22cb8fa5669d4f Signed-off-by: Myron Sosyak <myronx.sosyak@intel.com> Signed-off-by: Pshyk Serhiy <serhiyx.pshyk@intel.com> Signed-off-by: Mytnyk, Volodymyr <volodymyrx.mytnyk@intel.com>
Diffstat (limited to 'yardstick/tests/unit/network_services/libs/ixia_libs/test_ixnet_api.py')
-rw-r--r--yardstick/tests/unit/network_services/libs/ixia_libs/test_ixnet_api.py63
1 files changed, 59 insertions, 4 deletions
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 42ca7f769..4d5276ab8 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
@@ -44,8 +44,12 @@ TRAFFIC_PARAMETERS = {
'srcmask': 24
},
'outer_l4': {
- 'dstport': '2001',
- 'srcport': '1234'
+ 'seed': 1,
+ 'count': 1,
+ 'dstport': 2001,
+ 'srcport': 1234,
+ 'srcportmask': 0,
+ 'dstportmask': 0
},
'traffic_type': 'continuous'
},
@@ -69,8 +73,12 @@ TRAFFIC_PARAMETERS = {
'srcmask': 64
},
'outer_l4': {
- 'dstport': '1234',
- 'srcport': '2001'
+ 'seed': 1,
+ 'count': 1,
+ 'dstport': 1234,
+ 'srcport': 2001,
+ 'srcportmask': 0,
+ 'dstportmask': 0
},
'traffic_type': 'continuous'
}
@@ -357,6 +365,21 @@ class TestIxNextgen(unittest.TestCase):
'-randomMask', '0.0.0.63', '-valueType', 'random',
'-countValue', 25)
+ def test__update_udp_port(self):
+ with mock.patch.object(self.ixnet_gen, '_get_field_in_stack_item',
+ return_value='field_desc'):
+ self.ixnet_gen._update_udp_port(mock.ANY, mock.ANY, 1234,
+ 2, 0, 2)
+
+ self.ixnet_gen.ixnet.setMultiAttribute.assert_called_once_with(
+ 'field_desc',
+ '-auto', 'false',
+ '-seed', 1,
+ '-fixedBits', 1234,
+ '-randomMask', 0,
+ '-valueType', 'random',
+ '-countValue', 1)
+
def test_update_ip_packet(self):
with mock.patch.object(self.ixnet_gen, '_update_ipv4_address') as \
mock_update_add, \
@@ -374,6 +397,38 @@ class TestIxNextgen(unittest.TestCase):
with self.assertRaises(exceptions.IxNetworkFlowNotPresent):
self.ixnet_gen.update_ip_packet(TRAFFIC_PARAMETERS)
+ def test_update_l4(self):
+ with mock.patch.object(self.ixnet_gen, '_update_udp_port') as \
+ mock_update_udp, \
+ mock.patch.object(self.ixnet_gen, '_get_stack_item'), \
+ mock.patch.object(self.ixnet_gen,
+ '_get_config_element_by_flow_group_name', return_value='celm'):
+ self.ixnet_gen.update_l4(TRAFFIC_PARAMETERS)
+
+ self.assertEqual(4, len(mock_update_udp.mock_calls))
+
+ def test_update_l4_exception_no_config_element(self):
+ with mock.patch.object(self.ixnet_gen,
+ '_get_config_element_by_flow_group_name',
+ return_value=None):
+ with self.assertRaises(exceptions.IxNetworkFlowNotPresent):
+ self.ixnet_gen.update_l4(TRAFFIC_PARAMETERS)
+
+ def test_update_l4_exception_no_supported_proto(self):
+ traffic_parameters = {
+ UPLINK: {
+ 'id': 1,
+ 'outer_l3': {
+ 'proto': 'unsupported',
+ },
+ },
+ }
+ with mock.patch.object(self.ixnet_gen,
+ '_get_config_element_by_flow_group_name',
+ return_value='celm'):
+ with self.assertRaises(exceptions.IXIAUnsupportedProtocol):
+ self.ixnet_gen.update_l4(traffic_parameters)
+
@mock.patch.object(ixnet_api.IxNextgen, '_get_traffic_state')
def test_start_traffic(self, mock_ixnextgen_get_traffic_state):
self.ixnet_gen._ixnet.getList.return_value = [0]