aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/network_services/traffic_profile
diff options
context:
space:
mode:
authorRoss Brattain <ross.b.brattain@intel.com>2018-03-02 21:44:13 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-03-02 21:44:13 +0000
commit5e327a9910231917580b073fd3bbf56697e2139d (patch)
treedf9072e13bb7704ef83bb3a2b8ebcd6c06a2b7cc /tests/unit/network_services/traffic_profile
parent8b2b6806d73e3b4e377cb8afe5ff98152567438f (diff)
parent51382b303cd0c8bb63fbcd7a0144b186a24c07d7 (diff)
Merge "VNF interfaces are sorted by "vpci" address before being populated"
Diffstat (limited to 'tests/unit/network_services/traffic_profile')
-rw-r--r--tests/unit/network_services/traffic_profile/test_prox_profile.py21
1 files changed, 17 insertions, 4 deletions
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 078e72b8e..e5b36096f 100644
--- a/tests/unit/network_services/traffic_profile/test_prox_profile.py
+++ b/tests/unit/network_services/traffic_profile/test_prox_profile.py
@@ -31,14 +31,25 @@ if stl_patch:
class TestProxProfile(unittest.TestCase):
+ def test_sort_vpci(self):
+ traffic_generator = mock.Mock()
+ interface_1 = {'virtual-interface': {'vpci': 'id1'}, 'name': 'name1'}
+ interface_2 = {'virtual-interface': {'vpci': 'id2'}, 'name': 'name2'}
+ interface_3 = {'virtual-interface': {'vpci': 'id3'}, 'name': 'name3'}
+ interfaces = [interface_2, interface_3, interface_1]
+ traffic_generator.vnfd_helper = {
+ 'vdu': [{'external-interface': interfaces}]}
+ output = ProxProfile.sort_vpci(traffic_generator)
+ self.assertEqual([interface_1, interface_2, interface_3], output)
+
def test_fill_samples(self):
samples = {}
+
traffic_generator = mock.MagicMock()
- traffic_generator.vpci_if_name_ascending = [
+ interfaces = [
['id1', 'name1'],
- ['id2', 'name2'],
+ ['id2', 'name2']
]
-
traffic_generator.resource_helper.sut.port_stats.side_effect = [
list(range(12)),
list(range(10, 22)),
@@ -54,7 +65,9 @@ class TestProxProfile(unittest.TestCase):
'out_packets': 17,
},
}
- ProxProfile.fill_samples(samples, traffic_generator)
+ with mock.patch.object(ProxProfile, 'sort_vpci', return_value=interfaces):
+ ProxProfile.fill_samples(samples, traffic_generator)
+
self.assertDictEqual(samples, expected)
def test_init(self):