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;
24 import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
25 import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
26 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
27 import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
28 import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
29 import org.onap.so.client.exception.BadResponseException;
30 import org.onap.so.client.exception.MapperException;
31 import org.onap.so.client.sdnc.SDNCClient;
32 import org.onap.so.client.sdnc.beans.SDNCSvcAction;
33 import org.onap.so.client.sdnc.endpoint.SDNCTopology;
34 import org.onap.so.client.sdnc.mapper.GCTopologyOperationRequestMapper;
35 import org.springframework.beans.factory.annotation.Autowired;
36 import org.springframework.stereotype.Component;
38 import org.onap.sdnc.apps.client.model.GenericResourceApiGcTopologyOperationInformation;
39 import org.onap.sdnc.apps.client.model.GenericResourceApiRequestActionEnumeration;
42 public class SDNCConfigurationResources {
44 private GCTopologyOperationRequestMapper sdncRM;
47 private SDNCClient sdncClient;
50 * SDN-C call to assign configuration after it was created in A&AI
52 * @param serviceInstance
53 * @param requestContext
54 * @param vnrConfiguration
57 * @throws MapperException
58 * @throws BadResponseException
60 public String assignVnrConfiguration(ServiceInstance serviceInstance,
61 RequestContext requestContext,
63 Configuration vnrConfiguration,
65 throws MapperException, BadResponseException {
66 GenericResourceApiGcTopologyOperationInformation sdncReq = sdncRM.assignOrActivateVnrReqMapper(
68 GenericResourceApiRequestActionEnumeration.CREATEGENERICCONFIGURATIONINSTANCE ,
69 serviceInstance , requestContext, customer, vnrConfiguration,voiceVnf);
70 return sdncClient.post(sdncReq, SDNCTopology.CONFIGURATION);
74 * SDNC Call to Activate VNR Configuration
76 * @param serviceInstance
77 * @param requestContext
78 * @param vnrConfiguration
81 * @throws MapperException
82 * @throws BadResponseException
84 public String activateVnrConfiguration(ServiceInstance serviceInstance,
85 RequestContext requestContext,
87 Configuration vnrConfiguration,
89 throws MapperException, BadResponseException {
91 GenericResourceApiGcTopologyOperationInformation sdncReq = sdncRM.assignOrActivateVnrReqMapper(
92 SDNCSvcAction.ACTIVATE,
93 GenericResourceApiRequestActionEnumeration.CREATEGENERICCONFIGURATIONINSTANCE ,
94 serviceInstance , requestContext, customer, vnrConfiguration, voiceVnf);
95 return sdncClient.post(sdncReq, SDNCTopology.CONFIGURATION);
99 * method to unAssign Vnr Configuration in SDNC
101 * @param serviceInstance
102 * @param requestContext
103 * @param vnrConfiguration
105 * @throws BadResponseException
106 * @throws MapperException
108 public String unAssignVnrConfiguration(ServiceInstance serviceInstance, RequestContext requestContext,
109 Configuration vnrConfiguration) throws BadResponseException, MapperException {
111 GenericResourceApiGcTopologyOperationInformation sdncReq = sdncRM.deactivateOrUnassignVnrReqMapper
112 (SDNCSvcAction.UNASSIGN,serviceInstance, requestContext, vnrConfiguration);
113 return sdncClient.post(sdncReq, SDNCTopology.CONFIGURATION);
117 * Deactivate VNR SDNC Call
118 * @param serviceInstance
119 * @param requestContext
120 * @param vnrConfiguration
121 * @throws BadResponseException
122 * @throws MapperException
124 public String deactivateVnrConfiguration(ServiceInstance serviceInstance, RequestContext requestContext, Configuration vnrConfiguration) throws BadResponseException, MapperException {
125 GenericResourceApiGcTopologyOperationInformation sdncReq = sdncRM.deactivateOrUnassignVnrReqMapper(
126 SDNCSvcAction.DEACTIVATE,
127 serviceInstance , requestContext, vnrConfiguration);
128 return sdncClient.post(sdncReq, SDNCTopology.CONFIGURATION);