2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Modifications Copyright (c) 2019 Samsung
8 * ================================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * ============LICENSE_END=========================================================
23 package org.onap.so.client.orchestration;
26 import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation;
27 import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
28 import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
29 import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
30 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
31 import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
32 import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
33 import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
34 import org.onap.so.client.exception.BadResponseException;
35 import org.onap.so.client.exception.MapperException;
36 import org.onap.so.client.sdnc.SDNCClient;
37 import org.onap.so.client.sdnc.beans.SDNCSvcAction;
38 import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
39 import org.onap.so.client.sdnc.mapper.VfModuleTopologyOperationRequestMapper;
40 import org.springframework.beans.factory.annotation.Autowired;
41 import org.springframework.stereotype.Component;
44 public class SDNCVfModuleResources {
47 private VfModuleTopologyOperationRequestMapper sdncRM;
50 private SDNCClient sdncClient;
52 public GenericResourceApiVfModuleOperationInformation assignVfModule(VfModule vfModule, VolumeGroup volumeGroup,
53 GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion,
54 RequestContext requestContext, URI callbackURI) throws MapperException {
55 return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule,
56 volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext, null, callbackURI);
59 public GenericResourceApiVfModuleOperationInformation unassignVfModule(VfModule vfModule, GenericVnf vnf,
60 ServiceInstance serviceInstance, RequestContext requestContext, URI callbackURI) throws MapperException {
61 return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, vfModule, null,
62 vnf, serviceInstance, null, null, requestContext, null, callbackURI);
65 public GenericResourceApiVfModuleOperationInformation deactivateVfModule(VfModule vfModule, GenericVnf vnf,
66 ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext,
67 URI callbackURI) throws MapperException {
68 return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, vfModule, null,
69 vnf, serviceInstance, customer, cloudRegion, requestContext, null, callbackURI);
72 public String queryVfModule(VfModule vfModule) throws MapperException, BadResponseException {
73 String objectPath = vfModule.getSelflink();
74 return sdncClient.get(objectPath);
77 public GenericResourceApiVfModuleOperationInformation activateVfModule(VfModule vfModule, GenericVnf vnf,
78 ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext,
79 URI callbackURI) throws MapperException {
80 return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ACTIVATE, vfModule, null,
81 vnf, serviceInstance, customer, cloudRegion, requestContext, null, callbackURI);
84 public GenericResourceApiVfModuleOperationInformation changeAssignVfModule(VfModule vfModule, GenericVnf vnf,
85 ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext,
86 URI callbackURI) throws MapperException {
87 return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, vfModule,
88 null, vnf, serviceInstance, customer, cloudRegion, requestContext, null, callbackURI);