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;
25 import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation;
26 import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
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.L3Network;
30 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
31 import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
32 import org.onap.so.client.sdnc.beans.SDNCSvcAction;
33 import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
34 import org.onap.so.client.sdnc.mapper.NetworkTopologyOperationRequestMapper;
35 import org.slf4j.Logger;
36 import org.slf4j.LoggerFactory;
37 import org.springframework.beans.factory.annotation.Autowired;
38 import org.springframework.stereotype.Component;
41 public class SDNCNetworkResources {
42 private static final Logger logger = LoggerFactory.getLogger(SDNCNetworkResources.class);
45 private NetworkTopologyOperationRequestMapper sdncRM;
47 public GenericResourceApiNetworkOperationInformation assignNetwork(L3Network network,
48 ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
49 CloudRegion cloudRegion) {
50 return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,
51 GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer,
52 requestContext, cloudRegion);
55 public GenericResourceApiNetworkOperationInformation rollbackAssignNetwork(L3Network network,
56 ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
57 CloudRegion cloudRegion) {
58 return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN,
59 GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer,
60 requestContext, cloudRegion);
63 public GenericResourceApiNetworkOperationInformation activateNetwork(L3Network network,
64 ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
65 CloudRegion cloudRegion) {
66 return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ACTIVATE,
67 GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer,
68 requestContext, cloudRegion);
71 public GenericResourceApiNetworkOperationInformation deactivateNetwork(L3Network network,
72 ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
73 CloudRegion cloudRegion) {
74 return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE,
75 GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer,
76 requestContext, cloudRegion);
79 public GenericResourceApiNetworkOperationInformation deleteNetwork(L3Network network,
80 ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
81 CloudRegion cloudRegion) {
82 return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.DELETE,
83 GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer,
84 requestContext, cloudRegion);
87 public GenericResourceApiNetworkOperationInformation changeAssignNetwork(L3Network network,
88 ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
89 CloudRegion cloudRegion) {
90 return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN,
91 GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer,
92 requestContext, cloudRegion);
95 public GenericResourceApiNetworkOperationInformation unassignNetwork(L3Network network,
96 ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
97 CloudRegion cloudRegion) {
98 return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN,
99 GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer,
100 requestContext, cloudRegion);