summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/conductor/test_conductor_calls.py4
-rw-r--r--test/conductor/test_conductor_translation.py8
-rwxr-xr-xtest/config/opteng_config.yaml25
-rwxr-xr-xtest/functest/simulators/simulated-config/opteng_config.yaml25
-rw-r--r--test/optengine-tests/test_modelapi_invalid.json13
-rw-r--r--test/optengine-tests/test_modelapi_valid.json13
-rw-r--r--test/optengine-tests/test_optengine_invalid.json18
-rw-r--r--test/optengine-tests/test_optengine_invalid2.json15
-rw-r--r--test/optengine-tests/test_optengine_invalid_solver.json15
-rw-r--r--test/optengine-tests/test_optengine_modelId.json19
-rw-r--r--test/optengine-tests/test_optengine_no_modelid.json24
-rw-r--r--test/optengine-tests/test_optengine_no_optdata.json15
-rw-r--r--test/optengine-tests/test_optengine_solverid.json15
-rw-r--r--test/optengine-tests/test_optengine_valid.json20
-rw-r--r--test/optengine-tests/test_py_optengine_valid.json15
-rw-r--r--test/placement-tests/policy_response.json872
-rw-r--r--test/placement-tests/policy_response2.json867
-rw-r--r--test/placement-tests/request_placement_vfmod.json2
-rw-r--r--test/placement-tests/test_by_scope.yaml29
-rw-r--r--test/placement-tests/test_by_scope_org.yaml24
-rw-r--r--test/policy-local-files/meta-valid-policies-org.txt16
-rw-r--r--test/policy-local-files/meta-valid-policies.txt3
-rw-r--r--test/policy-local-files/new_policies/Affinity_vCPE_1.json33
-rw-r--r--test/policy-local-files/new_policies/Affinity_vFW_TD.json31
-rw-r--r--test/policy-local-files/new_policies/Capacity_vGMuxInfra.json32
-rw-r--r--test/policy-local-files/new_policies/Capacity_vG_1.json32
-rw-r--r--test/policy-local-files/new_policies/Distance_vGMuxInfra_1.json36
-rw-r--r--test/policy-local-files/new_policies/Distance_vG_1.json36
-rw-r--r--test/policy-local-files/new_policies/Placement_Optimization_1.json67
-rw-r--r--test/policy-local-files/new_policies/QueryPolicy_vCPE.json38
-rw-r--r--test/policy-local-files/new_policies/QueryPolicy_vCPE_2.json55
-rw-r--r--test/policy-local-files/new_policies/QueryPolicy_vFW_TD.json47
-rw-r--r--test/policy-local-files/new_policies/hpa_policy_vGMuxInfra_1.json231
-rw-r--r--test/policy-local-files/new_policies/hpa_policy_vG_1.json231
-rw-r--r--test/policy-local-files/new_policies/meta-valid-policies.txt16
-rw-r--r--test/policy-local-files/new_policies/subscriber_policy_vCPE.json32
-rw-r--r--test/policy-local-files/new_policies/vnfPolicy_vFW_TD.json47
-rw-r--r--test/policy-local-files/new_policies/vnfPolicy_vG.json38
-rw-r--r--test/policy-local-files/new_policies/vnfPolicy_vGMuxInfra.json38
-rw-r--r--test/policy-local-files/new_policies/vnfPolicy_vPGN_TD.json52
-rw-r--r--test/test_ConductorApiBuilder.py2
-rw-r--r--test/test_PolicyCalls.py7
-rw-r--r--test/test_get_opt_query_data.py4
-rw-r--r--test/test_model_api.py71
-rw-r--r--test/test_optim_engine.py78
45 files changed, 2934 insertions, 377 deletions
diff --git a/test/conductor/test_conductor_calls.py b/test/conductor/test_conductor_calls.py
index 52e0367..d811e63 100644
--- a/test/conductor/test_conductor_calls.py
+++ b/test/conductor/test_conductor_calls.py
@@ -40,12 +40,12 @@ class TestConductorCalls(unittest.TestCase):
def test_request(self):
req_json = json_from_file("./test/placement-tests/request.json")
- policies = pol.get_local_policies("test/policy-local-files/", self.lp)
+ policies = pol.get_local_policies("test/policy-local-files/new_policies/", self.lp)
conductor.request(req_json, self.osdf_config, policies)
def test_request_vfmod(self):
req_json = json_from_file("./test/placement-tests/request_vfmod.json")
- policies = pol.get_local_policies("test/policy-local-files/", self.lp)
+ policies = pol.get_local_policies("test/policy-local-files/new_policies/", self.lp)
conductor.request(req_json, self.osdf_config, policies)
diff --git a/test/conductor/test_conductor_translation.py b/test/conductor/test_conductor_translation.py
index ad70157..cc9dc1c 100644
--- a/test/conductor/test_conductor_translation.py
+++ b/test/conductor/test_conductor_translation.py
@@ -28,7 +28,7 @@ class TestConductorTranslation(unittest.TestCase):
self.main_dir = ""
self.conductor_api_template = self.main_dir + "osdf/templates/conductor_interface.json"
self.local_config_file = self.main_dir + "config/common_config.yaml"
- policy_data_path = self.main_dir + "test/policy-local-files"
+ policy_data_path = self.main_dir + "test/policy-local-files/new_policies"
valid_policies_list_file = policy_data_path + '/' + 'meta-valid-policies.txt'
valid_policies_files = local_policies.get_policy_names_from_file(valid_policies_list_file)
@@ -44,13 +44,15 @@ class TestConductorTranslation(unittest.TestCase):
def test_gen_demands(self):
# need to run this only on vnf policies
- vnf_policies = [x for x in self.policies if x["content"]["policyType"] == "vnfPolicy"]
+ vnf_policies = [x for x in self.policies if x[list(x.keys())[0]]["type"]
+ == "onap.policies.optimization.VnfPolicy"]
res = tr.gen_demands(self.request_json, vnf_policies)
assert res is not None
def test_gen_vfmod_demands(self):
# need to run this only on vnf policies
- vnf_policies = [x for x in self.policies if x["content"]["policyType"] == "vnfPolicy"]
+ vnf_policies = [x for x in self.policies if x[list(x.keys())[0]]["type"]
+ == "onap.policies.optimization.VnfPolicy"]
res = tr.gen_demands(self.request_vfmod_json, vnf_policies)
assert res is not None
diff --git a/test/config/opteng_config.yaml b/test/config/opteng_config.yaml
new file mode 100755
index 0000000..4a7e57d
--- /dev/null
+++ b/test/config/opteng_config.yaml
@@ -0,0 +1,25 @@
+# Policy Platform -- requires Authorization
+policyPlatformUrl: https://policy-xacml-pdp:6969/policy/pdpx/decision/v1 # Policy Dev platform URL
+
+# AAF Authentication config
+is_aaf_enabled: False
+aaf_cache_expiry_mins: 5
+aaf_url: https://aaftest.simpledemo.onap.org:8095
+aaf_user_roles:
+ - '/optmodel:org.onap.oof.access|*|read ALL'
+ - '/optengine:org.onap.oof.access|*|read ALL'
+
+# Secret Management Service from AAF
+aaf_sms_url: https://aaf-sms.onap:10443
+aaf_sms_timeout: 30
+secret_domain: osdf
+aaf_ca_certs: ssl_certs/aaf_root_ca.cer
+
+osdfDatabaseHost: localhost
+osdfDatabaseSchema: osdf
+osdfDatabaseUsername: osdf
+osdfDatabasePassword: osdf
+osdfDatabasePort: 3306
+
+#key
+appkey: os35@rrtky400fdntc#001t5 \ No newline at end of file
diff --git a/test/functest/simulators/simulated-config/opteng_config.yaml b/test/functest/simulators/simulated-config/opteng_config.yaml
new file mode 100755
index 0000000..4a7e57d
--- /dev/null
+++ b/test/functest/simulators/simulated-config/opteng_config.yaml
@@ -0,0 +1,25 @@
+# Policy Platform -- requires Authorization
+policyPlatformUrl: https://policy-xacml-pdp:6969/policy/pdpx/decision/v1 # Policy Dev platform URL
+
+# AAF Authentication config
+is_aaf_enabled: False
+aaf_cache_expiry_mins: 5
+aaf_url: https://aaftest.simpledemo.onap.org:8095
+aaf_user_roles:
+ - '/optmodel:org.onap.oof.access|*|read ALL'
+ - '/optengine:org.onap.oof.access|*|read ALL'
+
+# Secret Management Service from AAF
+aaf_sms_url: https://aaf-sms.onap:10443
+aaf_sms_timeout: 30
+secret_domain: osdf
+aaf_ca_certs: ssl_certs/aaf_root_ca.cer
+
+osdfDatabaseHost: localhost
+osdfDatabaseSchema: osdf
+osdfDatabaseUsername: osdf
+osdfDatabasePassword: osdf
+osdfDatabasePort: 3306
+
+#key
+appkey: os35@rrtky400fdntc#001t5 \ No newline at end of file
diff --git a/test/optengine-tests/test_modelapi_invalid.json b/test/optengine-tests/test_modelapi_invalid.json
new file mode 100644
index 0000000..a58258e
--- /dev/null
+++ b/test/optengine-tests/test_modelapi_invalid.json
@@ -0,0 +1,13 @@
+{
+ "requestInfo": {
+ "transactinId": "xxx-xxx-xxxx",
+ "requestID": "yyy-yyy-yyyy",
+ "sourceId": "cmopt"
+ },
+ "modelInfo": {
+ "modelId": "model2",
+ "solver": "mzn",
+ "description": "graph coloring problem for australia",
+ "modelContent": "int: nc;\r\nvar 1 .. nc: wa; var 1 .. nc: nt; var 1 .. nc: sa; var 1 .. nc: q;\r\nvar 1 .. nc: nsw; var 1 .. nc: v; var 1 .. nc: t;\r\nconstraint wa != nt;\r\nconstraint wa != sa;\r\nconstraint nt != sa;\r\nconstraint nt != q;\r\nconstraint sa != q;\r\nconstraint sa != nsw;\r\nconstraint sa != v;\r\nconstraint q != nsw;\r\nconstraint nsw != v;\r\nsolve satisfy;\r\noutput [\r\n \"wa=\\(wa)\\t nt=\\(nt)\\t sa=\\(sa)\\n\",\r\n \"q=\\(q)\\t nsw=\\(nsw)\\t v=\\(v)\\n\",\r\n \"t=\", show(t), \"\\n\"\r\n];"
+ }
+} \ No newline at end of file
diff --git a/test/optengine-tests/test_modelapi_valid.json b/test/optengine-tests/test_modelapi_valid.json
new file mode 100644
index 0000000..1fbca5b
--- /dev/null
+++ b/test/optengine-tests/test_modelapi_valid.json
@@ -0,0 +1,13 @@
+{
+ "requestInfo": {
+ "transactionId": "xxx-xxx-xxxx",
+ "requestID": "yyy-yyy-yyyy",
+ "sourceId": "cmopt"
+ },
+ "modelInfo": {
+ "modelId": "model2",
+ "solver": "mzn",
+ "description": "graph coloring problem for australia",
+ "modelContent": "int: nc;\r\nvar 1 .. nc: wa; var 1 .. nc: nt; var 1 .. nc: sa; var 1 .. nc: q;\r\nvar 1 .. nc: nsw; var 1 .. nc: v; var 1 .. nc: t;\r\nconstraint wa != nt;\r\nconstraint wa != sa;\r\nconstraint nt != sa;\r\nconstraint nt != q;\r\nconstraint sa != q;\r\nconstraint sa != nsw;\r\nconstraint sa != v;\r\nconstraint q != nsw;\r\nconstraint nsw != v;\r\nsolve satisfy;\r\noutput [\r\n \"wa=\\(wa)\\t nt=\\(nt)\\t sa=\\(sa)\\n\",\r\n \"q=\\(q)\\t nsw=\\(nsw)\\t v=\\(v)\\n\",\r\n \"t=\", show(t), \"\\n\"\r\n];"
+ }
+} \ No newline at end of file
diff --git a/test/optengine-tests/test_optengine_invalid.json b/test/optengine-tests/test_optengine_invalid.json
new file mode 100644
index 0000000..9a0267a
--- /dev/null
+++ b/test/optengine-tests/test_optengine_invalid.json
@@ -0,0 +1,18 @@
+{
+ "requestInfo": {
+ "transactioId": "xxx-xxx-xxxx",
+ "requestID": "yyy-yyy-yyyy",
+ "sourceId": "cmopt",
+ "timeout": 600
+ },
+ "optimInfo": {
+ "solver": "mzn",
+ "solverArgs": {
+ "solver": "geocode"
+ },
+ "modelContent": "int: nc;\r\nvar 1 .. nc: wa; var 1 .. nc: nt; var 1 .. nc: sa; var 1 .. nc: q;\r\nvar 1 .. nc: nsw; var 1 .. nc: v; var 1 .. nc: t;\r\nconstraint wa != nt;\r\nconstraint wa != sa;\r\nconstraint nt != sa;\r\nconstraint nt != q;\r\nconstraint sa != q;\r\nconstraint sa != nsw;\r\nconstraint sa != v;\r\nconstraint q != nsw;\r\nconstraint nsw != v;\r\nsolve satisfy;\r\noutput [\r\n \"wa=\\(wa)\\t nt=\\(nt)\\t sa=\\(sa)\\n\",\r\n \"q=\\(q)\\t nsw=\\(nsw)\\t v=\\(v)\\n\",\r\n \"t=\", show(t), \"\\n\"\r\n];",
+ "optData": {
+ "nc": 3
+ }
+ }
+} \ No newline at end of file
diff --git a/test/optengine-tests/test_optengine_invalid2.json b/test/optengine-tests/test_optengine_invalid2.json
new file mode 100644
index 0000000..23c5a8e
--- /dev/null
+++ b/test/optengine-tests/test_optengine_invalid2.json
@@ -0,0 +1,15 @@
+{
+ "requestInfo": {
+ "transactionId": "xxx-xxx-xxxx",
+ "requestID": "yyy-yyy-yyyy",
+ "sourceId": "cmopt",
+ "timeout": 600
+ },
+ "optimInfo": {
+
+ "solverArgs": {
+ "solver": "cbc"
+ },
+ "modelContent": "% Baking cakes for the school fete (with data file)\r\n\r\nint: flour; %no. grams of flour available\r\nint: banana; %no. of bananas available\r\nint: sugar; %no. grams of sugar available\r\nint: butter; %no. grams of butter available\r\nint: cocoa; %no. grams of cocoa available\r\n\r\nconstraint assert(flour >= 0,\"Invalid datafile: \" ++\r\n \"Amount of flour should be non-negative\");\r\nconstraint assert(banana >= 0,\"Invalid datafile: \" ++\r\n \"Amount of banana should be non-negative\");\r\nconstraint assert(sugar >= 0,\"Invalid datafile: \" ++\r\n \"Amount of sugar should be non-negative\");\r\nconstraint assert(butter >= 0,\"Invalid datafile: \" ++\r\n \"Amount of butter should be non-negative\");\r\nconstraint assert(cocoa >= 0,\"Invalid datafile: \" ++\r\n \"Amount of cocoa should be non-negative\");\r\n\r\nvar 0..100: b; % no. of banana cakes\r\nvar 0..100: c; % no. of chocolate cakes\r\n\r\n% flour\r\nconstraint 250*b + 200*c <= flour;\r\n% bananas\r\nconstraint 2*b <= banana;\r\n% sugar\r\nconstraint 75*b + 150*c <= sugar;\r\n% butter\r\nconstraint 100*b + 150*c <= butter;\r\n% cocoa\r\nconstraint 75*c <= cocoa;\r\n\r\n% maximize our profit\r\nsolve maximize 400*b + 450*c;\r\n\r\noutput [\"no. of banana cakes = \\(b)\\n\",\r\n \"no. of chocolate cakes = \\(c)\\n\"];"
+ }
+} \ No newline at end of file
diff --git a/test/optengine-tests/test_optengine_invalid_solver.json b/test/optengine-tests/test_optengine_invalid_solver.json
new file mode 100644
index 0000000..a967c16
--- /dev/null
+++ b/test/optengine-tests/test_optengine_invalid_solver.json
@@ -0,0 +1,15 @@
+{
+ "requestInfo": {
+ "transactionId": "xxx-xxx-xxxx",
+ "requestID": "yyy-yyy-yyyy",
+ "sourceId": "cmopt",
+ "timeout": 600
+ },
+ "optimInfo": {
+ "solver": "apy",
+ "modelContent": "import sys\r\n\r\nif __name__ == \"__main__\":\r\n print(sys.argv[1],sys.argv[2])\r\n\r\n with open(sys.argv[2], \"wt\") as f:\r\n f.write('{\"hello\":\"world\",\"another\":\"string\"}')\r\n\r\n",
+ "optData": {
+ "text": "flour = 8000; \r\nbanana = 11; \r\nsugar = 3000; \r\nbutter = 1500; \r\ncocoa = 800; "
+ }
+ }
+} \ No newline at end of file
diff --git a/test/optengine-tests/test_optengine_modelId.json b/test/optengine-tests/test_optengine_modelId.json
new file mode 100644
index 0000000..b676d91
--- /dev/null
+++ b/test/optengine-tests/test_optengine_modelId.json
@@ -0,0 +1,19 @@
+{
+ "requestInfo": {
+ "transactionId": "xxx-xxx-xxxx",
+ "requestID": "yyy-yyy-yyyy",
+ "sourceId": "cmopt",
+ "timeout": 600
+ },
+ "optimInfo": {
+ "modelId": "test",
+ "solverArgs": {
+ "solver": "geocode"
+ },
+ "optData": {
+ "json": {
+ "nc": 3
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/test/optengine-tests/test_optengine_no_modelid.json b/test/optengine-tests/test_optengine_no_modelid.json
new file mode 100644
index 0000000..9a8c3a4
--- /dev/null
+++ b/test/optengine-tests/test_optengine_no_modelid.json
@@ -0,0 +1,24 @@
+{
+ "requestInfo": {
+ "transactionId": "xxx-xxx-xxxx",
+ "requestID": "yyy-yyy-yyyy",
+ "sourceId": "cmopt",
+ "timeout": 600
+ },
+ "optimInfo": {
+ "solver": "mzn",
+ "solverArgs": {
+ "solver": "cbc"
+ },
+ "modelContent": "% Baking cakes for the school fete (with data file)\r\n\r\nint: flour; %no. grams of flour available\r\nint: banana; %no. of bananas available\r\nint: sugar; %no. grams of sugar available\r\nint: butter; %no. grams of butter available\r\nint: cocoa; %no. grams of cocoa available\r\n\r\nconstraint assert(flour >= 0,\"Invalid datafile: \" ++\r\n \"Amount of flour should be non-negative\");\r\nconstraint assert(banana >= 0,\"Invalid datafile: \" ++\r\n \"Amount of banana should be non-negative\");\r\nconstraint assert(sugar >= 0,\"Invalid datafile: \" ++\r\n \"Amount of sugar should be non-negative\");\r\nconstraint assert(butter >= 0,\"Invalid datafile: \" ++\r\n \"Amount of butter should be non-negative\");\r\nconstraint assert(cocoa >= 0,\"Invalid datafile: \" ++\r\n \"Amount of cocoa should be non-negative\");\r\n\r\nvar 0..100: b; % no. of banana cakes\r\nvar 0..100: c; % no. of chocolate cakes\r\n\r\n% flour\r\nconstraint 250*b + 200*c <= flour;\r\n% bananas\r\nconstraint 2*b <= banana;\r\n% sugar\r\nconstraint 75*b + 150*c <= sugar;\r\n% butter\r\nconstraint 100*b + 150*c <= butter;\r\n% cocoa\r\nconstraint 75*c <= cocoa;\r\n\r\n% maximize our profit\r\nsolve maximize 400*b + 450*c;\r\n\r\noutput [\"no. of banana cakes = \\(b)\\n\",\r\n \"no. of chocolate cakes = \\(c)\\n\"];",
+ "optData": {
+ "json": {
+ "flour": 4000,
+ "banana": 6,
+ "sugar": 2000,
+ "butter": 500,
+ "cocoa": 500
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/test/optengine-tests/test_optengine_no_optdata.json b/test/optengine-tests/test_optengine_no_optdata.json
new file mode 100644
index 0000000..f6645c8
--- /dev/null
+++ b/test/optengine-tests/test_optengine_no_optdata.json
@@ -0,0 +1,15 @@
+{
+ "requestInfo": {
+ "transactionId": "xxx-xxx-xxxx",
+ "requestID": "yyy-yyy-yyyy",
+ "sourceId": "cmopt",
+ "timeout": 600
+ },
+ "optimInfo": {
+ "solver": "mzn",
+ "solverArgs": {
+ "solver": "geocode"
+ },
+ "modelContent": "int: nc;\r\nvar 1 .. nc: wa; var 1 .. nc: nt; var 1 .. nc: sa; var 1 .. nc: q;\r\nvar 1 .. nc: nsw; var 1 .. nc: v; var 1 .. nc: t;\r\nconstraint wa != nt;\r\nconstraint wa != sa;\r\nconstraint nt != sa;\r\nconstraint nt != q;\r\nconstraint sa != q;\r\nconstraint sa != nsw;\r\nconstraint sa != v;\r\nconstraint q != nsw;\r\nconstraint nsw != v;\r\nsolve satisfy;\r\noutput [\r\n \"wa=\\(wa)\\t nt=\\(nt)\\t sa=\\(sa)\\n\",\r\n \"q=\\(q)\\t nsw=\\(nsw)\\t v=\\(v)\\n\",\r\n \"t=\", show(t), \"\\n\"\r\n];"
+ }
+} \ No newline at end of file
diff --git a/test/optengine-tests/test_optengine_solverid.json b/test/optengine-tests/test_optengine_solverid.json
new file mode 100644
index 0000000..bfd446c
--- /dev/null
+++ b/test/optengine-tests/test_optengine_solverid.json
@@ -0,0 +1,15 @@
+{
+ "requestInfo": {
+ "transactionId": "xxx-xxx-xxxx",
+ "requestID": "yyy-yyy-yyyy",
+ "sourceId": "cmopt",
+ "timeout": 600
+ },
+ "optimInfo": {
+ "solver": "py",
+ "modelContent": "import sys\r\n\r\nif __name__ == \"__main__\":\r\n print(sys.argv[1],sys.argv[2])\r\n\r\n with open(sys.argv[2], \"wt\") as f:\r\n f.write('{\"hello\":\"world\",\"another\":\"string\"}')\r\n\r\n",
+ "optData": {
+ "text": "flour = 8000; \r\nbanana = 11; \r\nsugar = 3000; \r\nbutter = 1500; \r\ncocoa = 800; "
+ }
+ }
+} \ No newline at end of file
diff --git a/test/optengine-tests/test_optengine_valid.json b/test/optengine-tests/test_optengine_valid.json
new file mode 100644
index 0000000..8de2b71
--- /dev/null
+++ b/test/optengine-tests/test_optengine_valid.json
@@ -0,0 +1,20 @@
+{
+ "requestInfo": {
+ "transactionId": "xxx-xxx-xxxx",
+ "requestID": "yyy-yyy-yyyy",
+ "sourceId": "cmopt",
+ "timeout": 600
+ },
+ "optimInfo": {
+ "solver": "mzn",
+ "solverArgs": {
+ "solver": "geocode"
+ },
+ "modelContent": "int: nc;\r\nvar 1 .. nc: wa; var 1 .. nc: nt; var 1 .. nc: sa; var 1 .. nc: q;\r\nvar 1 .. nc: nsw; var 1 .. nc: v; var 1 .. nc: t;\r\nconstraint wa != nt;\r\nconstraint wa != sa;\r\nconstraint nt != sa;\r\nconstraint nt != q;\r\nconstraint sa != q;\r\nconstraint sa != nsw;\r\nconstraint sa != v;\r\nconstraint q != nsw;\r\nconstraint nsw != v;\r\nsolve satisfy;\r\noutput [\r\n \"wa=\\(wa)\\t nt=\\(nt)\\t sa=\\(sa)\\n\",\r\n \"q=\\(q)\\t nsw=\\(nsw)\\t v=\\(v)\\n\",\r\n \"t=\", show(t), \"\\n\"\r\n];",
+ "optData": {
+ "json": {
+ "nc": 3
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/test/optengine-tests/test_py_optengine_valid.json b/test/optengine-tests/test_py_optengine_valid.json
new file mode 100644
index 0000000..bfd446c
--- /dev/null
+++ b/test/optengine-tests/test_py_optengine_valid.json
@@ -0,0 +1,15 @@
+{
+ "requestInfo": {
+ "transactionId": "xxx-xxx-xxxx",
+ "requestID": "yyy-yyy-yyyy",
+ "sourceId": "cmopt",
+ "timeout": 600
+ },
+ "optimInfo": {
+ "solver": "py",
+ "modelContent": "import sys\r\n\r\nif __name__ == \"__main__\":\r\n print(sys.argv[1],sys.argv[2])\r\n\r\n with open(sys.argv[2], \"wt\") as f:\r\n f.write('{\"hello\":\"world\",\"another\":\"string\"}')\r\n\r\n",
+ "optData": {
+ "text": "flour = 8000; \r\nbanana = 11; \r\nsugar = 3000; \r\nbutter = 1500; \r\ncocoa = 800; "
+ }
+ }
+} \ No newline at end of file
diff --git a/test/placement-tests/policy_response.json b/test/placement-tests/policy_response.json
index 8de8537..a257ecc 100644
--- a/test/placement-tests/policy_response.json
+++ b/test/placement-tests/policy_response.json
@@ -1,182 +1,694 @@
-[
{
- "policyConfigMessage": "Config Retrieved! ",
- "policyConfigStatus": "CONFIG_RETRIEVED",
- "type": "JSON",
- "config": "{\"service\":\"SubscriberPolicy\",\"policyName\":\"oofBeijing.SubscriberPolicy_v1\",\"description\":\"Subscriber Policy\",\"templateVersion\":\"0.0.1\",\"version\":\"oofBeijing\",\"priority\":\"1\",\"riskType\":\"test\",\"riskLevel\":\"3\",\"guard\":\"False\",\"content\":{\"identity\":\"subscriber\",\"policyScope\":[\"vcpe\",\"PVT Homing\",\"subscriberpolicy\",\"subscriber_x\",\"subscriber_y\"],\"properties\":{\"subscriberName\":[\"subscriber_x\",\"subscriber_y\"],\"subscriberRole\":[\"PVT Homing\"],\"provStatus\":[\"CAPPED\"]},\"policyType\":\"SubscriberPolicy\"}}",
- "policyName": "oofBeijing.Config_MS_SubscriberPolicy_v1.1.xml",
- "policyVersion": "1",
- "matchingConditions": {
- "ECOMPName": "SNIRO-Placement",
- "ONAPName": "SNIRO-Placement",
- "ConfigName": "",
- "service": "SubscriberPolicy",
- "uuid": "",
- "Location": ""
- },
- "responseAttributes": { },
- "property": null
- },
- {
- "policyConfigMessage": "Config Retrieved! ",
- "policyConfigStatus": "CONFIG_RETRIEVED",
- "type": "JSON",
- "config": "{\"service\":\"hpaPolicy\",\"policyName\":\"oofBeijing.hpaPolicy_vGMuxInfra\",\"description\":\"HPA policy for vGMuxInfra\",\"templateVersion\":\"0.0.1\",\"version\":\"1.0\",\"priority\":\"3\",\"riskType\":\"test\",\"riskLevel\":\"2\",\"guard\":\"False\",\"content\":{\"resources\":\"vGMuxInfra\",\"identity\":\"hpaPolicy_vGMuxInfra\",\"policyScope\":[\"vcpe\",\"PVT Homing\",\"us\",\"international\",\"ip\",\"vGMuxInfra\"],\"policyType\":\"hpaPolicy\",\"flavorFeatures\":[{\"flavorLabel\":\"flavor_label_vm_01\",\"flavorProperties\":[{\"hpa-feature\":\"cpuTopology\",\"mandatory\":\"True\",\"architecture\":\"generic\",\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"numCpusockets\",\"hpa-attribute-value\":\"2\",\"operator\":\">=\",\"unit\":\"\"},{\"hpa-attribute-key\":\"numCpusockets\",\"hpa-attribute-value\":\"4\",\"operator\":\"<=\",\"unit\":\"\"},{\"hpa-attribute-key\":\"numCpuCores\",\"hpa-attribute-value\":\"2\",\"operator\":\">=\",\"unit\":\"\"},{\"hpa-attribute-key\":\"numCpuCores\",\"hpa-attribute-value\":\"4\",\"operator\":\"<=\",\"unit\":\"\"},{\"hpa-attribute-key\":\"numCpuThreads\",\"hpa-attribute-value\":\"4\",\"operator\":\">=\",\"unit\":\"\"},{\"hpa-attribute-key\":\"numCpuThreads\",\"hpa-attribute-value\":\"8\",\"operator\":\"<=\",\"unit\":\"\"}]},{\"hpa-feature\":\"basicCapabilities\",\"mandatory\":\"True\",\"architecture\":\"generic\",\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"numVirtualCpu\",\"hpa-attribute-value\":\"6\",\"operator\":\"=\",\"unit\":\"\"},{\"hpa-attribute-key\":\"virtualMemSize\",\"hpa-attribute-value\":\"6\",\"operator\":\"=\",\"unit\":\"GB\"}]},{\"hpa-feature\":\"ovsDpdk\",\"mandatory\":\"False\",\"score\":\"3\",\"architecture\":\"generic\",\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"dataProcessingAccelerationLibrary\",\"hpa-attribute-value\":\"ovsDpdk_version\",\"operator\":\"=\",\"unit\":\"\"}]},{\"hpa-feature\":\"cpuInstructionSetExtensions\",\"mandatory\":\"True\",\"architecture\":\"INTEL-64\",\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"instructionSetExtensions\",\"hpa-attribute-value\":[\"<CPUINST>\",\"<CPUINST>\"],\"operator\":\"ALL\",\"unit\":\"\"}]}]},{\"flavorLabel\":\"flavor_label_vm_02\",\"flavorProperties\":[{\"hpa-feature\":\"cpuPinningy\",\"mandatory\":\"True\",\"architecture\":\"generic\",\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"logicalCpuThreadPinningPolicy\",\"hpa-attribute-value\":\"<CPUTHREADPOLICY>\",\"operator\":\"=\",\"unit\":\"\"},{\"hpa-attribute-key\":\"logicalCpuPinningPolicy\",\"hpa-attribute-value\":\"<CPUPOLICY>\",\"operator\":\"=\",\"unit\":\"\"}]},{\"hpa-feature\":\"basicCapabilities\",\"mandatory\":\"True\",\"architecture\":\"generic\",\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"numVirtualCpu\",\"hpa-attribute-value\":\"6\",\"operator\":\"=\",\"unit\":\"\"},{\"hpa-attribute-key\":\"virtualMemSize\",\"hpa-attribute-value\":\"6\",\"operator\":\"=\",\"unit\":\"GB\"}]},{\"hpa-feature\":\"localStorage\",\"mandatory\":\"False\",\"score\":\"5\",\"architecture\":\"generic\",\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"diskSize\",\"hpa-attribute-value\":\"2\",\"operator\":\"=\",\"unit\":\"GB\"},{\"hpa-attribute-key\":\"ephemeralDiskSize\",\"hpa-attribute-value\":\"2\",\"operator\":\"=\",\"unit\":\"GB\"},{\"hpa-attribute-key\":\"swapMemSize\",\"hpa-attribute-value\":\"16\",\"operator\":\"=\",\"unit\":\"MB\"}]},{\"hpa-feature\":\"pcie\",\"mandatory\":\"True\",\"architecture\":\"generic\",\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"pciCount\",\"hpa-attribute-value\":\"2\",\"operator\":\"=\",\"unit\":\"\"},{\"hpa-attribute-key\":\"pciVendorId\",\"hpa-attribute-value\":\"8086\",\"operator\":\"=\",\"unit\":\"\"},{\"hpa-attribute-key\":\"pciDeviceId\",\"hpa-attribute-value\":\"2\",\"operator\":\"=\",\"unit\":\"\"},{\"hpa-attribute-key\":\"functionType\",\"hpa-attribute-value\":\"<PCITYPEVALUE>\",\"operator\":\"=\",\"unit\":\"\"}]}]},{\"flavorLabel\":\"flavor_label_vm_03\",\"flavorProperties\":[{\"hpa-feature\":\"numa\",\"mandatory\":\"False\",\"score\":\"5\",\"architecture\":\"generic\",\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"numaNodes\",\"hpa-attribute-value\":\"2\",\"operator\":\"=\",\"unit\":\"\"},{\"hpa-attribute-key\":\"numaCpu-0\",\"hpa-attribute-value\":\"2\",\"operator\":\"=\",\"unit\":\"\"},{\"hpa-attribute-key\":\"numaMem-0\",\"hpa-attribute-value\":\"2048\",\"operator\":\"=\",\"unit\":\"MB\"},{\"hpa-attribute-key\":\"numaCpu-1\",\"hpa-attribute-value\":\"4\",\"operator\":\"=\",\"unit\":\"\"},{\"hpa-attribute-key\":\"numaMem-1\",\"value\":\"4096\",\"operator\":\"=\",\"unit\":\"MB\"}]},{\"hpa-feature\":\"basicCapabilities\",\"mandatory\":\"True\",\"architecture\":\"generic\",\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"numVirtualCpu\",\"hpa-attribute-value\":\"6\",\"operator\":\"=\",\"unit\":\"\"},{\"hpa-attribute-key\":\"virtualMemSize\",\"hpa-attribute-value\":\"6\",\"operator\":\"=\",\"unit\":\"GB\"}]},{\"hpa-feature\":\"hugePages\",\"mandatory\":\"False\",\"score\":\"7\",\"architecture\":\"generic\",\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"memoryPageSize\",\"hpa-attribute-value\":\"<MEMORYPAGESIZE>\",\"operator\":\"=\",\"unit\":\"\"}]}]}]}}",
- "policyName": "oofBeijing.Config_MS_hpaPolicy_vGMuxInfra.1.xml",
- "policyVersion": "1",
- "matchingConditions": {
- "ECOMPName": "SNIRO-Placement",
- "ONAPName": "SNIRO-Placement",
- "ConfigName": "",
- "service": "hpaPolicy",
- "uuid": "",
- "Location": ""
- },
- "responseAttributes": { },
- "property": null
- },
- {
- "policyConfigMessage": "Config Retrieved! ",
- "policyConfigStatus": "CONFIG_RETRIEVED",
- "type": "JSON",
- "config": "{\"service\":\"VnfPolicy\",\"policyName\":\"oofBeijing.vnfPolicy_vG\",\"description\":\"vnfPolicy\",\"templateVersion\":\"1702.03\",\"version\":\"oofBeijing\",\"priority\":\"6\",\"riskType\":\"test\",\"riskLevel\":\"3\",\"guard\":\"False\",\"content\":{\"identity\":\"vnf_vG\",\"policyScope\":[\"vcpe\",\"PVT Homing\",\"international\",\"ip\",\"vG\"],\"policyType\":\"vnf_policy\",\"resources\":[\"vG\"],\"applicableResources\":\"any\",\"vnfProperties\":[{\"inventoryProvider\":\"aai\",\"serviceType\":\"\",\"inventoryType\":\"cloud\",\"customerId\":\"\"},{\"inventoryProvider\":\"multicloud\",\"serviceType\":\"HNGATEWAY\",\"inventoryType\":\"service\",\"customerId\":\"21014aa2-526b-11e6-beb8-9e71128cae77\"}]}}",
- "policyName": "oofBeijing.Config_MS_vnfPolicy_vG.1.xml",
- "policyVersion": "1",
- "matchingConditions": {
- "ECOMPName": "SNIRO-Placement",
- "ONAPName": "SNIRO-Placement",
- "ConfigName": "",
- "service": "VnfPolicy",
- "uuid": "",
- "Location": ""
- },
- "responseAttributes": { },
- "property": null
- },
- {
- "policyConfigMessage": "Config Retrieved! ",
- "policyConfigStatus": "CONFIG_RETRIEVED",
- "type": "JSON",
- "config": "{\"service\":\"VnfPolicy\",\"policyName\":\"oofBeijing.vnfPolicy_vGMuxInfra\",\"description\":\"vnfPolicy\",\"templateVersion\":\"1702.03\",\"version\":\"oofBeijing\",\"priority\":\"6\",\"riskType\":\"test\",\"riskLevel\":\"3\",\"guard\":\"False\",\"content\":{\"identity\":\"vnf_vGMuxInfra\",\"policyScope\":[\"vcpe\",\"PVT Homing\",\"international\",\"ip\",\"vGMuxInfra\"],\"policyType\":\"vnf_policy\",\"resources\":[\"vGMuxInfra\"],\"applicableResources\":\"any\",\"vnfProperties\":[{\"inventoryProvider\":\"aai\",\"serviceType\":\"\",\"inventoryType\":\"cloud\",\"customerId\":\"\"},{\"inventoryProvider\":\"multicloud\",\"serviceType\":\"HNGATEWAY\",\"inventoryType\":\"service\",\"customerId\":\"21014aa2-526b-11e6-beb8-9e71128cae77\"}]}}",
- "policyName": "oofBeijing.Config_MS_vnfPolicy_vGMuxInfra.1.xml",
- "policyVersion": "1",
- "matchingConditions": {
- "ECOMPName": "SNIRO-Placement",
- "ONAPName": "SNIRO-Placement",
- "ConfigName": "",
- "service": "VnfPolicy",
- "uuid": "",
- "Location": ""
- },
- "responseAttributes": { },
- "property": null
- },
- {
- "policyConfigMessage": "Config Retrieved! ",
- "policyConfigStatus": "CONFIG_RETRIEVED",
- "type": "JSON",
- "config": "{\"service\":\"distancePolicy\",\"policyName\":\"oofBeijing.distancePolicy_vG\",\"description\":\"Distance Policy for vG\",\"templateVersion\":\"0.0.1\",\"version\":\"oofBeijing\",\"priority\":\"3\",\"riskType\":\"test\",\"riskLevel\":\"2\",\"guard\":\"False\",\"content\":{\"distanceProperties\":{\"locationInfo\":\"customer_location\",\"distance\":{\"value\":\"1500\",\"operator\":\"<\",\"unit\":\"km\"}},\"identity\":\"distance-vG\",\"resources\":[\"vG\"],\"policyScope\":[\"vcpe\",\"PVT Homing\",\"us\",\"international\",\"ip\",\"vG\"],\"policyType\":\"distancePolicy\",\"applicableResources\":\"any\"}}",
- "policyName": "oofBeijing.Config_MS_distancePolicy_vG.1.xml",
- "policyVersion": "1",
- "matchingConditions": {
- "ECOMPName": "SNIRO-Placement",
- "ONAPName": "SNIRO-Placement",
- "ConfigName": "",
- "service": "distancePolicy",
- "uuid": "",
- "Location": ""
- },
- "responseAttributes": { },
- "property": null
- },
- {
- "policyConfigMessage": "Config Retrieved! ",
- "policyConfigStatus": "CONFIG_RETRIEVED",
- "type": "JSON",
- "config": "{\"service\": \"capacityPolicy\", \"policyName\": \"oofBeijing.capacityPolicy_vG\", \"description\": \"Capacity policy for vG\", \"templateVersion\": \"1702.03\", \"version\": \"oofBeijing\", \"priority\": \"5\", \"riskType\": \"test\", \"riskLevel\": \"2\", \"guard\": \"False\", \"content\": {\"identity\": \"capacity_vG\", \"policyScope\": [\"vcpe\", \"PVT Homing\",\"us\", \"international\", \"ip\", \"vG\", \"vim_fit\"], \"resources\": [\"vG\"], \"capacityProperty\": {\"controller\": \"multicloud\", \"request\": \"{\\\"vCPU\\\": 10, \\\"Memory\\\": {\\\"quantity\\\": {\\\"get_param\\\": \\\"REQUIRED_MEM\\\"}, \\\"unit\\\": \\\"GB\\\"}, \\\"Storage\\\": {\\\"quantity\\\": {\\\"get_param\\\": \\\"REQUIRED_DISK\\\", \\\"unit\\\": \\\"GB\\\"}}}\"}, \"policyType\": \"vim_fit\", \"applicableResources\": \"any\"}}",
- "policyName": "oofBeijing.Config_MS_capacityPolicy_vG.1.xml",
- "policyVersion": "1",
- "matchingConditions": {
- "ECOMPName": "SNIRO-Placement",
- "ONAPName": "SNIRO-Placement",
- "ConfigName": "",
- "service": "capacityPolicy",
- "uuid": "",
- "Location": ""
- },
- "responseAttributes": { },
- "property": null
- },
- {
- "policyConfigMessage": "Config Retrieved! ",
- "policyConfigStatus": "CONFIG_RETRIEVED",
- "type": "JSON",
- "config": "{\"service\": \"optimizationQueryPolicy\", \"policyName\": \"oofBeijing.queryPolicy_vcpe\", \"description\": \"Optimization query policy for vcpe\", \"templateVersion\": \"0.0.1\", \"version\": \"oofBeijing\", \"priority\": \"3\", \"riskType\": \"test\", \"riskLevel\": \"2\", \"guard\": \"False\", \"content\": {\"queryProperties\": [{\"attribute\": \"locationId\", \"attribute_location\": \"customerLocation\", \"value\": \"\"}, {\"attribute\": \"id\", \"attribute_location\": \"vpnInfo.vpnId\", \"value\": \"\"}, {\"attribute\": \"upstreamBW\", \"attribute_location\": \"vpnInfo.upstreamBW\", \"value\": \"\"}, {\"attribute\": \"customerLatitude\", \"attribute_location\": \"customerLatitude\", \"value\": 32.89748}, {\"attribute\": \"customerLongitude\", \"attribute_location\": \"customerLongitude\", \"value\": -97.040443}], \"policyScope\": [\"vcpe\", \"PVT Homing\",\"us\", \"international\", \"ip\", \"vGMuxInfra\", \"vG\", \"optimizationQueryPolicy\"], \"policyType\": \"optimizationQueryPolicy\"}}",
- "policyName": "oofBeijing.Config_MS_queryPolicy_vcpe.1.xml",
- "policyVersion": "1",
- "matchingConditions": {
- "ECOMPName": "SNIRO-Placement",
- "ONAPName": "SNIRO-Placement",
- "ConfigName": "",
- "service": "optimizationQueryPolicy",
- "uuid": "",
- "Location": ""
- },
- "responseAttributes": { },
- "property": null
- },
- {
- "policyConfigMessage": "Config Retrieved! ",
- "policyConfigStatus": "CONFIG_RETRIEVED",
- "type": "JSON",
- "config": "{\"service\":\"PlacementOptimizationPolicy\",\"policyName\":\"oofBeijing.PlacementOptimizationPolicy_vGMuxInfra\",\"description\":\"Placement Optimization Policy for vGMuxInfra\",\"templateVersion\":\"1702.03\",\"version\":\"oofBeijing\",\"priority\":\"5\",\"riskType\":\"test\",\"riskLevel\":\"3\",\"guard\":\"False\",\"content\":{\"objectiveParameter\":{\"parameterAttributes\":[{\"resource\":[\"vGMuxInfra\"],\"customerLocationInfo\":\"customer_loc\",\"parameter\":\"distance\",\"weight\":\"1\",\"operator\":\"product\"},{\"resource\":[\"vG\"],\"customerLocationInfo\":\"customer_loc\",\"parameter\":\"distance\",\"weight\":\"1\",\"operator\":\"product\"}],\"operator\":\"sum\"},\"identity\":\"optimization\",\"policyScope\":[\"vcpe\",\"PVT Homing\",\"us\",\"international\",\"ip\",\"vGMuxInfra\",\"vG\"],\"policyType\":\"placementOptimization\",\"objective\":\"minimize\"}}",
- "policyName": "oofBeijing.Config_MS_PlacementOptimizationPolicy_vGMuxInfra.1.xml",
- "policyVersion": "1",
- "matchingConditions": {
- "ECOMPName": "SNIRO-Placement",
- "ONAPName": "SNIRO-Placement",
- "ConfigName": "",
- "service": "PlacementOptimizationPolicy",
- "uuid": "",
- "Location": ""
- },
- "responseAttributes": { },
- "property": null
- },
- {
- "policyConfigMessage": "Config Retrieved! ",
- "policyConfigStatus": "CONFIG_RETRIEVED",
- "type": "JSON",
- "config": "{\"service\":\"distancePolicy\",\"policyName\":\"oofBeijing.distancePolicy_vGMuxInfra\",\"description\":\"Distance Policy for vGMuxInfra\",\"templateVersion\":\"0.0.1\",\"version\":\"oofBeijing\",\"priority\":\"3\",\"riskType\":\"test\",\"riskLevel\":\"2\",\"guard\":\"False\",\"content\":{\"distanceProperties\":{\"locationInfo\":\"customer_location\",\"distance\":{\"value\":\"500\",\"operator\":\"<\",\"unit\":\"km\"}},\"identity\":\"distance-vGMuxInfra\",\"resources\":[\"vGMuxInfra\"],\"policyScope\":[\"vcpe\",\"PVT Homing\",\"us\",\"international\",\"ip\",\"vGMuxInfra\"],\"policyType\":\"distancePolicy\",\"applicableResources\":\"any\"}}",
- "policyName": "oofBeijing.Config_MS_distancePolicy_vGMuxInfra.1.xml",
- "policyVersion": "1",
- "matchingConditions": {
- "ECOMPName": "SNIRO-Placement",
- "ONAPName": "SNIRO-Placement",
- "ConfigName": "",
- "service": "distancePolicy",
- "uuid": "",
- "Location": ""
- },
- "responseAttributes": { },
- "property": null
- },
- {
- "policyConfigMessage": "Config Retrieved! ",
- "policyConfigStatus": "CONFIG_RETRIEVED",
- "type": "JSON",
- "config": "{\"service\": \"capacityPolicy\", \"policyName\": \"oofBeijing.capacityPolicy_vGMuxInfra\", \"description\": \"Capacity policy for vGMuxInfra\", \"templateVersion\": \"1702.03\", \"version\": \"oofBeijing\", \"priority\": \"5\", \"riskType\": \"test\", \"riskLevel\": \"2\", \"guard\": \"False\", \"content\": {\"identity\": \"capacity_vGMuxInfra\", \"policyScope\": [\"vcpe\", \"PVT Homing\",\"us\", \"international\", \"ip\", \"vGMuxInfra\", \"vim_fit\"], \"resources\": [\"vGMuxInfra\"], \"capacityProperty\": {\"controller\": \"multicloud\", \"request\": \"{\\\"vCPU\\\": 10, \\\"Memory\\\": {\\\"quantity\\\": {\\\"get_param\\\": \\\"REQUIRED_MEM\\\"}, \\\"unit\\\": \\\"GB\\\"}, \\\"Storage\\\": {\\\"quantity\\\": {\\\"get_param\\\": \\\"REQUIRED_DISK\\\", \\\"unit\\\": \\\"GB\\\"}}}\"}, \"policyType\": \"vim_fit\", \"applicableResources\": \"any\"}}",
- "policyName": "oofBeijing.Config_MS_capacityPolicy_vGMuxInfra.1.xml",
- "policyVersion": "1",
- "matchingConditions": {
- "ECOMPName": "SNIRO-Placement",
- "ONAPName": "SNIRO-Placement",
- "ConfigName": "",
- "service": "capacityPolicy",
- "uuid": "",
- "Location": ""
- },
- "responseAttributes": { },
- "property": null
+ "policies": {
+ "OSDF_FRANKFURT.SubscriberPolicy_v1": {
+ "type": "onap.policies.optimization.SubscriberPolicy",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.SubscriberPolicy_v1",
+ "policy-version": 1
+ },
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT"
+ ],
+ "services": [
+ "vCPE"
+ ],
+ "identity": "subscriber_vCPE",
+ "properties": {
+ "subscriberName": [
+ "subscriber_x",
+ "subscriber_y"
+ ],
+ "subscriberRole": [
+ "PVT Homing"
+ ],
+ "provStatus": [
+ "CAPPED"
+ ]
+ }
+ }
+ },
+ "OSDF_FRANKFURT.vnfPolicy_vG": {
+ "type": "onap.policies.optimization.VnfPolicy",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.vnfPolicy_vG",
+ "policy-version": 1
+ },
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT"
+ ],
+ "services": [
+ "vCPE"
+ ],
+ "resources": [
+ "vG"
+ ],
+ "geography": [
+ "US",
+ "INTERNATIONAL"
+ ],
+ "identity": "vnf_vG",
+ "applicableResources": "any",
+ "vnfProperties": [
+ {
+ "inventoryProvider": "aai",
+ "serviceType": "",
+ "inventoryType": "cloud",
+ "customerId": "",
+ "orchestrationStatus": "",
+ "equipmentRole": ""
+ }
+ ]
+ }
+ },
+ "OSDF_FRANKFURT.vnfPolicy_vGMuxInfra": {
+ "type": "onap.policies.optimization.VnfPolicy",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.vnfPolicy_vGMuxInfra",
+ "policy-version": 1
+ },
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT"
+ ],
+ "services": [
+ "vCPE"
+ ],
+ "resources": [
+ "vGMuxInfra"
+ ],
+ "geography": [
+ "US",
+ "INTERNATIONAL"
+ ],
+ "identity": "vnf_vGMuxInfra",
+ "applicableResources": "any",
+ "vnfProperties": [
+ {
+ "inventoryProvider": "aai",
+ "serviceType": "vGMuxInfra-xx",
+ "inventoryType": "service",
+ "customerId": "SDN-ETHERNET-INTERNET",
+ "orchestrationStatus": "",
+ "equipmentRole": ""
+ }
+ ]
+ }
+ },
+ "OSDF_FRANKFURT.Distance_vG_1": {
+ "type": "onap.policies.optimization.DistancePolicy",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.Distance_vG_1",
+ "policy-version": 1
+ },
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT"
+ ],
+ "services": [
+ "vCPE"
+ ],
+ "resources": [
+ "vG"
+ ],
+ "geography": [
+ "US",
+ "INTERNATIONAL"
+ ],
+ "identity": "distance-vG",
+ "applicableResources": "any",
+ "distanceProperties": {
+ "locationInfo": "customer_loc",
+ "distance": {
+ "value": "1500",
+ "operator": "<",
+ "unit": "km"
+ }
+ }
+ }
+ },
+ "OSDF_FRANKFURT.Distance_vGMuxInfra": {
+ "type": "onap.policies.optimization.DistancePolicy",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.Distance_vGMuxInfra",
+ "policy-version": 1
+ },
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT"
+ ],
+ "services": [
+ "vCPE"
+ ],
+ "resources": [
+ "vGMuxInfra"
+ ],
+ "geography": [
+ "US",
+ "INTERNATIONAL"
+ ],
+ "identity": "distance-vGMuxInfra",
+ "applicableResources": "any",
+ "distanceProperties": {
+ "locationInfo": "customer_loc",
+ "distance": {
+ "value": "500",
+ "operator": "<",
+ "unit": "km"
+ }
+ }
+ }
+ },
+ "OSDF_FRANKFURT.Placement_optimization_1": {
+ "type": "onap.policies.optimization.OptimizationPolicy",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.Placement_optimization_1",
+ "policy-version": 1
+ },
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT"
+ ],
+ "services": [
+ "vCPE"
+ ],
+ "resources": [
+ "vG",
+ "vGMuxInfra"
+ ],
+ "geography": [
+ "US",
+ "INTERNATIONAL"
+ ],
+ "identity": "optimization",
+ "objective": "minimize",
+ "objectiveParameter": {
+ "parameterAttributes": [
+ {
+ "resources": [
+ "vGMuxInfra"
+ ],
+ "customerLocationInfo": "customer_loc",
+ "parameter": "distance",
+ "weight": "1",
+ "operator": "product"
+ },
+ {
+ "resources": [
+ "vG"
+ ],
+ "customerLocationInfo": "customer_loc",
+ "parameter": "distance",
+ "weight": "1",
+ "operator": "product"
+ },
+ {
+ "resources": [
+ "vG"
+ ],
+ "parameter": "hpa_score",
+ "weight": "200",
+ "operator": "product"
+ },
+ {
+ "resources": [
+ "vFW"
+ ],
+ "customerLocationInfo": "customer_loc",
+ "parameter": "distance",
+ "weight": "100",
+ "operator": "product"
+ },
+ {
+ "resources": [
+ "vFW"
+ ],
+ "parameter": "hpa_score",
+ "weight": "200",
+ "operator": "product"
+ }
+ ],
+ "operator": "sum"
+ }
+ }
+ },
+ "OSDF_FRANKFURT.queryPolicy_vCPE": {
+ "type": "onap.policies.optimization.QueryPolicy",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.queryPolicy_vCPE",
+ "policy-version": 1
+ },
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT"
+ ],
+ "services": [
+ "vCPE"
+ ],
+ "resources": [
+ "vGMuxInfra",
+ "vG"
+ ],
+ "geography": [
+ "US",
+ "INTERNATIONAL"
+ ],
+ "identity": "vCPE_Query_Policy",
+ "queryProperties": [
+ {
+ "attribute": "customerLatitude",
+ "attribute_location": "customerLatitude"
+ },
+ {
+ "attribute": "customerLongitude",
+ "attribute_location": "customerLongitude"
+ }
+ ]
+ }
+ },
+ "OSDF_FRANKFURT.hpa_policy_vG_1": {
+ "type": "onap.policies.optimization.HpaPolicy",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.hpa_policy_vG_1",
+ "policy-version": 1
+ },
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT"
+ ],
+ "services": [
+ "vCPE"
+ ],
+ "resources": [
+ "vG"
+ ],
+ "geography": [
+ "US",
+ "INTERNATIONAL"
+ ],
+ "identity": "hpa-vG",
+ "flavorFeatures": [
+ {
+ "id": "vg_1",
+ "type": "vnfc",
+ "directives": [
+ {
+ "type": "flavor_directives",
+ "attributes": [
+ {
+ "attribute_name": "flavor_label_vm_01",
+ "attribute_value": ""
+ }
+ ]
+ }
+ ],
+ "flavorProperties": [
+ {
+ "hpa-feature": "cpuTopology",
+ "mandatory": "True",
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {
+ "hpa-attribute-key": "numCpuSockets",
+ "hpa-attribute-value": "2",
+ "operator": ">=",
+ "unit": ""
+ },
+ {
+ "hpa-attribute-key": "numCpuSockets",
+ "hpa-attribute-value": "4",
+ "operator": "<=",
+ "unit": ""
+ },
+ {
+ "hpa-attribute-key": "numCpuCores",
+ "hpa-attribute-value": "2",
+ "operator": ">=",
+ "unit": ""
+ },
+ {
+ "hpa-attribute-key": "numCpuCores",
+ "hpa-attribute-value": "4",
+ "operator": "<=",
+ "unit": ""
+ },
+ {
+ "hpa-attribute-key": "numCpuThreads",
+ "hpa-attribute-value": "4",
+ "operator": ">=",
+ "unit": ""
+ },
+ {
+ "hpa-attribute-key": "numCpuThreads",
+ "hpa-attribute-value": "8",
+ "operator": "<=",
+ "unit": ""
+ }
+ ]
+ },
+ {
+ "hpa-feature": "basicCapabilities",
+ "mandatory": true,
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {
+ "hpa-attribute-key": "numVirtualCpu",
+ "hpa-attribute-value": 6,
+ "operator": [
+ "="
+ ],
+ "unit": ""
+ },
+ {
+ "hpa-attribute-key": "virtualMemSize",
+ "hpa-attribute-value": 6,
+ "operator": [
+ "="
+ ],
+ "unit": ""
+ }
+ ]
+ },
+ {
+ "hpa-feature": "ovsDpdk",
+ "mandatory": false,
+ "score": 3,
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {
+ "hpa-attribute-key": "dataProcessingAccelerationLibrary",
+ "hpa-attribute-value": "ovsDpdk_version",
+ "operator": [
+ "="
+ ],
+ "unit": ""
+ }
+ ]
+ },
+ {
+ "hpa-feature": "cpuInstructionSetExtensions",
+ "mandatory": true,
+ "architecture": "INTEL-64",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {
+ "hpa-attribute-key": "instructionSetExtensions",
+ "hpa-attribute-value": [
+ "<CPUINST>",
+ "<CPUINST>"
+ ],
+ "operator": [
+ "ALL"
+ ],
+ "unit": ""
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "id": "vg_2",
+ "type": "vnfc",
+ "directives": [
+ {
+ "type": "flavor_directives",
+ "attributes": [
+ {
+ "attribute_name": "flavor_label_vm_02",
+ "attribute_value": ""
+ }
+ ]
+ }
+ ],
+ "flavorProperties": [
+ {
+ "hpa-feature": "cpuPinningy",
+ "mandatory": "True",
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {
+ "hpa-attribute-key": "logicalCpuThreadPinningPolicy",
+ "hpa-attribute-value": "<CPUTHREADPOLICY>",
+ "operator": "=",
+ "unit": ""
+ },
+ {
+ "hpa-attribute-key": "logicalCpuPinningPolicy",
+ "hpa-attribute-value": "<CPUPOLICY>",
+ "operator": "=",
+ "unit": ""
+ }
+ ]
+ },
+ {
+ "hpa-feature": "basicCapabilities",
+ "mandatory": "True",
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {
+ "hpa-attribute-key": "numVirtualCpu",
+ "hpa-attribute-value": "6",
+ "operator": "=",
+ "unit": ""
+ },
+ {
+ "hpa-attribute-key": "virtualMemSize",
+ "hpa-attribute-value": "6",
+ "operator": "=",
+ "unit": "GB"
+ }
+ ]
+ },
+ {
+ "hpa-feature": "localStorage",
+ "mandatory": "False",
+ "score": "5",
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {
+ "hpa-attribute-key": "diskSize",
+ "hpa-attribute-value": "2",
+ "operator": "=",
+ "unit": "GB"
+ },
+ {
+ "hpa-attribute-key": "ephemeralDiskSize",
+ "hpa-attribute-value": "2",
+ "operator": "=",
+ "unit": "GB"
+ },
+ {
+ "hpa-attribute-key": "swapMemSize",
+ "hpa-attribute-value": "16",
+ "operator": "=",
+ "unit": "MB"
+ }
+ ]
+ },
+ {
+ "hpa-feature": "pciePassthrough",
+ "mandatory": "True",
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {
+ "hpa-attribute-key": "pciCount",
+ "hpa-attribute-value": "2",
+ "operator": "=",
+ "unit": ""
+ },
+ {
+ "hpa-attribute-key": "pciVendorId",
+ "hpa-attribute-value": "8086",
+ "operator": "=",
+ "unit": ""
+ },
+ {
+ "hpa-attribute-key": "pciDeviceId",
+ "hpa-attribute-value": "2",
+ "operator": "=",
+ "unit": ""
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "id": "vg_3",
+ "type": "vnfc",
+ "directives": [
+ {
+ "type": "flavor_directives",
+ "attributes": [
+ {
+ "attribute_name": "flavor_label_vm_03",
+ "attribute_value": ""
+ }
+ ]
+ }
+ ],
+ "flavorProperties": [
+ {
+ "hpa-feature": "numa",
+ "mandatory": "False",
+ "score": "5",
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {
+ "hpa-attribute-key": "numaNodes",
+ "hpa-attribute-value": "2",
+ "operator": "=",
+ "unit": ""
+ },
+ {
+ "hpa-attribute-key": "numaCpu-0",
+ "hpa-attribute-value": "2",
+ "operator": "=",
+ "unit": ""
+ },
+ {
+ "hpa-attribute-key": "numaMem-0",
+ "hpa-attribute-value": "2048",
+ "operator": "=",
+ "unit": "MB"
+ },
+ {
+ "hpa-attribute-key": "numaCpu-1",
+ "hpa-attribute-value": "4",
+ "operator": "=",
+ "unit": ""
+ },
+ {
+ "hpa-attribute-key": "numaMem-1",
+ "value": "4096",
+ "operator": "=",
+ "unit": "MB"
+ }
+ ]
+ },
+ {
+ "hpa-feature": "basicCapabilities",
+ "mandatory": "True",
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {
+ "hpa-attribute-key": "numVirtualCpu",
+ "hpa-attribute-value": "6",
+ "operator": "=",
+ "unit": ""
+ },
+ {
+ "hpa-attribute-key": "virtualMemSize",
+ "hpa-attribute-value": "6",
+ "operator": "=",
+ "unit": "GB"
+ }
+ ]
+ },
+ {
+ "hpa-feature": "hugePages",
+ "mandatory": "False",
+ "score": "7",
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {
+ "hpa-attribute-key": "memoryPageSize",
+ "hpa-attribute-value": "<MEMORYPAGESIZE>",
+ "operator": "=",
+ "unit": ""
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ },
+ "OSDF_FRANKFURT.Capacity_vG_1": {
+ "type": "onap.policies.optimization.Vim_fit",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.Capacity_vG_1",
+ "policy-version": 1
+ },
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT"
+ ],
+ "services": [
+ "vCPE"
+ ],
+ "resources": [
+ "vG"
+ ],
+ "geography": [
+ "US",
+ "INTERNATIONAL"
+ ],
+ "identity": "capacity_vG",
+ "applicableResources": "any",
+ "capacityProperty": {
+ "controller": "multicloud",
+ "request": "{\"vCPU\": 10, \"Memory\": {\"quantity\": {\"get_param\": \"REQUIRED_MEM\"}, \"unit\": \"GB\"}, \"Storage\": {\"quantity\": {\"get_param\": \"REQUIRED_DISK\"}, \"unit\": \"GB\"}}"
+ }
+ }
+ },
+ "OSDF_FRANKFURT.Capacity_vGMuxInfra": {
+ "type": "onap.policies.optimization.Vim_fit",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.Capacity_vGMuxInfra",
+ "policy-version": 1
+ },
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT"
+ ],
+ "services": [
+ "vCPE"
+ ],
+ "resources": [
+ "vGMuxInfra"
+ ],
+ "geography": [
+ "US",
+ "INTERNATIONAL"
+ ],
+ "identity": "capacity_vGMuxInfra",
+ "applicableResources": "any",
+ "capacityProperty": {
+ "controller": "multicloud",
+ "request": "{\"vCPU\": 10, \"Memory\": {\"quantity\": {\"get_param\": \"REQUIRED_MEM\"}, \"unit\": \"GB\"}, \"Storage\": {\"quantity\": {\"get_param\": \"REQUIRED_DISK\"}, \"unit\": \"GB\"}}"
+ }
+ }
+ }
+ }
}
-] \ No newline at end of file
diff --git a/test/placement-tests/policy_response2.json b/test/placement-tests/policy_response2.json
index 2cd6dcb..15ddbe1 100644
--- a/test/placement-tests/policy_response2.json
+++ b/test/placement-tests/policy_response2.json
@@ -1,182 +1,705 @@
-[
- {
- "policyConfigMessage": "Config Retrieved! ",
- "policyConfigStatus": "CONFIG_RETRIEVED",
- "type": "JSON",
- "config": "{\"service\":\"SubscriberPolicy\",\"policyName\":\"oofBeijing.SubscriberPolicy_v1\",\"description\":\"Subscriber Policy\",\"templateVersion\":\"0.0.1\",\"version\":\"oofBeijing\",\"priority\":\"1\",\"riskType\":\"test\",\"riskLevel\":\"3\",\"guard\":\"False\",\"content\":{\"identity\":\"subscriber\",\"policyScope\":[\"vCPE\",\"PVT Homing\",\"SubscriberPolicy\",\"subscriber_x\",\"subscriber_y\"],\"properties\":{\"subscriberName\":[\"subscriber_x\",\"subscriber_y\"],\"subscriberRole\":[\"PVT Homing\"],\"provStatus\":[\"CAPPED\"]},\"policyType\":\"SubscriberPolicy\"}}",
- "policyName": "oofBeijing.Config_MS_SubscriberPolicy_v1.1.xml",
- "policyVersion": "1",
- "matchingConditions": {
- "ECOMPName": "SNIRO-Placement",
- "ONAPName": "SNIRO-Placement",
- "ConfigName": "",
- "service": "SubscriberPolicy",
- "uuid": "",
- "Location": ""
+{
+ "policies": {
+ "OSDF_FRANKFURT.SubscriberPolicy_v1": {
+ "type": "onap.policies.optimization.SubscriberPolicy",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.SubscriberPolicy_v1",
+ "policy-version": 1
+ },
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT",
+ "PVT Homing"
+ ],
+ "services": [
+ "vCPE"
+ ],
+ "identity": "subscriber_vCPE",
+ "properties": {
+ "subscriberName": [
+ "subscriber_x",
+ "subscriber_y"
+ ],
+ "subscriberRole": [
+ "PVT Homing"
+ ],
+ "provStatus": [
+ "CAPPED"
+ ]
+ }
+ }
},
- "responseAttributes": { },
- "property": null
- },
- {
- "policyConfigMessage": "Config Retrieved! ",
- "policyConfigStatus": "CONFIG_RETRIEVED",
- "type": "JSON",
- "config": "{\"service\":\"hpaPolicy\",\"policyName\":\"oofBeijing.hpaPolicy_vGMuxInfra\",\"description\":\"HPA policy for vGMuxInfra\",\"templateVersion\":\"0.0.1\",\"version\":\"1.0\",\"priority\":\"3\",\"riskType\":\"test\",\"riskLevel\":\"2\",\"guard\":\"False\",\"content\":{\"resources\":\"vGMuxInfra\",\"identity\":\"hpaPolicy_vGMuxInfra\",\"policyScope\":[\"vCPE\",\"PVT Homing\",\"US\",\"INTERNATIONAL\",\"ip\",\"vGMuxInfra\"],\"policyType\":\"hpaPolicy\",\"flavorFeatures\":[{\"flavorLabel\":\"flavor_label_vm_01\",\"flavorProperties\":[{\"hpa-feature\":\"cpuTopology\",\"mandatory\":\"True\",\"architecture\":\"generic\",\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"numCpuSockets\",\"hpa-attribute-value\":\"2\",\"operator\":\">=\",\"unit\":\"\"},{\"hpa-attribute-key\":\"numCpuSockets\",\"hpa-attribute-value\":\"4\",\"operator\":\"<=\",\"unit\":\"\"},{\"hpa-attribute-key\":\"numCpuCores\",\"hpa-attribute-value\":\"2\",\"operator\":\">=\",\"unit\":\"\"},{\"hpa-attribute-key\":\"numCpuCores\",\"hpa-attribute-value\":\"4\",\"operator\":\"<=\",\"unit\":\"\"},{\"hpa-attribute-key\":\"numCpuThreads\",\"hpa-attribute-value\":\"4\",\"operator\":\">=\",\"unit\":\"\"},{\"hpa-attribute-key\":\"numCpuThreads\",\"hpa-attribute-value\":\"8\",\"operator\":\"<=\",\"unit\":\"\"}]},{\"hpa-feature\":\"basicCapabilities\",\"mandatory\":\"True\",\"architecture\":\"generic\",\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"numVirtualCpu\",\"hpa-attribute-value\":\"6\",\"operator\":\"=\",\"unit\":\"\"},{\"hpa-attribute-key\":\"virtualMemSize\",\"hpa-attribute-value\":\"6\",\"operator\":\"=\",\"unit\":\"GB\"}]},{\"hpa-feature\":\"ovsDpdk\",\"mandatory\":\"False\",\"score\":\"3\",\"architecture\":\"generic\",\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"dataProcessingAccelerationLibrary\",\"hpa-attribute-value\":\"ovsDpdk_version\",\"operator\":\"=\",\"unit\":\"\"}]},{\"hpa-feature\":\"cpuInstructionSetExtensions\",\"mandatory\":\"True\",\"architecture\":\"INTEL-64\",\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"instructionSetExtensions\",\"hpa-attribute-value\":[\"<CPUINST>\",\"<CPUINST>\"],\"operator\":\"ALL\",\"unit\":\"\"}]}]},{\"flavorLabel\":\"flavor_label_vm_02\",\"flavorProperties\":[{\"hpa-feature\":\"cpuPinningy\",\"mandatory\":\"True\",\"architecture\":\"generic\",\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"logicalCpuThreadPinningPolicy\",\"hpa-attribute-value\":\"<CPUTHREADPOLICY>\",\"operator\":\"=\",\"unit\":\"\"},{\"hpa-attribute-key\":\"logicalCpuPinningPolicy\",\"hpa-attribute-value\":\"<CPUPOLICY>\",\"operator\":\"=\",\"unit\":\"\"}]},{\"hpa-feature\":\"basicCapabilities\",\"mandatory\":\"True\",\"architecture\":\"generic\",\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"numVirtualCpu\",\"hpa-attribute-value\":\"6\",\"operator\":\"=\",\"unit\":\"\"},{\"hpa-attribute-key\":\"virtualMemSize\",\"hpa-attribute-value\":\"6\",\"operator\":\"=\",\"unit\":\"GB\"}]},{\"hpa-feature\":\"localStorage\",\"mandatory\":\"False\",\"score\":\"5\",\"architecture\":\"generic\",\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"diskSize\",\"hpa-attribute-value\":\"2\",\"operator\":\"=\",\"unit\":\"GB\"},{\"hpa-attribute-key\":\"ephemeralDiskSize\",\"hpa-attribute-value\":\"2\",\"operator\":\"=\",\"unit\":\"GB\"},{\"hpa-attribute-key\":\"swapMemSize\",\"hpa-attribute-value\":\"16\",\"operator\":\"=\",\"unit\":\"MB\"}]},{\"hpa-feature\":\"pcie\",\"mandatory\":\"True\",\"architecture\":\"generic\",\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"pciCount\",\"hpa-attribute-value\":\"2\",\"operator\":\"=\",\"unit\":\"\"},{\"hpa-attribute-key\":\"pciVendorId\",\"hpa-attribute-value\":\"8086\",\"operator\":\"=\",\"unit\":\"\"},{\"hpa-attribute-key\":\"pciDeviceId\",\"hpa-attribute-value\":\"2\",\"operator\":\"=\",\"unit\":\"\"},{\"hpa-attribute-key\":\"functionType\",\"hpa-attribute-value\":\"<PCITYPEVALUE>\",\"operator\":\"=\",\"unit\":\"\"}]}]},{\"flavorLabel\":\"flavor_label_vm_03\",\"flavorProperties\":[{\"hpa-feature\":\"numa\",\"mandatory\":\"False\",\"score\":\"5\",\"architecture\":\"generic\",\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"numaNodes\",\"hpa-attribute-value\":\"2\",\"operator\":\"=\",\"unit\":\"\"},{\"hpa-attribute-key\":\"numaCpu-0\",\"hpa-attribute-value\":\"2\",\"operator\":\"=\",\"unit\":\"\"},{\"hpa-attribute-key\":\"numaMem-0\",\"hpa-attribute-value\":\"2048\",\"operator\":\"=\",\"unit\":\"MB\"},{\"hpa-attribute-key\":\"numaCpu-1\",\"hpa-attribute-value\":\"4\",\"operator\":\"=\",\"unit\":\"\"},{\"hpa-attribute-key\":\"numaMem-1\",\"value\":\"4096\",\"operator\":\"=\",\"unit\":\"MB\"}]},{\"hpa-feature\":\"basicCapabilities\",\"mandatory\":\"True\",\"architecture\":\"generic\",\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"numVirtualCpu\",\"hpa-attribute-value\":\"6\",\"operator\":\"=\",\"unit\":\"\"},{\"hpa-attribute-key\":\"virtualMemSize\",\"hpa-attribute-value\":\"6\",\"operator\":\"=\",\"unit\":\"GB\"}]},{\"hpa-feature\":\"hugePages\",\"mandatory\":\"False\",\"score\":\"7\",\"architecture\":\"generic\",\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"memoryPageSize\",\"hpa-attribute-value\":\"<MEMORYPAGESIZE>\",\"operator\":\"=\",\"unit\":\"\"}]}]}]}}",
- "policyName": "oofBeijing.Config_MS_hpaPolicy_vGMuxInfra.1.xml",
- "policyVersion": "1",
- "matchingConditions": {
- "ECOMPName": "SNIRO-Placement",
- "ONAPName": "SNIRO-Placement",
- "ConfigName": "",
- "service": "hpaPolicy",
- "uuid": "",
- "Location": ""
+ "OSDF_FRANKFURT.vnfPolicy_vG": {
+ "type": "onap.policies.optimization.VnfPolicy",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.vnfPolicy_vG",
+ "policy-version": 1
+ },
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT",
+ "PVT Homing"
+ ],
+ "services": [
+ "vCPE"
+ ],
+ "resources": [
+ "vG"
+ ],
+ "geography": [
+ "US",
+ "INTERNATIONAL"
+ ],
+ "identity": "vnf_vG",
+ "applicableResources": "any",
+ "vnfProperties": [
+ {
+ "inventoryProvider": "aai",
+ "serviceType": "",
+ "inventoryType": "cloud",
+ "customerId": "",
+ "orchestrationStatus": "",
+ "equipmentRole": ""
+ }
+ ]
+ }
},
- "responseAttributes": { },
- "property": null
- },
- {
- "policyConfigMessage": "Config Retrieved! ",
- "policyConfigStatus": "CONFIG_RETRIEVED",
- "type": "JSON",
- "config": "{\"service\":\"VnfPolicy\",\"policyName\":\"oofBeijing.vnfPolicy_vG\",\"description\":\"vnfPolicy\",\"templateVersion\":\"1702.03\",\"version\":\"oofBeijing\",\"priority\":\"6\",\"riskType\":\"test\",\"riskLevel\":\"3\",\"guard\":\"False\",\"content\":{\"identity\":\"vnf_vG\",\"policyScope\":[\"vCPE\",\"INTERNATIONAL\",\"ip\",\"vG\"],\"policyType\":\"vnf_policy\",\"resources\":[\"vG\"],\"applicableResources\":\"any\",\"vnfProperties\":[{\"inventoryProvider\":\"aai\",\"serviceType\":\"\",\"inventoryType\":\"cloud\",\"customerId\":\"\"},{\"inventoryProvider\":\"multicloud\",\"serviceType\":\"HNGATEWAY\",\"inventoryType\":\"service\",\"customerId\":\"21014aa2-526b-11e6-beb8-9e71128cae77\"}]}}",
- "policyName": "oofBeijing.Config_MS_vnfPolicy_vG.1.xml",
- "policyVersion": "1",
- "matchingConditions": {
- "ECOMPName": "SNIRO-Placement",
- "ONAPName": "SNIRO-Placement",
- "ConfigName": "",
- "service": "VnfPolicy",
- "uuid": "",
- "Location": ""
+ "OSDF_FRANKFURT.vnfPolicy_vGMuxInfra": {
+ "type": "onap.policies.optimization.VnfPolicy",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.vnfPolicy_vGMuxInfra",
+ "policy-version": 1
+ },
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT",
+ "PVT Homing"
+ ],
+ "services": [
+ "vCPE"
+ ],
+ "resources": [
+ "vGMuxInfra"
+ ],
+ "geography": [
+ "US",
+ "INTERNATIONAL"
+ ],
+ "identity": "vnf_vGMuxInfra",
+ "applicableResources": "any",
+ "vnfProperties": [
+ {
+ "inventoryProvider": "aai",
+ "serviceType": "vGMuxInfra-xx",
+ "inventoryType": "service",
+ "customerId": "SDN-ETHERNET-INTERNET",
+ "orchestrationStatus": "",
+ "equipmentRole": ""
+ }
+ ]
+ }
},
- "responseAttributes": { },
- "property": null
- },
- {
- "policyConfigMessage": "Config Retrieved! ",
- "policyConfigStatus": "CONFIG_RETRIEVED",
- "type": "JSON",
- "config": "{\"service\":\"VnfPolicy\",\"policyName\":\"oofBeijing.vnfPolicy_vGMuxInfra\",\"description\":\"vnfPolicy\",\"templateVersion\":\"1702.03\",\"version\":\"oofBeijing\",\"priority\":\"6\",\"riskType\":\"test\",\"riskLevel\":\"3\",\"guard\":\"False\",\"content\":{\"identity\":\"vnf_vGMuxInfra\",\"policyScope\":[\"vCPE\",\"INTERNATIONAL\",\"ip\",\"vGMuxInfra\"],\"policyType\":\"vnf_policy\",\"resources\":[\"vGMuxInfra\"],\"applicableResources\":\"any\",\"vnfProperties\":[{\"inventoryProvider\":\"aai\",\"serviceType\":\"\",\"inventoryType\":\"cloud\",\"customerId\":\"\"},{\"inventoryProvider\":\"multicloud\",\"serviceType\":\"HNGATEWAY\",\"inventoryType\":\"service\",\"customerId\":\"21014aa2-526b-11e6-beb8-9e71128cae77\"}]}}",
- "policyName": "oofBeijing.Config_MS_vnfPolicy_vGMuxInfra.1.xml",
- "policyVersion": "1",
- "matchingConditions": {
- "ECOMPName": "SNIRO-Placement",
- "ONAPName": "SNIRO-Placement",
- "ConfigName": "",
- "service": "VnfPolicy",
- "uuid": "",
- "Location": ""
+ "OSDF_FRANKFURT.Distance_vG_1": {
+ "type": "onap.policies.optimization.DistancePolicy",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.Distance_vG_1",
+ "policy-version": 1
+ },
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT",
+ "PVT Homing"
+ ],
+ "services": [
+ "vCPE"
+ ],
+ "resources": [
+ "vG"
+ ],
+ "geography": [
+ "US",
+ "INTERNATIONAL"
+ ],
+ "identity": "distance-vG",
+ "applicableResources": "any",
+ "distanceProperties": {
+ "locationInfo": "customer_loc",
+ "distance": {
+ "value": "1500",
+ "operator": "<",
+ "unit": "km"
+ }
+ }
+ }
},
- "responseAttributes": { },
- "property": null
- },
- {
- "policyConfigMessage": "Config Retrieved! ",
- "policyConfigStatus": "CONFIG_RETRIEVED",
- "type": "JSON",
- "config": "{\"service\":\"distancePolicy\",\"policyName\":\"oofBeijing.distancePolicy_vG\",\"description\":\"Distance Policy for vG\",\"templateVersion\":\"0.0.1\",\"version\":\"oofBeijing\",\"priority\":\"3\",\"riskType\":\"test\",\"riskLevel\":\"2\",\"guard\":\"False\",\"content\":{\"distanceProperties\":{\"locationInfo\":\"customer_location\",\"distance\":{\"value\":\"1500\",\"operator\":\"<\",\"unit\":\"km\"}},\"identity\":\"distance-vG\",\"resources\":[\"vG\"],\"policyScope\":[\"vCPE\",\"US\",\"INTERNATIONAL\",\"ip\",\"vG\"],\"policyType\":\"distancePolicy\",\"applicableResources\":\"any\"}}",
- "policyName": "oofBeijing.Config_MS_distancePolicy_vG.1.xml",
- "policyVersion": "1",
- "matchingConditions": {
- "ECOMPName": "SNIRO-Placement",
- "ONAPName": "SNIRO-Placement",
- "ConfigName": "",
- "service": "distancePolicy",
- "uuid": "",
- "Location": ""
+ "OSDF_FRANKFURT.Distance_vGMuxInfra": {
+ "type": "onap.policies.optimization.DistancePolicy",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.Distance_vGMuxInfra",
+ "policy-version": 1
+ },
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT",
+ "PVT Homing"
+ ],
+ "services": [
+ "vCPE"
+ ],
+ "resources": [
+ "vGMuxInfra"
+ ],
+ "geography": [
+ "US",
+ "INTERNATIONAL"
+ ],
+ "identity": "distance-vGMuxInfra",
+ "applicableResources": "any",
+ "distanceProperties": {
+ "locationInfo": "customer_loc",
+ "distance": {
+ "value": "500",
+ "operator": "<",
+ "unit": "km"
+ }
+ }
+ }
},
- "responseAttributes": { },
- "property": null
- },
- {
- "policyConfigMessage": "Config Retrieved! ",
- "policyConfigStatus": "CONFIG_RETRIEVED",
- "type": "JSON",
- "config": "{\"service\": \"capacityPolicy\", \"policyName\": \"oofBeijing.capacityPolicy_vG\", \"description\": \"Capacity policy for vG\", \"templateVersion\": \"1702.03\", \"version\": \"oofBeijing\", \"priority\": \"5\", \"riskType\": \"test\", \"riskLevel\": \"2\", \"guard\": \"False\", \"content\": {\"identity\": \"capacity_vG\", \"policyScope\": [\"VCPE\",\"US\", \"INTERNATIONAL\", \"ip\", \"vG\", \"vim_fit\"], \"resources\": [\"vG\"], \"capacityProperty\": {\"controller\": \"multicloud\", \"request\": \"{\\\"vCPU\\\": 10, \\\"Memory\\\": {\\\"quantity\\\": {\\\"get_param\\\": \\\"REQUIRED_MEM\\\"}, \\\"unit\\\": \\\"GB\\\"}, \\\"Storage\\\": {\\\"quantity\\\": {\\\"get_param\\\": \\\"REQUIRED_DISK\\\", \\\"unit\\\": \\\"GB\\\"}}}\"}, \"policyType\": \"vim_fit\", \"applicableResources\": \"any\"}}",
- "policyName": "oofBeijing.Config_MS_capacityPolicy_vG.1.xml",
- "policyVersion": "1",
- "matchingConditions": {
- "ECOMPName": "SNIRO-Placement",
- "ONAPName": "SNIRO-Placement",
- "ConfigName": "",
- "service": "capacityPolicy",
- "uuid": "",
- "Location": ""
+ "OSDF_FRANKFURT.Placement_optimization_1": {
+ "type": "onap.policies.optimization.OptimizationPolicy",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.Placement_optimization_1",
+ "policy-version": 1
+ },
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT",
+ "PVT Homing"
+ ],
+ "services": [
+ "vCPE"
+ ],
+ "resources": [
+ "vG",
+ "vGMuxInfra"
+ ],
+ "geography": [
+ "US",
+ "INTERNATIONAL"
+ ],
+ "identity": "optimization",
+ "objective": "minimize",
+ "objectiveParameter": {
+ "parameterAttributes": [
+ {
+ "resources": [
+ "vGMuxInfra"
+ ],
+ "customerLocationInfo": "customer_loc",
+ "parameter": "distance",
+ "weight": "1",
+ "operator": "product"
+ },
+ {
+ "resources": [
+ "vG"
+ ],
+ "customerLocationInfo": "customer_loc",
+ "parameter": "distance",
+ "weight": "1",
+ "operator": "product"
+ },
+ {
+ "resources": [
+ "vG"
+ ],
+ "parameter": "hpa_score",
+ "weight": "200",
+ "operator": "product"
+ },
+ {
+ "resources": [
+ "vFW"
+ ],
+ "customerLocationInfo": "customer_loc",
+ "parameter": "distance",
+ "weight": "100",
+ "operator": "product"
+ },
+ {
+ "resources": [
+ "vFW"
+ ],
+ "parameter": "hpa_score",
+ "weight": "200",
+ "operator": "product"
+ }
+ ],
+ "operator": "sum"
+ }
+ }
},
- "responseAttributes": { },
- "property": null
- },
- {
- "policyConfigMessage": "Config Retrieved! ",
- "policyConfigStatus": "CONFIG_RETRIEVED",
- "type": "JSON",
- "config": "{\"service\": \"optimizationQueryPolicy\", \"policyName\": \"oofBeijing.queryPolicy_vCPE\", \"description\": \"Optimization query policy for vCPE\", \"templateVersion\": \"0.0.1\", \"version\": \"oofBeijing\", \"priority\": \"3\", \"riskType\": \"test\", \"riskLevel\": \"2\", \"guard\": \"False\", \"content\": {\"queryProperties\": [{\"attribute\": \"locationId\", \"attribute_location\": \"customerLocation\", \"value\": \"\"}, {\"attribute\": \"id\", \"attribute_location\": \"vpnInfo.vpnId\", \"value\": \"\"}, {\"attribute\": \"upstreamBW\", \"attribute_location\": \"vpnInfo.upstreamBW\", \"value\": \"\"}, {\"attribute\": \"customerLatitude\", \"attribute_location\": \"customerLatitude\", \"value\": 32.89748}, {\"attribute\": \"customerLongitude\", \"attribute_location\": \"customerLongitude\", \"value\": -97.040443}], \"policyScope\": [\"vCPE\",\"US\", \"INTERNATIONAL\", \"ip\", \"vGMuxInfra\", \"vG\", \"optimizationQueryPolicy\"], \"policyType\": \"optimizationQueryPolicy\"}}",
- "policyName": "oofBeijing.Config_MS_queryPolicy_vCPE.1.xml",
- "policyVersion": "1",
- "matchingConditions": {
- "ECOMPName": "SNIRO-Placement",
- "ONAPName": "SNIRO-Placement",
- "ConfigName": "",
- "service": "optimizationQueryPolicy",
- "uuid": "",
- "Location": ""
+ "OSDF_FRANKFURT.queryPolicy_vCPE": {
+ "type": "onap.policies.optimization.QueryPolicy",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.queryPolicy_vCPE",
+ "policy-version": 1
+ },
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT",
+ "PVT Homing"
+ ],
+ "services": [
+ "vCPE"
+ ],
+ "resources": [
+ "vGMuxInfra",
+ "vG"
+ ],
+ "geography": [
+ "US",
+ "INTERNATIONAL"
+ ],
+ "identity": "vCPE_Query_Policy",
+ "queryProperties": [
+ {
+ "attribute": "customerLatitude",
+ "attribute_location": "customerLatitude"
+ },
+ {
+ "attribute": "customerLongitude",
+ "attribute_location": "customerLongitude"
+ }
+ ]
+ }
},
- "responseAttributes": { },
- "property": null
- },
- {
- "policyConfigMessage": "Config Retrieved! ",
- "policyConfigStatus": "CONFIG_RETRIEVED",
- "type": "JSON",
- "config": "{\"service\":\"PlacementOptimizationPolicy\",\"policyName\":\"oofBeijing.PlacementOptimizationPolicy_vGMuxInfra\",\"description\":\"Placement Optimization Policy for vGMuxInfra\",\"templateVersion\":\"1702.03\",\"version\":\"oofBeijing\",\"priority\":\"5\",\"riskType\":\"test\",\"riskLevel\":\"3\",\"guard\":\"False\",\"content\":{\"objectiveParameter\":{\"parameterAttributes\":[{\"resource\":[\"vGMuxInfra\"],\"customerLocationInfo\":\"customer_loc\",\"parameter\":\"distance\",\"weight\":\"1\",\"operator\":\"product\"},{\"resource\":[\"vG\"],\"customerLocationInfo\":\"customer_loc\",\"parameter\":\"distance\",\"weight\":\"1\",\"operator\":\"product\"}],\"operator\":\"sum\"},\"identity\":\"optimization\",\"policyScope\":[\"vCPE\",\"US\",\"INTERNATIONAL\",\"ip\",\"vGMuxInfra\",\"vG\"],\"policyType\":\"placementOptimization\",\"objective\":\"minimize\"}}",
- "policyName": "oofBeijing.Config_MS_PlacementOptimizationPolicy_vGMuxInfra.1.xml",
- "policyVersion": "1",
- "matchingConditions": {
- "ECOMPName": "SNIRO-Placement",
- "ONAPName": "SNIRO-Placement",
- "ConfigName": "",
- "service": "PlacementOptimizationPolicy",
- "uuid": "",
- "Location": ""
+ "OSDF_FRANKFURT.hpa_policy_vG_1": {
+ "type": "onap.policies.optimization.HpaPolicy",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.hpa_policy_vG_1",
+ "policy-version": 1
+ },
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT",
+ "PVT Homing"
+ ],
+ "services": [
+ "vCPE"
+ ],
+ "resources": [
+ "vG"
+ ],
+ "geography": [
+ "US",
+ "INTERNATIONAL"
+ ],
+ "identity": "hpa-vG",
+ "flavorFeatures": [
+ {
+ "id": "vg_1",
+ "type": "vnfc",
+ "directives": [
+ {
+ "type": "flavor_directives",
+ "attributes": [
+ {
+ "attribute_name": "flavor_label_vm_01",
+ "attribute_value": ""
+ }
+ ]
+ }
+ ],
+ "flavorProperties": [
+ {
+ "hpa-feature": "cpuTopology",
+ "mandatory": "True",
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {
+ "hpa-attribute-key": "numCpuSockets",
+ "hpa-attribute-value": "2",
+ "operator": ">=",
+ "unit": ""
+ },
+ {
+ "hpa-attribute-key": "numCpuSockets",
+ "hpa-attribute-value": "4",
+ "operator": "<=",
+ "unit": ""
+ },
+ {
+ "hpa-attribute-key": "numCpuCores",
+ "hpa-attribute-value": "2",
+ "operator": ">=",
+ "unit": ""
+ },
+ {
+ "hpa-attribute-key": "numCpuCores",
+ "hpa-attribute-value": "4",
+ "operator": "<=",
+ "unit": ""
+ },
+ {
+ "hpa-attribute-key": "numCpuThreads",
+ "hpa-attribute-value": "4",
+ "operator": ">=",
+ "unit": ""
+ },
+ {
+ "hpa-attribute-key": "numCpuThreads",
+ "hpa-attribute-value": "8",
+ "operator": "<=",
+ "unit": ""
+ }
+ ]
+ },
+ {
+ "hpa-feature": "basicCapabilities",
+ "mandatory": true,
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {
+ "hpa-attribute-key": "numVirtualCpu",
+ "hpa-attribute-value": 6,
+ "operator": [
+ "="
+ ],
+ "unit": ""
+ },
+ {
+ "hpa-attribute-key": "virtualMemSize",
+ "hpa-attribute-value": 6,
+ "operator": [
+ "="
+ ],
+ "unit": ""
+ }
+ ]
+ },
+ {
+ "hpa-feature": "ovsDpdk",
+ "mandatory": false,
+ "score": 3,
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {
+ "hpa-attribute-key": "dataProcessingAccelerationLibrary",
+ "hpa-attribute-value": "ovsDpdk_version",
+ "operator": [
+ "="
+ ],
+ "unit": ""
+ }
+ ]
+ },
+ {
+ "hpa-feature": "cpuInstructionSetExtensions",
+ "mandatory": true,
+ "architecture": "INTEL-64",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {
+ "hpa-attribute-key": "instructionSetExtensions",
+ "hpa-attribute-value": [
+ "<CPUINST>",
+ "<CPUINST>"
+ ],
+ "operator": [
+ "ALL"
+ ],
+ "unit": ""
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "id": "vg_2",
+ "type": "vnfc",
+ "directives": [
+ {
+ "type": "flavor_directives",
+ "attributes": [
+ {
+ "attribute_name": "flavor_label_vm_02",
+ "attribute_value": ""
+ }
+ ]
+ }
+ ],
+ "flavorProperties": [
+ {
+ "hpa-feature": "cpuPinningy",
+ "mandatory": "True",
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {
+ "hpa-attribute-key": "logicalCpuThreadPinningPolicy",
+ "hpa-attribute-value": "<CPUTHREADPOLICY>",
+ "operator": "=",
+ "unit": ""
+ },
+ {
+ "hpa-attribute-key": "logicalCpuPinningPolicy",
+ "hpa-attribute-value": "<CPUPOLICY>",
+ "operator": "=",
+ "unit": ""
+ }
+ ]
+ },
+ {
+ "hpa-feature": "basicCapabilities",
+ "mandatory": "True",
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {
+ "hpa-attribute-key": "numVirtualCpu",
+ "hpa-attribute-value": "6",
+ "operator": "=",
+ "unit": ""
+ },
+ {
+ "hpa-attribute-key": "virtualMemSize",
+ "hpa-attribute-value": "6",
+ "operator": "=",
+ "unit": "GB"
+ }
+ ]
+ },
+ {
+ "hpa-feature": "localStorage",
+ "mandatory": "False",
+ "score": "5",
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {
+ "hpa-attribute-key": "diskSize",
+ "hpa-attribute-value": "2",
+ "operator": "=",
+ "unit": "GB"
+ },
+ {
+ "hpa-attribute-key": "ephemeralDiskSize",
+ "hpa-attribute-value": "2",
+ "operator": "=",
+ "unit": "GB"
+ },
+ {
+ "hpa-attribute-key": "swapMemSize",
+ "hpa-attribute-value": "16",
+ "operator": "=",
+ "unit": "MB"
+ }
+ ]
+ },
+ {
+ "hpa-feature": "pciePassthrough",
+ "mandatory": "True",
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {
+ "hpa-attribute-key": "pciCount",
+ "hpa-attribute-value": "2",
+ "operator": "=",
+ "unit": ""
+ },
+ {
+ "hpa-attribute-key": "pciVendorId",
+ "hpa-attribute-value": "8086",
+ "operator": "=",
+ "unit": ""
+ },
+ {
+ "hpa-attribute-key": "pciDeviceId",
+ "hpa-attribute-value": "2",
+ "operator": "=",
+ "unit": ""
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "id": "vg_3",
+ "type": "vnfc",
+ "directives": [
+ {
+ "type": "flavor_directives",
+ "attributes": [
+ {
+ "attribute_name": "flavor_label_vm_03",
+ "attribute_value": ""
+ }
+ ]
+ }
+ ],
+ "flavorProperties": [
+ {
+ "hpa-feature": "numa",
+ "mandatory": "False",
+ "score": "5",
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {
+ "hpa-attribute-key": "numaNodes",
+ "hpa-attribute-value": "2",
+ "operator": "=",
+ "unit": ""
+ },
+ {
+ "hpa-attribute-key": "numaCpu-0",
+ "hpa-attribute-value": "2",
+ "operator": "=",
+ "unit": ""
+ },
+ {
+ "hpa-attribute-key": "numaMem-0",
+ "hpa-attribute-value": "2048",
+ "operator": "=",
+ "unit": "MB"
+ },
+ {
+ "hpa-attribute-key": "numaCpu-1",
+ "hpa-attribute-value": "4",
+ "operator": "=",
+ "unit": ""
+ },
+ {
+ "hpa-attribute-key": "numaMem-1",
+ "value": "4096",
+ "operator": "=",
+ "unit": "MB"
+ }
+ ]
+ },
+ {
+ "hpa-feature": "basicCapabilities",
+ "mandatory": "True",
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {
+ "hpa-attribute-key": "numVirtualCpu",
+ "hpa-attribute-value": "6",
+ "operator": "=",
+ "unit": ""
+ },
+ {
+ "hpa-attribute-key": "virtualMemSize",
+ "hpa-attribute-value": "6",
+ "operator": "=",
+ "unit": "GB"
+ }
+ ]
+ },
+ {
+ "hpa-feature": "hugePages",
+ "mandatory": "False",
+ "score": "7",
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {
+ "hpa-attribute-key": "memoryPageSize",
+ "hpa-attribute-value": "<MEMORYPAGESIZE>",
+ "operator": "=",
+ "unit": ""
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
},
- "responseAttributes": { },
- "property": null
- },
- {
- "policyConfigMessage": "Config Retrieved! ",
- "policyConfigStatus": "CONFIG_RETRIEVED",
- "type": "JSON",
- "config": "{\"service\":\"distancePolicy\",\"policyName\":\"oofBeijing.distancePolicy_vGMuxInfra\",\"description\":\"Distance Policy for vGMuxInfra\",\"templateVersion\":\"0.0.1\",\"version\":\"oofBeijing\",\"priority\":\"3\",\"riskType\":\"test\",\"riskLevel\":\"2\",\"guard\":\"False\",\"content\":{\"distanceProperties\":{\"locationInfo\":\"customer_location\",\"distance\":{\"value\":\"500\",\"operator\":\"<\",\"unit\":\"km\"}},\"identity\":\"distance-vGMuxInfra\",\"resources\":[\"vGMuxInfra\"],\"policyScope\":[\"vCPE\",\"US\",\"INTERNATIONAL\",\"ip\",\"vGMuxInfra\"],\"policyType\":\"distancePolicy\",\"applicableResources\":\"any\"}}",
- "policyName": "oofBeijing.Config_MS_distancePolicy_vGMuxInfra.1.xml",
- "policyVersion": "1",
- "matchingConditions": {
- "ECOMPName": "SNIRO-Placement",
- "ONAPName": "SNIRO-Placement",
- "ConfigName": "",
- "service": "distancePolicy",
- "uuid": "",
- "Location": ""
+ "OSDF_FRANKFURT.Capacity_vG_1": {
+ "type": "onap.policies.optimization.Vim_fit",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.Capacity_vG_1",
+ "policy-version": 1
+ },
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT",
+ "PVT Homing"
+ ],
+ "services": [
+ "vCPE"
+ ],
+ "resources": [
+ "vG"
+ ],
+ "geography": [
+ "US",
+ "INTERNATIONAL"
+ ],
+ "identity": "capacity_vG",
+ "applicableResources": "any",
+ "capacityProperty": {
+ "controller": "multicloud",
+ "request": "{\"vCPU\": 10, \"Memory\": {\"quantity\": {\"get_param\": \"REQUIRED_MEM\"}, \"unit\": \"GB\"}, \"Storage\": {\"quantity\": {\"get_param\": \"REQUIRED_DISK\"}, \"unit\": \"GB\"}}"
+ }
+ }
},
- "responseAttributes": { },
- "property": null
- },
- {
- "policyConfigMessage": "Config Retrieved! ",
- "policyConfigStatus": "CONFIG_RETRIEVED",
- "type": "JSON",
- "config": "{\"service\": \"capacityPolicy\", \"policyName\": \"oofBeijing.capacityPolicy_vGMuxInfra\", \"description\": \"Capacity policy for vGMuxInfra\", \"templateVersion\": \"1702.03\", \"version\": \"oofBeijing\", \"priority\": \"5\", \"riskType\": \"test\", \"riskLevel\": \"2\", \"guard\": \"False\", \"content\": {\"identity\": \"capacity_vGMuxInfra\", \"policyScope\": [\"VCPE\",\"US\", \"INTERNATIONAL\", \"ip\", \"vGMuxInfra\", \"vim_fit\"], \"resources\": [\"vGMuxInfra\"], \"capacityProperty\": {\"controller\": \"multicloud\", \"request\": \"{\\\"vCPU\\\": 10, \\\"Memory\\\": {\\\"quantity\\\": {\\\"get_param\\\": \\\"REQUIRED_MEM\\\"}, \\\"unit\\\": \\\"GB\\\"}, \\\"Storage\\\": {\\\"quantity\\\": {\\\"get_param\\\": \\\"REQUIRED_DISK\\\", \\\"unit\\\": \\\"GB\\\"}}}\"}, \"policyType\": \"vim_fit\", \"applicableResources\": \"any\"}}",
- "policyName": "oofBeijing.Config_MS_capacityPolicy_vGMuxInfra.1.xml",
- "policyVersion": "1",
- "matchingConditions": {
- "ECOMPName": "SNIRO-Placement",
- "ONAPName": "SNIRO-Placement",
- "ConfigName": "",
- "service": "capacityPolicy",
- "uuid": "",
- "Location": ""
- },
- "responseAttributes": { },
- "property": null
+ "OSDF_FRANKFURT.Capacity_vGMuxInfra": {
+ "type": "onap.policies.optimization.Vim_fit",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.Capacity_vGMuxInfra",
+ "policy-version": 1
+ },
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT",
+ "PVT Homing"
+ ],
+ "services": [
+ "vCPE"
+ ],
+ "resources": [
+ "vGMuxInfra"
+ ],
+ "geography": [
+ "US",
+ "INTERNATIONAL"
+ ],
+ "identity": "capacity_vGMuxInfra",
+ "applicableResources": "any",
+ "capacityProperty": {
+ "controller": "multicloud",
+ "request": "{\"vCPU\": 10, \"Memory\": {\"quantity\": {\"get_param\": \"REQUIRED_MEM\"}, \"unit\": \"GB\"}, \"Storage\": {\"quantity\": {\"get_param\": \"REQUIRED_DISK\"}, \"unit\": \"GB\"}}"
+ }
+ }
+ }
}
-] \ No newline at end of file
+}
+
diff --git a/test/placement-tests/request_placement_vfmod.json b/test/placement-tests/request_placement_vfmod.json
index 4b2b852..5242ee7 100644
--- a/test/placement-tests/request_placement_vfmod.json
+++ b/test/placement-tests/request_placement_vfmod.json
@@ -93,7 +93,7 @@
},
"constraints": {
"affinity_vFW_TD": {
- "type": "zone",
+ "type": "onap.policies.optimization.AffinityPolicy",
"demands": [
"vFW-SINK",
"vPGN"
diff --git a/test/placement-tests/test_by_scope.yaml b/test/placement-tests/test_by_scope.yaml
index 2cdd4e4..1968b89 100644
--- a/test/placement-tests/test_by_scope.yaml
+++ b/test/placement-tests/test_by_scope.yaml
@@ -2,23 +2,32 @@ references:
service_name:
source: request
value: serviceInfo.serviceName
+ resource:
+ source: request
+ value: placementInfo.placementDemands.resourceModuleName
subscriber_role:
- source: SubscriberPolicy
- value: content.properties.subscriberRole
+ source: onap.policies.optimization.SubscriberPolicy
+ value: properties.properties.subscriberRole
policy_info:
placement:
policy_fetch: by_scope
policy_scope:
- default_scope: OSDF_R2
- vcpe_scope: OSDF_R2
- secondary_scopes:
- -
- - get_param: service_name
- - SubscriberPolicy
- -
+ -
+ scope:
+ - OSDF_FRANKFURT
+ - onap.policies.optimization.SubscriberPolicy
+ service:
- get_param: service_name
+ -
+ scope:
+ - OSDF_FRANKFURT
- get_param: subscriber_role
+ service:
+ - get_param: service_name
+ # -
+ # - get_param: service_name
+ # - get_param: subscriber_role
default: # if no explicit service related information is needed
policy_fetch: by_name
- policy_scope: none
+ policy_scope: none \ No newline at end of file
diff --git a/test/placement-tests/test_by_scope_org.yaml b/test/placement-tests/test_by_scope_org.yaml
new file mode 100644
index 0000000..2cdd4e4
--- /dev/null
+++ b/test/placement-tests/test_by_scope_org.yaml
@@ -0,0 +1,24 @@
+references:
+ service_name:
+ source: request
+ value: serviceInfo.serviceName
+ subscriber_role:
+ source: SubscriberPolicy
+ value: content.properties.subscriberRole
+
+policy_info:
+ placement:
+ policy_fetch: by_scope
+ policy_scope:
+ default_scope: OSDF_R2
+ vcpe_scope: OSDF_R2
+ secondary_scopes:
+ -
+ - get_param: service_name
+ - SubscriberPolicy
+ -
+ - get_param: service_name
+ - get_param: subscriber_role
+ default: # if no explicit service related information is needed
+ policy_fetch: by_name
+ policy_scope: none
diff --git a/test/policy-local-files/meta-valid-policies-org.txt b/test/policy-local-files/meta-valid-policies-org.txt
new file mode 100644
index 0000000..99e3e88
--- /dev/null
+++ b/test/policy-local-files/meta-valid-policies-org.txt
@@ -0,0 +1,16 @@
+Affinity_vCPE_1.json
+Capacity_vGMuxInfra.json
+Capacity_vG_1.json
+Distance_vGMuxInfra_1.json
+Distance_vG_1.json
+Placement_Optimization_1.json
+QueryPolicy_vCPE.json
+QueryPolicy_vCPE_2.json
+hpa_policy_vGMuxInfra_1.json
+hpa_policy_vG_1.json
+vnfPolicy_vG.json
+vnfPolicy_vGMuxInfra.json
+QueryPolicy_vFW_TD.json
+vnfPolicy_vFW_TD.json
+vnfPolicy_vPGN_TD.json
+affinity_vFW_TD.json \ No newline at end of file
diff --git a/test/policy-local-files/meta-valid-policies.txt b/test/policy-local-files/meta-valid-policies.txt
index 99e3e88..53f113f 100644
--- a/test/policy-local-files/meta-valid-policies.txt
+++ b/test/policy-local-files/meta-valid-policies.txt
@@ -11,6 +11,3 @@ hpa_policy_vG_1.json
vnfPolicy_vG.json
vnfPolicy_vGMuxInfra.json
QueryPolicy_vFW_TD.json
-vnfPolicy_vFW_TD.json
-vnfPolicy_vPGN_TD.json
-affinity_vFW_TD.json \ No newline at end of file
diff --git a/test/policy-local-files/new_policies/Affinity_vCPE_1.json b/test/policy-local-files/new_policies/Affinity_vCPE_1.json
new file mode 100644
index 0000000..4f111eb
--- /dev/null
+++ b/test/policy-local-files/new_policies/Affinity_vCPE_1.json
@@ -0,0 +1,33 @@
+{
+ "OSDF_FRANKFURT.Affinity_vCPE_1": {
+ "type": "onap.policies.optimization.AffinityPolicy",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.Affinity_vCPE_1",
+ "policy-version": 1
+ },
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT"
+ ],
+ "services": [
+ "vCPE"
+ ],
+ "resources": [
+ "vG",
+ "vGMuxInfra"
+ ],
+ "geography": [
+ "US",
+ "INTERNATIONAL"
+ ],
+ "identity": "affinity_vCPE",
+ "applicableResources": "any",
+ "affinityProperties": {
+ "qualifier": "same",
+ "category": "complex"
+ }
+ }
+ }
+}
diff --git a/test/policy-local-files/new_policies/Affinity_vFW_TD.json b/test/policy-local-files/new_policies/Affinity_vFW_TD.json
new file mode 100644
index 0000000..53bb31b
--- /dev/null
+++ b/test/policy-local-files/new_policies/Affinity_vFW_TD.json
@@ -0,0 +1,31 @@
+{
+ "OSDF_FRANKFURT.Affinity_vFW_TD": {
+ "type": "onap.policies.optimization.AffinityPolicy",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.Affinity_vFW_TD",
+ "policy-version": 1
+ },
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT",
+ "TD"
+ ],
+ "resources": [
+ "vFW-SINK",
+ "vPGN"
+ ],
+ "geography": [
+ "US",
+ "INTERNATIONAL"
+ ],
+ "identity": "affinity_vFW_TD",
+ "applicableResources": "any",
+ "affinityProperties": {
+ "qualifier": "same",
+ "category": "region"
+ }
+ }
+ }
+}
diff --git a/test/policy-local-files/new_policies/Capacity_vGMuxInfra.json b/test/policy-local-files/new_policies/Capacity_vGMuxInfra.json
new file mode 100644
index 0000000..1d6d26d
--- /dev/null
+++ b/test/policy-local-files/new_policies/Capacity_vGMuxInfra.json
@@ -0,0 +1,32 @@
+{
+ "OSDF_FRANKFURT.Capacity_vGMuxInfra": {
+ "type": "onap.policies.optimization.Vim_fit",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.Capacity_vGMuxInfra",
+ "policy-version": 1
+ },
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT"
+ ],
+ "services": [
+ "vCPE"
+ ],
+ "resources": [
+ "vGMuxInfra"
+ ],
+ "geography": [
+ "US",
+ "INTERNATIONAL"
+ ],
+ "identity": "capacity_vGMuxInfra",
+ "applicableResources": "any",
+ "capacityProperty": {
+ "controller": "multicloud",
+ "request": "{\"vCPU\": 10, \"Memory\": {\"quantity\": {\"get_param\": \"REQUIRED_MEM\"}, \"unit\": \"GB\"}, \"Storage\": {\"quantity\": {\"get_param\": \"REQUIRED_DISK\"}, \"unit\": \"GB\"}}"
+ }
+ }
+ }
+}
diff --git a/test/policy-local-files/new_policies/Capacity_vG_1.json b/test/policy-local-files/new_policies/Capacity_vG_1.json
new file mode 100644
index 0000000..f07e7bc
--- /dev/null
+++ b/test/policy-local-files/new_policies/Capacity_vG_1.json
@@ -0,0 +1,32 @@
+{
+ "OSDF_FRANKFURT.Capacity_vG_1": {
+ "type": "onap.policies.optimization.Vim_fit",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.Capacity_vG_1",
+ "policy-version": 1
+ },
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT"
+ ],
+ "services": [
+ "vCPE"
+ ],
+ "resources": [
+ "vG"
+ ],
+ "geography": [
+ "US",
+ "INTERNATIONAL"
+ ],
+ "identity": "capacity_vG",
+ "applicableResources": "any",
+ "capacityProperty": {
+ "controller": "multicloud",
+ "request": "{\"vCPU\": 10, \"Memory\": {\"quantity\": {\"get_param\": \"REQUIRED_MEM\"}, \"unit\": \"GB\"}, \"Storage\": {\"quantity\": {\"get_param\": \"REQUIRED_DISK\"}, \"unit\": \"GB\"}}"
+ }
+ }
+ }
+}
diff --git a/test/policy-local-files/new_policies/Distance_vGMuxInfra_1.json b/test/policy-local-files/new_policies/Distance_vGMuxInfra_1.json
new file mode 100644
index 0000000..7de102e
--- /dev/null
+++ b/test/policy-local-files/new_policies/Distance_vGMuxInfra_1.json
@@ -0,0 +1,36 @@
+{
+ "OSDF_FRANKFURT.Distance_vGMuxInfra": {
+ "type": "onap.policies.optimization.DistancePolicy",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.Distance_vGMuxInfra",
+ "policy-version": 1
+ },
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT"
+ ],
+ "services": [
+ "vCPE"
+ ],
+ "resources": [
+ "vGMuxInfra"
+ ],
+ "geography": [
+ "US",
+ "INTERNATIONAL"
+ ],
+ "identity": "distance-vGMuxInfra",
+ "applicableResources": "any",
+ "distanceProperties": {
+ "locationInfo": "customer_loc",
+ "distance": {
+ "value": "500",
+ "operator": "<",
+ "unit": "km"
+ }
+ }
+ }
+ }
+}
diff --git a/test/policy-local-files/new_policies/Distance_vG_1.json b/test/policy-local-files/new_policies/Distance_vG_1.json
new file mode 100644
index 0000000..dcb45b2
--- /dev/null
+++ b/test/policy-local-files/new_policies/Distance_vG_1.json
@@ -0,0 +1,36 @@
+{
+ "OSDF_FRANKFURT.Distance_vG_1": {
+ "type": "onap.policies.optimization.DistancePolicy",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.Distance_vG_1",
+ "policy-version": 1
+ },
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT"
+ ],
+ "services": [
+ "vCPE"
+ ],
+ "resources": [
+ "vG"
+ ],
+ "geography": [
+ "US",
+ "INTERNATIONAL"
+ ],
+ "identity": "distance-vG",
+ "applicableResources": "any",
+ "distanceProperties": {
+ "locationInfo": "customer_loc",
+ "distance": {
+ "value": "1500",
+ "operator": "<",
+ "unit": "km"
+ }
+ }
+ }
+ }
+}
diff --git a/test/policy-local-files/new_policies/Placement_Optimization_1.json b/test/policy-local-files/new_policies/Placement_Optimization_1.json
new file mode 100644
index 0000000..b3efa64
--- /dev/null
+++ b/test/policy-local-files/new_policies/Placement_Optimization_1.json
@@ -0,0 +1,67 @@
+{
+ "OSDF_FRANKFURT.Placement_optimization_1": {
+ "type": "onap.policies.optimization.OptimizationPolicy",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.Placement_optimization_1",
+ "policy-version": 1
+ },
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT"
+ ],
+ "services": [
+ "vCPE"
+ ],
+ "resources": [
+ "vG",
+ "vGMuxInfra"
+ ],
+ "geography": [
+ "US",
+ "INTERNATIONAL"
+ ],
+ "identity": "optimization",
+ "objective": "minimize",
+ "objectiveParameter": {
+ "parameterAttributes": [
+ {
+ "resources": ["vGMuxInfra"],
+ "customerLocationInfo": "customer_loc",
+ "parameter": "distance",
+ "weight": "1",
+ "operator": "product"
+ },
+ {
+ "resources": ["vG"],
+ "customerLocationInfo": "customer_loc",
+ "parameter": "distance",
+ "weight": "1",
+ "operator": "product"
+ },
+ {
+ "resources": ["vG"],
+ "parameter": "hpa_score",
+ "weight": "200",
+ "operator": "product"
+ },
+ {
+ "resources": ["vFW"],
+ "customerLocationInfo": "customer_loc",
+ "parameter": "distance",
+ "weight": "100",
+ "operator": "product"
+ },
+ {
+ "resources": ["vFW"],
+ "parameter": "hpa_score",
+ "weight": "200",
+ "operator": "product"
+ }
+ ],
+ "operator": "sum"
+ }
+ }
+ }
+}
diff --git a/test/policy-local-files/new_policies/QueryPolicy_vCPE.json b/test/policy-local-files/new_policies/QueryPolicy_vCPE.json
new file mode 100644
index 0000000..1a8d205
--- /dev/null
+++ b/test/policy-local-files/new_policies/QueryPolicy_vCPE.json
@@ -0,0 +1,38 @@
+{
+ "OSDF_FRANKFURT.queryPolicy_vCPE": {
+ "type": "onap.policies.optimization.QueryPolicy",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.queryPolicy_vCPE",
+ "policy-version": 1
+ },
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT"
+ ],
+ "services": [
+ "vCPE"
+ ],
+ "resources": [
+ "vGMuxInfra",
+ "vG"
+ ],
+ "geography": [
+ "US",
+ "INTERNATIONAL"
+ ],
+ "identity": "vCPE_Query_Policy",
+ "queryProperties": [
+ {
+ "attribute": "customerLatitude",
+ "attribute_location": "customerLatitude"
+ },
+ {
+ "attribute": "customerLongitude",
+ "attribute_location": "customerLongitude"
+ }
+ ]
+ }
+ }
+}
diff --git a/test/policy-local-files/new_policies/QueryPolicy_vCPE_2.json b/test/policy-local-files/new_policies/QueryPolicy_vCPE_2.json
new file mode 100644
index 0000000..7a4d227
--- /dev/null
+++ b/test/policy-local-files/new_policies/QueryPolicy_vCPE_2.json
@@ -0,0 +1,55 @@
+{
+ "OSDF_FRANKFURT.queryPolicy_vCPE": {
+ "type": "onap.policies.optimization.QueryPolicy",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.queryPolicy_vCPE",
+ "policy-version": 1
+ },
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT"
+ ],
+ "services": [
+ "vCPE"
+ ],
+ "resources": [
+ "vGMuxInfra",
+ "vG"
+ ],
+ "geography": [
+ "US",
+ "INTERNATIONAL"
+ ],
+ "identity": "vCPE_Query_Policy",
+ "queryProperties": [
+ {
+ "attribute": "locationId",
+ "attribute_location": "customerLocation",
+ "value": ""
+ },
+ {
+ "attribute": "id",
+ "attribute_location": "vpnInfo.vpnId",
+ "value": ""
+ },
+ {
+ "attribute": "upstreamBW",
+ "attribute_location": "vpnInfo.upstreamBW",
+ "value": ""
+ },
+ {
+ "attribute": "customerLatitude",
+ "attribute_location": "customerLatitude",
+ "value": 1.1
+ },
+ {
+ "attribute": "customerLongitude",
+ "attribute_location": "customerLongitude",
+ "value": 2.2
+ }
+ ]
+ }
+ }
+}
diff --git a/test/policy-local-files/new_policies/QueryPolicy_vFW_TD.json b/test/policy-local-files/new_policies/QueryPolicy_vFW_TD.json
new file mode 100644
index 0000000..1a6eb21
--- /dev/null
+++ b/test/policy-local-files/new_policies/QueryPolicy_vFW_TD.json
@@ -0,0 +1,47 @@
+{
+ "OSDF_FRANKFURT.queryPolicy_vFW_TD": {
+ "type": "onap.policies.optimization.QueryPolicy",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.queryPolicy_vFW_TD",
+ "policy-version": 1
+ },
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT"
+ ],
+ "services": [
+ "vFW_TD"
+ ],
+ "resources": [
+ "vFW-SINK",
+ "vPGN"
+ ],
+ "geography": [
+ "US"
+ ],
+ "identity": "vFW_TD_Query_Policy",
+ "queryProperties": [
+ {
+ "attribute": "chosen_region",
+ "attribute_location": "chosenRegion"
+ },
+ {
+ "attribute": "chosen_customer_id",
+ "attribute_location": "chosenCustomerId"
+ },
+ {
+ "attribute": "customerLatitude",
+ "attribute_location": "customerLatitude",
+ "value": 1.1
+ },
+ {
+ "attribute": "customerLongitude",
+ "attribute_location": "customerLongitude",
+ "value": 2.2
+ }
+ ]
+ }
+ }
+}
diff --git a/test/policy-local-files/new_policies/hpa_policy_vGMuxInfra_1.json b/test/policy-local-files/new_policies/hpa_policy_vGMuxInfra_1.json
new file mode 100644
index 0000000..c233c5f
--- /dev/null
+++ b/test/policy-local-files/new_policies/hpa_policy_vGMuxInfra_1.json
@@ -0,0 +1,231 @@
+{
+ "OSDF_FRANKFURT.hpa_policy_vGMuxInfra_1": {
+ "type": "onap.policies.optimization.HpaPolicy",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.hpa_policy_vGMuxInfra_1",
+ "policy-version": 1
+ },
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT"
+ ],
+ "services": [
+ "vCPE"
+ ],
+ "resources": [
+ "vGMuxInfra"
+ ],
+ "geography": [
+ "US",
+ "INTERNATIONAL"
+ ],
+ "identity": "hpa-vGMuxInfra",
+ "flavorFeatures": [
+ {
+ "id": "vgmux_1",
+ "type": "vnfc",
+ "directives": [
+ {
+ "type": "flavor_directives",
+ "attributes": [
+ {
+ "attribute_name": "flavor_label_vm_01",
+ "attribute_value": ""
+ }
+ ]
+ }
+ ],
+ "flavorProperties": [
+ {
+ "hpa-feature" : "cpuTopology",
+ "mandatory" : "True",
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {"hpa-attribute-key":"numCpuSockets", "hpa-attribute-value": "2","operator": ">=", "unit": ""},
+ {"hpa-attribute-key":"numCpuSockets", "hpa-attribute-value": "4","operator": "<=", "unit": ""},
+ {"hpa-attribute-key":"numCpuCores", "hpa-attribute-value": "2", "operator":">=", "unit": ""},
+ {"hpa-attribute-key":"numCpuCores", "hpa-attribute-value": "4", "operator":"<=", "unit": ""},
+ {"hpa-attribute-key":"numCpuThreads", "hpa-attribute-value": "4", "operator":">=", "unit": ""},
+ {"hpa-attribute-key":"numCpuThreads", "hpa-attribute-value": "8", "operator":"<=", "unit": ""}
+ ]
+ },
+ {
+ "hpa-feature": "basicCapabilities",
+ "mandatory": true,
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {
+ "hpa-attribute-key": "numVirtualCpu",
+ "hpa-attribute-value": 6,
+ "operator": [
+ "="
+ ],
+ "unit": ""
+ },
+ {
+ "hpa-attribute-key": "virtualMemSize",
+ "hpa-attribute-value": 6,
+ "operator": [
+ "="
+ ],
+ "unit": ""
+ }
+ ]
+ },
+ {
+ "hpa-feature": "ovsDpdk",
+ "mandatory": false,
+ "score": 3,
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {
+ "hpa-attribute-key": "dataProcessingAccelerationLibrary",
+ "hpa-attribute-value": "ovsDpdk_version",
+ "operator": [
+ "="
+ ],
+ "unit": ""
+ }
+ ]
+ },
+ {
+ "hpa-feature": "cpuInstructionSetExtensions",
+ "mandatory": true,
+ "architecture": "INTEL-64",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {
+ "hpa-attribute-key": "instructionSetExtensions",
+ "hpa-attribute-value": [
+ "<CPUINST>",
+ "<CPUINST>"
+ ],
+ "operator": [
+ "ALL"
+ ],
+ "unit": ""
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "id": "vgmux_2",
+ "type": "vnfc",
+ "directives": [
+ {
+ "type": "flavor_directives",
+ "attributes": [
+ {
+ "attribute_name": "flavor_label_vm_02",
+ "attribute_value": ""
+ }
+ ]
+ }
+ ],
+ "flavorProperties":[
+ {
+ "hpa-feature" : "cpuPinningy",
+ "mandatory" : "True",
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {"hpa-attribute-key":"logicalCpuThreadPinningPolicy", "hpa-attribute-value":"<CPUTHREADPOLICY>", "operator": "=", "unit":""},
+ {"hpa-attribute-key":"logicalCpuPinningPolicy", "hpa-attribute-value": "<CPUPOLICY>","operator": "=", "unit":""}
+ ]
+ },
+ {
+ "hpa-feature" : "basicCapabilities",
+ "mandatory" : "True",
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {"hpa-attribute-key": "numVirtualCpu", "hpa-attribute-value": "6", "operator": "=", "unit": ""},
+ {"hpa-attribute-key": "virtualMemSize", "hpa-attribute-value":"6", "operator": "=", "unit": "GB"}
+ ]
+ },
+ {
+ "hpa-feature" : "localStorage",
+ "mandatory" : "False",
+ "score" : "5",
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {"hpa-attribute-key": "diskSize", "hpa-attribute-value": "2", "operator": "=", "unit": "GB"},
+ {"hpa-attribute-key": "ephemeralDiskSize", "hpa-attribute-value": "2", "operator": "=", "unit": "GB"},
+ {"hpa-attribute-key": "swapMemSize", "hpa-attribute-value":"16", "operator": "=", "unit": "MB"}
+ ]
+ },
+ {
+ "hpa-feature" : "pciePassthrough",
+ "mandatory" : "True",
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {"hpa-attribute-key": "pciCount", "hpa-attribute-value": "2", "operator": "=", "unit": ""},
+ {"hpa-attribute-key": "pciVendorId", "hpa-attribute-value":"8086", "operator": "=", "unit": ""},
+ {"hpa-attribute-key": "pciDeviceId", "hpa-attribute-value": "2", "operator": "=", "unit": ""}
+ ]
+ }
+]
+ },
+ {
+ "id": "vgmux_3",
+ "type": "vnfc",
+ "directives": [
+ {
+ "type": "flavor_directives",
+ "attributes": [
+ {
+ "attribute_name": "flavor_label_vm_03",
+ "attribute_value": ""
+ }
+ ]
+ }
+ ],
+ "flavorProperties":[
+ {
+ "hpa-feature" : "numa",
+ "mandatory" : "False",
+ "score" : "5",
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {"hpa-attribute-key": "numaNodes", "hpa-attribute-value": "2", "operator": "=", "unit": ""},
+ {"hpa-attribute-key": "numaCpu-0", "hpa-attribute-value":"2", "operator": "=", "unit": ""},
+ {"hpa-attribute-key": "numaMem-0", "hpa-attribute-value": "2048", "operator": "=", "unit": "MB"},
+ {"hpa-attribute-key": "numaCpu-1", "hpa-attribute-value":"4", "operator": "=", "unit": ""},
+ {"hpa-attribute-key": "numaMem-1", "value": "4096", "operator": "=", "unit": "MB"}
+ ]
+},
+ {
+ "hpa-feature" : "basicCapabilities",
+ "mandatory" : "True",
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {"hpa-attribute-key": "numVirtualCpu", "hpa-attribute-value": "6", "operator": "=", "unit": ""},
+ {"hpa-attribute-key": "virtualMemSize", "hpa-attribute-value":"6", "operator": "=", "unit": "GB"}
+ ]
+ },
+ {
+ "hpa-feature" : "hugePages",
+ "mandatory" : "False",
+ "score" : "7",
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {"hpa-attribute-key": "memoryPageSize", "hpa-attribute-value": "<MEMORYPAGESIZE>", "operator": "=", "unit": ""}
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ }
+}
diff --git a/test/policy-local-files/new_policies/hpa_policy_vG_1.json b/test/policy-local-files/new_policies/hpa_policy_vG_1.json
new file mode 100644
index 0000000..4f9a7b4
--- /dev/null
+++ b/test/policy-local-files/new_policies/hpa_policy_vG_1.json
@@ -0,0 +1,231 @@
+{
+ "OSDF_FRANKFURT.hpa_policy_vG_1": {
+ "type": "onap.policies.optimization.HpaPolicy",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.hpa_policy_vG_1",
+ "policy-version": 1
+ },
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT"
+ ],
+ "services": [
+ "vCPE"
+ ],
+ "resources": [
+ "vG"
+ ],
+ "geography": [
+ "US",
+ "INTERNATIONAL"
+ ],
+ "identity": "hpa-vG",
+ "flavorFeatures": [
+ {
+ "id": "vg_1",
+ "type": "vnfc",
+ "directives": [
+ {
+ "type": "flavor_directives",
+ "attributes": [
+ {
+ "attribute_name": "flavor_label_vm_01",
+ "attribute_value": ""
+ }
+ ]
+ }
+ ],
+ "flavorProperties": [
+ {
+ "hpa-feature" : "cpuTopology",
+ "mandatory" : "True",
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {"hpa-attribute-key":"numCpuSockets", "hpa-attribute-value": "2","operator": ">=", "unit": ""},
+ {"hpa-attribute-key":"numCpuSockets", "hpa-attribute-value": "4","operator": "<=", "unit": ""},
+ {"hpa-attribute-key":"numCpuCores", "hpa-attribute-value": "2", "operator":">=", "unit": ""},
+ {"hpa-attribute-key":"numCpuCores", "hpa-attribute-value": "4", "operator":"<=", "unit": ""},
+ {"hpa-attribute-key":"numCpuThreads", "hpa-attribute-value": "4", "operator":">=", "unit": ""},
+ {"hpa-attribute-key":"numCpuThreads", "hpa-attribute-value": "8", "operator":"<=", "unit": ""}
+ ]
+ },
+ {
+ "hpa-feature": "basicCapabilities",
+ "mandatory": true,
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {
+ "hpa-attribute-key": "numVirtualCpu",
+ "hpa-attribute-value": 6,
+ "operator": [
+ "="
+ ],
+ "unit": ""
+ },
+ {
+ "hpa-attribute-key": "virtualMemSize",
+ "hpa-attribute-value": 6,
+ "operator": [
+ "="
+ ],
+ "unit": ""
+ }
+ ]
+ },
+ {
+ "hpa-feature": "ovsDpdk",
+ "mandatory": false,
+ "score": 3,
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {
+ "hpa-attribute-key": "dataProcessingAccelerationLibrary",
+ "hpa-attribute-value": "ovsDpdk_version",
+ "operator": [
+ "="
+ ],
+ "unit": ""
+ }
+ ]
+ },
+ {
+ "hpa-feature": "cpuInstructionSetExtensions",
+ "mandatory": true,
+ "architecture": "INTEL-64",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {
+ "hpa-attribute-key": "instructionSetExtensions",
+ "hpa-attribute-value": [
+ "<CPUINST>",
+ "<CPUINST>"
+ ],
+ "operator": [
+ "ALL"
+ ],
+ "unit": ""
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "id": "vg_2",
+ "type": "vnfc",
+ "directives": [
+ {
+ "type": "flavor_directives",
+ "attributes": [
+ {
+ "attribute_name": "flavor_label_vm_02",
+ "attribute_value": ""
+ }
+ ]
+ }
+ ],
+ "flavorProperties":[
+ {
+ "hpa-feature" : "cpuPinningy",
+ "mandatory" : "True",
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {"hpa-attribute-key":"logicalCpuThreadPinningPolicy", "hpa-attribute-value":"<CPUTHREADPOLICY>", "operator": "=", "unit":""},
+ {"hpa-attribute-key":"logicalCpuPinningPolicy", "hpa-attribute-value": "<CPUPOLICY>","operator": "=", "unit":""}
+ ]
+ },
+ {
+ "hpa-feature" : "basicCapabilities",
+ "mandatory" : "True",
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {"hpa-attribute-key": "numVirtualCpu", "hpa-attribute-value": "6", "operator": "=", "unit": ""},
+ {"hpa-attribute-key": "virtualMemSize", "hpa-attribute-value":"6", "operator": "=", "unit": "GB"}
+ ]
+ },
+ {
+ "hpa-feature" : "localStorage",
+ "mandatory" : "False",
+ "score" : "5",
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {"hpa-attribute-key": "diskSize", "hpa-attribute-value": "2", "operator": "=", "unit": "GB"},
+ {"hpa-attribute-key": "ephemeralDiskSize", "hpa-attribute-value": "2", "operator": "=", "unit": "GB"},
+ {"hpa-attribute-key": "swapMemSize", "hpa-attribute-value":"16", "operator": "=", "unit": "MB"}
+ ]
+ },
+ {
+ "hpa-feature" : "pciePassthrough",
+ "mandatory" : "True",
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {"hpa-attribute-key": "pciCount", "hpa-attribute-value": "2", "operator": "=", "unit": ""},
+ {"hpa-attribute-key": "pciVendorId", "hpa-attribute-value":"8086", "operator": "=", "unit": ""},
+ {"hpa-attribute-key": "pciDeviceId", "hpa-attribute-value": "2", "operator": "=", "unit": ""}
+ ]
+ }
+]
+ },
+ {
+ "id": "vg_3",
+ "type": "vnfc",
+ "directives": [
+ {
+ "type": "flavor_directives",
+ "attributes": [
+ {
+ "attribute_name": "flavor_label_vm_03",
+ "attribute_value": ""
+ }
+ ]
+ }
+ ],
+ "flavorProperties":[
+ {
+ "hpa-feature" : "numa",
+ "mandatory" : "False",
+ "score" : "5",
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {"hpa-attribute-key": "numaNodes", "hpa-attribute-value": "2", "operator": "=", "unit": ""},
+ {"hpa-attribute-key": "numaCpu-0", "hpa-attribute-value":"2", "operator": "=", "unit": ""},
+ {"hpa-attribute-key": "numaMem-0", "hpa-attribute-value": "2048", "operator": "=", "unit": "MB"},
+ {"hpa-attribute-key": "numaCpu-1", "hpa-attribute-value":"4", "operator": "=", "unit": ""},
+ {"hpa-attribute-key": "numaMem-1", "value": "4096", "operator": "=", "unit": "MB"}
+ ]
+},
+ {
+ "hpa-feature" : "basicCapabilities",
+ "mandatory" : "True",
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {"hpa-attribute-key": "numVirtualCpu", "hpa-attribute-value": "6", "operator": "=", "unit": ""},
+ {"hpa-attribute-key": "virtualMemSize", "hpa-attribute-value":"6", "operator": "=", "unit": "GB"}
+ ]
+ },
+ {
+ "hpa-feature" : "hugePages",
+ "mandatory" : "False",
+ "score" : "7",
+ "architecture": "generic",
+ "directives": [],
+ "hpa-feature-attributes": [
+ {"hpa-attribute-key": "memoryPageSize", "hpa-attribute-value": "<MEMORYPAGESIZE>", "operator": "=", "unit": ""}
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ }
+}
diff --git a/test/policy-local-files/new_policies/meta-valid-policies.txt b/test/policy-local-files/new_policies/meta-valid-policies.txt
new file mode 100644
index 0000000..7f5a007
--- /dev/null
+++ b/test/policy-local-files/new_policies/meta-valid-policies.txt
@@ -0,0 +1,16 @@
+Affinity_vCPE_1.json
+Capacity_vGMuxInfra.json
+Capacity_vG_1.json
+Distance_vGMuxInfra_1.json
+Distance_vG_1.json
+Placement_Optimization_1.json
+QueryPolicy_vCPE.json
+QueryPolicy_vCPE_2.json
+hpa_policy_vGMuxInfra_1.json
+hpa_policy_vG_1.json
+vnfPolicy_vG.json
+vnfPolicy_vGMuxInfra.json
+QueryPolicy_vFW_TD.json
+vnfPolicy_vFW_TD.json
+vnfPolicy_vPGN_TD.json
+Affinity_vFW_TD.json
diff --git a/test/policy-local-files/new_policies/subscriber_policy_vCPE.json b/test/policy-local-files/new_policies/subscriber_policy_vCPE.json
new file mode 100644
index 0000000..305ce58
--- /dev/null
+++ b/test/policy-local-files/new_policies/subscriber_policy_vCPE.json
@@ -0,0 +1,32 @@
+{
+ "OSDF_FRANKFURT.SubscriberPolicy_v1": {
+ "type": "onap.policies.optimization.SubscriberPolicy",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.SubscriberPolicy_v1",
+ "policy-version": 1
+ },
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT"
+ ],
+ "services": [
+ "vCPE"
+ ],
+ "identity": "subscriber_vCPE",
+ "properties": {
+ "subscriberName": [
+ "subscriber_x",
+ "subscriber_y"
+ ],
+ "subscriberRole": [
+ "PVT Homing"
+ ],
+ "provStatus": [
+ "CAPPED"
+ ]
+ }
+ }
+ }
+}
diff --git a/test/policy-local-files/new_policies/vnfPolicy_vFW_TD.json b/test/policy-local-files/new_policies/vnfPolicy_vFW_TD.json
new file mode 100644
index 0000000..387ed56
--- /dev/null
+++ b/test/policy-local-files/new_policies/vnfPolicy_vFW_TD.json
@@ -0,0 +1,47 @@
+{
+ "OSDF_FRANKFURT.vnfPolicy_vFW_TD": {
+ "type": "onap.policies.optimization.VnfPolicy",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.vnfPolicy_vFW_TD",
+ "policy-version": 1
+ },
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT",
+ "TD"
+ ],
+ "resources": [
+ "vFW-SINK"
+ ],
+ "geography": [
+ "US"
+ ],
+ "identity": "vnf_vFW_TD",
+ "applicableResources": "any",
+ "vnfProperties": [{
+ "inventoryProvider": "aai",
+ "serviceType": "",
+ "inventoryType": "vfmodule",
+ "customerId": {
+ "get_param": "chosen_customer_id"
+ },
+ "equipmentRole": "",
+ "attributes": {
+ "orchestrationStatus": ["active"],
+ "provStatus": "ACTIVE",
+ "cloudRegionId": {
+ "get_param": "chosen_region"
+ },
+ "service_instance_id": {
+ "get_param": "service_id"
+ }
+ },
+ "passthroughAttributes": {
+ "td-role": "destination"
+ }
+ }]
+ }
+ }
+}
diff --git a/test/policy-local-files/new_policies/vnfPolicy_vG.json b/test/policy-local-files/new_policies/vnfPolicy_vG.json
new file mode 100644
index 0000000..786ffc2
--- /dev/null
+++ b/test/policy-local-files/new_policies/vnfPolicy_vG.json
@@ -0,0 +1,38 @@
+{
+ "OSDF_FRANKFURT.vnfPolicy_vG": {
+ "type": "onap.policies.optimization.VnfPolicy",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.vnfPolicy_vG",
+ "policy-version": 1
+ },
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT"
+ ],
+ "services": [
+ "vCPE"
+ ],
+ "resources": [
+ "vG"
+ ],
+ "geography": [
+ "US",
+ "INTERNATIONAL"
+ ],
+ "identity": "vnf_vG",
+ "applicableResources": "any",
+ "vnfProperties": [
+ {
+ "inventoryProvider": "aai",
+ "serviceType": "",
+ "inventoryType": "cloud",
+ "customerId": "",
+ "orchestrationStatus": "",
+ "equipmentRole": ""
+ }
+ ]
+ }
+ }
+}
diff --git a/test/policy-local-files/new_policies/vnfPolicy_vGMuxInfra.json b/test/policy-local-files/new_policies/vnfPolicy_vGMuxInfra.json
new file mode 100644
index 0000000..deb34fd
--- /dev/null
+++ b/test/policy-local-files/new_policies/vnfPolicy_vGMuxInfra.json
@@ -0,0 +1,38 @@
+{
+ "OSDF_FRANKFURT.vnfPolicy_vGMuxInfra": {
+ "type": "onap.policies.optimization.VnfPolicy",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.vnfPolicy_vGMuxInfra",
+ "policy-version": 1
+ },
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT"
+ ],
+ "services": [
+ "vCPE"
+ ],
+ "resources": [
+ "vGMuxInfra"
+ ],
+ "geography": [
+ "US",
+ "INTERNATIONAL"
+ ],
+ "identity": "vnf_vGMuxInfra",
+ "applicableResources": "any",
+ "vnfProperties": [
+ {
+ "inventoryProvider": "aai",
+ "serviceType": "vGMuxInfra-xx",
+ "inventoryType": "service",
+ "customerId": "SDN-ETHERNET-INTERNET",
+ "orchestrationStatus": "",
+ "equipmentRole": ""
+ }
+ ]
+ }
+ }
+}
diff --git a/test/policy-local-files/new_policies/vnfPolicy_vPGN_TD.json b/test/policy-local-files/new_policies/vnfPolicy_vPGN_TD.json
new file mode 100644
index 0000000..c441156
--- /dev/null
+++ b/test/policy-local-files/new_policies/vnfPolicy_vPGN_TD.json
@@ -0,0 +1,52 @@
+{
+ "OSDF_FRANKFURT.vnfPolicy_vPGN_TD": {
+ "type": "onap.policies.optimization.VnfPolicy",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.vnfPolicy_vPGN_TD",
+ "policy-version": 1
+ },
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT",
+ "TD"
+ ],
+ "resources": [
+ "vPGN"
+ ],
+ "geography": [
+ "US"
+ ],
+ "identity": "vnf_vPGN_TD",
+ "applicableResources": "any",
+ "vnfProperties": [
+ {
+ "inventoryProvider": "aai",
+ "serviceType": "",
+ "inventoryType": "vfmodule",
+ "customerId": {
+ "get_param": "chosen_customer_id"
+ },
+ "equipmentRole": "",
+ "unique": "False",
+ "attributes": {
+ "orchestrationStatus": [
+ "active"
+ ],
+ "provStatus": "ACTIVE",
+ "cloudRegionId": {
+ "get_param": "chosen_region"
+ },
+ "service_instance_id": {
+ "get_param": "service_id"
+ }
+ },
+ "passthroughAttributes": {
+ "td-role": "anchor"
+ }
+ }
+ ]
+ }
+ }
+}
diff --git a/test/test_ConductorApiBuilder.py b/test/test_ConductorApiBuilder.py
index 07cb3bb..1be0a4b 100644
--- a/test/test_ConductorApiBuilder.py
+++ b/test/test_ConductorApiBuilder.py
@@ -30,7 +30,7 @@ class TestConductorApiBuilder(unittest.TestCase):
self.main_dir = ""
self.conductor_api_template = self.main_dir + "apps/placement/templates/conductor_interface.json"
self.local_config_file = self.main_dir + "config/common_config.yaml"
- policy_data_path = self.main_dir + "test/policy-local-files" # "test/policy-local-files"
+ policy_data_path = self.main_dir + "test/policy-local-files/new_policies" # "test/policy-local-files"
valid_policies_list_file = policy_data_path + '/' + 'meta-valid-policies.txt'
valid_policies_files = local_policies.get_policy_names_from_file(valid_policies_list_file)
diff --git a/test/test_PolicyCalls.py b/test/test_PolicyCalls.py
index e7e8eab..4358eeb 100644
--- a/test/test_PolicyCalls.py
+++ b/test/test_PolicyCalls.py
@@ -33,7 +33,7 @@ class TestPolicyCalls(unittest.TestCase):
def setUp(self):
main_dir = ""
parameter_data_file = main_dir + "test/placement-tests/request.json"
- policy_data_path = main_dir + "test/policy-local-files/"
+ policy_data_path = main_dir + "test/policy-local-files/new_policies/"
local_config_file = main_dir + "config/common_config.yaml"
valid_policies_list_file = policy_data_path + '/' + 'meta-valid-policies.txt'
@@ -63,7 +63,7 @@ class TestPolicyCalls(unittest.TestCase):
"test/placement-tests/policy_response2.json")
with patch('osdf.adapters.policy.interface.policy_api_call', return_value=policy_response):
policy_list = interface.remote_api(req_json, osdf_config, service_type="placement")
- policy_type = [policy['content']['policyType'] for policy in policy_list]
+ policy_type = [policy[list(policy.keys())[0]]['type'] for policy in policy_list]
#self.assertEqual(set(policy_type), {'hpaPolicy', 'SubscriberPolicy'})
def failure_policy_call(self, req_json_file, resp_json_file):
@@ -99,7 +99,8 @@ class TestPolicyCalls(unittest.TestCase):
req_json = "./test/placement-tests/request.json"
req_json = json.loads(open(req_json).read())
# need to run this only on vnf policies
- vnf_policies = [x for x in self.policies if x["content"]["policyType"] == "vnfPolicy"]
+ vnf_policies = [x for x in self.policies if x[list(x.keys())[0]]["type"] ==
+ "onap.policies.optimization.VnfPolicy"]
gen_demands = translation.gen_demands(req_json, vnf_policies)
for action in req_json['placementInfo']['placementDemands']:
actions_list.append(action['resourceModuleName'])
diff --git a/test/test_get_opt_query_data.py b/test/test_get_opt_query_data.py
index a7a4d88..06dfbf9 100644
--- a/test/test_get_opt_query_data.py
+++ b/test/test_get_opt_query_data.py
@@ -25,7 +25,7 @@ class TestGetOptQueryData(unittest.TestCase):
def test_get_opt_query_data(self):
main_dir = ""
parameter_data_file = main_dir + "test/placement-tests/request.json"
- policy_data_path = main_dir + "test/policy-local-files/"
+ policy_data_path = main_dir + "test/policy-local-files/new_policies/"
query_policy_data_file = ["QueryPolicy_vCPE.json"]
request_json = json.loads(open(parameter_data_file).read())
@@ -37,7 +37,7 @@ class TestGetOptQueryData(unittest.TestCase):
def test_get_opt_query_data_vfmod(self):
main_dir = ""
parameter_data_file = main_dir + "test/placement-tests/request_vfmod.json"
- policy_data_path = main_dir + "test/policy-local-files/"
+ policy_data_path = main_dir + "test/policy-local-files/new_policies/"
query_policy_data_file = ["QueryPolicy_vFW_TD.json"]
request_json = json.loads(open(parameter_data_file).read())
diff --git a/test/test_model_api.py b/test/test_model_api.py
new file mode 100644
index 0000000..2a1cecf
--- /dev/null
+++ b/test/test_model_api.py
@@ -0,0 +1,71 @@
+# -------------------------------------------------------------------------
+# Copyright (c) 2020 AT&T Intellectual Property
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# -------------------------------------------------------------------------
+#
+
+import json
+import os
+
+import pytest
+from mock import patch
+from schematics.exceptions import DataError
+
+from runtime.model_api import create_model_data, get_model_data, delete_model_data, retrieve_all_models
+from runtime.models.api.model_request import OptimModelRequestAPI
+from runtime.optim_engine import validate_request
+
+BASE_DIR = os.path.dirname(__file__)
+
+ret_val = {'modelId': 'test', 'description': 'desc', 'solver': 'mzn'}
+
+
+class TestModelApi():
+
+ def test_valid_mapi_request(self):
+ req_json = json.loads(open("./test/optengine-tests/test_modelapi_valid.json").read())
+
+ assert OptimModelRequestAPI(req_json).validate() is None
+
+ def test_invalid_mapi_request(self):
+ req_json = json.loads(open("./test/optengine-tests/test_modelapi_invalid.json").read())
+ with pytest.raises(DataError):
+ validate_request(req_json)
+
+ @patch('runtime.model_api.build_model_dict')
+ @patch('mysql.connector.connect')
+ @patch('runtime.model_api.osdf_config')
+ def test_create_model(self, config, conn, model_data):
+ model_data.return_value = ret_val
+ req_json = json.loads(open("./test/optengine-tests/test_modelapi_valid.json").read())
+
+ create_model_data(req_json)
+
+ @patch('runtime.model_api.build_model_dict')
+ @patch('mysql.connector.connect')
+ @patch('runtime.model_api.osdf_config')
+ def test_retrieve_model(self, config, conn, model_data):
+ model_data.return_value = ret_val
+ get_model_data('test')
+
+ @patch('mysql.connector.connect')
+ @patch('runtime.model_api.osdf_config')
+ def test_delete_model(self, config, conn):
+ delete_model_data('test')
+
+ @patch('mysql.connector.connect')
+ @patch('runtime.model_api.osdf_config')
+ def test_retrieve_all_model(self, config, conn):
+ retrieve_all_models()
diff --git a/test/test_optim_engine.py b/test/test_optim_engine.py
new file mode 100644
index 0000000..e1756f8
--- /dev/null
+++ b/test/test_optim_engine.py
@@ -0,0 +1,78 @@
+# -------------------------------------------------------------------------
+# Copyright (c) 2020 AT&T Intellectual Property
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# -------------------------------------------------------------------------
+#
+
+import json
+import os
+
+import pytest
+from mock import patch
+from schematics.exceptions import DataError
+
+from osdf.operation.exceptions import BusinessException
+from runtime.optim_engine import validate_request, process_request
+
+BASE_DIR = os.path.dirname(__file__)
+
+
+class TestOptimEngine():
+
+ def test_valid_optim_request(self):
+ req_json = json.loads(open("./test/optengine-tests/test_optengine_valid.json").read())
+
+ assert validate_request(req_json) == True
+
+ def test_invalid_optim_request(self):
+ req_json = json.loads(open("./test/optengine-tests/test_optengine_invalid.json").read())
+ with pytest.raises(DataError):
+ validate_request(req_json)
+
+ def test_invalid_optim_request_without_modelid(self):
+ req_json = json.loads(open("./test/optengine-tests/test_optengine_invalid2.json").read())
+ with pytest.raises(BusinessException):
+ validate_request(req_json)
+
+ def test_invalid_optim_request_no_optdata(self):
+ req_json = json.loads(open("./test/optengine-tests/test_optengine_no_optdata.json").read())
+ with pytest.raises(BusinessException):
+ validate_request(req_json)
+
+ def test_process_request(self):
+ req_json = json.loads(open("./test/optengine-tests/test_optengine_valid.json").read())
+
+ res = process_request(req_json)
+ assert res.status_code == 400
+
+ def test_py_process_request(self):
+ req_json = json.loads(open("./test/optengine-tests/test_py_optengine_valid.json").read())
+
+ res = process_request(req_json)
+ assert res.status_code == 200
+
+ def test_invalid_solver(self):
+ req_json = json.loads(open("./test/optengine-tests/test_optengine_invalid_solver.json").read())
+
+ with pytest.raises(BusinessException):
+ process_request(req_json)
+
+ @patch('runtime.optim_engine.get_model_data')
+ def test_process_solverid_request(self, mocker):
+ req_json = json.loads(open("./test/optengine-tests/test_optengine_modelId.json").read())
+
+ data = 200, ('junk', '', '', 'py')
+ mocker.return_value = data
+ process_request(req_json)