diff options
author | Ross Brattain <ross.b.brattain@intel.com> | 2018-03-02 21:44:13 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2018-03-02 21:44:13 +0000 |
commit | 5e327a9910231917580b073fd3bbf56697e2139d (patch) | |
tree | df9072e13bb7704ef83bb3a2b8ebcd6c06a2b7cc /tests/unit | |
parent | 8b2b6806d73e3b4e377cb8afe5ff98152567438f (diff) | |
parent | 51382b303cd0c8bb63fbcd7a0144b186a24c07d7 (diff) |
Merge "VNF interfaces are sorted by "vpci" address before being populated"
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/network_services/traffic_profile/test_prox_profile.py | 21 |
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): |