From 9b0b8ae33541c0ad8925521b1c3f1bc559fefbe6 Mon Sep 17 00:00:00 2001 From: Ross Brattain Date: Tue, 12 Sep 2017 09:57:38 -0700 Subject: NSB: count from 0, vnf_0, tg_9, private->uplink, public->downlink Also rename private to uplink, public to downlink for scale-out template we need to count from 0 so we can use range() without +1/-1 errors vnf_0, vnf_1 tg_0, tg_1 also fix Ixia defaults Change-Id: I6aecfbb95f99af20f012a9df19c19be77d1b5b77 Signed-off-by: Ross Brattain Signed-off-by: Edward MacGillivray --- .../helpers/acl_vnf_topology_ixia.yaml | 4 +- .../helpers/test_samplevnf_helper.py | 14 ++-- .../network_services/libs/ixia_libs/test_IxNet.py | 31 +++++---- .../traffic_profile/test_ixia_rfc2544.py | 74 +++++++++++----------- .../traffic_profile/test_rfc2544.py | 20 +++--- .../traffic_profile/test_traffic_profile.py | 32 +++++----- .../network_services/vnf_generic/test_vnfdgen.py | 29 +++++---- .../vnf_generic/vnf/test_acl_vnf.py | 8 +-- .../vnf_generic/vnf/test_cgnapt_vnf.py | 10 +-- .../vnf_generic/vnf/test_prox_helpers.py | 10 +-- .../vnf_generic/vnf/test_prox_vnf.py | 8 +-- .../vnf_generic/vnf/test_sample_vnf.py | 20 +++--- .../vnf_generic/vnf/test_tg_prox.py | 8 +-- .../vnf_generic/vnf/test_tg_rfc2544_trex.py | 4 +- .../vnf_generic/vnf/test_tg_trex.py | 8 +-- .../vnf_generic/vnf/test_udp_replay.py | 12 ++-- .../vnf_generic/vnf/test_vfw_vnf.py | 8 +-- .../vnf_generic/vnf/test_vpe_vnf.py | 22 +++---- 18 files changed, 165 insertions(+), 157 deletions(-) (limited to 'tests/unit/network_services') diff --git a/tests/unit/network_services/helpers/acl_vnf_topology_ixia.yaml b/tests/unit/network_services/helpers/acl_vnf_topology_ixia.yaml index 606d557e9..f60834fbd 100644 --- a/tests/unit/network_services/helpers/acl_vnf_topology_ixia.yaml +++ b/tests/unit/network_services/helpers/acl_vnf_topology_ixia.yaml @@ -27,7 +27,7 @@ nsd:nsd-catalog: VNF model: ../../vnf_descriptors/acl_vnf.yaml vld: - - id: private_1 + - id: uplink_1 name: tg__1 to vnf__1 link 1 type: ELAN vnfd-connection-point-ref: @@ -38,7 +38,7 @@ nsd:nsd-catalog: vnfd-connection-point-ref: xe0 vnfd-id-ref: vnf__1 #VNF - - id: public_1 + - id: downlink_1 name: vnf__1 to tg__1 link 2 type: ELAN vnfd-connection-point-ref: diff --git a/tests/unit/network_services/helpers/test_samplevnf_helper.py b/tests/unit/network_services/helpers/test_samplevnf_helper.py index 3d3f6dc28..0ac363f28 100644 --- a/tests/unit/network_services/helpers/test_samplevnf_helper.py +++ b/tests/unit/network_services/helpers/test_samplevnf_helper.py @@ -37,7 +37,7 @@ class TestPortPairs(unittest.TestCase): vnfd = TestMultiPortConfig.VNFD['vnfd:vnfd-catalog']['vnfd'][0] interfaces = vnfd['vdu'][0]['external-interface'] port_pairs = PortPairs(interfaces) - self.assertEqual(port_pairs.valid_networks, [("private_0", "public_0")]) + self.assertEqual(port_pairs.valid_networks, [("uplink_0", "downlink_0")]) def test_all_ports(self): vnfd = TestMultiPortConfig.VNFD['vnfd:vnfd-catalog']['vnfd'][0] @@ -45,17 +45,17 @@ class TestPortPairs(unittest.TestCase): port_pairs = PortPairs(interfaces) self.assertEqual(set(port_pairs.all_ports), {"xe0", "xe1"}) - def test_priv_ports(self): + def test_uplink_ports(self): vnfd = TestMultiPortConfig.VNFD['vnfd:vnfd-catalog']['vnfd'][0] interfaces = vnfd['vdu'][0]['external-interface'] port_pairs = PortPairs(interfaces) - self.assertEqual(port_pairs.priv_ports, ["xe0"]) + self.assertEqual(port_pairs.uplink_ports, ["xe0"]) - def test_pub_ports(self): + def test_downlink_ports(self): vnfd = TestMultiPortConfig.VNFD['vnfd:vnfd-catalog']['vnfd'][0] interfaces = vnfd['vdu'][0]['external-interface'] port_pairs = PortPairs(interfaces) - self.assertEqual(port_pairs.pub_ports, ["xe1"]) + self.assertEqual(port_pairs.downlink_ports, ["xe1"]) class TestMultiPortConfig(unittest.TestCase): @@ -99,7 +99,7 @@ class TestMultiPortConfig(unittest.TestCase): 'ifname': 'xe0', 'local_iface_name': 'eth0', 'local_mac': '00:00:00:00:00:02', - 'vld_id': 'private_0', + 'vld_id': 'uplink_0', }, 'vnfd-connection-point-ref': 'xe0', 'name': 'xe0'}, @@ -117,7 +117,7 @@ class TestMultiPortConfig(unittest.TestCase): 'ifname': 'xe1', 'local_iface_name': 'eth1', 'local_mac': '00:00:00:00:00:01', - 'vld_id': 'public_0', + 'vld_id': 'downlink_0', }, 'vnfd-connection-point-ref': 'xe1', 'name': 'xe1'} diff --git a/tests/unit/network_services/libs/ixia_libs/test_IxNet.py b/tests/unit/network_services/libs/ixia_libs/test_IxNet.py index ea2f9c3d9..0c82d74a8 100644 --- a/tests/unit/network_services/libs/ixia_libs/test_IxNet.py +++ b/tests/unit/network_services/libs/ixia_libs/test_IxNet.py @@ -26,6 +26,9 @@ from yardstick.network_services.libs.ixia_libs.IxNet.IxNet import IP_VERSION_4 from yardstick.network_services.libs.ixia_libs.IxNet.IxNet import IP_VERSION_6 +UPLINK = "uplink" +DOWNLINK = "downlink" + class TestIxNextgen(unittest.TestCase): def test___init__(self): @@ -97,7 +100,7 @@ class TestIxNextgen(unittest.TestCase): def test_ix_update_frame(self): static_traffic_params = { - "private": { + UPLINK: { "id": 1, "bidir": "False", "duration": 60, @@ -139,7 +142,7 @@ class TestIxNextgen(unittest.TestCase): }, "traffic_type": "continuous" }, - "public": { + DOWNLINK: { "id": 2, "bidir": "False", "duration": 60, @@ -268,7 +271,7 @@ class TestIxNextgen(unittest.TestCase): def test_add_ip_header_v4(self): static_traffic_params = { - "private_0": { + "uplink_0": { "id": 1, "bidir": "False", "duration": 60, @@ -308,7 +311,7 @@ class TestIxNextgen(unittest.TestCase): }, "traffic_type": "continuous" }, - "public_0": { + "downlink_0": { "id": 2, "bidir": "False", "duration": 60, @@ -366,7 +369,7 @@ class TestIxNextgen(unittest.TestCase): def test_add_ip_header_v4_nothing_to_do(self): static_traffic_params = { - "private_0": { + "uplink_0": { "id": 1, "bidir": "False", "duration": 60, @@ -406,7 +409,7 @@ class TestIxNextgen(unittest.TestCase): }, "traffic_type": "continuous" }, - "public_0": { + "downlink_0": { "id": 2, "bidir": "False", "duration": 60, @@ -464,7 +467,7 @@ class TestIxNextgen(unittest.TestCase): def test_add_ip_header_v6(self): static_traffic_profile = { - "private_0": { + "uplink_0": { "id": 1, "bidir": "False", "duration": 60, @@ -497,7 +500,7 @@ class TestIxNextgen(unittest.TestCase): }, "traffic_type": "continuous" }, - "public_0": { + "downlink_0": { "id": 2, "bidir": "False", "duration": 60, @@ -547,7 +550,7 @@ class TestIxNextgen(unittest.TestCase): def test_add_ip_header_v6_nothing_to_do(self): static_traffic_params = { - "private_0": { + "uplink_0": { "id": 1, "bidir": "False", "duration": 60, @@ -579,7 +582,7 @@ class TestIxNextgen(unittest.TestCase): }, "traffic_type": "continuous" }, - "public_0": { + "downlink_0": { "id": 2, "bidir": "False", "duration": 60, @@ -684,7 +687,7 @@ class TestIxNextgen(unittest.TestCase): def test_ix_update_ether(self): static_traffic_params = { - "private_0": { + "uplink_0": { "id": 1, "bidir": "False", "duration": 60, @@ -723,7 +726,7 @@ class TestIxNextgen(unittest.TestCase): }, "traffic_type": "continuous" }, - "public_0": { + "downlink_0": { "id": 2, "bidir": "False", "duration": 60, @@ -787,7 +790,7 @@ class TestIxNextgen(unittest.TestCase): def test_ix_update_ether_nothing_to_do(self): static_traffic_params = { - "private_0": { + "uplink_0": { "id": 1, "bidir": "False", "duration": 60, @@ -820,7 +823,7 @@ class TestIxNextgen(unittest.TestCase): }, "traffic_type": "continuous" }, - "public_0": { + "downlink_0": { "id": 2, "bidir": "False", "duration": 60, diff --git a/tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py b/tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py index 656623624..6fffb9ede 100644 --- a/tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py +++ b/tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py @@ -54,7 +54,7 @@ class TestIXIARFC2544Profile(unittest.TestCase): 'name': 'rfc2544', 'traffic_profile': {'traffic_type': 'IXIARFC2544Profile', 'frame_rate': 100}, - 'public': {'ipv4': + IXIARFC2544Profile.DOWNLINK: {'ipv4': {'outer_l2': {'framesize': {'64B': '100', '1518B': '0', '128B': '0', '1400B': '0', @@ -66,7 +66,7 @@ class TestIXIARFC2544Profile(unittest.TestCase): 'dscp': 0, 'ttl': 32}, 'outer_l4': {'srcport': '2001', 'dsrport': '1234'}}}, - 'private': {'ipv4': + IXIARFC2544Profile.UPLINK: {'ipv4': {'outer_l2': {'framesize': {'64B': '100', '1518B': '0', '128B': '0', '1400B': '0', @@ -83,12 +83,12 @@ class TestIXIARFC2544Profile(unittest.TestCase): def test_get_ixia_traffic_profile_error(self): traffic_generator = mock.Mock(autospec=TrexProfile) traffic_generator.my_ports = [0, 1] - traffic_generator.priv_ports = [-1] - traffic_generator.pub_ports = [1] + traffic_generator.uplink_ports = [-1] + traffic_generator.downlink_ports = [1] traffic_generator.client = \ mock.Mock(return_value=True) STATIC_TRAFFIC = { - "private": { + IXIARFC2544Profile.UPLINK: { "id": 1, "bidir": "False", "duration": 60, @@ -127,7 +127,7 @@ class TestIXIARFC2544Profile(unittest.TestCase): }, "traffic_type": "continuous" }, - "public": { + IXIARFC2544Profile.DOWNLINK: { "id": 2, "bidir": "False", "duration": 60, @@ -187,12 +187,12 @@ class TestIXIARFC2544Profile(unittest.TestCase): def test_get_ixia_traffic_profile(self, mock_open): traffic_generator = mock.Mock(autospec=TrexProfile) traffic_generator.my_ports = [0, 1] - traffic_generator.priv_ports = [-1] - traffic_generator.pub_ports = [1] + traffic_generator.uplink_ports = [-1] + traffic_generator.downlink_ports = [1] traffic_generator.client = \ mock.Mock(return_value=True) STATIC_TRAFFIC = { - "private": { + IXIARFC2544Profile.UPLINK: { "id": 1, "bidir": "False", "duration": 60, @@ -234,7 +234,7 @@ class TestIXIARFC2544Profile(unittest.TestCase): }, "traffic_type": "continuous" }, - "public": { + IXIARFC2544Profile.DOWNLINK: { "id": 2, "bidir": "False", "duration": 60, @@ -297,12 +297,12 @@ class TestIXIARFC2544Profile(unittest.TestCase): def test_get_ixia_traffic_profile_v6(self, mock_open): traffic_generator = mock.Mock(autospec=TrexProfile) traffic_generator.my_ports = [0, 1] - traffic_generator.priv_ports = [-1] - traffic_generator.pub_ports = [1] + traffic_generator.uplink_ports = [-1] + traffic_generator.downlink_ports = [1] traffic_generator.client = \ mock.Mock(return_value=True) STATIC_TRAFFIC = { - "private": { + IXIARFC2544Profile.UPLINK: { "id": 1, "bidir": "False", "duration": 60, @@ -341,7 +341,7 @@ class TestIXIARFC2544Profile(unittest.TestCase): }, "traffic_type": "continuous" }, - "public": { + IXIARFC2544Profile.DOWNLINK: { "id": 2, "bidir": "False", "duration": 60, @@ -398,7 +398,7 @@ class TestIXIARFC2544Profile(unittest.TestCase): 'traffic_profile': {'traffic_type': 'IXIARFC2544Profile', 'frame_rate': 100}, - 'public': + IXIARFC2544Profile.DOWNLINK: {'ipv4': {'outer_l2': {'framesize': {'64B': '100', '1518B': '0', @@ -415,7 +415,7 @@ class TestIXIARFC2544Profile(unittest.TestCase): 'dscp': 0, 'ttl': 32}, 'outer_l4': {'srcport': '2001', 'dsrport': '1234'}}}, - 'private': {'ipv4': + IXIARFC2544Profile.UPLINK: {'ipv4': {'outer_l2': {'framesize': {'64B': '100', '1518B': '0', '128B': '0', '1400B': '0', @@ -449,13 +449,13 @@ class TestIXIARFC2544Profile(unittest.TestCase): def test__ixia_traffic_generate(self): traffic_generator = mock.Mock(autospec=TrexProfile) traffic_generator.networks = { - "private_0": ["xe0"], - "public_0": ["xe1"], + "uplink_0": ["xe0"], + "downlink_0": ["xe1"], } traffic_generator.client = \ mock.Mock(return_value=True) - traffic = {"public": {'iload': 10}, - "private": {'iload': 10}} + traffic = {IXIARFC2544Profile.DOWNLINK: {'iload': 10}, + IXIARFC2544Profile.UPLINK: {'iload': 10}} ixia_obj = mock.MagicMock() r_f_c2544_profile = IXIARFC2544Profile(self.TRAFFIC_PROFILE) r_f_c2544_profile.rate = 100 @@ -466,15 +466,15 @@ class TestIXIARFC2544Profile(unittest.TestCase): def test_execute(self): traffic_generator = mock.Mock(autospec=TrexProfile) traffic_generator.networks = { - "private_0": ["xe0"], - "public_0": ["xe1"], + "uplink_0": ["xe0"], + "downlink_0": ["xe1"], } traffic_generator.client = \ mock.Mock(return_value=True) r_f_c2544_profile = IXIARFC2544Profile(self.TRAFFIC_PROFILE) r_f_c2544_profile.first_run = True - r_f_c2544_profile.params = {"public": {'iload': 10}, - "private": {'iload': 10}} + r_f_c2544_profile.params = {IXIARFC2544Profile.DOWNLINK: {'iload': 10}, + IXIARFC2544Profile.UPLINK: {'iload': 10}} r_f_c2544_profile.get_streams = mock.Mock() r_f_c2544_profile.full_profile = {} @@ -487,9 +487,9 @@ class TestIXIARFC2544Profile(unittest.TestCase): def test_update_traffic_profile(self): traffic_generator = mock.Mock(autospec=TrexProfile) traffic_generator.networks = { - "private_0": ["xe0"], # private, one value for intfs - "public_0": ["xe1", "xe2"], # public, two values for intfs - "public_1": ["xe3"], # not in TRAFFIC PROFILE + "uplink_0": ["xe0"], # private, one value for intfs + "downlink_0": ["xe1", "xe2"], # public, two values for intfs + "downlink_1": ["xe3"], # not in TRAFFIC PROFILE "tenant_0": ["xe4"], # not public or private } @@ -499,8 +499,8 @@ class TestIXIARFC2544Profile(unittest.TestCase): traffic_profile = deepcopy(self.TRAFFIC_PROFILE) traffic_profile.update({ - "private_0": ["xe0"], - "public_0": ["xe1", "xe2"], + "uplink_0": ["xe0"], + "downlink_0": ["xe1", "xe2"], }) r_f_c2544_profile = IXIARFC2544Profile(traffic_profile) @@ -513,8 +513,8 @@ class TestIXIARFC2544Profile(unittest.TestCase): def test_get_drop_percentage(self): traffic_generator = mock.Mock(autospec=TrexProfile) traffic_generator.networks = { - "private_0": ["xe0"], - "public_0": ["xe1"], + "uplink_0": ["xe0"], + "downlink_0": ["xe1"], } traffic_generator.client = \ mock.Mock(return_value=True) @@ -548,8 +548,8 @@ class TestIXIARFC2544Profile(unittest.TestCase): def test_get_drop_percentage_update(self): traffic_generator = mock.Mock(autospec=TrexProfile) traffic_generator.my_ports = [0, 1] - traffic_generator.priv_ports = [0] - traffic_generator.pub_ports = [1] + traffic_generator.uplink_ports = [0] + traffic_generator.downlink_ports = [1] traffic_generator.client = \ mock.Mock(return_value=True) r_f_c2544_profile = IXIARFC2544Profile(self.TRAFFIC_PROFILE) @@ -582,8 +582,8 @@ class TestIXIARFC2544Profile(unittest.TestCase): def test_get_drop_percentage_div_zero(self): traffic_generator = mock.Mock(autospec=TrexProfile) traffic_generator.my_ports = [0, 1] - traffic_generator.priv_ports = [0] - traffic_generator.pub_ports = [1] + traffic_generator.uplink_ports = [0] + traffic_generator.downlink_ports = [1] traffic_generator.client = \ mock.Mock(return_value=True) r_f_c2544_profile = IXIARFC2544Profile(self.TRAFFIC_PROFILE) @@ -623,8 +623,8 @@ class TestIXIARFC2544Profile(unittest.TestCase): def test_start_ixia_latency(self): traffic_generator = mock.Mock(autospec=TrexProfile) traffic_generator.networks = { - "private_0": ["xe0"], - "public_0": ["xe1"], + "uplink_0": ["xe0"], + "downlink_0": ["xe1"], } traffic_generator.client = \ mock.Mock(return_value=True) diff --git a/tests/unit/network_services/traffic_profile/test_rfc2544.py b/tests/unit/network_services/traffic_profile/test_rfc2544.py index 2366b8124..221233710 100644 --- a/tests/unit/network_services/traffic_profile/test_rfc2544.py +++ b/tests/unit/network_services/traffic_profile/test_rfc2544.py @@ -50,7 +50,7 @@ class TestRFC2544Profile(unittest.TestCase): 'name': 'rfc2544', 'traffic_profile': {'traffic_type': 'RFC2544Profile', 'frame_rate': 100}, - 'public_0': {'ipv4': + 'downlink_0': {'ipv4': {'outer_l2': {'framesize': {'64B': '100', '1518B': '0', '128B': '0', '1400B': '0', @@ -62,7 +62,7 @@ class TestRFC2544Profile(unittest.TestCase): 'dscp': 0, 'ttl': 32, 'count': 1}, 'outer_l4': {'srcport': '2001', 'dsrport': '1234', 'count': 1}}}, - 'private_0': {'ipv4': + 'uplink_0': {'ipv4': {'outer_l2': {'framesize': {'64B': '100', '1518B': '0', '128B': '0', '1400B': '0', @@ -83,8 +83,8 @@ class TestRFC2544Profile(unittest.TestCase): def test_execute(self): traffic_generator = mock.Mock(autospec=TrexProfile) traffic_generator.networks = { - "private_0": ["xe0"], - "public_0": ["xe1"], + "uplink_0": ["xe0"], + "downlink_0": ["xe1"], } traffic_generator.client = \ mock.Mock(return_value=True) @@ -96,8 +96,8 @@ class TestRFC2544Profile(unittest.TestCase): def test_get_drop_percentage(self): traffic_generator = mock.Mock(autospec=TrexProfile) traffic_generator.networks = { - "private_0": ["xe0"], - "public_0": ["xe1"], + "uplink_0": ["xe0"], + "downlink_0": ["xe1"], } traffic_generator.client = mock.Mock(return_value=True) @@ -143,8 +143,8 @@ class TestRFC2544Profile(unittest.TestCase): def test_get_drop_percentage_update(self): traffic_generator = mock.Mock(autospec=RFC2544Profile) traffic_generator.networks = { - "private_0": ["xe0"], - "public_0": ["xe1"], + "uplink_0": ["xe0"], + "downlink_0": ["xe1"], } traffic_generator.client = mock.Mock(return_value=True) @@ -191,8 +191,8 @@ class TestRFC2544Profile(unittest.TestCase): def test_get_drop_percentage_div_zero(self): traffic_generator = mock.Mock(autospec=TrexProfile) traffic_generator.networks = { - "private_0": ["xe0"], - "public_0": ["xe1"], + "uplink_0": ["xe0"], + "downlink_0": ["xe1"], } traffic_generator.client = \ mock.Mock(return_value=True) diff --git a/tests/unit/network_services/traffic_profile/test_traffic_profile.py b/tests/unit/network_services/traffic_profile/test_traffic_profile.py index e0b0ce85c..8355c85b6 100644 --- a/tests/unit/network_services/traffic_profile/test_traffic_profile.py +++ b/tests/unit/network_services/traffic_profile/test_traffic_profile.py @@ -60,24 +60,24 @@ class TestTrexProfile(unittest.TestCase): 'name': 'rfc2544', 'traffic_profile': {'traffic_type': 'RFC2544Profile', 'frame_rate': 100}, - 'public': {'ipv4': {'outer_l2': {'framesize': {'64B': '100', + TrafficProfile.DOWNLINK: {'ipv4': {'outer_l2': {'framesize': {'64B': '100', '1518B': '0', '128B': '0', '1400B': '0', '256B': '0', '373b': '0', '570B': '0'}, - "srcmac": "00:00:00:00:00:02", - "dstmac": "00:00:00:00:00:01"}, - 'outer_l3v4': {'dstip4': '1.1.1.1-1.1.2.2', + "srcmac": "00:00:00:00:00:02", + "dstmac": "00:00:00:00:00:01"}, + 'outer_l3v4': {'dstip4': '1.1.1.1-1.1.2.2', 'proto': 'udp', 'srcip4': '9.9.1.1-90.1.2.2', 'dscp': 0, 'ttl': 32, 'count': 1}, - 'outer_l4': {'srcport': '2001', + 'outer_l4': {'srcport': '2001', 'dsrport': '1234', 'count': 1}}}, - 'private': {'ipv4': + TrafficProfile.UPLINK: {'ipv4': {'outer_l2': {'framesize': {'64B': '100', '1518B': '0', '128B': '0', '1400B': '0', @@ -97,22 +97,22 @@ class TestTrexProfile(unittest.TestCase): 'name': 'rfc2544', 'traffic_profile': {'traffic_type': 'RFC2544Profile', 'frame_rate': 100}, - 'public': {'ipv6': {'outer_l2': {'framesize': + TrafficProfile.DOWNLINK: {'ipv6': {'outer_l2': {'framesize': {'64B': '100', '1518B': '0', '128B': '0', '1400B': '0', '256B': '0', '373b': '0', '570B': '0'}, "srcmac": "00:00:00:00:00:02", "dstmac": "00:00:00:00:00:01"}, - 'outer_l3v4': {'dstip6': '0064:ff9b:0:0:0:0:9810:6414-0064:ff9b:0:0:0:0:9810:6420', + 'outer_l3v4': {'dstip6': '0064:ff9b:0:0:0:0:9810:6414-0064:ff9b:0:0:0:0:9810:6420', 'proto': 'udp', 'srcip6': '0064:ff9b:0:0:0:0:9810:2814-0064:ff9b:0:0:0:0:9810:2820', 'dscp': 0, 'ttl': 32, 'count': 1}, - 'outer_l4': {'srcport': '2001', + 'outer_l4': {'srcport': '2001', 'dsrport': '1234', 'count': 1}}}, - 'private': + TrafficProfile.UPLINK: {'ipv6': {'outer_l2': {'framesize': {'64B': '100', '1518B': '0', '128B': '0', '1400B': '0', @@ -153,21 +153,21 @@ class TestTrexProfile(unittest.TestCase): TrexProfile(TrafficProfile) qinq = {"S-VLAN": {"id": 128, "priority": 0, "cfi": 0}, "C-VLAN": {"id": 512, "priority": 0, "cfi": 0}} - outer_l2 = self.PROFILE['private']['ipv4']['outer_l2'] + outer_l2 = self.PROFILE[TrafficProfile.UPLINK]['ipv4']['outer_l2'] outer_l2['QinQ'] = qinq self.assertEqual(None, trex_profile._set_outer_l2_fields(outer_l2)) def test__set_outer_l3v4_fields(self): trex_profile = \ TrexProfile(TrafficProfile) - outer_l3v4 = self.PROFILE['private']['ipv4']['outer_l3v4'] + outer_l3v4 = self.PROFILE[TrafficProfile.UPLINK]['ipv4']['outer_l3v4'] outer_l3v4['proto'] = 'tcp' self.assertEqual(None, trex_profile._set_outer_l3v4_fields(outer_l3v4)) def test__set_outer_l3v6_fields(self): trex_profile = \ TrexProfile(TrafficProfile) - outer_l3v6 = self.PROFILE_v6['private']['ipv6']['outer_l3v4'] + outer_l3v6 = self.PROFILE_v6[TrafficProfile.UPLINK]['ipv6']['outer_l3v4'] outer_l3v6['proto'] = 'tcp' outer_l3v6['tc'] = 1 outer_l3v6['hlim'] = 10 @@ -176,19 +176,19 @@ class TestTrexProfile(unittest.TestCase): def test__set_outer_l4_fields(self): trex_profile = \ TrexProfile(TrafficProfile) - outer_l4 = self.PROFILE['private']['ipv4']['outer_l4'] + outer_l4 = self.PROFILE[TrafficProfile.UPLINK]['ipv4']['outer_l4'] self.assertEqual(None, trex_profile._set_outer_l4_fields(outer_l4)) def test_get_streams(self): trex_profile = \ TrexProfile(TrafficProfile) trex_profile.params = self.PROFILE - profile_data = self.PROFILE["private"] + profile_data = self.PROFILE[TrafficProfile.UPLINK] self.assertIsNotNone(trex_profile.get_streams(profile_data)) trex_profile.pg_id = 1 self.assertIsNotNone(trex_profile.get_streams(profile_data)) trex_profile.params = self.PROFILE_v6 - trex_profile.profile_data = self.PROFILE_v6["private"] + trex_profile.profile_data = self.PROFILE_v6[TrafficProfile.UPLINK] self.assertIsNotNone(trex_profile.get_streams(profile_data)) trex_profile.pg_id = 1 self.assertIsNotNone(trex_profile.get_streams(profile_data)) diff --git a/tests/unit/network_services/vnf_generic/test_vnfdgen.py b/tests/unit/network_services/vnf_generic/test_vnfdgen.py index c2b923568..ee881c963 100644 --- a/tests/unit/network_services/vnf_generic/test_vnfdgen.py +++ b/tests/unit/network_services/vnf_generic/test_vnfdgen.py @@ -24,6 +24,10 @@ from six.moves import range from yardstick.common.yaml_loader import yaml_load from yardstick.network_services.vnf_generic import vnfdgen + +UPLINK = "uplink" +DOWNLINK = "downlink" + TREX_VNFD_TEMPLATE = """ vnfd:vnfd-catalog: vnfd: @@ -183,22 +187,23 @@ NODE_CFG = {'ip': '1.1.1.1', } +# need to template, but can't use {} so use %s TRAFFIC_PROFILE_TPL = """ -private: +%(0)s: - ipv4: outer_l2: framesize: - 64B: "{{ get(imix, 'private.imix_small', 10) }}" - 128B: "{{ get(imix, 'private.imix_128B', 10) }}" - 256B: "{{ get(imix, 'private.imix_256B', 10) }}" - 373B: "{{ get(imix, 'private.imix_373B', 10) }}" - 570B: "{{get(imix, 'private.imix_570B', 10) }}" - 1400B: "{{get(imix, 'private.imix_1400B', 10) }}" - 1518B: "{{get(imix, 'private.imix_1500B', 40) }}" -""" + 64B: "{{ get(imix, '%(0)s.imix_small', 10) }}" + 128B: "{{ get(imix, '%(0)s.imix_128B', 10) }}" + 256B: "{{ get(imix, '%(0)s.imix_256B', 10) }}" + 373B: "{{ get(imix, '%(0)s.imix_373B', 10) }}" + 570B: "{{get(imix, '%(0)s.imix_570B', 10) }}" + 1400B: "{{get(imix, '%(0)s.imix_1400B', 10) }}" + 1518B: "{{get(imix, '%(0)s.imix_1500B', 40) }}" +""" % {"0": UPLINK} TRAFFIC_PROFILE = { - "private": [{"ipv4": {"outer_l2": + UPLINK: [{"ipv4": {"outer_l2": {"framesize": {"64B": '10', "128B": '10', "256B": '10', "373B": '10', "570B": '10', "1400B": '10', @@ -269,8 +274,8 @@ class TestVnfdGen(unittest.TestCase): generated_tp = \ vnfdgen.generate_vnfd(TRAFFIC_PROFILE_TPL, - {"imix": {"private": {"imix_small": '20'}}}) + {"imix": {UPLINK: {"imix_small": '20'}}}) self.maxDiff = None tp2 = dict(TRAFFIC_PROFILE) - tp2["private"][0]["ipv4"]["outer_l2"]["framesize"]["64B"] = '20' + tp2[UPLINK][0]["ipv4"]["outer_l2"]["framesize"]["64B"] = '20' self.assertDictEqual(tp2, generated_tp) diff --git a/tests/unit/network_services/vnf_generic/vnf/test_acl_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_acl_vnf.py index f47da3729..e9444b493 100644 --- a/tests/unit/network_services/vnf_generic/vnf/test_acl_vnf.py +++ b/tests/unit/network_services/vnf_generic/vnf/test_acl_vnf.py @@ -144,7 +144,7 @@ class TestAclApproxVnf(unittest.TestCase): 'ip': '1.2.1.1', 'interfaces': {'xe0': {'local_iface_name': 'ens513f0', - 'vld_id': 'public', + 'vld_id': AclApproxVnf.DOWNLINK, 'netmask': '255.255.255.0', 'local_ip': '152.16.40.20', 'dst_mac': '00:00:00:00:00:01', @@ -172,7 +172,7 @@ class TestAclApproxVnf(unittest.TestCase): 'ip': '1.2.1.1', 'interfaces': {'xe0': {'local_iface_name': 'ens785f0', - 'vld_id': 'private', + 'vld_id': AclApproxVnf.UPLINK, 'netmask': '255.255.255.0', 'local_ip': '152.16.100.20', 'dst_mac': '00:00:00:00:00:02', @@ -197,7 +197,7 @@ class TestAclApproxVnf(unittest.TestCase): 'ip': '1.2.1.1', 'interfaces': {'xe0': {'local_iface_name': 'ens786f0', - 'vld_id': 'private', + 'vld_id': AclApproxVnf.UPLINK, 'netmask': '255.255.255.0', 'local_ip': '152.16.100.19', 'dst_mac': '00:00:00:00:00:04', @@ -207,7 +207,7 @@ class TestAclApproxVnf(unittest.TestCase): 'vpci': '0000:05:00.0', 'dpdk_port_num': 0}, 'xe1': {'local_iface_name': 'ens786f1', - 'vld_id': 'public', + 'vld_id': AclApproxVnf.DOWNLINK, 'netmask': '255.255.255.0', 'local_ip': '152.16.40.19', 'dst_mac': '00:00:00:00:00:03', diff --git a/tests/unit/network_services/vnf_generic/vnf/test_cgnapt_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_cgnapt_vnf.py index c21beabfc..76f2d5b5d 100644 --- a/tests/unit/network_services/vnf_generic/vnf/test_cgnapt_vnf.py +++ b/tests/unit/network_services/vnf_generic/vnf/test_cgnapt_vnf.py @@ -73,7 +73,7 @@ link 1 up def test__get_cgnapt_config(self): vnfd_helper = mock.Mock() - vnfd_helper.port_pairs.priv_ports = [{"name": 'a'}, {"name": "b"}, {"name": "c"}] + vnfd_helper.port_pairs.uplink_ports = [{"name": 'a'}, {"name": "b"}, {"name": "c"}] helper = CgnaptApproxSetupEnvHelper(vnfd_helper, mock.Mock(), mock.Mock()) helper._get_ports_gateway = mock.Mock(side_effect=[3, 5, 2]) @@ -206,7 +206,7 @@ class TestCgnaptApproxVnf(unittest.TestCase): 'ip': '1.2.1.1', 'interfaces': {'xe0': {'local_iface_name': 'ens513f0', - 'vld_id': 'public', + 'vld_id': CgnaptApproxVnf.DOWNLINK, 'netmask': '255.255.255.0', 'local_ip': '152.16.40.20', 'dst_mac': '00:00:00:00:00:01', @@ -234,7 +234,7 @@ class TestCgnaptApproxVnf(unittest.TestCase): 'ip': '1.2.1.1', 'interfaces': {'xe0': {'local_iface_name': 'ens785f0', - 'vld_id': 'private', + 'vld_id': CgnaptApproxVnf.UPLINK, 'netmask': '255.255.255.0', 'local_ip': '152.16.100.20', 'dst_mac': '00:00:00:00:00:02', @@ -259,7 +259,7 @@ class TestCgnaptApproxVnf(unittest.TestCase): 'ip': '1.2.1.1', 'interfaces': {'xe0': {'local_iface_name': 'ens786f0', - 'vld_id': 'private', + 'vld_id': CgnaptApproxVnf.UPLINK, 'netmask': '255.255.255.0', 'local_ip': '152.16.100.19', 'dst_mac': '00:00:00:00:00:04', @@ -269,7 +269,7 @@ class TestCgnaptApproxVnf(unittest.TestCase): 'vpci': '0000:05:00.0', 'dpdk_port_num': 0}, 'xe1': {'local_iface_name': 'ens786f1', - 'vld_id': 'public', + 'vld_id': CgnaptApproxVnf.DOWNLINK, 'netmask': '255.255.255.0', 'local_ip': '152.16.40.19', 'dst_mac': '00:00:00:00:00:03', diff --git a/tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py b/tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py index 821c10f64..8d21fbb28 100644 --- a/tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py +++ b/tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py @@ -679,7 +679,7 @@ class TestProxDpdkVnfSetupEnvHelper(unittest.TestCase): 'vpci': '0000:05:00.0', 'local_ip': '152.16.100.19', 'type': 'PCI-PASSTHROUGH', - 'vld_id': 'private_0', + 'vld_id': 'uplink_0', 'netmask': '255.255.255.0', 'dpdk_port_num': 0, 'bandwidth': '10 Gbps', @@ -698,7 +698,7 @@ class TestProxDpdkVnfSetupEnvHelper(unittest.TestCase): 'vpci': '0000:05:00.1', 'local_ip': '152.16.40.19', 'type': 'PCI-PASSTHROUGH', - 'vld_id': 'public_0', + 'vld_id': 'downlink_0', 'driver': "i40e", 'netmask': '255.255.255.0', 'dpdk_port_num': 1, @@ -1281,7 +1281,7 @@ class TestProxResourceHelper(unittest.TestCase): 'vpci': '0000:05:00.0', 'local_ip': '152.16.100.19', 'type': 'PCI-PASSTHROUGH', - 'vld_id': 'private_0', + 'vld_id': 'uplink_0', 'netmask': '255.255.255.0', 'dpdk_port_num': 0, 'bandwidth': '10 Gbps', @@ -1300,7 +1300,7 @@ class TestProxResourceHelper(unittest.TestCase): 'vpci': '0000:05:00.1', 'local_ip': '152.16.40.19', 'type': 'PCI-PASSTHROUGH', - 'vld_id': 'public_0', + 'vld_id': 'downlink_0', 'driver': "i40e", 'netmask': '255.255.255.0', 'dpdk_port_num': 1, @@ -1755,7 +1755,7 @@ class TestProxResourceHelper(unittest.TestCase): 'vpci': '0000:06:00.0', 'local_ip': '152.16.100.20', 'type': 'PCI-PASSTHROUGH', - 'vld_id': 'private_1', + 'vld_id': 'uplink_1', 'netmask': '255.255.255.0', 'dpdk_port_num': 0, 'bandwidth': '10 Gbps', diff --git a/tests/unit/network_services/vnf_generic/vnf/test_prox_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_prox_vnf.py index 2e83cafc1..d1f7f05d8 100644 --- a/tests/unit/network_services/vnf_generic/vnf/test_prox_vnf.py +++ b/tests/unit/network_services/vnf_generic/vnf/test_prox_vnf.py @@ -187,7 +187,7 @@ class TestProxApproxVnf(unittest.TestCase): 'interfaces': { 'xe0': { 'local_iface_name': 'ens513f0', - 'vld_id': 'public', + 'vld_id': ProxApproxVnf.DOWNLINK, 'netmask': '255.255.255.0', 'local_ip': '152.16.40.20', 'dst_mac': '00:00:00:00:00:01', @@ -221,7 +221,7 @@ class TestProxApproxVnf(unittest.TestCase): 'interfaces': { 'xe0': { 'local_iface_name': 'ens785f0', - 'vld_id': 'private', + 'vld_id': ProxApproxVnf.UPLINK, 'netmask': '255.255.255.0', 'local_ip': '152.16.100.20', 'dst_mac': '00:00:00:00:00:02', @@ -252,7 +252,7 @@ class TestProxApproxVnf(unittest.TestCase): 'interfaces': { 'xe0': { 'local_iface_name': 'ens786f0', - 'vld_id': 'private', + 'vld_id': ProxApproxVnf.UPLINK, 'netmask': '255.255.255.0', 'local_ip': '152.16.100.19', 'dst_mac': '00:00:00:00:00:04', @@ -264,7 +264,7 @@ class TestProxApproxVnf(unittest.TestCase): }, 'xe1': { 'local_iface_name': 'ens786f1', - 'vld_id': 'public', + 'vld_id': ProxApproxVnf.DOWNLINK, 'netmask': '255.255.255.0', 'local_ip': '152.16.40.19', 'dst_mac': '00:00:00:00:00:03', diff --git a/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py index fa733489c..4b9f4172e 100644 --- a/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py +++ b/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py @@ -102,7 +102,7 @@ class TestVnfSshHelper(unittest.TestCase): 'bandwidth': '10 Gbps', 'dst_ip': '152.16.100.20', 'local_mac': '00:00:00:00:00:01', - 'vld_id': 'private_0', + 'vld_id': 'uplink_0', 'ifname': 'xe0', }, 'vnfd-connection-point-ref': 'xe0', @@ -119,7 +119,7 @@ class TestVnfSshHelper(unittest.TestCase): 'bandwidth': '10 Gbps', 'dst_ip': '152.16.40.20', 'local_mac': '00:00:00:00:00:02', - 'vld_id': 'public_0', + 'vld_id': 'downlink_0', 'ifname': 'xe1', }, 'vnfd-connection-point-ref': 'xe1', @@ -300,7 +300,7 @@ class TestSetupEnvHelper(unittest.TestCase): 'bandwidth': '10 Gbps', 'dst_ip': '152.16.100.20', 'local_mac': '00:00:00:00:00:01', - 'vld_id': 'private_0', + 'vld_id': 'uplink_0', 'ifname': 'xe0', }, 'vnfd-connection-point-ref': 'xe0', @@ -317,7 +317,7 @@ class TestSetupEnvHelper(unittest.TestCase): 'bandwidth': '10 Gbps', 'dst_ip': '152.16.40.20', 'local_mac': '00:00:00:00:00:02', - 'vld_id': 'public_0', + 'vld_id': 'downlink_0', 'ifname': 'xe1', }, 'vnfd-connection-point-ref': 'xe1', @@ -430,7 +430,7 @@ class TestDpdkVnfSetupEnvHelper(unittest.TestCase): 'bandwidth': '10 Gbps', 'dst_ip': '152.16.100.20', 'local_mac': '00:00:00:00:00:01', - 'vld_id': 'private_0', + 'vld_id': 'uplink_0', 'ifname': 'xe0', }, 'vnfd-connection-point-ref': 'xe0', @@ -448,7 +448,7 @@ class TestDpdkVnfSetupEnvHelper(unittest.TestCase): 'bandwidth': '10 Gbps', 'dst_ip': '152.16.40.20', 'local_mac': '00:00:00:00:00:02', - 'vld_id': 'public_0', + 'vld_id': 'downlink_0', 'ifname': 'xe1', }, 'vnfd-connection-point-ref': 'xe1', @@ -1029,7 +1029,7 @@ class TestClientResourceHelper(unittest.TestCase): 'bandwidth': '10 Gbps', 'dst_ip': '152.16.100.20', 'local_mac': '00:00:00:00:00:01', - 'vld_id': 'private_0', + 'vld_id': 'uplink_0', 'ifname': 'xe0', }, 'vnfd-connection-point-ref': 'xe0', @@ -1047,7 +1047,7 @@ class TestClientResourceHelper(unittest.TestCase): 'bandwidth': '10 Gbps', 'dst_ip': '152.16.40.20', 'local_mac': '00:00:00:00:00:02', - 'vld_id': 'public_0', + 'vld_id': 'downlink_0', 'ifname': 'xe1', }, 'vnfd-connection-point-ref': 'xe1', @@ -1912,8 +1912,8 @@ class TestSampleVnf(unittest.TestCase): self.assertIsNone(sample_vnf._build_ports()) self.assertIsNotNone(sample_vnf.networks) - self.assertIsNotNone(sample_vnf.priv_ports) - self.assertIsNotNone(sample_vnf.pub_ports) + self.assertIsNotNone(sample_vnf.uplink_ports) + self.assertIsNotNone(sample_vnf.downlink_ports) self.assertIsNotNone(sample_vnf.my_ports) @mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.time") diff --git a/tests/unit/network_services/vnf_generic/vnf/test_tg_prox.py b/tests/unit/network_services/vnf_generic/vnf/test_tg_prox.py index d1f24700a..73e1c723f 100644 --- a/tests/unit/network_services/vnf_generic/vnf/test_tg_prox.py +++ b/tests/unit/network_services/vnf_generic/vnf/test_tg_prox.py @@ -180,7 +180,7 @@ class TestProxTrafficGen(unittest.TestCase): 'interfaces': { 'xe0': { 'local_iface_name': 'ens513f0', - 'vld_id': 'public', + 'vld_id': ProxTrafficGen.DOWNLINK, 'netmask': '255.255.255.0', 'local_ip': '152.16.40.20', 'dst_mac': '00:00:00:00:00:01', @@ -214,7 +214,7 @@ class TestProxTrafficGen(unittest.TestCase): 'interfaces': { 'xe0': { 'local_iface_name': 'ens785f0', - 'vld_id': 'private', + 'vld_id': ProxTrafficGen.UPLINK, 'netmask': '255.255.255.0', 'local_ip': '152.16.100.20', 'dst_mac': '00:00:00:00:00:02', @@ -245,7 +245,7 @@ class TestProxTrafficGen(unittest.TestCase): 'interfaces': { 'xe0': { 'local_iface_name': 'ens786f0', - 'vld_id': 'private', + 'vld_id': ProxTrafficGen.UPLINK, 'netmask': '255.255.255.0', 'local_ip': '152.16.100.19', 'dst_mac': '00:00:00:00:00:04', @@ -257,7 +257,7 @@ class TestProxTrafficGen(unittest.TestCase): }, 'xe1': { 'local_iface_name': 'ens786f1', - 'vld_id': 'public', + 'vld_id': ProxTrafficGen.DOWNLINK, 'netmask': '255.255.255.0', 'local_ip': '152.16.40.19', 'dst_mac': '00:00:00:00:00:03', diff --git a/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_trex.py b/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_trex.py index 0fe0c3d45..637706fb4 100644 --- a/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_trex.py +++ b/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_trex.py @@ -100,7 +100,7 @@ class TestTrexTrafficGenRFC(unittest.TestCase): 'local_ip': '152.16.100.19', 'type': 'PCI-PASSTHROUGH', 'netmask': '255.255.255.0', - 'vld_id': 'private_0', + 'vld_id': 'uplink_0', 'dpdk_port_num': 0, 'bandwidth': '10 Gbps', 'driver': "i40e", @@ -120,7 +120,7 @@ class TestTrexTrafficGenRFC(unittest.TestCase): 'type': 'PCI-PASSTHROUGH', 'driver': "i40e", 'netmask': '255.255.255.0', - 'vld_id': 'public_0', + 'vld_id': 'downlink_0', 'dpdk_port_num': 1, 'bandwidth': '10 Gbps', 'dst_ip': '152.16.40.20', diff --git a/tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py b/tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py index 4fd4c4c43..eb9f0525b 100644 --- a/tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py +++ b/tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py @@ -165,7 +165,7 @@ class TestTrexTrafficGen(unittest.TestCase): "interfaces": { "xe0": { "local_iface_name": "ens786f0", - "vld_id": "private", + "vld_id": TrafficProfile.UPLINK, "netmask": "255.255.255.0", "vpci": "0000:05:00.0", "local_ip": "152.16.100.19", @@ -177,7 +177,7 @@ class TestTrexTrafficGen(unittest.TestCase): }, "xe1": { "local_iface_name": "ens786f1", - "vld_id": "public", + "vld_id": TrafficProfile.DOWNLINK, "netmask": "255.255.255.0", "vpci": "0000:05:00.1", "local_ip": "152.16.40.19", @@ -233,7 +233,7 @@ class TestTrexTrafficGen(unittest.TestCase): "interfaces": { "xe0": { "local_iface_name": "ens513f0", - "vld_id": "public", + "vld_id": TrafficProfile.DOWNLINK, "netmask": "255.255.255.0", "vpci": "0000:02:00.0", "local_ip": "152.16.40.20", @@ -267,7 +267,7 @@ class TestTrexTrafficGen(unittest.TestCase): "interfaces": { "xe0": { "local_iface_name": "ens785f0", - "vld_id": "private", + "vld_id": TrafficProfile.UPLINK, "netmask": "255.255.255.0", "vpci": "0000:05:00.0", "local_ip": "152.16.100.20", diff --git a/tests/unit/network_services/vnf_generic/vnf/test_udp_replay.py b/tests/unit/network_services/vnf_generic/vnf/test_udp_replay.py index 95bc08b17..b75ed6764 100644 --- a/tests/unit/network_services/vnf_generic/vnf/test_udp_replay.py +++ b/tests/unit/network_services/vnf_generic/vnf/test_udp_replay.py @@ -78,7 +78,7 @@ class TestUdpReplayApproxVnf(unittest.TestCase): 'netmask': '255.255.255.0', 'dst_ip': '152.16.100.20', 'type': 'PCI-PASSTHROUGH', - 'vld_id': 'private_0', + 'vld_id': 'uplink_0', 'ifname': 'xe0', }, 'vnfd-connection-point-ref': 'xe0', @@ -97,7 +97,7 @@ class TestUdpReplayApproxVnf(unittest.TestCase): 'netmask': '255.255.255.0', 'dst_ip': '152.16.40.20', 'type': 'PCI-PASSTHROUGH', - 'vld_id': 'public_0', + 'vld_id': 'downlink_0', 'ifname': 'xe1', }, 'vnfd-connection-point-ref': 'xe1', @@ -200,7 +200,7 @@ class TestUdpReplayApproxVnf(unittest.TestCase): "interfaces": { "xe0": { "local_iface_name": "ens786f0", - "vld_id": "private", + "vld_id": UdpReplayApproxVnf.UPLINK, "netmask": "255.255.255.0", "vpci": "0000:05:00.0", "local_ip": "152.16.100.19", @@ -212,7 +212,7 @@ class TestUdpReplayApproxVnf(unittest.TestCase): }, "xe1": { "local_iface_name": "ens786f1", - "vld_id": "public", + "vld_id": UdpReplayApproxVnf.DOWNLINK, "netmask": "255.255.255.0", "vpci": "0000:05:00.1", "local_ip": "152.16.40.19", @@ -268,7 +268,7 @@ class TestUdpReplayApproxVnf(unittest.TestCase): "interfaces": { "xe0": { "local_iface_name": "ens513f0", - "vld_id": "public", + "vld_id": UdpReplayApproxVnf.DOWNLINK, "netmask": "255.255.255.0", "vpci": "0000:02:00.0", "local_ip": "152.16.40.20", @@ -302,7 +302,7 @@ class TestUdpReplayApproxVnf(unittest.TestCase): "interfaces": { "xe0": { "local_iface_name": "ens785f0", - "vld_id": "private", + "vld_id": UdpReplayApproxVnf.UPLINK, "netmask": "255.255.255.0", "vpci": "0000:05:00.0", "local_ip": "152.16.100.20", diff --git a/tests/unit/network_services/vnf_generic/vnf/test_vfw_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_vfw_vnf.py index 38cc1774a..958099a03 100644 --- a/tests/unit/network_services/vnf_generic/vnf/test_vfw_vnf.py +++ b/tests/unit/network_services/vnf_generic/vnf/test_vfw_vnf.py @@ -142,7 +142,7 @@ class TestFWApproxVnf(unittest.TestCase): 'ip': '1.2.1.1', 'interfaces': {'xe0': {'local_iface_name': 'ens513f0', - 'vld_id': 'public', + 'vld_id': FWApproxVnf.DOWNLINK, 'netmask': '255.255.255.0', 'local_ip': '152.16.40.20', 'dst_mac': '00:00:00:00:00:01', @@ -170,7 +170,7 @@ class TestFWApproxVnf(unittest.TestCase): 'ip': '1.2.1.1', 'interfaces': {'xe0': {'local_iface_name': 'ens785f0', - 'vld_id': 'private', + 'vld_id': FWApproxVnf.UPLINK, 'netmask': '255.255.255.0', 'local_ip': '152.16.100.20', 'dst_mac': '00:00:00:00:00:02', @@ -195,7 +195,7 @@ class TestFWApproxVnf(unittest.TestCase): 'ip': '1.2.1.1', 'interfaces': {'xe0': {'local_iface_name': 'ens786f0', - 'vld_id': 'private', + 'vld_id': FWApproxVnf.UPLINK, 'netmask': '255.255.255.0', 'local_ip': '152.16.100.19', 'dst_mac': '00:00:00:00:00:04', @@ -205,7 +205,7 @@ class TestFWApproxVnf(unittest.TestCase): 'vpci': '0000:05:00.0', 'dpdk_port_num': 0}, 'xe1': {'local_iface_name': 'ens786f1', - 'vld_id': 'public', + 'vld_id': FWApproxVnf.DOWNLINK, 'netmask': '255.255.255.0', 'local_ip': '152.16.40.19', 'dst_mac': '00:00:00:00:00:03', diff --git a/tests/unit/network_services/vnf_generic/vnf/test_vpe_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_vpe_vnf.py index 62389870b..757109d11 100644 --- a/tests/unit/network_services/vnf_generic/vnf/test_vpe_vnf.py +++ b/tests/unit/network_services/vnf_generic/vnf/test_vpe_vnf.py @@ -57,8 +57,8 @@ class TestConfigCreate(unittest.TestCase): def test___init__(self): config_create = ConfigCreate([0], [1], 2) - self.assertEqual(config_create.priv_ports, [0]) - self.assertEqual(config_create.pub_ports, [1]) + self.assertEqual(config_create.uplink_ports, [0]) + self.assertEqual(config_create.downlink_ports, [1]) self.assertEqual(config_create.socket, 2) def test_vpe_initialize(self): @@ -110,7 +110,7 @@ class TestConfigCreate(unittest.TestCase): self.assertNotEqual(result, '') def test_create_vpe_config(self): - priv_ports = [ + uplink_ports = [ { 'index': 0, 'dpdk_port_num': 1, @@ -121,7 +121,7 @@ class TestConfigCreate(unittest.TestCase): }, ] - pub_ports = [ + downlink_ports = [ { 'index': 2, 'dpdk_port_num': 3, @@ -132,7 +132,7 @@ class TestConfigCreate(unittest.TestCase): }, ] - config_create = ConfigCreate(priv_ports, pub_ports, 23) + config_create = ConfigCreate(uplink_ports, downlink_ports, 23) curr_path = os.path.dirname(os.path.abspath(__file__)) vpe_cfg = "samples/vnf_samples/nsut/vpe/vpe_config" vnf_cfg = os.path.join(curr_path, "../../../../..", vpe_cfg) @@ -192,7 +192,7 @@ class TestVpeApproxVnf(unittest.TestCase): 'dst_ip': '152.16.100.20', 'local_iface_name': 'xe0', 'local_mac': '00:00:00:00:00:02', - 'vld_id': 'private_0', + 'vld_id': 'uplink_0', 'ifname': 'xe0', }, 'vnfd-connection-point-ref': 'xe0', @@ -211,7 +211,7 @@ class TestVpeApproxVnf(unittest.TestCase): 'dst_ip': '152.16.40.20', 'local_iface_name': 'xe1', 'local_mac': '00:00:00:00:00:01', - 'vld_id': 'public_0', + 'vld_id': 'downlink_0', 'ifname': 'xe1', }, 'vnfd-connection-point-ref': 'xe1', @@ -310,7 +310,7 @@ class TestVpeApproxVnf(unittest.TestCase): 'interfaces': { 'xe0': { 'local_iface_name': 'ens513f0', - 'vld_id': 'public', + 'vld_id': VpeApproxVnf.DOWNLINK, 'netmask': '255.255.255.0', 'local_ip': '152.16.40.20', 'dst_mac': '00:00:00:00:00:01', @@ -344,7 +344,7 @@ class TestVpeApproxVnf(unittest.TestCase): 'interfaces': { 'xe0': { 'local_iface_name': 'ens785f0', - 'vld_id': 'private', + 'vld_id': VpeApproxVnf.UPLINK, 'netmask': '255.255.255.0', 'local_ip': '152.16.100.20', 'dst_mac': '00:00:00:00:00:02', @@ -375,7 +375,7 @@ class TestVpeApproxVnf(unittest.TestCase): 'interfaces': { 'xe0': { 'local_iface_name': 'ens786f0', - 'vld_id': 'private', + 'vld_id': VpeApproxVnf.UPLINK, 'netmask': '255.255.255.0', 'local_ip': '152.16.100.19', 'dst_mac': '00:00:00:00:00:04', @@ -387,7 +387,7 @@ class TestVpeApproxVnf(unittest.TestCase): }, 'xe1': { 'local_iface_name': 'ens786f1', - 'vld_id': 'public', + 'vld_id': VpeApproxVnf.DOWNLINK, 'netmask': '255.255.255.0', 'local_ip': '152.16.40.19', 'dst_mac': '00:00:00:00:00:03', -- cgit 1.2.3-korg