Replaced all tabs with spaces in java and pom.xml
[so.git] / bpmn / so-bpmn-building-blocks / src / test / java / org / onap / so / BuildingBlockTestDataSetup.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 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
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
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=========================================================
19  */
20 package org.onap.so;
21
22 import static org.mockito.Mockito.doReturn;
23 import static org.mockito.Mockito.mock;
24 import java.util.ArrayList;
25 import java.util.Arrays;
26 import java.util.HashMap;
27 import java.util.List;
28 import java.util.Map;
29 import java.util.UUID;
30 import org.camunda.bpm.engine.delegate.DelegateExecution;
31 import org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl;
32 import org.junit.Before;
33 import org.junit.Rule;
34 import org.junit.rules.ExpectedException;
35 import org.onap.so.bpmn.common.BuildingBlockExecution;
36 import org.onap.so.bpmn.common.DelegateExecutionImpl;
37 import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
38 import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
39 import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
40 import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
41 import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
42 import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
43 import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
44 import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
45 import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity;
46 import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
47 import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
48 import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
49 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
50 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy;
51 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
52 import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
53 import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
54 import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
55 import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBondingLink;
56 import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
57 import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
58 import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
59 import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
60 import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters;
61 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration;
62 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
63 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork;
64 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
65 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
66 import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
67 import org.onap.so.client.exception.BBObjectNotFoundException;
68 import org.onap.so.bpmn.servicedecomposition.bbobjects.AllottedResource;
69 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoAllottedResource;
70 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceProxy;
71
72 public class BuildingBlockTestDataSetup {
73     private int collectionCounter;
74     private int configurationCounter;
75     private int customerCounter;
76     private int genericVnfCounter;
77     private int instanceGroupCounter;
78     private int l3NetworkCounter;
79     private int owningEntityCounter;
80     private int pnfCounter;
81     private int projectCounter;
82     private int serviceInstanceCounter;
83     private int serviceProxyCounter;
84     private int serviceSubscriptionCounter;
85     private int vfModuleCounter;
86     private int volumeGroupCounter;
87     private int vpnBindingCounter;
88     private int vpnBondingLinkCounter;
89
90     protected BuildingBlockExecution execution;
91
92     protected GeneralBuildingBlock gBBInput;
93
94     protected HashMap<ResourceKey, String> lookupKeyMap;
95
96     protected ExtractPojosForBB extractPojosForBB = new ExtractPojosForBB();
97
98     @Rule
99     public ExpectedException expectedException = ExpectedException.none();
100
101     protected DelegateExecution delegateExecution;
102
103     @Before
104     public void buildingBlockTestDataSetupBefore() {
105         collectionCounter = 0;
106         configurationCounter = 0;
107         customerCounter = 0;
108         genericVnfCounter = 0;
109         instanceGroupCounter = 0;
110         l3NetworkCounter = 0;
111         owningEntityCounter = 0;
112         pnfCounter = 0;
113         projectCounter = 0;
114         serviceInstanceCounter = 0;
115         serviceProxyCounter = 0;
116         serviceSubscriptionCounter = 0;
117         vfModuleCounter = 0;
118         volumeGroupCounter = 0;
119         vpnBindingCounter = 0;
120         vpnBondingLinkCounter = 0;
121
122         execution = new DelegateExecutionImpl(new ExecutionImpl());
123         execution.setVariable("testProcessKey", "testProcessKeyValue");
124
125         gBBInput = new GeneralBuildingBlock();
126         execution.setVariable("gBBInput", gBBInput);
127
128         lookupKeyMap = new HashMap<ResourceKey, String>();
129         execution.setVariable("lookupKeyMap", lookupKeyMap);
130
131         ExecutionImpl mockExecutionImpl = mock(ExecutionImpl.class);
132         doReturn("test").when(mockExecutionImpl).getProcessInstanceId();
133
134         ExecutionImpl executionImpl = new ExecutionImpl();
135         executionImpl.setProcessInstance(mockExecutionImpl);
136
137         delegateExecution = (DelegateExecution) executionImpl;
138         delegateExecution.setVariable("testProcessKey", "testProcessKeyValue");
139     }
140
141     public Map<String, String> buildUserInput() {
142         Map<String, String> userInput = new HashMap<>();
143         userInput.put("testUserInputKey", "testUserInputValue");
144
145         return userInput;
146     }
147
148     public Map<String, String> setUserInput() {
149         Map<String, String> userInput = buildUserInput();
150
151         gBBInput.setUserInput(userInput);
152
153         return userInput;
154     }
155
156     public RequestContext buildRequestContext() {
157         RequestContext requestContext = new RequestContext();
158         requestContext.setMsoRequestId(UUID.randomUUID().toString());
159         requestContext.setProductFamilyId("testProductFamilyId");
160         requestContext.setRequestorId("testRequestorId");
161
162         requestContext.setUserParams(new HashMap<>());
163
164         Map<String, Object> dataMap = new HashMap<>();
165         dataMap.put("vpnId", "testVpnId");
166         dataMap.put("vpnRegion", "testVpnRegion");
167         dataMap.put("vpnRt", "testVpnRt");
168         dataMap.put("vpnName", "vpnName");
169         dataMap.put("vpnRegion", Arrays.asList(new String[] {"USA", "EMEA", "APAC"}));
170
171         HashMap<String, Object> userParams = new HashMap<>();
172         userParams.put("vpnData", dataMap);
173
174         List<Map<String, Object>> userParamsList = new ArrayList<>();
175         userParamsList.add(userParams);
176
177         RequestParameters requestParameters = new RequestParameters();
178         requestParameters.setUserParams(userParamsList);
179         requestContext.setRequestParameters(requestParameters);
180
181         return requestContext;
182     }
183
184     public RequestContext setRequestContext() {
185         RequestContext requestContext = buildRequestContext();
186
187         gBBInput.setRequestContext(requestContext);
188
189         return requestContext;
190     }
191
192     public CloudRegion buildCloudRegion() {
193         CloudRegion cloudRegion = new CloudRegion();
194         cloudRegion.setLcpCloudRegionId("testLcpCloudRegionId");
195         cloudRegion.setTenantId("testTenantId");
196         cloudRegion.setCloudOwner("testCloudOwner");
197
198         return cloudRegion;
199     }
200
201     public CloudRegion setCloudRegion() {
202         CloudRegion cloudRegion = buildCloudRegion();
203
204         gBBInput.setCloudRegion(cloudRegion);
205
206         return cloudRegion;
207     }
208
209     public OrchestrationContext buildOrchestrationContext() {
210         OrchestrationContext orchestrationContext = new OrchestrationContext();
211
212         return orchestrationContext;
213     }
214
215     public OrchestrationContext setOrchestrationContext() {
216         OrchestrationContext orchestrationContext = buildOrchestrationContext();
217
218         gBBInput.setOrchContext(orchestrationContext);
219
220         return orchestrationContext;
221     }
222
223     public Collection buildCollection() {
224         collectionCounter++;
225
226         Collection collection = new Collection();
227         collection.setId("testId" + collectionCounter);
228         collection.setInstanceGroup(buildInstanceGroup());
229
230         return collection;
231     }
232
233     public Configuration buildConfiguration() {
234         configurationCounter++;
235
236         Configuration configuration = new Configuration();
237         configuration.setConfigurationId("testConfigurationId" + configurationCounter);
238         configuration.setConfigurationName("testConfigurationName" + configurationCounter);
239
240         ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration();
241         modelInfoConfiguration.setModelVersionId("testModelVersionId" + configurationCounter);
242         modelInfoConfiguration.setModelInvariantId("testModelInvariantId" + configurationCounter);
243         modelInfoConfiguration.setModelCustomizationId("testModelCustomizationId" + configurationCounter);
244
245         configuration.setModelInfoConfiguration(modelInfoConfiguration);
246
247         return configuration;
248     }
249
250     public OwningEntity buildOwningEntity() {
251         owningEntityCounter++;
252
253         OwningEntity owningEntity = new OwningEntity();
254         owningEntity.setOwningEntityId("testOwningEntityId" + owningEntityCounter);
255         owningEntity.setOwningEntityName("testOwningEntityName" + owningEntityCounter);
256
257         return owningEntity;
258     }
259
260     public Project buildProject() {
261         projectCounter++;
262
263         Project project = new Project();
264         project.setProjectName("testProjectName" + projectCounter);
265
266         return project;
267     }
268
269     public ServiceSubscription buildServiceSubscription() {
270         serviceSubscriptionCounter++;
271
272         ServiceSubscription serviceSubscription = new ServiceSubscription();
273         serviceSubscription.setTempUbSubAccountId("testTempUbSubAccountId" + serviceSubscriptionCounter);
274         serviceSubscription.setServiceType("testServiceType" + serviceSubscriptionCounter);
275
276         return serviceSubscription;
277     }
278
279     public Customer buildCustomer() {
280         customerCounter++;
281
282         Customer customer = new Customer();
283         customer.setGlobalCustomerId("testGlobalCustomerId" + customerCounter);
284         customer.setSubscriberType("testSubscriberType" + customerCounter);
285
286         customer.setServiceSubscription(buildServiceSubscription());
287
288         return customer;
289     }
290
291     public ServiceInstance buildServiceInstance() {
292         serviceInstanceCounter++;
293
294         ServiceInstance serviceInstance = new ServiceInstance();
295         serviceInstance.setServiceInstanceId("testServiceInstanceId" + serviceInstanceCounter);
296         serviceInstance.setServiceInstanceName("testServiceInstanceName" + serviceInstanceCounter);
297
298         ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
299         modelInfoServiceInstance.setModelInvariantUuid("testModelInvariantUUID" + serviceInstanceCounter);
300         modelInfoServiceInstance.setModelUuid("testModelUUID" + serviceInstanceCounter);
301         modelInfoServiceInstance.setModelVersion("testModelVersion" + serviceInstanceCounter);
302         modelInfoServiceInstance.setModelName("testModelName" + serviceInstanceCounter);
303         modelInfoServiceInstance.setServiceType("testServiceType" + serviceInstanceCounter);
304         serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
305
306         serviceInstance.setProject(buildProject());
307
308         serviceInstance.setOwningEntity(buildOwningEntity());
309
310         serviceInstance.setCollection(buildCollection());
311
312         serviceInstance.getConfigurations().add(buildConfiguration());
313
314         return serviceInstance;
315     }
316
317     public ServiceInstance setServiceInstance() {
318         ServiceInstance serviceInstance = buildServiceInstance();
319
320         if (gBBInput.getCustomer() == null) {
321             gBBInput.setCustomer(buildCustomer());
322         }
323         gBBInput.getCustomer().getServiceSubscription().getServiceInstances().add(serviceInstance);
324         lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstance.getServiceInstanceId());
325
326         return serviceInstance;
327     }
328
329     public Customer setCustomer() {
330         if (gBBInput.getCustomer() != null)
331             return gBBInput.getCustomer();
332         Customer customer = new Customer();
333         customer.setGlobalCustomerId("testGlobalCustomerId");
334         customer.setSubscriberType("testSubscriberType");
335
336         customer.setServiceSubscription(buildServiceSubscription());
337
338         gBBInput.setCustomer(customer);
339
340         return customer;
341     }
342
343     public Collection setCollection() {
344         Collection collection = new Collection();
345         collection.setId("testId");
346
347         ServiceInstance serviceInstance = null;
348
349         try {
350             serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
351         } catch (BBObjectNotFoundException e) {
352             serviceInstance = setServiceInstance();
353         }
354
355         serviceInstance.setCollection(collection);
356
357         return collection;
358     }
359
360     public InstanceGroup setInstanceGroup() {
361         InstanceGroup instanceGroup = new InstanceGroup();
362         instanceGroup.setId("testId");
363         instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction");
364
365         Collection collection = null;
366
367         try {
368             ServiceInstance serviceInstance =
369                     extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
370             collection = serviceInstance.getCollection();
371
372             if (collection == null) {
373                 collection = setCollection();
374             }
375         } catch (BBObjectNotFoundException e) {
376             collection = setCollection();
377         }
378
379         collection.setInstanceGroup(instanceGroup);
380
381         return instanceGroup;
382     }
383
384     public VpnBinding buildVpnBinding() {
385         vpnBindingCounter++;
386
387         VpnBinding vpnBinding = new VpnBinding();
388         vpnBinding.setVpnId("testVpnId" + vpnBindingCounter);
389         vpnBinding.setVpnName("testVpnName" + vpnBindingCounter);
390         vpnBinding.setCustomerVpnId("testCustomerVpnId" + vpnBindingCounter);
391
392         return vpnBinding;
393     }
394
395     public VpnBinding setVpnBinding() {
396         VpnBinding vpnBinding = buildVpnBinding();
397
398         Customer customer = gBBInput.getCustomer();
399
400         if (customer == null) {
401             customer = buildCustomer();
402         }
403
404         customer.getVpnBindings().add(vpnBinding);
405         lookupKeyMap.put(ResourceKey.VPN_ID, vpnBinding.getVpnId());
406
407         return vpnBinding;
408     }
409
410     public InstanceGroup buildInstanceGroup() {
411         instanceGroupCounter++;
412
413         InstanceGroup instanceGroup = new InstanceGroup();
414         instanceGroup.setId("testId" + instanceGroupCounter);
415         instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction" + instanceGroupCounter);
416
417         return instanceGroup;
418     }
419
420     public L3Network buildL3Network() {
421         l3NetworkCounter++;
422
423         L3Network network = new L3Network();
424         network.setNetworkId("testNetworkId" + l3NetworkCounter);
425         network.setNetworkName("testNetworkName" + l3NetworkCounter);
426         network.setNetworkType("testNetworkType" + l3NetworkCounter);
427
428         ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork();
429         modelInfoNetwork.setModelInvariantUUID("testModelInvariantUUID" + l3NetworkCounter);
430         modelInfoNetwork.setModelName("testModelName" + l3NetworkCounter);
431         modelInfoNetwork.setModelVersion("testModelVersion" + l3NetworkCounter);
432         modelInfoNetwork.setModelUUID("testModelUUID" + l3NetworkCounter);
433         network.setModelInfoNetwork(modelInfoNetwork);
434
435         return network;
436     }
437
438     public L3Network setL3Network() {
439         L3Network network = buildL3Network();
440
441         ServiceInstance serviceInstance = null;
442
443         try {
444             serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
445         } catch (BBObjectNotFoundException e) {
446             serviceInstance = setServiceInstance();
447         }
448
449         serviceInstance.getNetworks().add(network);
450         lookupKeyMap.put(ResourceKey.NETWORK_ID, network.getNetworkId());
451
452         return network;
453     }
454
455     public GenericVnf buildGenericVnf() {
456         genericVnfCounter++;
457
458         GenericVnf genericVnf = new GenericVnf();
459         genericVnf.setVnfId("testVnfId" + genericVnfCounter);
460         genericVnf.setVnfName("testVnfName" + genericVnfCounter);
461         genericVnf.setVnfType("testVnfType" + genericVnfCounter);
462
463         Platform platform = new Platform();
464         platform.setPlatformName("testPlatformName");
465         genericVnf.setPlatform(platform);
466
467         LineOfBusiness lob = new LineOfBusiness();
468         lob.setLineOfBusinessName("testLineOfBusinessName");
469         genericVnf.setLineOfBusiness(lob);
470
471         ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
472         modelInfoGenericVnf.setModelName("testModelName" + genericVnfCounter);
473         modelInfoGenericVnf.setModelCustomizationUuid("testModelCustomizationUUID" + genericVnfCounter);
474         modelInfoGenericVnf.setModelInvariantUuid("testModelInvariantUUID" + genericVnfCounter);
475         modelInfoGenericVnf.setModelVersion("testModelVersion" + genericVnfCounter);
476         modelInfoGenericVnf.setModelUuid("testModelUUID" + genericVnfCounter);
477         modelInfoGenericVnf.setModelInstanceName("testModelInstanceName" + genericVnfCounter);
478         genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf);
479
480         return genericVnf;
481     }
482
483     public GenericVnf setGenericVnf() {
484         GenericVnf genericVnf = buildGenericVnf();
485
486         ServiceInstance serviceInstance = null;
487
488         try {
489             serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
490         } catch (BBObjectNotFoundException e) {
491             serviceInstance = setServiceInstance();
492         }
493
494         serviceInstance.getVnfs().add(genericVnf);
495         lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, genericVnf.getVnfId());
496
497         return genericVnf;
498     }
499
500     public VfModule buildVfModule() {
501         vfModuleCounter++;
502
503         VfModule vfModule = new VfModule();
504         vfModule.setVfModuleId("testVfModuleId" + vfModuleCounter);
505         vfModule.setVfModuleName("testVfModuleName" + vfModuleCounter);
506
507         ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
508         modelInfoVfModule.setModelInvariantUUID("testModelInvariantUUID" + vfModuleCounter);
509         modelInfoVfModule.setModelVersion("testModelVersion" + vfModuleCounter);
510         modelInfoVfModule.setModelUUID("testModelUUID" + vfModuleCounter);
511         modelInfoVfModule.setModelName("testModelName" + vfModuleCounter);
512         modelInfoVfModule.setModelCustomizationUUID("testModelCustomizationUUID" + vfModuleCounter);
513         vfModule.setModelInfoVfModule(modelInfoVfModule);
514
515         return vfModule;
516     }
517
518     public VfModule setVfModule() {
519         VfModule vfModule = buildVfModule();
520
521         GenericVnf genericVnf = null;
522
523         try {
524             genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
525         } catch (BBObjectNotFoundException e) {
526             genericVnf = setGenericVnf();
527         }
528
529         genericVnf.getVfModules().add(vfModule);
530         lookupKeyMap.put(ResourceKey.VF_MODULE_ID, vfModule.getVfModuleId());
531
532         return vfModule;
533     }
534
535     public VolumeGroup buildVolumeGroup() {
536         volumeGroupCounter++;
537
538         VolumeGroup volumeGroup = new VolumeGroup();
539         volumeGroup.setVolumeGroupId("testVolumeGroupId" + volumeGroupCounter);
540         volumeGroup.setVolumeGroupName("testVolumeGroupName" + volumeGroupCounter);
541         volumeGroup.setHeatStackId("testHeatStackId" + volumeGroupCounter);
542
543         return volumeGroup;
544     }
545
546     public VolumeGroup setVolumeGroup() {
547         VolumeGroup volumeGroup = buildVolumeGroup();
548
549         GenericVnf genericVnf = null;
550
551         try {
552             genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
553         } catch (BBObjectNotFoundException e) {
554             genericVnf = setGenericVnf();
555         }
556
557         genericVnf.getVolumeGroups().add(volumeGroup);
558         lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroup.getVolumeGroupId());
559
560         return volumeGroup;
561     }
562
563     public Pnf buildPnf() {
564         pnfCounter++;
565
566         Pnf pnf = new Pnf();
567         pnf.setPnfId("testPnfId" + pnfCounter);
568         pnf.setPnfName("testPnfName" + pnfCounter);
569
570         return pnf;
571     }
572
573     public ServiceProxy buildServiceProxy() {
574         serviceProxyCounter++;
575
576         ServiceProxy serviceProxy = new ServiceProxy();
577         serviceProxy.setServiceInstance(buildServiceInstance());
578         serviceProxy.getServiceInstance().getVnfs().add(buildGenericVnf());
579
580         Pnf primaryPnf = buildPnf();
581         primaryPnf.setRole("Primary");
582         serviceProxy.getServiceInstance().getPnfs().add(primaryPnf);
583
584         Pnf secondaryPnf = buildPnf();
585         secondaryPnf.setRole("Secondary");
586         serviceProxy.getServiceInstance().getPnfs().add(secondaryPnf);
587
588         return serviceProxy;
589     }
590
591     public VpnBondingLink buildVpnBondingLink() {
592         vpnBondingLinkCounter++;
593
594         VpnBondingLink vpnBondingLink = new VpnBondingLink();
595         vpnBondingLink.setVpnBondingLinkId("testVpnBondingLinkId" + vpnBondingLinkCounter);
596
597         Configuration vnrConfiguration = buildConfiguration();
598         vnrConfiguration.setNetwork(buildL3Network());
599         vpnBondingLink.setVnrConfiguration(vnrConfiguration);
600
601         vpnBondingLink.setVrfConfiguration(buildConfiguration());
602
603         vpnBondingLink.setInfrastructureServiceProxy(buildServiceProxy());
604
605         vpnBondingLink.setTransportServiceProxy(buildServiceProxy());
606
607         return vpnBondingLink;
608     }
609
610     public VpnBondingLink setVpnBondingLink() {
611         VpnBondingLink vpnBondingLink = buildVpnBondingLink();
612
613         ServiceInstance serviceInstance = null;
614
615         try {
616             serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
617         } catch (BBObjectNotFoundException e) {
618             serviceInstance = setServiceInstance();
619         }
620
621         serviceInstance.getVpnBondingLinks().add(vpnBondingLink);
622         lookupKeyMap.put(ResourceKey.VPN_BONDING_LINK_ID, vpnBondingLink.getVpnBondingLinkId());
623
624
625         return vpnBondingLink;
626     }
627
628     public Customer setAvpnCustomer() {
629         Customer customer = buildCustomer();
630
631         gBBInput.setCustomer(customer);
632
633         return customer;
634     }
635
636     public ServiceProxy setServiceProxy(String uniqueIdentifier, String type) {
637         ServiceProxy serviceProxy = new ServiceProxy();
638         serviceProxy.setId("testProxyId" + uniqueIdentifier);
639         serviceProxy.setType(type);
640
641         ModelInfoServiceProxy modelInfo = new ModelInfoServiceProxy();
642         modelInfo.setModelInvariantUuid("testProxyModelInvariantUuid" + uniqueIdentifier);
643         modelInfo.setModelName("testProxyModelName" + uniqueIdentifier);
644         modelInfo.setModelUuid("testProxyModelUuid" + uniqueIdentifier);
645         modelInfo.setModelVersion("testProxyModelVersion" + uniqueIdentifier);
646         modelInfo.setModelInstanceName("testProxyModelInstanceName" + uniqueIdentifier);
647
648         serviceProxy.setModelInfoServiceProxy(modelInfo);
649
650         return serviceProxy;
651     }
652
653     public AllottedResource setAllottedResource(String uniqueIdentifier) {
654         AllottedResource ar = new AllottedResource();
655         ar.setId("testAllottedResourceId" + uniqueIdentifier);
656
657         ModelInfoAllottedResource modelInfo = new ModelInfoAllottedResource();
658         modelInfo.setModelInvariantUuid("testAllottedModelInvariantUuid" + uniqueIdentifier);
659         modelInfo.setModelName("testAllottedModelName" + uniqueIdentifier);
660         modelInfo.setModelUuid("testAllottedModelUuid" + uniqueIdentifier);
661         modelInfo.setModelVersion("testAllottedModelVersion" + uniqueIdentifier);
662         modelInfo.setModelInstanceName("testAllottedModelInstanceName" + uniqueIdentifier);
663
664         ar.setModelInfoAllottedResource(modelInfo);
665
666         return ar;
667     }
668 }