Merge "Typo in bpmn mso-request-id variable name"
[so.git] / bpmn / MSOCommonBPMN / src / main / java / org / onap / so / bpmn / servicedecomposition / tasks / BBInputSetupUtils.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
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
12  * 
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  * 
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=========================================================
21  */
22
23 package org.onap.so.bpmn.servicedecomposition.tasks;
24
25 import java.io.IOException;
26 import java.util.List;
27 import java.util.Map;
28 import java.util.Optional;
29 import org.onap.aai.domain.yang.CloudRegion;
30 import org.onap.aai.domain.yang.Configuration;
31 import org.onap.aai.domain.yang.GenericVnf;
32 import org.onap.aai.domain.yang.GenericVnfs;
33 import org.onap.aai.domain.yang.InstanceGroup;
34 import org.onap.aai.domain.yang.L3Network;
35 import org.onap.aai.domain.yang.L3Networks;
36 import org.onap.aai.domain.yang.ServiceInstance;
37 import org.onap.aai.domain.yang.ServiceInstances;
38 import org.onap.aai.domain.yang.ServiceSubscription;
39 import org.onap.aai.domain.yang.VfModule;
40 import org.onap.aai.domain.yang.VolumeGroup;
41 import org.onap.aai.domain.yang.VolumeGroups;
42 import org.onap.aai.domain.yang.VpnBinding;
43 import org.onap.so.bpmn.common.InjectionHelper;
44 import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
45 import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.MultipleObjectsFoundException;
46 import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.NoServiceInstanceFoundException;
47 import org.onap.so.client.aai.AAIObjectPlurals;
48 import org.onap.so.client.aai.AAIObjectType;
49 import org.onap.so.client.aai.entities.AAIResultWrapper;
50 import org.onap.so.client.aai.entities.uri.AAIResourceUri;
51 import org.onap.so.client.aai.entities.uri.AAIUriFactory;
52 import org.onap.so.client.graphinventory.entities.uri.Depth;
53 import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
54 import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
55 import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
56 import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
57 import org.onap.so.db.catalog.beans.Service;
58 import org.onap.so.db.catalog.beans.VfModuleCustomization;
59 import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
60 import org.onap.so.db.catalog.client.CatalogDbClient;
61 import org.onap.so.db.request.beans.InfraActiveRequests;
62 import org.onap.so.db.request.client.RequestsDbClient;
63 import org.onap.so.serviceinstancebeans.CloudConfiguration;
64 import org.onap.so.serviceinstancebeans.ModelType;
65 import org.onap.so.serviceinstancebeans.RelatedInstance;
66 import org.onap.so.serviceinstancebeans.RelatedInstanceList;
67 import org.onap.so.serviceinstancebeans.RequestDetails;
68 import org.slf4j.Logger;
69 import org.slf4j.LoggerFactory;
70 import org.springframework.beans.factory.annotation.Autowired;
71 import org.springframework.stereotype.Component;
72 import com.fasterxml.jackson.databind.DeserializationFeature;
73 import com.fasterxml.jackson.databind.ObjectMapper;
74 import com.fasterxml.jackson.databind.SerializationFeature;
75
76 @Component("BBInputSetupUtils")
77 public class BBInputSetupUtils {
78
79     private static final Logger logger = LoggerFactory.getLogger(BBInputSetupUtils.class);
80     private ObjectMapper objectMapper = new ObjectMapper();
81     private static final String REQUEST_ERROR = "Could not find request.";
82
83     @Autowired
84     protected CatalogDbClient catalogDbClient;
85
86     @Autowired
87     protected RequestsDbClient requestsDbClient;
88
89     @Autowired
90     protected InjectionHelper injectionHelper;
91
92     public RelatedInstance getRelatedInstanceByType(RequestDetails requestDetails, ModelType modelType) {
93         if (requestDetails.getRelatedInstanceList() != null) {
94             for (RelatedInstanceList relatedInstanceList : requestDetails.getRelatedInstanceList()) {
95                 RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance();
96                 if (relatedInstance != null && relatedInstance.getModelInfo() != null
97                         && relatedInstance.getModelInfo().getModelType() != null
98                         && relatedInstance.getModelInfo().getModelType().equals(modelType)) {
99                     return relatedInstance;
100                 }
101             }
102         }
103         return null;
104     }
105
106     public void updateInfraActiveRequestVnfId(InfraActiveRequests request, String vnfId) {
107         if (request != null) {
108             request.setVnfId(vnfId);
109             this.requestsDbClient.updateInfraActiveRequests(request);
110         } else {
111             logger.debug(REQUEST_ERROR);
112         }
113     }
114
115     public void updateInfraActiveRequestVfModuleId(InfraActiveRequests request, String vfModuleId) {
116         if (request != null) {
117             request.setVfModuleId(vfModuleId);
118             this.requestsDbClient.updateInfraActiveRequests(request);
119         } else {
120             logger.debug(REQUEST_ERROR);
121         }
122     }
123
124     public void updateInfraActiveRequestVolumeGroupId(InfraActiveRequests request, String volumeGroupId) {
125         if (request != null) {
126             request.setVolumeGroupId(volumeGroupId);
127             this.requestsDbClient.updateInfraActiveRequests(request);
128         } else {
129             logger.debug(REQUEST_ERROR);
130         }
131     }
132
133     public void updateInfraActiveRequestNetworkId(InfraActiveRequests request, String networkId) {
134         if (request != null) {
135             request.setNetworkId(networkId);
136             this.requestsDbClient.updateInfraActiveRequests(request);
137         } else {
138             logger.debug(REQUEST_ERROR);
139         }
140     }
141
142     public Service getCatalogServiceByModelUUID(String modelUUID) {
143         return catalogDbClient.getServiceByID(modelUUID);
144     }
145
146     public Service getCatalogServiceByModelVersionAndModelInvariantUUID(String modelVersion,
147             String modelInvariantUUID) {
148         return catalogDbClient.getServiceByModelVersionAndModelInvariantUUID(modelVersion, modelInvariantUUID);
149     }
150
151     public CollectionNetworkResourceCustomization getCatalogCollectionNetworkResourceCustByID(String key) {
152         return catalogDbClient.getCollectionNetworkResourceCustomizationByID(key);
153     }
154
155     public NetworkCollectionResourceCustomization getCatalogNetworkCollectionResourceCustByID(
156             String collectionCustomizationId) {
157         return catalogDbClient.getNetworkCollectionResourceCustomizationByID(collectionCustomizationId);
158     }
159
160     public VfModuleCustomization getVfModuleCustomizationByModelCuztomizationUUID(String modelCustomizationUUID) {
161         return catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID(modelCustomizationUUID);
162     }
163
164     public CvnfcConfigurationCustomization getCvnfcConfigurationCustomization(String serviceModelUUID,
165             String vnfCustomizationUuid, String vfModuleCustomizationUuid, String cvnfcCustomizationUuid) {
166         return catalogDbClient.getCvnfcCustomization(serviceModelUUID, vnfCustomizationUuid, vfModuleCustomizationUuid,
167                 cvnfcCustomizationUuid);
168     }
169
170     public List<VnfcInstanceGroupCustomization> getVnfcInstanceGroups(String modelCustomizationUUID) {
171         return catalogDbClient.getVnfcInstanceGroupsByVnfResourceCust(modelCustomizationUUID);
172     }
173
174     public Map<String, String> getURIKeysFromServiceInstance(String serviceInstanceId) {
175         AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId);
176         return uri.getURIKeys();
177     }
178
179     protected RequestDetails getRequestDetails(String requestId) throws IOException {
180         if (requestId != null && !requestId.isEmpty()) {
181             InfraActiveRequests activeRequest = this.getInfraActiveRequest(requestId);
182             String requestBody = activeRequest.getRequestBody().replaceAll("\\\\", "");
183             objectMapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
184             objectMapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
185             return objectMapper.readValue(requestBody, RequestDetails.class);
186         } else {
187             return null;
188         }
189     }
190
191     protected InfraActiveRequests getInfraActiveRequest(String requestId) {
192         if (requestId != null && !requestId.isEmpty()) {
193             return requestsDbClient.getInfraActiveRequestbyRequestId(requestId);
194         } else {
195             return null;
196         }
197     }
198
199     protected CloudRegion getCloudRegion(CloudConfiguration cloudConfiguration) {
200         if (cloudConfiguration != null) {
201             String cloudRegionId = cloudConfiguration.getLcpCloudRegionId();
202             String cloudOwner = cloudConfiguration.getCloudOwner();
203             if (cloudRegionId != null && cloudOwner != null && !cloudRegionId.isEmpty() && !cloudOwner.isEmpty()) {
204                 return injectionHelper.getAaiClient().get(CloudRegion.class, AAIUriFactory
205                         .createResourceUri(AAIObjectType.CLOUD_REGION, cloudOwner, cloudRegionId).depth(Depth.TWO))
206                         .orElse(null);
207
208             } else {
209                 return null;
210             }
211         } else {
212             return null;
213         }
214     }
215
216     protected InstanceGroup getAAIInstanceGroup(String instanceGroupId) {
217         return injectionHelper.getAaiClient().get(InstanceGroup.class,
218                 AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroupId)).orElse(null);
219     }
220
221     public org.onap.aai.domain.yang.Customer getAAICustomer(String globalSubscriberId) {
222         return injectionHelper.getAaiClient().get(org.onap.aai.domain.yang.Customer.class,
223                 AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, globalSubscriberId)).orElse(null);
224     }
225
226     public ServiceSubscription getAAIServiceSubscription(String globalSubscriberId, String subscriptionServiceType) {
227
228         if (globalSubscriberId == null || globalSubscriberId.equals("") || subscriptionServiceType == null
229                 || subscriptionServiceType.equals("")) {
230             return null;
231         } else {
232             return injectionHelper.getAaiClient().get(ServiceSubscription.class, AAIUriFactory
233                     .createResourceUri(AAIObjectType.SERVICE_SUBSCRIPTION, globalSubscriberId, subscriptionServiceType))
234                     .orElse(null);
235         }
236
237     }
238
239     public ServiceInstance getAAIServiceInstanceById(String serviceInstanceId) {
240         return injectionHelper.getAaiClient()
241                 .get(ServiceInstance.class, AAIUriFactory
242                         .createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId).depth(Depth.TWO))
243                 .orElse(null);
244     }
245
246     protected ServiceInstance getAAIServiceInstanceByIdAndCustomer(String globalCustomerId, String serviceType,
247             String serviceInstanceId) {
248         return injectionHelper.getAaiClient().get(ServiceInstance.class, AAIUriFactory
249                 .createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustomerId, serviceType, serviceInstanceId)
250                 .depth(Depth.TWO)).orElse(null);
251     }
252
253     protected org.onap.aai.domain.yang.ServiceInstances getAAIServiceInstancesByName(String serviceInstanceName,
254             Customer customer) {
255
256         return injectionHelper.getAaiClient()
257                 .get(org.onap.aai.domain.yang.ServiceInstances.class,
258                         AAIUriFactory
259                                 .createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, customer.getGlobalCustomerId(),
260                                         customer.getServiceSubscription().getServiceType())
261                                 .queryParam("service-instance-name", serviceInstanceName).depth(Depth.TWO))
262                 .orElseGet(() -> {
263                     logger.debug("No Service Instance matched by name");
264                     return null;
265                 });
266     }
267
268     public org.onap.aai.domain.yang.ServiceInstance getAAIServiceInstanceByName(String serviceInstanceName,
269             Customer customer) throws Exception {
270         org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = null;
271         org.onap.aai.domain.yang.ServiceInstances aaiServiceInstances = null;
272         aaiServiceInstances = getAAIServiceInstancesByName(serviceInstanceName, customer);
273
274         if (aaiServiceInstances == null) {
275             return null;
276         } else if (aaiServiceInstances.getServiceInstance().size() > 1) {
277             throw new Exception("Multiple Service Instances Returned");
278         } else {
279             aaiServiceInstance = aaiServiceInstances.getServiceInstance().get(0);
280         }
281         return aaiServiceInstance;
282     }
283
284     protected ServiceInstances getAAIServiceInstancesByName(String globalCustomerId, String serviceType,
285             String serviceInstanceName) {
286
287         return injectionHelper.getAaiClient()
288                 .get(ServiceInstances.class,
289                         AAIUriFactory
290                                 .createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, globalCustomerId, serviceType)
291                                 .queryParam("service-instance-name", serviceInstanceName).depth(Depth.TWO))
292                 .orElseGet(() -> {
293                     logger.debug("No Service Instance matched by name");
294                     return null;
295                 });
296     }
297
298     public Optional<ServiceInstance> getAAIServiceInstanceByName(String globalCustomerId, String serviceType,
299             String serviceInstanceName) throws Exception {
300         ServiceInstance aaiServiceInstance = null;
301         ServiceInstances aaiServiceInstances = null;
302         aaiServiceInstances = getAAIServiceInstancesByName(globalCustomerId, serviceType, serviceInstanceName);
303
304         if (aaiServiceInstances == null) {
305             return Optional.empty();
306         } else if (aaiServiceInstances.getServiceInstance().size() > 1) {
307             throw new Exception("Multiple Service Instances Returned");
308         } else {
309             aaiServiceInstance = aaiServiceInstances.getServiceInstance().get(0);
310         }
311         return Optional.of(aaiServiceInstance);
312     }
313
314     public org.onap.so.db.catalog.beans.InstanceGroup getCatalogInstanceGroup(String modelUUID) {
315         return this.catalogDbClient.getInstanceGroupByModelUUID(modelUUID);
316     }
317
318     public List<CollectionResourceInstanceGroupCustomization> getCollectionResourceInstanceGroupCustomization(
319             String modelCustomizationUUID) {
320         return this.catalogDbClient
321                 .getCollectionResourceInstanceGroupCustomizationByModelCustUUID(modelCustomizationUUID);
322     }
323
324     public AAIResultWrapper getAAIResourceDepthOne(AAIResourceUri aaiResourceUri) {
325         AAIResourceUri clonedUri = aaiResourceUri.clone();
326         return this.injectionHelper.getAaiClient().get(clonedUri.depth(Depth.ONE));
327     }
328
329     public AAIResultWrapper getAAIResourceDepthTwo(AAIResourceUri aaiResourceUri) {
330         AAIResourceUri clonedUri = aaiResourceUri.clone();
331         return this.injectionHelper.getAaiClient().get(clonedUri.depth(Depth.TWO));
332     }
333
334     public Configuration getAAIConfiguration(String configurationId) {
335         return this.injectionHelper.getAaiClient()
336                 .get(Configuration.class,
337                         AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId).depth(Depth.ONE))
338                 .orElseGet(() -> {
339                     logger.debug("No Configuration matched by id");
340                     return null;
341                 });
342     }
343
344     public GenericVnf getAAIGenericVnf(String vnfId) {
345
346         return this.injectionHelper.getAaiClient()
347                 .get(GenericVnf.class,
348                         AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE))
349                 .orElseGet(() -> {
350                     logger.debug("No Generic Vnf matched by id");
351                     return null;
352                 });
353     }
354
355     public VpnBinding getAAIVpnBinding(String vpnBindingId) {
356
357         return this.injectionHelper.getAaiClient()
358                 .get(VpnBinding.class,
359                         AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, vpnBindingId).depth(Depth.ONE))
360                 .orElseGet(() -> {
361                     logger.debug("No VpnBinding matched by id");
362                     return null;
363                 });
364     }
365
366     public VolumeGroup getAAIVolumeGroup(String cloudOwnerId, String cloudRegionId, String volumeGroupId) {
367         return this.injectionHelper.getAaiClient()
368                 .get(VolumeGroup.class, AAIUriFactory
369                         .createResourceUri(AAIObjectType.VOLUME_GROUP, cloudOwnerId, cloudRegionId, volumeGroupId)
370                         .depth(Depth.ONE))
371                 .orElseGet(() -> {
372                     logger.debug("No Generic Vnf matched by id");
373                     return null;
374                 });
375     }
376
377     public VfModule getAAIVfModule(String vnfId, String vfModuleId) {
378         return this.injectionHelper.getAaiClient()
379                 .get(VfModule.class,
380                         AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId).depth(Depth.ONE))
381                 .orElseGet(() -> {
382                     logger.debug("No Generic Vnf matched by id");
383                     return null;
384                 });
385     }
386
387     public L3Network getAAIL3Network(String networkId) {
388
389         return this.injectionHelper.getAaiClient()
390                 .get(L3Network.class,
391                         AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId).depth(Depth.ONE))
392                 .orElseGet(() -> {
393                     logger.debug("No Generic Vnf matched by id");
394                     return null;
395                 });
396
397     }
398
399     public Optional<ServiceInstance> getRelatedServiceInstanceFromInstanceGroup(String instanceGroupId)
400             throws Exception {
401         AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroupId);
402         uri.relatedTo(AAIObjectPlurals.SERVICE_INSTANCE);
403         Optional<ServiceInstances> serviceInstances = injectionHelper.getAaiClient().get(ServiceInstances.class, uri);
404         ServiceInstance serviceInstance = null;
405         if (!serviceInstances.isPresent()) {
406             logger.debug("No ServiceInstances were found");
407             return Optional.empty();
408         } else {
409             if (serviceInstances.get().getServiceInstance().isEmpty()) {
410                 throw new NoServiceInstanceFoundException("No ServiceInstances Returned");
411             } else if (serviceInstances.get().getServiceInstance().size() > 1) {
412                 throw new MultipleObjectsFoundException("Multiple ServiceInstances Returned");
413             } else {
414                 serviceInstance = serviceInstances.get().getServiceInstance().get(0);
415             }
416             return Optional.of(serviceInstance);
417         }
418     }
419
420     public Optional<L3Network> getRelatedNetworkByNameFromServiceInstance(String serviceInstanceId, String networkName)
421             throws Exception {
422         AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId);
423         uri.relatedTo(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", networkName);
424         Optional<L3Networks> networks = injectionHelper.getAaiClient().get(L3Networks.class, uri);
425         L3Network network = null;
426         if (!networks.isPresent()) {
427             logger.debug("No Networks matched by name");
428             return Optional.empty();
429         } else {
430             if (networks.get().getL3Network().size() > 1) {
431                 throw new Exception("Multiple Networks Returned");
432             } else {
433                 network = networks.get().getL3Network().get(0);
434             }
435             return Optional.of(network);
436         }
437     }
438
439     public Optional<GenericVnf> getRelatedVnfByNameFromServiceInstance(String serviceInstanceId, String vnfName)
440             throws Exception {
441         AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId);
442         uri.relatedTo(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName);
443         Optional<GenericVnfs> vnfs = injectionHelper.getAaiClient().get(GenericVnfs.class, uri);
444         GenericVnf vnf = null;
445         if (!vnfs.isPresent()) {
446             logger.debug("No Vnfs matched by name");
447             return Optional.empty();
448         } else {
449             if (vnfs.get().getGenericVnf().size() > 1) {
450                 throw new Exception("Multiple Vnfs Returned");
451             } else {
452                 vnf = vnfs.get().getGenericVnf().get(0);
453             }
454             return Optional.of(vnf);
455         }
456     }
457
458     public Optional<VolumeGroup> getRelatedVolumeGroupByNameFromVnf(String vnfId, String volumeGroupName)
459             throws Exception {
460         AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId);
461         uri.relatedTo(AAIObjectPlurals.VOLUME_GROUP).queryParam("volume-group-name", volumeGroupName);
462         Optional<VolumeGroups> volumeGroups = injectionHelper.getAaiClient().get(VolumeGroups.class, uri);
463         VolumeGroup volumeGroup = null;
464         if (!volumeGroups.isPresent()) {
465             logger.debug("No VolumeGroups matched by name");
466             return Optional.empty();
467         } else {
468             if (volumeGroups.get().getVolumeGroup().size() > 1) {
469                 throw new Exception("Multiple VolumeGroups Returned");
470             } else {
471                 volumeGroup = volumeGroups.get().getVolumeGroup().get(0);
472             }
473             return Optional.of(volumeGroup);
474         }
475     }
476
477     public Optional<VolumeGroup> getRelatedVolumeGroupByNameFromVfModule(String vnfId, String vfModuleId,
478             String volumeGroupName) throws Exception {
479         AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId);
480         uri.relatedTo(AAIObjectPlurals.VOLUME_GROUP).queryParam("volume-group-name", volumeGroupName);
481         Optional<VolumeGroups> volumeGroups = injectionHelper.getAaiClient().get(VolumeGroups.class, uri);
482         VolumeGroup volumeGroup = null;
483         if (!volumeGroups.isPresent()) {
484             logger.debug("No VolumeGroups matched by name");
485             return Optional.empty();
486         } else {
487             if (volumeGroups.get().getVolumeGroup().size() > 1) {
488                 throw new Exception("Multiple VolumeGroups Returned");
489             } else {
490                 volumeGroup = volumeGroups.get().getVolumeGroup().get(0);
491             }
492             return Optional.of(volumeGroup);
493         }
494     }
495
496     public Optional<org.onap.aai.domain.yang.VpnBinding> getAICVpnBindingFromNetwork(
497             org.onap.aai.domain.yang.L3Network aaiLocalNetwork) {
498         AAIResultWrapper networkWrapper = new AAIResultWrapper(aaiLocalNetwork);
499         if (networkWrapper.getRelationships().isPresent()
500                 && !networkWrapper.getRelationships().get().getRelatedUris(AAIObjectType.VPN_BINDING).isEmpty()) {
501             return getAAIResourceDepthOne(
502                     networkWrapper.getRelationships().get().getRelatedUris(AAIObjectType.VPN_BINDING).get(0))
503                             .asBean(org.onap.aai.domain.yang.VpnBinding.class);
504         }
505         return Optional.empty();
506     }
507 }