summaryrefslogtreecommitdiffstats
path: root/tests/unit
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/apiserver/__init__.py6
-rw-r--r--tests/unit/benchmark/core/test_task.py24
-rw-r--r--tests/unit/benchmark/scenarios/networking/ipv4_throughput_vpe.yaml28
-rw-r--r--tests/unit/benchmark/scenarios/networking/test_vnf_generic.py12
-rw-r--r--tests/unit/benchmark/scenarios/networking/vpe_vnf_topology.yaml4
-rw-r--r--tests/unit/network_services/helpers/acl_vnf_topology_ixia.yaml4
-rw-r--r--tests/unit/network_services/helpers/test_samplevnf_helper.py14
-rw-r--r--tests/unit/network_services/libs/ixia_libs/test_IxNet.py31
-rw-r--r--tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py74
-rw-r--r--tests/unit/network_services/traffic_profile/test_prox_acl.py40
-rw-r--r--tests/unit/network_services/traffic_profile/test_prox_binsearch.py4
-rw-r--r--tests/unit/network_services/traffic_profile/test_prox_mpls.py4
-rw-r--r--tests/unit/network_services/traffic_profile/test_prox_profile.py6
-rw-r--r--tests/unit/network_services/traffic_profile/test_rfc2544.py20
-rw-r--r--tests/unit/network_services/traffic_profile/test_traffic_profile.py32
-rw-r--r--tests/unit/network_services/vnf_generic/test_vnfdgen.py29
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_acl_vnf.py8
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_cgnapt_vnf.py10
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py116
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_prox_vnf.py20
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py20
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_tg_prox.py26
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_trex.py4
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py8
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_udp_replay.py12
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_vfw_vnf.py8
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_vpe_vnf.py22
27 files changed, 303 insertions, 283 deletions
diff --git a/tests/unit/apiserver/__init__.py b/tests/unit/apiserver/__init__.py
index 1c9d5a672..5e1ed2ea1 100644
--- a/tests/unit/apiserver/__init__.py
+++ b/tests/unit/apiserver/__init__.py
@@ -1,5 +1,6 @@
from __future__ import absolute_import
+import mock
import os
import socket
import unittest
@@ -16,6 +17,10 @@ class APITestCase(unittest.TestCase):
self.db_fd, self.db_path = tempfile.mkstemp()
consts.SQLITE = 'sqlite:///{}'.format(self.db_path)
+ # server calls gethostbyname which takes 4 seconds, and we should mock it anyway
+ self.socket_mock = mock.patch.dict("sys.modules", {"socket": mock.MagicMock(
+ **{"gethostbyname.return_value": "127.0.0.1", "gethostname.return_value": "localhost"})})
+ self.socket_mock.start()
try:
from api import server
except socket.gaierror:
@@ -30,6 +35,7 @@ class APITestCase(unittest.TestCase):
def tearDown(self):
os.close(self.db_fd)
os.unlink(self.db_path)
+ self.socket_mock.stop()
def _post(self, url, data):
headers = {'Content-Type': 'application/json'}
diff --git a/tests/unit/benchmark/core/test_task.py b/tests/unit/benchmark/core/test_task.py
index e3917b5b2..737e7058b 100644
--- a/tests/unit/benchmark/core/test_task.py
+++ b/tests/unit/benchmark/core/test_task.py
@@ -70,10 +70,10 @@ class TaskTestCase(unittest.TestCase):
'network_name': 'mgmt',
},
'xe0': {
- 'network_name': 'private_0',
+ 'network_name': 'uplink_0',
},
'xe1': {
- 'network_name': 'public_0',
+ 'network_name': 'downlink_0',
},
},
},
@@ -82,11 +82,11 @@ class TaskTestCase(unittest.TestCase):
'mgmt': {
'network_name': 'mgmt',
},
- 'private_0': {
- 'network_name': 'private_0',
+ 'uplink_0': {
+ 'network_name': 'uplink_0',
},
- 'public_0': {
- 'network_name': 'public_0',
+ 'downlink_0': {
+ 'network_name': 'downlink_0',
},
},
},
@@ -100,15 +100,15 @@ class TaskTestCase(unittest.TestCase):
},
{},
{
- 'name': 'private_0',
+ 'name': 'uplink_0',
'subnet_cidr': '10.20.0.0/16',
},
{
- 'name': 'public_0',
+ 'name': 'downlink_0',
'segmentation_id': '1001',
},
{
- 'name': 'private_1',
+ 'name': 'uplink_1',
},
])
@@ -116,9 +116,9 @@ class TaskTestCase(unittest.TestCase):
expected_get_network_calls = 6
expected = {
'mgmt': {'name': 'mgmt', 'network_type': 'flat'},
- 'private_0': {'name': 'private_0', 'subnet_cidr': '10.20.0.0/16'},
- 'private_1': {'name': 'private_1'},
- 'public_0': {'name': 'public_0', 'segmentation_id': '1001'},
+ 'uplink_0': {'name': 'uplink_0', 'subnet_cidr': '10.20.0.0/16'},
+ 'uplink_1': {'name': 'uplink_1'},
+ 'downlink_0': {'name': 'downlink_0', 'segmentation_id': '1001'},
}
networks = task.get_networks_from_nodes(nodes)
diff --git a/tests/unit/benchmark/scenarios/networking/ipv4_throughput_vpe.yaml b/tests/unit/benchmark/scenarios/networking/ipv4_throughput_vpe.yaml
index cfa166a74..2123e4705 100644
--- a/tests/unit/benchmark/scenarios/networking/ipv4_throughput_vpe.yaml
+++ b/tests/unit/benchmark/scenarios/networking/ipv4_throughput_vpe.yaml
@@ -49,13 +49,13 @@ private:
ipv4:
outer_l2:
framesize:
- 64B: "{{ get(imix, 'imix.private.imix_small', '0') }}"
- 128B: "{{ get(imix, 'imix.private.imix_128B', '0') }}"
- 256B: "{{ get(imix, 'imix.private.imix_256B', '0') }}"
- 373b: "{{ get(imix, 'imix.private.imix_373B', '0') }}"
- 570B: "{{get(imix, 'imix.private.imix_570B', '0') }}"
- 1400B: "{{get(imix, 'imix.private.imix_1400B', '0') }}"
- 1518B: "{{get(imix, 'imix.private.imix_1500B', '0') }}"
+ 64B: "{{ get(imix, 'imix.uplink.imix_small', '0') }}"
+ 128B: "{{ get(imix, 'imix.uplink.imix_128B', '0') }}"
+ 256B: "{{ get(imix, 'imix.uplink.imix_256B', '0') }}"
+ 373b: "{{ get(imix, 'imix.uplink.imix_373B', '0') }}"
+ 570B: "{{get(imix, 'imix.uplink.imix_570B', '0') }}"
+ 1400B: "{{get(imix, 'imix.uplink.imix_1400B', '0') }}"
+ 1518B: "{{get(imix, 'imix.uplink.imix_1500B', '0') }}"
QinQ:
S-VLAN:
@@ -81,13 +81,13 @@ public:
ipv4:
outer_l2:
framesize:
- 64B: "{{ get(imix, 'imix.private.imix_small', '0') }}"
- 128B: "{{ get(imix, 'imix.private.imix_128B', '0') }}"
- 256B: "{{ get(imix, 'imix.private.imix_256B', '0') }}"
- 373b: "{{ get(imix, 'imix.private.imix_373B', '0') }}"
- 570B: "{{get(imix, 'imix.private.imix_570B', '0') }}"
- 1400B: "{{get(imix, 'imix.private.imix_1400B', '0') }}"
- 1518B: "{{get(imix, 'imix.private.imix_1500B', '0') }}"
+ 64B: "{{ get(imix, 'imix.uplink.imix_small', '0') }}"
+ 128B: "{{ get(imix, 'imix.uplink.imix_128B', '0') }}"
+ 256B: "{{ get(imix, 'imix.uplink.imix_256B', '0') }}"
+ 373b: "{{ get(imix, 'imix.uplink.imix_373B', '0') }}"
+ 570B: "{{get(imix, 'imix.uplink.imix_570B', '0') }}"
+ 1400B: "{{get(imix, 'imix.uplink.imix_1400B', '0') }}"
+ 1518B: "{{get(imix, 'imix.uplink.imix_1500B', '0') }}"
outer_l3v4:
proto: "tcp"
diff --git a/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py b/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py
index 8aa9a8c8b..fa9b8549d 100644
--- a/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py
+++ b/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py
@@ -242,11 +242,11 @@ class TestNetworkServiceTestCase(unittest.TestCase):
'vnf__1': self.vnf__1,
},
'networks': {
- 'private': {
- 'vld_id': 'private',
+ GenericVNF.UPLINK: {
+ 'vld_id': GenericVNF.UPLINK,
},
- 'public': {
- 'vld_id': 'public',
+ GenericVNF.DOWNLINK: {
+ 'vld_id': GenericVNF.DOWNLINK,
},
},
}
@@ -265,7 +265,7 @@ class TestNetworkServiceTestCase(unittest.TestCase):
}
],
'type': 'ELAN',
- 'id': 'private',
+ 'id': GenericVNF.UPLINK,
'name': 'tg__1 to vnf__1 link 1'
}
@@ -283,7 +283,7 @@ class TestNetworkServiceTestCase(unittest.TestCase):
}
],
'type': 'ELAN',
- 'id': 'public',
+ 'id': GenericVNF.DOWNLINK,
'name': 'vnf__1 to tg__1 link 2'
}
diff --git a/tests/unit/benchmark/scenarios/networking/vpe_vnf_topology.yaml b/tests/unit/benchmark/scenarios/networking/vpe_vnf_topology.yaml
index 0de4b6e79..1ac6c1f89 100644
--- a/tests/unit/benchmark/scenarios/networking/vpe_vnf_topology.yaml
+++ b/tests/unit/benchmark/scenarios/networking/vpe_vnf_topology.yaml
@@ -27,7 +27,7 @@ nsd:nsd-catalog:
VNF model: ../../vnf_descriptors/vpe_vnf.yaml #tg_l3fwd.yaml #tg_trex_tpl.yaml #TREX
vld:
- - id: private
+ - id: uplink
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
+ - id: downlink
name: vnf__1 to tg__1 link 2
type: ELAN
vnfd-connection-point-ref:
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_prox_acl.py b/tests/unit/network_services/traffic_profile/test_prox_acl.py
index be172f26b..a0c60186c 100644
--- a/tests/unit/network_services/traffic_profile/test_prox_acl.py
+++ b/tests/unit/network_services/traffic_profile/test_prox_acl.py
@@ -29,19 +29,38 @@ if stl_patch:
from yardstick.network_services.vnf_generic.vnf.prox_helpers import ProxTestDataTuple
-class TestProxRampProfile(unittest.TestCase):
+class TestProxACLProfile(unittest.TestCase):
def test_run_test_with_pkt_size(self):
+ def target(*args, **kwargs):
+ runs.append(args[2])
+ if args[2] < 0 or args[2] > 100:
+ raise RuntimeError(' '.join([str(args), str(runs)]))
+ if args[2] > 75.0:
+ return fail_tuple, {}
+ return success_tuple, {}
+
+ def get_mock_samples(*args, **kwargs):
+ if args[2] < 0:
+ raise RuntimeError(' '.join([str(args), str(runs)]))
+ return success_tuple
+
tp_config = {
- 'traffic_profile': {
+ 'traffic_profile': {
'upper_bound': 100.0,
+ 'lower_bound': 0.0,
+ 'tolerated_loss': 50.0,
+ 'attempts': 20
},
}
+ runs = []
success_tuple = ProxTestDataTuple(10.0, 1, 2, 3, 4, [5.1, 5.2, 5.3], 995, 1000, 123.4)
fail_tuple = ProxTestDataTuple(10.0, 1, 2, 3, 4, [5.6, 5.7, 5.8], 850, 1000, 123.4)
traffic_gen = mock.MagicMock()
+ traffic_gen.run_test = target
+
traffic_gen.resource_helper.run_test.side_effect = [
success_tuple,
success_tuple,
@@ -53,14 +72,15 @@ class TestProxRampProfile(unittest.TestCase):
fail_tuple,
]
- fill_values = [1, 2, 3, 4, RuntimeError]
-
profile = ProxACLProfile(tp_config)
- profile.fill_samples = fill_samples = mock.MagicMock(side_effect=fill_values)
- profile.queue = mock.MagicMock()
+ profile.init(mock.MagicMock())
- with self.assertRaises(RuntimeError):
- profile.run_test_with_pkt_size(traffic_gen, 128, 30)
+ profile.prox_config["attempts"] = 20
+ profile.queue = mock.MagicMock()
+ profile.tolerated_loss = 50.0
+ profile.pkt_size = 128
+ profile.duration = 30
+ profile.test_value = 100.0
+ profile.tolerated_loss = 100.0
- self.assertEqual(traffic_gen.resource_helper.run_test.call_count, 5)
- self.assertEqual(fill_samples.call_count, 5)
+ profile.run_test_with_pkt_size(traffic_gen, profile.pkt_size, profile.duration)
diff --git a/tests/unit/network_services/traffic_profile/test_prox_binsearch.py b/tests/unit/network_services/traffic_profile/test_prox_binsearch.py
index 0edce7a14..f56a7fba9 100644
--- a/tests/unit/network_services/traffic_profile/test_prox_binsearch.py
+++ b/tests/unit/network_services/traffic_profile/test_prox_binsearch.py
@@ -56,7 +56,7 @@ class TestProxBinSearchProfile(unittest.TestCase):
profile = ProxBinSearchProfile(tp_config)
profile.init(mock.MagicMock())
- profile.execute(traffic_generator)
+ profile.execute_traffic(traffic_generator)
self.assertEqual(round(profile.current_lower, 2), 74.69)
self.assertEqual(round(profile.current_upper, 2), 75.39)
self.assertEqual(len(runs), 8)
@@ -87,7 +87,7 @@ class TestProxBinSearchProfile(unittest.TestCase):
profile = ProxBinSearchProfile(tp_config)
profile.init(mock.MagicMock())
- profile.execute(traffic_generator)
+ profile.execute_traffic(traffic_generator)
self.assertEqual(round(profile.current_lower, 2), 24.06)
self.assertEqual(round(profile.current_upper, 2), 25.47)
self.assertEqual(len(runs), 7)
diff --git a/tests/unit/network_services/traffic_profile/test_prox_mpls.py b/tests/unit/network_services/traffic_profile/test_prox_mpls.py
index 77bca9cc0..642fecc35 100644
--- a/tests/unit/network_services/traffic_profile/test_prox_mpls.py
+++ b/tests/unit/network_services/traffic_profile/test_prox_mpls.py
@@ -56,7 +56,7 @@ class TestProxMplsTagUntagProfile(unittest.TestCase):
profile = ProxMplsTagUntagProfile(tp_config)
profile.init(mock.MagicMock())
- profile.execute(traffic_generator)
+ profile.execute_traffic(traffic_generator)
self.assertEqual(round(profile.current_lower, 2), 74.69)
self.assertEqual(round(profile.current_upper, 2), 75.39)
self.assertEqual(len(runs), 8)
@@ -87,7 +87,7 @@ class TestProxMplsTagUntagProfile(unittest.TestCase):
profile = ProxMplsTagUntagProfile(tp_config)
profile.init(mock.MagicMock())
- profile.execute(traffic_generator)
+ profile.execute_traffic(traffic_generator)
self.assertEqual(round(profile.current_lower, 2), 24.06)
self.assertEqual(round(profile.current_upper, 2), 25.47)
self.assertEqual(len(runs), 7)
diff --git a/tests/unit/network_services/traffic_profile/test_prox_profile.py b/tests/unit/network_services/traffic_profile/test_prox_profile.py
index 14223da0f..9899d9909 100644
--- a/tests/unit/network_services/traffic_profile/test_prox_profile.py
+++ b/tests/unit/network_services/traffic_profile/test_prox_profile.py
@@ -65,7 +65,7 @@ class TestProxProfile(unittest.TestCase):
profile.init(234)
self.assertEqual(profile.queue, 234)
- def test_execute(self):
+ def test_execute_traffic(self):
packet_sizes = [
10,
100,
@@ -83,9 +83,9 @@ class TestProxProfile(unittest.TestCase):
self.assertFalse(profile.done)
for _ in packet_sizes:
with self.assertRaises(NotImplementedError):
- profile.execute(traffic_generator)
+ profile.execute_traffic(traffic_generator)
- self.assertIsNone(profile.execute(traffic_generator))
+ self.assertIsNone(profile.execute_traffic(traffic_generator))
def test_bounds_iterator(self):
tp_config = {
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..995b4a2cc 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,
@@ -884,11 +884,11 @@ class TestProxDpdkVnfSetupEnvHelper(unittest.TestCase):
helper.upload_prox_config = mock.MagicMock(return_value='5')
self.assertEqual(helper.additional_files, {})
- self.assertNotEqual(helper.prox_config_dict, '4')
+ self.assertNotEqual(helper._prox_config_data, '4')
self.assertNotEqual(helper.remote_path, '5')
helper.build_config_file()
self.assertEqual(helper.additional_files, {})
- self.assertEqual(helper.prox_config_dict, '4')
+ self.assertEqual(helper._prox_config_data, '4')
self.assertEqual(helper.remote_path, '5')
@mock.patch('yardstick.network_services.vnf_generic.vnf.prox_helpers.find_relative_file')
@@ -934,7 +934,7 @@ class TestProxDpdkVnfSetupEnvHelper(unittest.TestCase):
],
}
- mock_find_path.side_effect = ['1', '2']
+ mock_find_path.side_effect = ['1', '2'] + [str(i) for i in range(len(vnf1['prox_files']))]
vnfd_helper = mock.MagicMock()
ssh_helper = mock.MagicMock()
scenario_helper = ScenarioHelper('vnf1')
@@ -951,12 +951,12 @@ class TestProxDpdkVnfSetupEnvHelper(unittest.TestCase):
helper.upload_prox_config = mock.MagicMock(return_value='55')
self.assertEqual(helper.additional_files, {})
- self.assertNotEqual(helper.prox_config_dict, '44')
+ self.assertNotEqual(helper._prox_config_data, '44')
self.assertNotEqual(helper.remote_path, '55')
expected = {'h.i': '33', 'l': '34', 'm_n': '35'}
helper.build_config_file()
self.assertDictEqual(helper.additional_files, expected)
- self.assertEqual(helper.prox_config_dict, '44')
+ self.assertEqual(helper._prox_config_data, '44')
self.assertEqual(helper.remote_path, '55')
@mock.patch('yardstick.network_services.vnf_generic.vnf.prox_helpers.find_relative_file')
@@ -986,9 +986,10 @@ class TestProxDpdkVnfSetupEnvHelper(unittest.TestCase):
helper = ProxDpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
helper.remote_path = "/tmp/prox.cfg"
- prox_cmd = helper.build_config()
expected = "sudo bash -c 'cd /opt/nsb_bin; /opt/nsb_bin/prox -o cli -f -f /tmp/prox.cfg '"
- self.assertEqual(prox_cmd, expected)
+ with mock.patch.object(helper, "build_config_file") as mock_build_config:
+ prox_cmd = helper.build_config()
+ self.assertEqual(prox_cmd, expected)
def test__insert_additional_file(self):
vnfd_helper = mock.MagicMock()
@@ -1281,7 +1282,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 +1301,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,
@@ -1392,7 +1393,7 @@ class TestProxResourceHelper(unittest.TestCase):
def test_test_cores(self):
setup_helper = mock.MagicMock()
- setup_helper.prox_config_dict = {}
+ setup_helper.prox_config_data = []
helper = ProxResourceHelper(setup_helper)
helper._cpu_topology = []
@@ -1401,7 +1402,7 @@ class TestProxResourceHelper(unittest.TestCase):
result = helper.test_cores
self.assertEqual(result, expected)
- setup_helper.prox_config_dict = [
+ setup_helper.prox_config_data = [
('section1', []),
('section2', [
('a', 'b'),
@@ -1449,10 +1450,9 @@ class TestProxResourceHelper(unittest.TestCase):
def test_get_test_type(self):
setup_helper = mock.MagicMock()
- setup_helper.prox_config_dict = {}
-
helper = ProxResourceHelper(setup_helper)
- setup_helper.prox_config_dict = [
+
+ setup_helper.prox_config_data = [
('global', [
('name', helper.PROX_CORE_MPLS_TEST)
]),
@@ -1479,27 +1479,7 @@ class TestProxResourceHelper(unittest.TestCase):
def test_get_cores(self):
setup_helper = mock.MagicMock()
- setup_helper.prox_config_dict = {}
-
- helper = ProxResourceHelper(setup_helper)
- helper._cpu_topology = {
- 0: {
- 1: {
- 5: (5, 1, 0)
- },
- 2: {
- 6: (6, 2, 0)
- },
- 3: {
- 7: (7, 3, 0)
- },
- 4: {
- 8: (8, 3, 0)
- },
- }
- }
-
- setup_helper.prox_config_dict = [
+ setup_helper.prox_config_data = [
('section1', []),
('section2', [
('a', 'b'),
@@ -1520,14 +1500,6 @@ class TestProxResourceHelper(unittest.TestCase):
]),
]
- expected = [7, 8]
- result = helper.get_cores(helper.PROX_CORE_GEN_MODE)
- self.assertEqual(result, expected)
-
- def test_get_cores_mpls(self):
- setup_helper = mock.MagicMock()
- setup_helper.prox_config_dict = {}
-
helper = ProxResourceHelper(setup_helper)
helper._cpu_topology = {
0: {
@@ -1546,7 +1518,13 @@ class TestProxResourceHelper(unittest.TestCase):
}
}
- setup_helper.prox_config_dict = [
+ expected = [7, 8]
+ result = helper.get_cores(helper.PROX_CORE_GEN_MODE)
+ self.assertEqual(result, expected)
+
+ def test_get_cores_mpls(self):
+ setup_helper = mock.MagicMock()
+ setup_helper.prox_config_data = [
('section1', []),
('section2', [
('a', 'b'),
@@ -1569,6 +1547,24 @@ class TestProxResourceHelper(unittest.TestCase):
]),
]
+ helper = ProxResourceHelper(setup_helper)
+ helper._cpu_topology = {
+ 0: {
+ 1: {
+ 5: (5, 1, 0)
+ },
+ 2: {
+ 6: (6, 2, 0)
+ },
+ 3: {
+ 7: (7, 3, 0)
+ },
+ 4: {
+ 8: (8, 3, 0)
+ },
+ }
+ }
+
expected_tagged = [7]
expected_plain = [8]
result_tagged, result_plain = helper.get_cores_mpls(helper.PROX_CORE_GEN_MODE)
@@ -1577,7 +1573,7 @@ class TestProxResourceHelper(unittest.TestCase):
def test_latency_cores(self):
setup_helper = mock.MagicMock()
- setup_helper.prox_config_dict = {}
+ setup_helper.prox_config_data= []
helper = ProxResourceHelper(setup_helper)
helper._cpu_topology = []
@@ -1586,7 +1582,7 @@ class TestProxResourceHelper(unittest.TestCase):
result = helper.latency_cores
self.assertEqual(result, expected)
- setup_helper.prox_config_dict = [
+ setup_helper.prox_config_data = [
('section1', []),
('section2', [
('a', 'b'),
@@ -1649,7 +1645,9 @@ class TestProxResourceHelper(unittest.TestCase):
def test_start_collect(self):
setup_helper = mock.MagicMock()
helper = ProxResourceHelper(setup_helper)
+ helper.resource = resource = mock.MagicMock()
self.assertIsNone(helper.start_collect())
+ resource.start.assert_called_once()
def test_terminate(self):
setup_helper = mock.MagicMock()
@@ -1681,7 +1679,7 @@ class TestProxResourceHelper(unittest.TestCase):
@mock.patch('yardstick.network_services.vnf_generic.vnf.prox_helpers.time')
def test_traffic_context(self, mock_time):
setup_helper = mock.MagicMock()
- setup_helper.prox_config_dict = {}
+ setup_helper.vnfd_helper.interfaces = []
helper = ProxResourceHelper(setup_helper)
helper._cpu_topology = {
@@ -1701,7 +1699,7 @@ class TestProxResourceHelper(unittest.TestCase):
}
}
- setup_helper.prox_config_dict = [
+ setup_helper.prox_config_data = [
('global', [
('name', helper.PROX_CORE_MPLS_TEST)
]),
@@ -1727,8 +1725,6 @@ class TestProxResourceHelper(unittest.TestCase):
]),
]
- setup_helper = mock.MagicMock()
- setup_helper.vnfd_helper.interfaces = []
client = mock.MagicMock()
client.hz.return_value = 2
@@ -1755,7 +1751,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',
@@ -1823,20 +1819,6 @@ class TestProxResourceHelper(unittest.TestCase):
result = helper.get_latency()
self.assertIs(result, expected)
- def test__get_logical_if_name(self):
- setup_helper = mock.MagicMock()
- setup_helper.vnfd_helper.interfaces = []
-
- helper = ProxResourceHelper(setup_helper)
- helper._vpci_to_if_name_map = {
- 'key1': 234,
- 'key2': 432,
- }
-
- expected = 234
- result = helper._get_logical_if_name('key1')
- self.assertEqual(result, expected)
-
@mock.patch('yardstick.network_services.vnf_generic.vnf.prox_helpers.time')
@mock.patch('yardstick.network_services.vnf_generic.vnf.prox_helpers.ProxSocketHelper')
def test__connect(self, mock_socket_helper_type, mock_time):
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..c88b1528c 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
@@ -86,6 +86,7 @@ class TestProxApproxVnf(unittest.TestCase):
'local_ip': '152.16.100.19',
'type': 'PCI-PASSTHROUGH',
'vld_id': '',
+ 'ifname': 'xe1',
'netmask': '255.255.255.0',
'dpdk_port_num': 0,
'bandwidth': '10 Gbps',
@@ -104,6 +105,7 @@ class TestProxApproxVnf(unittest.TestCase):
'local_ip': '152.16.40.19',
'type': 'PCI-PASSTHROUGH',
'vld_id': '',
+ 'ifname': 'xe3',
'driver': "i40e",
'netmask': '255.255.255.0',
'dpdk_port_num': 1,
@@ -187,7 +189,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 +223,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 +254,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 +266,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',
@@ -340,7 +342,7 @@ class TestProxApproxVnf(unittest.TestCase):
resource_helper = mock.MagicMock()
resource_helper.execute.return_value = list(range(12))
- resource_helper.collect_kpi.return_value = {'core': {'result': 234}}
+ resource_helper.collect_collectd_kpi.return_value = {'core': {'result': 234}}
prox_approx_vnf = ProxApproxVnf(NAME, self.VNFD0)
prox_approx_vnf.resource_helper = resource_helper
@@ -372,8 +374,10 @@ class TestProxApproxVnf(unittest.TestCase):
file_path = os.path.join(curr_path, filename)
return file_path
+ @mock.patch('yardstick.benchmark.scenarios.networking.vnf_generic.open', create=True)
+ @mock.patch('yardstick.network_services.vnf_generic.vnf.iniparser.open', create=True)
@mock.patch(SSH_HELPER)
- def test_run_prox(self, ssh, mock_time):
+ def test_run_prox(self, ssh, *_):
mock_ssh(ssh)
prox_approx_vnf = ProxApproxVnf(NAME, self.VNFD0)
@@ -382,7 +386,7 @@ class TestProxApproxVnf(unittest.TestCase):
prox_approx_vnf.setup_helper.remote_path = 'configs/file56.cfg'
expected = "sudo bash -c 'cd /tool_path12; " \
- "/tool_path12/tool_file34 -o cli -t -f configs/file56.cfg '"
+ "/tool_path12/tool_file34 -o cli -t -f /tmp/l3-swap-2.cfg '"
prox_approx_vnf._run()
result = prox_approx_vnf.ssh_helper.run.call_args[0][0]
@@ -395,7 +399,7 @@ class TestProxApproxVnf(unittest.TestCase):
prox_approx_vnf.setup_helper = mock.MagicMock()
# we can't mock super
prox_approx_vnf.instantiate(self.SCENARIO_CFG, self.CONTEXT_CFG)
- prox_approx_vnf.setup_helper.build_config.assert_called_once
+ prox_approx_vnf.setup_helper.build_config.assert_called_once()
@mock.patch(SSH_HELPER)
def test_wait_for_instantiate_panic(self, ssh, mock_time):
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..eb569cfe6 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
@@ -20,7 +20,6 @@ import mock
from tests.unit.network_services.vnf_generic.vnf.test_base import mock_ssh
from tests.unit import STL_MOCKS
-from yardstick.network_services.nfvi.resource import ResourceProfile
SSH_HELPER = 'yardstick.network_services.vnf_generic.vnf.sample_vnf.VnfSshHelper'
NAME = 'vnf__1'
@@ -180,7 +179,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 +213,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 +244,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 +256,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',
@@ -331,7 +330,8 @@ class TestProxTrafficGen(unittest.TestCase):
mock_ssh(ssh)
prox_traffic_gen = ProxTrafficGen(NAME, self.VNFD0)
- prox_traffic_gen._vnf_wrapper.resource = mock.Mock(autospec=ResourceProfile)
+ prox_traffic_gen._vnf_wrapper.resource_helper.resource = mock.MagicMock(
+ **{"check_if_sa_running.return_value": [False]})
prox_traffic_gen._vnf_wrapper.vnf_execute = mock.Mock(return_value="")
self.assertEqual({}, prox_traffic_gen.collect_kpi())
@@ -371,12 +371,12 @@ class TestProxTrafficGen(unittest.TestCase):
'task_path': '',
'options': {'tg__1': {'prox_args': {'-e': '',
'-t': ''},
- 'prox_config': 'configs/l3-gen-2.cfg',
- 'prox_path': '/root/dppd-PROX-v035/build/prox'},
- 'vnf__1': {'prox_args': {'-t': ''},
- 'prox_config': 'configs/l3-swap-2.cfg',
- 'prox_path': '/root/dppd-PROX-v035/build/prox'}
- }
+ 'prox_config': 'configs/l3-gen-2.cfg',
+ 'prox_path': '/root/dppd-PROX-v035/build/prox'},
+ 'vnf__1': {'prox_args': {'-t': ''},
+ 'prox_config': 'configs/l3-swap-2.cfg',
+ 'prox_path': '/root/dppd-PROX-v035/build/prox'}
+ }
}
prox_traffic_gen.instantiate(scenario_cfg, {})
@@ -391,10 +391,10 @@ class TestProxTrafficGen(unittest.TestCase):
vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
sut = ProxTrafficGen(NAME, vnfd)
- sut.prox_config_dict = {}
sut._get_socket = mock.MagicMock()
sut.ssh_helper = mock.Mock()
sut.ssh_helper.run = mock.Mock()
+ sut.setup_helper.prox_config_dict = {}
sut._vpci_ascending = ["0000:05:00.0", "0000:05:00.1"]
sut._connect_client = mock.Mock(autospec=STLClient)
sut._connect_client.get_stats = mock.Mock(return_value="0")
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',