X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=NG-RO%2Fosm_ng_ro%2Ftests%2Ftest_ns.py;fp=NG-RO%2Fosm_ng_ro%2Ftests%2Ftest_ns.py;h=d2fdc4dcc681146584aed16f8ac53f793ff82878;hb=203144b6b0ed2ada23a9ec9ce98b6c7f862570e7;hp=97f072bd5a80ff2dbaca205f456be53205cb86d4;hpb=beb04b09f31396ef652d733e76751a4ea29763f4;p=osm%2FRO.git diff --git a/NG-RO/osm_ng_ro/tests/test_ns.py b/NG-RO/osm_ng_ro/tests/test_ns.py index 97f072bd..d2fdc4dc 100644 --- a/NG-RO/osm_ng_ro/tests/test_ns.py +++ b/NG-RO/osm_ng_ro/tests/test_ns.py @@ -1494,7 +1494,7 @@ class TestNs(unittest.TestCase): self.assertDictEqual(expected_numa_result, numa_result) self.assertEqual(expected_epa_vcpu_set_result, epa_vcpu_set_result) - def test__process_guest_epa_cpu_pinning_params_with_threads(self): + def test__process_guest_epa_cpu_pinning_params_with_policy_prefer(self): expected_numa_result = {"threads": 3} expected_epa_vcpu_set_result = True guest_epa_quota = { @@ -1513,9 +1513,47 @@ class TestNs(unittest.TestCase): self.assertDictEqual(expected_numa_result, numa_result) self.assertEqual(expected_epa_vcpu_set_result, epa_vcpu_set_result) - def test__process_guest_epa_cpu_pinning_params(self): + def test__process_guest_epa_cpu_pinning_params_with_policy_isolate(self): expected_numa_result = {"cores": 3} expected_epa_vcpu_set_result = True + guest_epa_quota = { + "cpu-pinning-policy": "DEDICATED", + "cpu-thread-pinning-policy": "ISOLATE", + } + vcpu_count = 3 + epa_vcpu_set = False + + numa_result, epa_vcpu_set_result = Ns._process_guest_epa_cpu_pinning_params( + guest_epa_quota=guest_epa_quota, + vcpu_count=vcpu_count, + epa_vcpu_set=epa_vcpu_set, + ) + + self.assertDictEqual(expected_numa_result, numa_result) + self.assertEqual(expected_epa_vcpu_set_result, epa_vcpu_set_result) + + def test__process_guest_epa_cpu_pinning_params_with_policy_require(self): + expected_numa_result = {"threads": 3} + expected_epa_vcpu_set_result = True + guest_epa_quota = { + "cpu-pinning-policy": "DEDICATED", + "cpu-thread-pinning-policy": "REQUIRE", + } + vcpu_count = 3 + epa_vcpu_set = False + + numa_result, epa_vcpu_set_result = Ns._process_guest_epa_cpu_pinning_params( + guest_epa_quota=guest_epa_quota, + vcpu_count=vcpu_count, + epa_vcpu_set=epa_vcpu_set, + ) + + self.assertDictEqual(expected_numa_result, numa_result) + self.assertEqual(expected_epa_vcpu_set_result, epa_vcpu_set_result) + + def test__process_guest_epa_cpu_pinning_params(self): + expected_numa_result = {"threads": 3} + expected_epa_vcpu_set_result = True guest_epa_quota = { "cpu-pinning-policy": "DEDICATED", } @@ -1777,7 +1815,6 @@ class TestNs(unittest.TestCase): self, epa_params, ): - target_flavor = {} indata = { "vnf": [ @@ -1804,7 +1841,6 @@ class TestNs(unittest.TestCase): self, epa_params, ): - target_flavor = { "no-target-flavor": "here", } @@ -1827,7 +1863,6 @@ class TestNs(unittest.TestCase): self, epa_params, ): - expected_result = { "find_params": { "flavor_data": { @@ -1872,7 +1907,6 @@ class TestNs(unittest.TestCase): self, epa_params, ): - expected_result = { "find_params": { "flavor_data": { @@ -2029,7 +2063,6 @@ class TestNs(unittest.TestCase): self, epa_params, ): - expected_result = { "find_params": { "flavor_data": { @@ -2094,7 +2127,6 @@ class TestNs(unittest.TestCase): self, epa_params, ): - kwargs = { "db": db, } @@ -2205,7 +2237,6 @@ class TestNs(unittest.TestCase): self, epa_params, ): - expected_result = { "find_params": { "flavor_data": { @@ -2270,7 +2301,6 @@ class TestNs(unittest.TestCase): self, epa_params, ): - kwargs = { "db": db, } @@ -3612,7 +3642,8 @@ class TestProcessVduParams(unittest.TestCase): self, mock_volume_keeping_required ): """Find persistent ordinary volume, volume id is not persistent_root_disk dict, - vim-volume-id is given as instantiation parameter but disk id is not matching.""" + vim-volume-id is given as instantiation parameter but disk id is not matching. + """ mock_volume_keeping_required.return_value = True vdu_instantiation_volumes_list = [ {