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.GenericResourceApiConfigurationinformationConfigurationInformation;
26 import org.onap.sdnc.northbound.client.model.GenericResourceApiGcTopologyOperationInformation;
27 import org.onap.sdnc.northbound.client.model.GenericResourceApiGcrequestinputGcRequestInput;
28 import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
29 import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestinformationRequestInformation;
30 import org.onap.sdnc.northbound.client.model.GenericResourceApiSdncrequestheaderSdncRequestHeader;
31 import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceinformationServiceInformation;
32 import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
33 import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
34 import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
35 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
36 import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
37 import org.onap.so.client.sdnc.beans.SDNCSvcAction;
38 import org.springframework.beans.factory.annotation.Autowired;
39 import org.springframework.stereotype.Component;
41 @Component(value = "sdncGCTopologyOperationRequestMapper")
42 public class GCTopologyOperationRequestMapper {
45 private GeneralTopologyObjectMapper generalTopologyObjectMapper;
47 public GenericResourceApiGcTopologyOperationInformation assignOrActivateVnrReqMapper(SDNCSvcAction svcAction,
48 GenericResourceApiRequestActionEnumeration reqAction,
49 ServiceInstance serviceInstance,
50 RequestContext requestContext,
52 Configuration vnrConfiguration,
53 GenericVnf voiceVnf, String sdncReqId,URI callbackUri) {
55 GenericResourceApiGcTopologyOperationInformation req = new GenericResourceApiGcTopologyOperationInformation();
56 GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId,callbackUri.toString());
57 GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(sdncReqId, reqAction);
58 GenericResourceApiServiceinformationServiceInformation serviceInformation = generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, false);
59 GenericResourceApiConfigurationinformationConfigurationInformation configurationInformation = generalTopologyObjectMapper.buildConfigurationInformation(vnrConfiguration,true);
60 GenericResourceApiGcrequestinputGcRequestInput gcRequestInput = generalTopologyObjectMapper.buildGcRequestInformation(voiceVnf,null);
61 req.setRequestInformation(requestInformation);
62 req.setSdncRequestHeader(sdncRequestHeader);
63 req.setServiceInformation(serviceInformation);
64 req.setConfigurationInformation(configurationInformation);
65 req.setGcRequestInput(gcRequestInput);
72 public GenericResourceApiGcTopologyOperationInformation deactivateOrUnassignVnrReqMapper(SDNCSvcAction svcAction,
73 ServiceInstance serviceInstance,
74 RequestContext requestContext,
75 Configuration vnrConfiguration, String sdncReqId, URI callbackUri) {
77 GenericResourceApiGcTopologyOperationInformation req = new GenericResourceApiGcTopologyOperationInformation();
78 GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader =
79 generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId,callbackUri.toString());
80 GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper
81 .buildGenericResourceApiRequestinformationRequestInformation(sdncReqId,
82 GenericResourceApiRequestActionEnumeration.DELETEGENERICCONFIGURATIONINSTANCE);
83 GenericResourceApiServiceinformationServiceInformation serviceInformation = new GenericResourceApiServiceinformationServiceInformation();
84 serviceInformation.setServiceInstanceId(serviceInstance.getServiceInstanceId());
85 GenericResourceApiConfigurationinformationConfigurationInformation configurationInformation =
86 new GenericResourceApiConfigurationinformationConfigurationInformation();
87 configurationInformation.setConfigurationId(vnrConfiguration.getConfigurationId());
88 configurationInformation.setConfigurationType(vnrConfiguration.getConfigurationType());
89 req.setRequestInformation(requestInformation);
90 req.setSdncRequestHeader(sdncRequestHeader);
91 req.setServiceInformation(serviceInformation);
92 req.setConfigurationInformation(configurationInformation);