summaryrefslogtreecommitdiffstats
path: root/test/conductor/test_conductor_translation.py
diff options
context:
space:
mode:
authordhebeha <dhebeha.mj71@wipro.com>2020-09-05 20:16:48 +0530
committerVikas Varma <vikas.varma@att.com>2020-09-18 19:34:01 +0000
commitedf98746a52408386efab26143778198b0efd3c5 (patch)
treeadc101beb879a57547cc828283803bfe7c5fd89b /test/conductor/test_conductor_translation.py
parentf9b3575cae2b521ba8c6b6b30b15c89bd8a1cb48 (diff)
Add support to process NSI selection request
Issue-ID: OPTFRA-802 Signed-off-by: dhebeha <dhebeha.mj71@wipro.com> Signed-off-by: krishnaa96 <krishna.moorthy6@wipro.com> Change-Id: I85d951061abc697714425bd223b89102d4f2ede9
Diffstat (limited to 'test/conductor/test_conductor_translation.py')
-rw-r--r--test/conductor/test_conductor_translation.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/conductor/test_conductor_translation.py b/test/conductor/test_conductor_translation.py
index 8b6c0a1..2a600e4 100644
--- a/test/conductor/test_conductor_translation.py
+++ b/test/conductor/test_conductor_translation.py
@@ -40,6 +40,9 @@ class TestConductorTranslation(unittest.TestCase):
self.request_vfmod_json = json_from_file(parameter_data_file)
self.policies = [json_from_file(policy_data_path + '/' + name) for name in valid_policies_files]
+ self.optimization_policies = [json_from_file(policy_data_path + '/'
+ + "slice-selection-files/opt_policy_nsi_reuse.json")]
+
def tearDown(self):
pass
@@ -58,6 +61,26 @@ class TestConductorTranslation(unittest.TestCase):
res = tr.gen_demands(self.request_vfmod_json['placementInfo']['placementDemands'], vnf_policies)
assert res is not None
+ def test_gen_optimization_policy(self):
+ expected = [{
+ "goal": "minimize",
+ "operation_function": {
+ "operator": "sum",
+ "operands": [
+ {
+ "function": "attribute",
+ "params": {
+ "attribute": "creation_cost",
+ "demand": "embb-nst"
+ }
+ }
+ ]
+ }
+ }]
+ self.assertEqual(expected,
+ tr.gen_optimization_policy(self.request_vfmod_json['placementInfo']['placementDemands'],
+ self.optimization_policies))
+
if __name__ == "__main__":
unittest.main()