summaryrefslogtreecommitdiffstats
path: root/conductor
diff options
context:
space:
mode:
authorShankar Narayanan <snarayanan@research.att.com>2019-03-04 19:04:28 -0500
committerShankar Narayanan <snarayanan@research.att.com>2019-03-04 19:05:53 -0500
commit2f098216574f3b507aeb1e1aa76c9a340e6b4bcd (patch)
tree263bbd88286cf06ea334cd44f4845e4ebc370beb /conductor
parent71f238ad677db501d253398b9d67b5e0414d4a19 (diff)
removed misleading reservation logic
removed reservation logic that is not supported by SDNC in ONAP Issue-ID: OPTFRA-452 Change-Id: Id7db22f0de6bd0df06ffd2c73fd3b7220dcd5470 Signed-off-by: Shankar Narayanan <snarayanan@research.att.com>
Diffstat (limited to 'conductor')
-rw-r--r--conductor/conductor/data/plugins/service_controller/sdnc.py260
1 files changed, 3 insertions, 257 deletions
diff --git a/conductor/conductor/data/plugins/service_controller/sdnc.py b/conductor/conductor/data/plugins/service_controller/sdnc.py
index 5518a93..5e4e8a0 100644
--- a/conductor/conductor/data/plugins/service_controller/sdnc.py
+++ b/conductor/conductor/data/plugins/service_controller/sdnc.py
@@ -123,76 +123,12 @@ class SDNC(base.ServiceControllerBase):
return response
def reserve_candidates(self, candidate_list, request):
-
- path = '/operations/DHVCAPACITY-API:service-capacity-check-operation'
- action_type = "RESERVE"
- change_type = "New-Start"
-
- e2evpnkey = request.get('e2evpnkey')
- dhv_service_instance = request.get('dhv_service_instance')
-
- vnf_input_list = []
-
- for candidate in candidate_list:
-
- # SDN-GC does not reserve cloud candidates
- if candidate.get("inventory_type") == "cloud":
- continue
-
- vnf_input = {}
- # VNF input parameters common to all service_type
- request = candidate.get('request')
- vnf_input["device-type"] = request.get('service_type')
- vnf_input['dhv-site-effective-bandwidth'] = request.get('dhv_site_effective_bandwidth')
-
- if candidate.get('location_id') == "AAIAIC25":
- vnf_input["cloud-region-id"] = ""
- else:
- vnf_input["cloud-region-id"] = candidate.get('location_id')
-
- if "service_resource_id" in candidate:
- vnf_input["cust-service-instance-id"] = candidate.get('service_resource_id')
-
- vnf_input["vnf-host-name"] = candidate.get('host_id')
- vnf_input["infra-service-instance-id"] = candidate.get('candidate_id')
-
- vnf_input_list.append(vnf_input)
-
- data = {
- "input": {
- "service-capacity-check-operation": {
- "sdnc-request-header": {
- "request-id":
- "59c36776-249b-4966-b911-9a89a63d1676"
- },
- "capacity-check-information": {
- "service-instance-id": dhv_service_instance,
- "service": "DHV SD-WAN",
- "action-type": action_type,
- "change-type": change_type,
- "e2e-vpn-key": e2evpnkey,
- "vnf-list": {
- "vnf": vnf_input_list
- }
- }
- }
- }
- }
-
try:
- response = self._request('post', path=path, data=data)
- if response is None or response.status_code != 200:
- return
- body = response.json()
- response_code = body.get("output"). \
- get("service-capacity-check-response"). \
- get("response-code")
-
- if response_code == "200":
- return candidate_list
+ LOG.debug("Request to reservation {} ".format(request))
+ return candidate_list
except Exception as exc:
- LOG.error("SD-WAN reservation, SDNC unknown error: {}".
+ LOG.error("Reservation error: {}".
format(exc))
return
@@ -200,194 +136,4 @@ class SDNC(base.ServiceControllerBase):
constraint_name, constraint_type, request_type):
"""Reduce candidate list based on SDN-C intelligence"""
selected_candidates = []
- path = '/operations/DHVCAPACITY-API:service-capacity-check-operation'
- action_type = ""
- if constraint_type == "instance_fit":
- action_type = "CAPCHECK-SERVICE"
- elif constraint_type == "region_fit":
- action_type = "CAPCHECK-NEWVNF"
- else:
- LOG.error(_LE("Constraint {} has an unknown type {}").
- format(constraint_name, constraint_type))
-
- # VNF input params common to all services
- service_type = request.get('service_type')
- e2evpnkey = request.get('e2evpnkey')
-
- vnf_input = {}
- # VNF inputs specific to service_types
- if service_type.lower() == "vvig":
- # get input parameters
- bw_down = request.get('bw_down')
- bw_up = request.get('bw_up')
- dhv_site_effective_bandwidth = request.get('dhv_site_effective_bandwidth')
- dhv_service_instance = request.get('dhv_service_instance')
- if not dhv_site_effective_bandwidth or not bw_down or not bw_up:
- LOG.error(_LE("Constraint {} vVIG capacity check is "
- "missing up/down/effective bandwidth").
- format(constraint_name))
- return
- # add instance_fit specific input parameters
- if constraint_type == "instance_fit":
- if not dhv_service_instance:
- LOG.error(_LE("Constraint {} vVIG capacity check is "
- "missing DHV service instance").
- format(constraint_name))
- return
- vnf_input["infra-service-instance-id"] = dhv_service_instance
- # input params common to both instance_fit & region_fit
- vnf_input["upstream-bandwidth"] = bw_up
- vnf_input["downstream-bandwidth"] = bw_down
- vnf_input["dhv-site-effective-bandwidth"] = dhv_site_effective_bandwidth
-
- elif service_type.lower() == "vhngw":
- # get input parameters
- dhv_site_effective_bandwidth = \
- request.get('dhv_site_effective_bandwidth')
- if not dhv_site_effective_bandwidth:
- LOG.error(_LE("Constraint {} vHNGW capacity check is "
- "missing DHV site effective bandwidth").
- format(constraint_name))
- return
- vnf_input["dhv-site-effective-bandwidth"] = \
- dhv_site_effective_bandwidth
- elif service_type.lower() == "vhnportal":
- dhv_service_instance = request.get('dhv_service_instance')
- # add instance_fit specific input parameters
- if constraint_type == "instance_fit":
- if not dhv_service_instance:
- LOG.error(_LE("Constraint {} vHNPortal capacity check is "
- "missing DHV service instance").
- format(constraint_name))
- return
- vnf_input["infra-service-instance-id"] = dhv_service_instance
-
- for candidate in candidate_list:
-
- # generate the value of change_type based on the request type (inital or speed changed)
- # and existing placement
- # For New Start (or initial): New-Start
- # For Change Speed No Rehome : Change-Speed
- # For Change Speed Rehome: Rehome
- change_type = ""
- if request_type == "initial" or request_type == "":
- change_type = "New-Start"
- elif request_type == "speed changed":
- existing_placement = str(candidate.get('existing_placement'))
- if existing_placement == 'false':
- change_type = "Rehome"
- elif existing_placement == 'true':
- change_type = "Change-Speed"
- else:
- LOG.error(_LE("Constraint {} has an unknown request type {}").
- format(constraint_name, request_type))
-
- # VNF input parameters common to all service_type
- vnf_input["device-type"] = service_type
- # If the candidate region id is AAIAIC25 and region_fit constraint
- # then ignore that candidate since SDNC may fall over if it
- # receives a capacity check for these candidates.
- # If candidate region id is AAIAIC25 and instance constraint
- # then set the region id to empty string in the input to SDNC.
- # If neither of these conditions, then send the candidate's
- # location id as the region id input to SDNC
- if constraint_type == "region_fit" \
- and candidate.get("inventory_type") == "cloud" \
- and candidate.get('location_id') == "AAIAIC25":
- continue
- elif constraint_type == "instance_fit" \
- and candidate.get("inventory_type") == "service" \
- and candidate.get('location_id') == "AAIAIC25":
- vnf_input["cloud-region-id"] = ""
- else:
- vnf_input["cloud-region-id"] = candidate.get('location_id')
-
- if constraint_type == "instance_fit":
- vnf_input["vnf-host-name"] = candidate.get('host_id')
- '''
- ONLY for service candidates:
- For candidates with AIC version 2.5, SDN-GC uses 'infra-service-instance-id' to identify vvig.
- 'infra-service-instance-id' is 'candidate_id' in Conductor candidate structure
- '''
- vnf_input["infra-service-instance-id"] = candidate.get('candidate_id')
-
- if "service_resource_id" in candidate:
- vnf_input["cust-service-instance-id"] = candidate.get('service_resource_id')
-
- data = {
- "input": {
- "service-capacity-check-operation": {
- "sdnc-request-header": {
- "request-id":
- "59c36776-249b-4966-b911-9a89a63d1676"
- },
- "capacity-check-information": {
- "service-instance-id": "ssb-0001",
- "service": "DHV SD-WAN",
- "action-type": action_type,
- "change-type": change_type,
- "e2e-vpn-key": e2evpnkey,
- "vnf-list": {
- "vnf": [vnf_input]
- }
- }
- }
- }
- }
-
- try:
- device = None
- cloud_region_id = None
- available_capacity = None
- context = "constraint, type, service type"
- value = "{}, {}, {}".format(
- constraint_name, constraint_type, service_type)
- LOG.debug("Json sent to SDNC: {}".format(data))
- response = self._request('post', path=path, data=data,
- context=context, value=value)
- if response is None or response.status_code != 200:
- return
- body = response.json()
- vnf_list = body.get("output").\
- get("service-capacity-check-response").\
- get("vnf-list").get("vnf")
- if not vnf_list or len(vnf_list) < 1:
- LOG.error(_LE("VNF is missing in SDNC response "
- "for constraint {}, type: {}, "
- "service type: {}").
- format(constraint_name, constraint_type,
- service_type))
- elif len(vnf_list) > 1:
- LOG.error(_LE("More than one VNF received in response"
- "for constraint {}, type: {}, "
- "service type: {}").
- format(constraint_name, constraint_type,
- service_type))
- LOG.debug("VNF List: {}".format(vnf_list))
- else:
- for vnf in vnf_list:
- device = vnf.get("device-type")
- cloud_region_id = vnf.get("cloud-region-id")
- available_capacity = vnf.get("available-capacity")
- break # only one response expected for one candidate
- if available_capacity == "N":
- LOG.error(_LE("insufficient capacity for {} in region {} "
- "for constraint {}, type: {}, "
- "service type: {}").
- format(device, cloud_region_id, constraint_name,
- constraint_type, service_type))
- LOG.debug("VNF List: {}".format(vnf_list))
- elif available_capacity == "Y":
- selected_candidates.append(candidate)
- LOG.debug("Candidate found for {} in region {} "
- "for constraint {}, type: {}, "
- "service type: {}"
- .format(device, cloud_region_id, constraint_name,
- constraint_type, service_type))
- except Exception as exc:
- # TODO(shankar): Make more specific once we know SDNC errors
- LOG.error("Constraint {}, type: {}, SDNC unknown error: {}".
- format(constraint_name, constraint_type, exc))
- return
-
return selected_candidates