2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 - 2018 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.sdnc.mapper;
25 import org.onap.sdnc.northbound.client.model.*;
26 import org.onap.so.bpmn.servicedecomposition.bbobjects.*;
27 import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
28 import org.onap.so.client.sdnc.beans.SDNCSvcAction;
29 import org.springframework.stereotype.Component;
31 @Component(value = "sdncGCTopologyOperationRequestMapper")
32 public class GCTopologyOperationRequestMapper {
34 private static final GeneralTopologyObjectMapper generalTopologyObjectMapper = new GeneralTopologyObjectMapper();
36 public GenericResourceApiGcTopologyOperationInformation assignOrActivateVnrReqMapper(SDNCSvcAction svcAction,
37 GenericResourceApiRequestActionEnumeration reqAction,
38 ServiceInstance serviceInstance,
39 RequestContext requestContext,
41 Configuration vnrConfiguration,
42 GenericVnf voiceVnf, String sdncReqId,URI callbackUri) {
44 GenericResourceApiGcTopologyOperationInformation req = new GenericResourceApiGcTopologyOperationInformation();
45 GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId,callbackUri.toString());
46 GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(sdncReqId, reqAction);
47 GenericResourceApiServiceinformationServiceInformation serviceInformation = generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, false);
48 GenericResourceApiConfigurationinformationConfigurationInformation configurationInformation = generalTopologyObjectMapper.buildConfigurationInformation(vnrConfiguration,true);
49 GenericResourceApiGcrequestinputGcRequestInput gcRequestInput = generalTopologyObjectMapper.buildGcRequestInformation(voiceVnf,null);
50 req.setRequestInformation(requestInformation);
51 req.setSdncRequestHeader(sdncRequestHeader);
52 req.setServiceInformation(serviceInformation);
53 req.setConfigurationInformation(configurationInformation);
54 req.setGcRequestInput(gcRequestInput);
61 public GenericResourceApiGcTopologyOperationInformation deactivateOrUnassignVnrReqMapper(SDNCSvcAction svcAction,
62 ServiceInstance serviceInstance,
63 RequestContext requestContext,
64 Configuration vnrConfiguration, String sdncReqId, URI callbackUri) {
66 GenericResourceApiGcTopologyOperationInformation req = new GenericResourceApiGcTopologyOperationInformation();
67 GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader =
68 generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId,callbackUri.toString());
69 GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper
70 .buildGenericResourceApiRequestinformationRequestInformation(sdncReqId,
71 GenericResourceApiRequestActionEnumeration.DELETEGENERICCONFIGURATIONINSTANCE);
72 GenericResourceApiServiceinformationServiceInformation serviceInformation = new GenericResourceApiServiceinformationServiceInformation();
73 serviceInformation.setServiceInstanceId(serviceInstance.getServiceInstanceId());
74 GenericResourceApiConfigurationinformationConfigurationInformation configurationInformation =
75 new GenericResourceApiConfigurationinformationConfigurationInformation();
76 configurationInformation.setConfigurationId(vnrConfiguration.getConfigurationId());
77 req.setRequestInformation(requestInformation);
78 req.setSdncRequestHeader(sdncRequestHeader);
79 req.setServiceInformation(serviceInformation);
80 req.setConfigurationInformation(configurationInformation);