diff options
-rwxr-xr-x | config/osdf_config.yaml | 4 | ||||
-rwxr-xr-x | osdf/__init__.py | 1 | ||||
-rw-r--r-- | osdf/optimizers/pciopt/pci_opt_processor.py | 49 | ||||
-rwxr-xr-x | osdf/optimizers/placementopt/conductor/conductor.py | 2 | ||||
-rw-r--r-- | osdf/optimizers/routeopt/__init__.py | 17 | ||||
-rw-r--r-- | osdf/optimizers/routeopt/simple_route_opt.py | 82 | ||||
-rwxr-xr-x | osdfapp.py | 40 | ||||
-rw-r--r-- | test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/hpa_policy_vGMuxInfra_1.json | 53 | ||||
-rw-r--r-- | test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/hpa_policy_vG_1.json | 65 | ||||
-rw-r--r-- | test/pci-optimization-tests/request.json | 4 | ||||
-rw-r--r-- | test/placement-tests/conductor_response.json | 62 | ||||
-rw-r--r-- | test/placement-tests/response.json | 126 | ||||
-rw-r--r-- | test/policy-local-files/hpa_policy_vGMuxInfra_1.json | 53 | ||||
-rw-r--r-- | test/policy-local-files/hpa_policy_vG_1.json | 53 |
14 files changed, 480 insertions, 131 deletions
diff --git a/config/osdf_config.yaml b/config/osdf_config.yaml index 636b6ad..c484fb4 100755 --- a/config/osdf_config.yaml +++ b/config/osdf_config.yaml @@ -81,3 +81,7 @@ configDbGetNbrListUrl: 'SDNCConfigDBAPI/getNbrList' # Credentials for PCIHandler pciHMSUsername: "" # pcihandler username for call back. pciHMSPassword: "" # pcihandler password for call back. + +# Credentials for the OOF PCI Opt service +osdfPCIOptUsername: pci_test +osdfPCIOptPassword: pci_testpwd diff --git a/osdf/__init__.py b/osdf/__init__.py index 5d15a85..c33639e 100755 --- a/osdf/__init__.py +++ b/osdf/__init__.py @@ -24,6 +24,7 @@ from jinja2 import Template end_point_auth_mapping = { # map a URL endpoint to auth group "cmscheduler": "CMScheduler", "placement": "Placement", + "pci": "PCIOpt" } userid_suffix, passwd_suffix = "Username", "Password" diff --git a/osdf/optimizers/pciopt/pci_opt_processor.py b/osdf/optimizers/pciopt/pci_opt_processor.py index 030128e..989f578 100644 --- a/osdf/optimizers/pciopt/pci_opt_processor.py +++ b/osdf/optimizers/pciopt/pci_opt_processor.py @@ -20,7 +20,6 @@ import traceback from requests import RequestException from osdf.logging.osdf_logging import metrics_log, MH, error_log -from osdf.models.api.pciOptimizationResponse import PCIOptimizationResponse, Solution, PCISolution from osdf.operation.error_handling import build_json_error_body from osdf.utils.interfaces import get_rest_client from .configdb import request as config_request @@ -44,26 +43,9 @@ def process_pci_optimation(request_json, osdf_config, flat_policies): try: rc = get_rest_client(request_json, service="pcih") req_id = request_json["requestInfo"]["requestId"] - transaction_id = request_json['requestInfo']['transactionId'] cell_info_list, network_cell_info = config_request(request_json, osdf_config, flat_policies) - pci_response = PCIOptimizationResponse() - pci_response.transactionId = transaction_id - pci_response.requestId = req_id - pci_response.requestStatus = 'success' - pci_response.solutions = Solution() - pci_response.solutions.networkId = request_json['cellInfo']['networkId'] - pci_response.solutions.pciSolutions = [] - - for cell in request_json['cellInfo']['cellIdList']: - pci_solution = optimize(cell['cellId'], network_cell_info, cell_info_list) - error_log.error(pci_solution) - sol = pci_solution[0]['pci'] - for k, v in sol.items(): - response = PCISolution() - response.cellId = get_cell_id(network_cell_info, k) - response.pci = get_pci_value(network_cell_info, v) - pci_response.solutions.pciSolutions.append(response) + pci_response = get_solutions(cell_info_list, network_cell_info, request_json) metrics_log.info(MH.inside_worker_thread(req_id)) except Exception as err: @@ -82,3 +64,32 @@ def process_pci_optimation(request_json, osdf_config, flat_policies): rc.request(json=pci_response, noresponse=True) except RequestException: # can't do much here but log it and move on error_log.error("Error sending asynchronous notification for {} {}".format(req_id, traceback.format_exc())) + + +def get_solutions(cell_info_list, network_cell_info, request_json): + return { + "transactionId": request_json['requestInfo']['transactionId'], + "requestId": request_json["requestInfo"]["requestId"], + "requestStatus": "completed", + "statusMessage": "success", + "solutions": [ + { + 'networkId': request_json['cellInfo']['networkId'], + 'pciSolutions': build_solution_list(cell_info_list, network_cell_info, request_json) + } + ] + } + + +def build_solution_list(cell_info_list, network_cell_info, request_json): + solution_list = [] + for cell in request_json['cellInfo']['cellIdList']: + opt_solution = optimize(cell, network_cell_info, cell_info_list) + sol = opt_solution[0]['pci'] + for k, v in sol.items(): + response = { + 'cellId': get_cell_id(network_cell_info, k), + 'pci': get_pci_value(network_cell_info, v) + } + solution_list.append(response) + return solution_list diff --git a/osdf/optimizers/placementopt/conductor/conductor.py b/osdf/optimizers/placementopt/conductor/conductor.py index 29f0bbc..357efd1 100755 --- a/osdf/optimizers/placementopt/conductor/conductor.py +++ b/osdf/optimizers/placementopt/conductor/conductor.py @@ -136,7 +136,7 @@ def conductor_response_processor(conductor_response, raw_response, req_id): name_map = {"physical-location-id": "cloudClli", "host_id": "vnfHostName",
"cloud_version": "cloudVersion", "cloud_owner": "cloudOwner",
"cloud": "cloudRegionId", "service": "serviceInstanceId", "is_rehome": "isRehome",
- "location_id": "locationId", "location_type": "locationType"}
+ "location_id": "locationId", "location_type": "locationType", "directives": "oof_directives"}
for reco in conductor_response['plans'][0]['recommendations']:
for resource in reco.keys():
c = reco[resource]['candidate']
diff --git a/osdf/optimizers/routeopt/__init__.py b/osdf/optimizers/routeopt/__init__.py new file mode 100644 index 0000000..c235f2a --- /dev/null +++ b/osdf/optimizers/routeopt/__init__.py @@ -0,0 +1,17 @@ +# ------------------------------------------------------------------------- +# Copyright (c) 2018 Huawei 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. +# +# ------------------------------------------------------------------------- +# diff --git a/osdf/optimizers/routeopt/simple_route_opt.py b/osdf/optimizers/routeopt/simple_route_opt.py index d1cf13f..ed179c9 100644 --- a/osdf/optimizers/routeopt/simple_route_opt.py +++ b/osdf/optimizers/routeopt/simple_route_opt.py @@ -32,6 +32,7 @@ class RouteOpt: aai_headers = { "X-TransactionId": "9999", "X-FromAppId": "OOF", + "Accept": "application/json", "Content-Type": "application/json", "Real-Time": "true" } @@ -42,10 +43,9 @@ class RouteOpt: :param logical_link: :return: """ - for relationship in logical_link["logical-links"]["relationship-list"]["relationship"]: - if relationship["related-to"] == "p-interface": - if "ext-aai-network" in relationship["related-link"]: - return True + for relationship in logical_link["relationship-list"]["relationship"]: + if relationship["related-to"] == "external-aai-network": + return True return False def getRoute(self, request): @@ -62,21 +62,8 @@ class RouteOpt: ingress_p_interface = None egress_p_interface = None - logical_links = self.get_logical_links() - - # take the logical link where both the p-interface in same onap - if logical_links != None: - for logical_link in logical_links["results"]: - if not self.isCrossONAPLink(logical_link): - - # link is in local ONAP - for relationship in logical_link["logical-links"]["relationship-list"]["relationship"]: - if relationship["related-to"] == "p-interface": - if src_access_node_id in relationship["related-link"]: - ingress_p_interface = relationship["related-link"].split("/")[-1] - if dst_access_node_id in relationship["related-link"]: - egress_p_interface = relationship["related-link"].split("/")[-1] - + # for the case of request_json for same domain, return the same node with destination update + if src_access_node_id == dst_access_node_id: data = '{'\ '"vpns":['\ '{'\ @@ -85,20 +72,48 @@ class RouteOpt: '"access-provider-id": "' + request["srcPort"]["src-access-provider-id"]+ '",'\ '"access-node-id": "' + request["srcPort"]["src-access-node-id"]+ '",'\ '"src-access-ltp-id": "' + request["srcPort"]["src-access-ltp-id"]+ '",'\ - '"dst-access-ltp-id": "' + ingress_p_interface +'"'\ - '},'\ - '{' \ - '"access-topology-id": "' + request["dstPort"]["dst-access-topology-id"] + '",' \ - '"access-topology-id": "' + request["dstPort"]["dst-access-topology-id"]+ '",' \ - '"access-provider-id": "' + request["dstPort"]["dst-access-provider-id"]+ '",' \ - '"access-node-id": "' + request["dstPort"]["dst-access-node-id"]+ '",' \ - '"src-access-ltp-id": "' + egress_p_interface + '",' \ - '"dst-access-ltp-id": "' + request["dstPort"]["dst-access-ltp-id"] + '"' \ + '"dst-access-ltp-id": "' + request["dstPort"]["dst-access-ltp-id"] +'"'\ '}'\ ']'\ '}' return data - + else: + logical_links = self.get_logical_links() + + # take the logical link where both the p-interface in same onap + if logical_links != None: + for logical_link in logical_links.get("logical-link"): + if not self.isCrossONAPLink(logical_link): + # link is in local ONAP + for relationship in logical_link["relationship-list"]["relationship"]: + if relationship["related-to"] == "p-interface": + if src_access_node_id in relationship["related-link"]: + i_interface = relationship["related-link"].split("/")[-1] + ingress_p_interface = i_interface.split("-")[-1] + if dst_access_node_id in relationship["related-link"]: + e_interface = relationship["related-link"].split("/")[-1] + egress_p_interface = e_interface.split("-")[-1] + data = '{'\ + '"vpns":['\ + '{'\ + '"access-topology-id": "' + request["srcPort"]["src-access-topology-id"] + '",'\ + '"access-client-id": "' + request["srcPort"]["src-access-client-id"] + '",'\ + '"access-provider-id": "' + request["srcPort"]["src-access-provider-id"]+ '",'\ + '"access-node-id": "' + request["srcPort"]["src-access-node-id"]+ '",'\ + '"src-access-ltp-id": "' + request["srcPort"]["src-access-ltp-id"]+ '",'\ + '"dst-access-ltp-id": "' + ingress_p_interface +'"'\ + '},'\ + '{' \ + '"access-topology-id": "' + request["dstPort"]["dst-access-topology-id"] + '",' \ + '"access-topology-id": "' + request["dstPort"]["dst-access-topology-id"]+ '",' \ + '"access-provider-id": "' + request["dstPort"]["dst-access-provider-id"]+ '",' \ + '"access-node-id": "' + request["dstPort"]["dst-access-node-id"]+ '",' \ + '"src-access-ltp-id": "' + egress_p_interface + '",' \ + '"dst-access-ltp-id": "' + request["dstPort"]["dst-access-ltp-id"] + '"' \ + '}'\ + ']'\ + '}' + return data def get_pinterface(self, url): @@ -109,7 +124,8 @@ class RouteOpt: aai_req_url = self.aai_host + url response = requests.get(aai_req_url, headers=self.aai_headers, - auth=HTTPBasicAuth("", "")) + auth=HTTPBasicAuth("AAI", "AAI"), + verify=False) if response.status_code == 200: return response.json() @@ -121,12 +137,14 @@ class RouteOpt: from /aai/v14/network/logical-links?operation-status="Up" :return: logical-links[] """ - logical_link_url = "/aai/v14/network/logical-links?operation-status=\"Up\"" + logical_link_url = "/aai/v13/network/logical-links?operational-status=up" aai_req_url = self.aai_host + logical_link_url response = requests.get(aai_req_url, headers=self.aai_headers, - auth=HTTPBasicAuth("", "")) + auth=HTTPBasicAuth("AAI", "AAI"), + verify=False) + logical_links = None if response.status_code == 200: return response.json()
\ No newline at end of file @@ -34,15 +34,15 @@ import osdf.config.loader import osdf.operation.error_handling import osdf.operation.responses import traceback +from schematics.exceptions import DataError +from requests import RequestException +from optparse import OptionParser from osdf.adapters.policy.interface import get_policies from osdf.config.base import osdf_config from osdf.optimizers.placementopt.conductor.remote_opt_processor import process_placement_opt from osdf.webapp.appcontroller import auth_basic -from optparse import OptionParser from osdf.operation.exceptions import BusinessException from osdf.operation.error_handling import request_exception_to_json_body, internal_error_message -from requests import RequestException -from schematics.exceptions import DataError from osdf.logging.osdf_logging import MH, audit_log, error_log, debug_log from osdf.models.api.placementRequest import PlacementAPI from osdf.models.api.pciOptimizationRequest import PCIOptimizationAPI @@ -145,32 +145,7 @@ def do_route_calc(): """ request_json = request.get_json() audit_log.info("Calculate Route request received!") - src_access_node_id = "" - dst_access_node_id = "" - try: - src_access_node_id = request_json["srcPort"]["src-access-node-id"] - audit_log.info( src_access_node_id ) - dst_access_node_id = request_json["dstPort"]["dst-access-node-id"] - except Exception as ex: - error_log.error("Exception while retriving the src and dst node info") - # for the case of request_json for same domain, return the same node with destination update - if src_access_node_id == dst_access_node_id: - audit_log.info("src and dst are same") - data = '{'\ - '"vpns":['\ - '{'\ - '"access-topology-id": "' + request_json["srcPort"]["src-access-topology-id"] + '",'\ - '"access-client-id": "' + request_json["srcPort"]["src-access-client-id"] + '",'\ - '"access-provider-id": "' + request_json["srcPort"]["src-access-provider-id"]+ '",'\ - '"access-node-id": "' + request_json["srcPort"]["src-access-node-id"]+ '",'\ - '"src-access-ltp-id": "' + request_json["srcPort"]["src-access-ltp-id"]+ '",'\ - '"dst-access-ltp-id": "' + request_json["dstPort"]["dst-access-ltp-id"] +'"'\ - '}'\ - ']'\ - '}' - return data - else: - return RouteOpt.getRoute(request_json) + return RouteOpt().getRoute(request_json) @app.route("/api/oof/v1/pci", methods=["POST"]) @auth_basic.login_required @@ -180,15 +155,17 @@ def do_pci_optimization(): g.request_id = req_id audit_log.info(MH.received_request(request.url, request.remote_addr, json.dumps(request_json))) PCIOptimizationAPI(request_json).validate() - policies = get_policies(request_json, "pciopt") + #disable policy retrieval + # policies = get_policies(request_json, "pciopt") audit_log.info(MH.new_worker_thread(req_id, "[for pciopt]")) - t = Thread(target=process_pci_optimation, args=(request_json, policies, osdf_config)) + t = Thread(target=process_pci_optimation, args=(request_json, osdf_config, None)) t.start() audit_log.info(MH.accepted_valid_request(req_id, request)) return req_accept(request_id=req_id, transaction_id=request_json['requestInfo']['transactionId'], request_status="accepted", status_message="") + @app.errorhandler(500) def internal_failure(error): """Returned when unexpected coding errors occur during initial synchronous processing""" @@ -197,7 +174,6 @@ def internal_failure(error): response.status_code = 500 return response - def get_options(argv): program_version_string = '%%prog %s' % "v1.0" program_longdesc = "" diff --git a/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/hpa_policy_vGMuxInfra_1.json b/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/hpa_policy_vGMuxInfra_1.json index da4ef03..85b1e82 100644 --- a/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/hpa_policy_vGMuxInfra_1.json +++ b/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/hpa_policy_vGMuxInfra_1.json @@ -15,12 +15,25 @@ "policyType": "hpaPolicy", "flavorFeatures": [ { - "flavorLabel": "flavor_label_vm_01", + "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": ""}, @@ -34,6 +47,7 @@ "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"} @@ -44,6 +58,7 @@ "mandatory" : "False", "score" : "3", "architecture": "generic", + "directives": [], "hpa-feature-attributes": [ {"hpa-attribute-key":"dataProcessingAccelerationLibrary", "hpa-attribute-value":"ovsDpdk_version", "operator": "=", "unit":""} ] @@ -52,6 +67,7 @@ "hpa-feature" : "cpuInstructionSetExtensions", "mandatory" : "True", "architecture": "INTEL-64", + "directives":[], "hpa-feature-attributes": [ {"hpa-attribute-key":"instructionSetExtensions", "hpa-attribute-value":["<CPUINST>", "<CPUINST>"], "operator": "ALL", "unit":""} ] @@ -59,12 +75,25 @@ ] }, { - "flavorLabel": "flavor_label_vm_02", + "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":""} @@ -74,6 +103,7 @@ "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"} @@ -84,6 +114,7 @@ "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"}, @@ -94,6 +125,7 @@ "hpa-feature" : "pcie", "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": ""}, @@ -104,13 +136,26 @@ ] }, { - "flavorLabel": "flavor_label_vm_03", + "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": ""}, @@ -123,6 +168,7 @@ "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"} @@ -133,6 +179,7 @@ "mandatory" : "False", "score" : "7", "architecture": "generic", + "directives":[], "hpa-feature-attributes": [ {"hpa-attribute-key": "memoryPageSize", "hpa-attribute-value": "<MEMORYPAGESIZE>", "operator": "=", "unit": ""} ] diff --git a/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/hpa_policy_vG_1.json b/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/hpa_policy_vG_1.json index f50ed6d..262ffe7 100644 --- a/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/hpa_policy_vG_1.json +++ b/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/hpa_policy_vG_1.json @@ -15,12 +15,25 @@ "policyType": "hpaPolicy", "flavorFeatures": [ { - "flavorLabel": "flavor_label_vm_01", + "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": ""}, @@ -34,6 +47,7 @@ "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"} @@ -44,6 +58,7 @@ "mandatory" : "False", "score" : "3", "architecture": "generic", + "directives": [], "hpa-feature-attributes": [ {"hpa-attribute-key":"dataProcessingAccelerationLibrary", "hpa-attribute-value":"ovsDpdk_version", "operator": "=", "unit":""} ] @@ -52,6 +67,7 @@ "hpa-feature" : "cpuInstructionSetExtensions", "mandatory" : "True", "architecture": "INTEL-64", + "directives": [], "hpa-feature-attributes": [ {"hpa-attribute-key":"instructionSetExtensions", "hpa-attribute-value":["<CPUINST>", "<CPUINST>"], "operator": "ALL", "unit":""} ] @@ -59,12 +75,25 @@ ] }, { - "flavorLabel": "flavor_label_vm_02", + "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":""} @@ -74,6 +103,7 @@ "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"} @@ -84,6 +114,7 @@ "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"}, @@ -94,22 +125,46 @@ "hpa-feature" : "pcie", "mandatory" : "True", "architecture": "generic", + "directives": [ + { + "type": "pcie_directives", + "attributes": [ + { + "attribute_name": "<pcie_label_name>", + "attribute_value": "<value for pcie network>" + } + ] + } + ], "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": ""} + {"hpa-attribute-key": "physicalNetwork", "hpa-attribute-value": "<PCITYPEVALUE>","operator": "=", "unit": ""} ] } ] }, { - "flavorLabel": "flavor_label_vm_03", + "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", + "directives": [], "architecture": "generic", "hpa-feature-attributes": [ {"hpa-attribute-key": "numaNodes", "hpa-attribute-value": "2", "operator": "=", "unit": ""}, @@ -123,6 +178,7 @@ "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"} @@ -133,6 +189,7 @@ "mandatory" : "False", "score" : "7", "architecture": "generic", + "directives": [], "hpa-feature-attributes": [ {"hpa-attribute-key": "memoryPageSize", "hpa-attribute-value": "<MEMORYPAGESIZE>", "operator": "=", "unit": ""} ] diff --git a/test/pci-optimization-tests/request.json b/test/pci-optimization-tests/request.json index 79c98c3..7ec9ab5 100644 --- a/test/pci-optimization-tests/request.json +++ b/test/pci-optimization-tests/request.json @@ -14,9 +14,7 @@ "cellInfo": { "networkId": "1000", "cellIdList": [ - { - "cellId": "cell0" - } + "cell0" ] } }
\ No newline at end of file diff --git a/test/placement-tests/conductor_response.json b/test/placement-tests/conductor_response.json index e7037c2..ee38ce9 100644 --- a/test/placement-tests/conductor_response.json +++ b/test/placement-tests/conductor_response.json @@ -24,9 +24,65 @@ "location_type": "openstack-cloud" }, "attributes": { - "flavors": { - "flavor_label_1": "vim_flavor_X", - "flavor_label_2": "vim_flavor_Y" + "directives": { + "directives": [ + { + "id": "vFW_0", + "type": "<vnfc/tocsa.nodes.nfv.Vdu.Compute>", + "directives": [ + { + "type": "flavor_directives", + "attributes": [ + { + "attribute_name": "oof_returned_flavor_label_for_firewall", + "attribute_value": "vim_flavor_X" + } + ] + }, + { + "type": "sriovNICNetwork_directives", + "attributes": [ + { + "attribute_name": "oof_returned_vnic_type_for_firewall_protected", + "attribute_value": "direct" + }, + { + "attribute_name": "oof_returned_provider_network_for_firewall_protected", + "attribute_value": "physnet1" + } + ] + }, + { + "type": "sriovNICNetwork_directives", + "attributes": [ + { + "attribute_name": "oof_returned_vnic_type_for_firewall_unprotected", + "attribute_value": "direct" + }, + { + "attribute_name": "oof_returned_provider_network_for_firewall_unprotected", + "attribute_value": "physnet2" + } + ] + } + ] + }, + { + "id": "vFW_1", + "type": "<vnfc/tocsa.nodes.nfv.Vdu.Compute>", + "directives": [ + { + "type": "flavor_directives", + "attributes": [ + { + "attribute_name": "oof_returned_flavor_label_for_generator", + "attribute_value": "vim_flavor_Y" + } + ] + } + ] + } + ] }, "cloud_owner": "CloudOwner1", "physical-location-id": "DLLSTX1A", diff --git a/test/placement-tests/response.json b/test/placement-tests/response.json index 92751ac..71963e2 100644 --- a/test/placement-tests/response.json +++ b/test/placement-tests/response.json @@ -6,44 +6,114 @@ "solutions": { "placementSolutions": [ [ - { - "resourceModuleName": "vGMuxInfra", - "serviceResourceId": "someResourceId", - "solution": { + { + "resourceModuleName": "vGMuxInfra", + "serviceResourceId": "someResourceId", + "solution": { "identifierType": "serviceInstanceId", - "identifiers": ["gjhd-098-fhd-987"] + "identifiers": [ + "gjhd-098-fhd-987" + ] + }, + "assignmentInfo": [ + { + "key": "cloudOwner", + "value": "amazon" + }, + { + "key": "vnfHostName", + "value": "ahr344gh" + }, + { + "key": "isRehome", + "value": "False" + }, + { + "key": "cloudRegionId", + "value": "1ac71fb8-ad43-4e16-9459-c3f372b8236d" + }, + { + "key": "oof_directives", + "value": { + "directives": [ + { + "id": "vgmux_1", + "type": "vnfc", + "directives": [ + { + "type": "flavor_directives", + "attributes": [ + { + "attribute_name": "flavorLabel1", + "attribute_value": "vimFlavorX" + } + ] + } + ] + }, + { + "id": "vgmux_2", + "type": "vnfc", + "directives": [ + { + "type": "flavor_directives", + "attributes": [ + { + "attribute_name": "flavorLabel2", + "attribute_value": "vimFlavorY" + } + ] + } + ] + } + ] + } + } + ] }, - "assignmentInfo": [ - { "key": "cloudOwner", "value": "amazon" }, - { "key": "vnfHostName", "value": "ahr344gh" }, - { "key": "isRehome", "value": "False" }, - { "key": "cloudRegionId", "value": "1ac71fb8-ad43-4e16-9459-c3f372b8236d" }, - { "key":"flavors", "value": { "flavorLabel1": "vimFlavorX", "flavorLabel2": "vimFlavorY"}} - ] - }, - { - "resourceModuleName": "vG", - "serviceResourceId": "someResourceId", - "solution": { + { + "resourceModuleName": "vG", + "serviceResourceId": "someResourceId", + "solution": { "identifierType": "cloudRegionId", "cloudOwner": "amazon", - "identifiers": ["gjhd-098-fhd-987"] - }, - "assignmentInfo": [ - { "key": "cloudOwner", "value": "amazon" }, - { "key": "cloudRegionId", "value": "1ac71fb8-ad43-4e16-9459-c3f372b8236d" } - ] - } + "identifiers": [ + "gjhd-098-fhd-987" + ] + }, + "assignmentInfo": [ + { + "key": "cloudOwner", + "value": "amazon" + }, + { + "key": "cloudRegionId", + "value": "1ac71fb8-ad43-4e16-9459-c3f372b8236d" + } + ] + } ] ], "licenseSolutions": [ { "resourceModuleName": "vGMuxInfra", "serviceResourceId": "someResourceId", - "entitlementPoolUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"], - "licenseKeyGroupUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"], - "entitlementPoolInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"], - "licenseKeyGroupInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"] + "entitlementPoolUUID": [ + "1ac71fb8-ad43-4e16-9459-c3f372b8236d", + "834fc71fb8-ad43-4fh7-9459-c3f372b8236f" + ], + "licenseKeyGroupUUID": [ + "1ac71fb8-ad43-4e16-9459-c3f372b8236d", + "834fc71fb8-ad43-4fh7-9459-c3f372b8236f" + ], + "entitlementPoolInvariantUUID": [ + "1ac71fb8-ad43-4e16-9459-c3f372b8236d", + "834fc71fb8-ad43-4fh7-9459-c3f372b8236f" + ], + "licenseKeyGroupInvariantUUID": [ + "1ac71fb8-ad43-4e16-9459-c3f372b8236d", + "834fc71fb8-ad43-4fh7-9459-c3f372b8236f" + ] } ] } diff --git a/test/policy-local-files/hpa_policy_vGMuxInfra_1.json b/test/policy-local-files/hpa_policy_vGMuxInfra_1.json index da4ef03..ce0b7e3 100644 --- a/test/policy-local-files/hpa_policy_vGMuxInfra_1.json +++ b/test/policy-local-files/hpa_policy_vGMuxInfra_1.json @@ -15,12 +15,25 @@ "policyType": "hpaPolicy", "flavorFeatures": [ { - "flavorLabel": "flavor_label_vm_01", + "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": ""}, @@ -34,6 +47,7 @@ "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"} @@ -44,6 +58,7 @@ "mandatory" : "False", "score" : "3", "architecture": "generic", + "directives": [], "hpa-feature-attributes": [ {"hpa-attribute-key":"dataProcessingAccelerationLibrary", "hpa-attribute-value":"ovsDpdk_version", "operator": "=", "unit":""} ] @@ -52,6 +67,7 @@ "hpa-feature" : "cpuInstructionSetExtensions", "mandatory" : "True", "architecture": "INTEL-64", + "directives": [], "hpa-feature-attributes": [ {"hpa-attribute-key":"instructionSetExtensions", "hpa-attribute-value":["<CPUINST>", "<CPUINST>"], "operator": "ALL", "unit":""} ] @@ -59,12 +75,25 @@ ] }, { - "flavorLabel": "flavor_label_vm_02", + "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":""} @@ -74,6 +103,7 @@ "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"} @@ -84,6 +114,7 @@ "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"}, @@ -94,6 +125,7 @@ "hpa-feature" : "pcie", "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": ""}, @@ -104,13 +136,26 @@ ] }, { - "flavorLabel": "flavor_label_vm_03", + "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": ""}, @@ -123,6 +168,7 @@ "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"} @@ -133,6 +179,7 @@ "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/hpa_policy_vG_1.json b/test/policy-local-files/hpa_policy_vG_1.json index f50ed6d..4dfb6ce 100644 --- a/test/policy-local-files/hpa_policy_vG_1.json +++ b/test/policy-local-files/hpa_policy_vG_1.json @@ -15,12 +15,25 @@ "policyType": "hpaPolicy", "flavorFeatures": [ { - "flavorLabel": "flavor_label_vm_01", + "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": ""}, @@ -34,6 +47,7 @@ "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"} @@ -44,6 +58,7 @@ "mandatory" : "False", "score" : "3", "architecture": "generic", + "directives": [], "hpa-feature-attributes": [ {"hpa-attribute-key":"dataProcessingAccelerationLibrary", "hpa-attribute-value":"ovsDpdk_version", "operator": "=", "unit":""} ] @@ -52,6 +67,7 @@ "hpa-feature" : "cpuInstructionSetExtensions", "mandatory" : "True", "architecture": "INTEL-64", + "directives": [], "hpa-feature-attributes": [ {"hpa-attribute-key":"instructionSetExtensions", "hpa-attribute-value":["<CPUINST>", "<CPUINST>"], "operator": "ALL", "unit":""} ] @@ -59,12 +75,25 @@ ] }, { - "flavorLabel": "flavor_label_vm_02", + "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":""} @@ -74,6 +103,7 @@ "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"} @@ -84,6 +114,7 @@ "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"}, @@ -94,6 +125,7 @@ "hpa-feature" : "pcie", "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": ""}, @@ -104,13 +136,26 @@ ] }, { - "flavorLabel": "flavor_label_vm_03", + "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": ""}, @@ -123,6 +168,7 @@ "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"} @@ -133,6 +179,7 @@ "mandatory" : "False", "score" : "7", "architecture": "generic", + "directives": [], "hpa-feature-attributes": [ {"hpa-attribute-key": "memoryPageSize", "hpa-attribute-value": "<MEMORYPAGESIZE>", "operator": "=", "unit": ""} ] |