2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.so.client.orchestration;
23 import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
24 import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation;
25 import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
26 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
27 import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
28 import org.onap.so.client.exception.BadResponseException;
29 import org.onap.so.client.exception.MapperException;
30 import org.onap.so.client.sdnc.beans.SDNCSvcAction;
31 import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
32 import org.onap.so.client.sdnc.mapper.ServiceTopologyOperationMapper;
33 import org.springframework.beans.factory.annotation.Autowired;
34 import org.springframework.stereotype.Component;
37 public class SDNCServiceInstanceResources {
40 private ServiceTopologyOperationMapper sdncRM;
43 * SDNC call to perform Service Topology Assign for ServiceInsatnce
45 * @param serviceInstance
47 * @param requestContext
48 * @throws MapperException
49 * @throws BadResponseException
50 * @return the response as a String
52 public GenericResourceApiServiceOperationInformation assignServiceInstance(ServiceInstance serviceInstance,
53 Customer customer, RequestContext requestContext) {
54 return sdncRM.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,
55 GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE, serviceInstance, customer,
60 * SDNC call to perform Service Topology Delete for ServiceInsatnce
62 * @param serviceInstance
64 * @param requestContext
65 * @throws MapperException
66 * @throws BadResponseException
67 * @return the response as a String
69 public GenericResourceApiServiceOperationInformation deleteServiceInstance(ServiceInstance serviceInstance,
70 Customer customer, RequestContext requestContext) {
71 return sdncRM.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.DELETE,
72 GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE, serviceInstance, customer,
76 public GenericResourceApiServiceOperationInformation unassignServiceInstance(ServiceInstance serviceInstance,
77 Customer customer, RequestContext requestContext) {
78 return sdncRM.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.DELETE,
79 GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE, serviceInstance, customer,
84 * SDNC call to perform Service Topology Deactivate for ServiceInstance
86 * @param serviceInstance
88 * @param requestContext
89 * @throws MapperException
90 * @throws BadResponseException
91 * @return the response as a String
93 public GenericResourceApiServiceOperationInformation deactivateServiceInstance(ServiceInstance serviceInstance,
94 Customer customer, RequestContext requestContext) {
95 return sdncRM.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE,
96 GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE, serviceInstance, customer,
101 * SDNC call to perform Service Topology Change Assign for the
104 * @param serviceInstance
106 * @param requestContext
107 * @throws MapperException
108 * @throws BadResponseException
109 * @return the response as a String
111 public GenericResourceApiServiceOperationInformation changeModelServiceInstance(ServiceInstance serviceInstance,
112 Customer customer, RequestContext requestContext) {
113 return sdncRM.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN,
114 GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE, serviceInstance, customer,