a58522ac8baea52531db8104fa715a6f07438e77
[appc.git] / appc-outbound / appc-aai-client / provider / src / test / java / org / openecomp / appc / aai / client / aai / MockAaiService.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP : APPC
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Copyright (C) 2017 Amdocs
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  * 
21  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22  * ============LICENSE_END=========================================================
23  */
24
25 package org.openecomp.appc.aai.client.aai;
26 import static org.junit.Assert.assertEquals;
27
28 import static org.junit.Assert.fail;
29
30
31 import java.util.HashMap;
32 import java.util.Map;
33
34 import org.apache.commons.lang3.StringUtils;
35
36 import com.att.eelf.configuration.EELFLogger;
37 import com.att.eelf.configuration.EELFManager;
38 import org.openecomp.sdnc.sli.SvcLogicContext;
39 import org.openecomp.sdnc.sli.SvcLogicResource;
40 import org.openecomp.sdnc.sli.aai.AAIClient;
41
42 public class MockAaiService extends AaiService {
43     
44     //ONAP migration
45     
46     private static final EELFLogger log = EELFManager.getInstance().getLogger(MockAaiService.class);
47          private AAIClient aaiClient;
48          
49          public MockAaiService(AAIClient aaic) {
50              super(aaic);
51          }
52          
53          
54          /*public MockAaiService() {
55               super(new AAIClientMock());
56          }*/
57          
58          public SvcLogicContext readResource(String query, String prefix, String resourceType) throws Exception {
59              log.info("In MockRead Resource");   
60              SvcLogicContext resourceContext = new SvcLogicContext();
61                
62                 //prefix = StringUtils.isNotBlank(prefix) ? (prefix+".") : "";
63                 if ( "generic-vnf".equals(resourceType) ) {
64                     populateGenericVnfContext(resourceContext, prefix);
65                 }
66                 else if("vserver".equals(resourceType) ) {
67                     populateVmContext(resourceContext, prefix);
68                 }
69                 else if("vnfc".equals(resourceType) ) {
70                     populateVnfcContext(resourceContext, prefix);
71                 }
72               
73                
74                 return resourceContext;
75                 
76                 
77                 
78          }
79          
80          public void addVnfc(String vnfcName, Map<String, String> params, String prefix) throws Exception  {
81              
82              
83              if ( vnfcName.startsWith("ibcx")) {
84                 assertEquals("ibcxvm0002func0001", vnfcName);
85                  
86                  
87                  log.info("In AddVnfc " + vnfcName);
88                  Map<String, String> expectedParams  = getExpectedParams();
89                  
90                  
91                 /*    for (Map.Entry<String, String> entry : params.entrySet()) {
92                             String key = entry.getKey();
93                             String value = entry.getValue();
94         
95         
96                            log.info("key= " + key + "value = " + value );
97                          
98                     }*/
99                  assertEquals(params, expectedParams);
100              }
101          }
102         
103          
104          public void updateResource( String resource, String resourceKey,  Map<String, String> params)  throws Exception {
105                 
106                  Map<String, String> expectedParams = new HashMap<String, String>();
107              
108                 
109                 expectedParams.put("prov-status", "NVTPROV"); 
110                 assertEquals(params, expectedParams);
111                 
112                 if ( "vserver".equals(resource))  {
113                     
114                     String key  = "vserver.vserver-id = 'ibcx00000'" +
115                             " AND tenant.tenant-id = 'tenantId'" + 
116                             " AND cloud-region.cloud-owner = 'cloudOwner'" + 
117                             " AND cloud-region.cloud-region-id = 'cloudRegionId'";
118                     
119                     assertEquals(key, resourceKey);
120                 }
121                 else if ( "generic-vnf".equals(resource))  {
122                     assertEquals(resourceKey, "generic-vnf.vnf-id = 'ibcx000000'");
123                 }
124                 else
125                     fail("Invalid resource " + resource);
126                 
127             
128             
129             
130             } 
131          
132         public Map<String, String> getExpectedParams() throws Exception {
133             Map<String, String> vnfcParams = new HashMap<String, String>();
134              
135             vnfcParams.put("vnfc-function-code", "func0");
136             
137             
138             
139             vnfcParams.put("vnfc-type", "ssc0");
140             
141             vnfcParams.put("ipaddress-v4-oam-vip", "000.00.00.00");
142             
143             vnfcParams.put("prov-status", "NVTPROV");
144             vnfcParams.put("orchestration-status", "CONFIGURED");
145             vnfcParams.put("in-maint", "false");
146             vnfcParams.put("is-closed-loop", "false");
147             vnfcParams.put("group-notation","2");
148             
149             
150             vnfcParams.put("relationship-list.relationship[0].related-to","vserver");
151             vnfcParams.put("relationship-list.relationship[0].relationship-data[0].relationship-key","vserver.vserver-id");
152             vnfcParams.put("relationship-list.relationship[0].relationship-data[0].relationship-value","ibcx00000");
153             
154             
155             vnfcParams.put("relationship-list.relationship[0].relationship-data[1].relationship-key","tenant.tenant-id");
156             vnfcParams.put("relationship-list.relationship[0].relationship-data[1].relationship-value","tenantId");
157             
158             
159             vnfcParams.put("relationship-list.relationship[0].relationship-data[2].relationship-key","cloud-region.cloud-owner");
160             vnfcParams.put("relationship-list.relationship[0].relationship-data[2].relationship-value","cloudOwner");
161             
162             
163             vnfcParams.put("relationship-list.relationship[0].relationship-data[3].relationship-key","cloud-region.cloud-region-id");
164             vnfcParams.put("relationship-list.relationship[0].relationship-data[3].relationship-value","cloudRegionId");
165             
166             
167             vnfcParams.put("relationship-list.relationship[1].related-to","generic-vnf");
168             vnfcParams.put("relationship-list.relationship[1].relationship-data[0].relationship-key","generic-vnf.vnf-id");
169             vnfcParams.put("relationship-list.relationship[1].relationship-data[0].relationship-value","ibcx000000");
170             
171             
172             vnfcParams.put("relationship-list.relationship[2].related-to","vf-module");
173             vnfcParams.put("relationship-list.relationship[2].relationship-data[0].relationship-key","generic-vnf.vnf-id");
174             vnfcParams.put("relationship-list.relationship[2].relationship-data[0].relationship-value","ibcx000000");
175             
176             
177             vnfcParams.put("relationship-list.relationship[2].relationship-data[1].relationship-key","vf-module.vf-module-id");
178             vnfcParams.put("relationship-list.relationship[2].relationship-data[1].relationship-value","vfModuleId");
179         
180             return vnfcParams;
181         }
182         public void populateVnfcContext(SvcLogicContext ctx, String prefix) {
183              log.info("In populateVnfcContext " + prefix);
184              
185              ctx.setAttribute(prefix + ".vnfc-type", "vnfctype1");
186              ctx.setAttribute(prefix + ".vnfc-function-code", "funccode1");
187              ctx.setAttribute(prefix + ".group-notation", "grpnot1");
188         }
189          
190         public void populateVmContext(SvcLogicContext ctx, String prefix) {
191             log.info("In populateVmContext " + prefix);
192              
193             ctx.setAttribute(prefix + ".vserver-name", "ibcx0000000");
194             
195             
196             ctx.setAttribute(prefix + ".relationship-list.relationship_length", "3");
197                  
198                  // Junk
199             ctx.setAttribute(prefix + ".relationship-list.relationship[0].related-to", "test");
200             ctx.setAttribute(prefix + ".relationship-list.relationship[0].relationship-data_length", "1");
201             ctx.setAttribute(prefix + ".relationship-list.relationship[0].relationship-data[0].relationship-key", "vnfc.vnfc-name");
202             ctx.setAttribute(prefix + ".relationship-list.relationship[0].relationship-data[0].relationship-value", "test");
203                  
204                  
205                  
206              // VNFC
207              ctx.setAttribute(prefix + ".relationship-list.relationship[1].related-to", "vnfc");
208              ctx.setAttribute(prefix + ".relationship-list.relationship[1].relationship-data_length", "1");
209              ctx.setAttribute(prefix + ".relationship-list.relationship[1].relationship-data[0].relationship-key", "vnfc.vnfc-name");
210              ctx.setAttribute(prefix + ".relationship-list.relationship[1].relationship-data[0].relationship-value", "ibcx0001vm001vnfc1");
211                  
212                  
213              // VFModule
214                  
215              ctx.setAttribute(prefix + ".relationship-list.relationship[2].related-to", "vf-module");
216              ctx.setAttribute(prefix + ".relationship-list.relationship[2].relationship-data_length", "1");
217              ctx.setAttribute(prefix + ".relationship-list.relationship[2].relationship-data[0].relationship-key", "vf-module.vf-module-id");
218              ctx.setAttribute(prefix + ".relationship-list.relationship[2].relationship-data[0].relationship-value", "vfModule1");
219                  
220                  
221         }
222
223         public void populateGenericVnfContext(SvcLogicContext ctx, String prefix)  throws Exception {
224             
225              log.info("In populateGenericVnf " + prefix);
226              ctx.setAttribute(prefix + ".vnf-name", "ibvcx0001");
227              ctx.setAttribute(prefix + ".vnf-type", "vUSP-Metaswitch");
228              
229              ctx.setAttribute(prefix + ".relationship-list.relationship_length", "3");
230              
231             /* // VM1
232              ctx.setAttribute(prefix + ".relationship-list.relationship[0].related-to", "vserver");
233              ctx.setAttribute(prefix + ".relationship-list.relationship[0].relationship-data_length", "4");
234              ctx.setAttribute(prefix + ".relationship-list.relationship[0].relationship-data[0].relationship-key", "vserver.vserver-id");
235              ctx.setAttribute(prefix + ".relationship-list.relationship[0].relationship-data[0].relationship-value", "ibcx001vm001-id");
236              ctx.setAttribute(prefix + ".relationship-list.relationship[0].relationship-data[1].relationship-key", "tenant.tenant-id");
237              ctx.setAttribute(prefix + ".relationship-list.relationship[0].relationship-data[1].relationship-value", "sometenant");
238              ctx.setAttribute(prefix + ".relationship-list.relationship[0].relationship-data[2].relationship-key", "cloud-region.cloud-owner");
239              ctx.setAttribute(prefix + ".relationship-list.relationship[0].relationship-data[2].relationship-value", "ATTAIC");
240              ctx.setAttribute(prefix + ".relationship-list.relationship[0].relationship-data[3].relationship-key", "cloud-region.cloud-region-id");
241              ctx.setAttribute(prefix + ".relationship-list.relationship[0].relationship-data[3].relationship-value", "testcloudregionid");
242            
243              
244              //ctx.setAttribute(prefix + ".relationship-list.relationship_length", "3");
245 */             
246              // VM1
247              ctx.setAttribute(prefix + ".relationship-list.relationship[0].related-to", "vserver");
248              ctx.setAttribute(prefix + ".relationship-list.relationship[0].relationship-data_length", "4");
249              ctx.setAttribute(prefix + ".relationship-list.relationship[0].relationship-data[0].relationship-key", "vserver.vserver-id");
250              ctx.setAttribute(prefix + ".relationship-list.relationship[0].relationship-data[0].relationship-value", "ibcx001vm001-id");
251              ctx.setAttribute(prefix + ".relationship-list.relationship[0].relationship-data[1].relationship-key", "tenant.tenant-id");
252              ctx.setAttribute(prefix + ".relationship-list.relationship[0].relationship-data[1].relationship-value", "sometenant");
253              ctx.setAttribute(prefix + ".relationship-list.relationship[0].relationship-data[2].relationship-key", "cloud-region.cloud-owner");
254              ctx.setAttribute(prefix + ".relationship-list.relationship[0].relationship-data[2].relationship-value", "ATTAIC");
255              ctx.setAttribute(prefix + ".relationship-list.relationship[0].relationship-data[3].relationship-key", "cloud-region.cloud-region-id");
256              ctx.setAttribute(prefix + ".relationship-list.relationship[0].relationship-data[3].relationship-value", "testcloudregionid");
257              
258              
259              // VM2
260              ctx.setAttribute(prefix + ".relationship-list.relationship[1].related-to", "vserver");
261              ctx.setAttribute(prefix + ".relationship-list.relationship[1].relationship-data_length", "4");
262              ctx.setAttribute(prefix + ".relationship-list.relationship[1].relationship-data[0].relationship-key", "vserver.vserver-id");
263              ctx.setAttribute(prefix + ".relationship-list.relationship[1].relationship-data[0].relationship-value", "ibcx000000");
264              
265                 
266              ctx.setAttribute(prefix + ".relationship-list.relationship[1].relationship-data[1].relationship-key", "tenant.tenant-id");
267              ctx.setAttribute(prefix + ".relationship-list.relationship[1].relationship-data[1].relationship-value", "sometenant");
268              
269              ctx.setAttribute(prefix + ".relationship-list.relationship[1].relationship-data[2].relationship-key", "cloud-region.cloud-owner");
270              ctx.setAttribute(prefix + ".relationship-list.relationship[0].relationship-data[2].relationship-value", "ATTAIC");
271              
272              ctx.setAttribute(prefix + ".relationship-list.relationship[1].relationship-data[3].relationship-key", "cloud-region.cloud-region-id");
273              ctx.setAttribute(prefix + ".relationship-list.relationship[1].relationship-data[3].relationship-value", "testcloudregionid");
274              
275              
276              // Unrelated 
277              ctx.setAttribute(prefix + ".relationship-list.relationship[2].related-to", "junk");
278              
279              ctx.setAttribute(prefix + ".relationship-list.relationship[2].relationship-data_length", "4");
280              
281              
282              ctx.setAttribute(prefix + ".relationship-list.relationship[2].relationship-data[0].relationship-key", "test");
283              ctx.setAttribute(prefix + ".relationship-list.relationship[2].relationship-data[0].relationship-value", "ibcx000000");
284              
285                 
286              ctx.setAttribute(prefix + ".relationship-list.relationship[2].relationship-data[1].relationship-key", "test1");
287              ctx.setAttribute(prefix + ".relationship-list.relationship[2].relationship-data[1].relationship-value", "sometenant");
288              
289              ctx.setAttribute(prefix + ".relationship-list.relationship[2].relationship-data[2].relationship-key", "test2");
290              ctx.setAttribute(prefix + ".relationship-list.relationship[2].relationship-data[2].relationship-value", "ATTAIC");
291              
292              ctx.setAttribute(prefix + ".relationship-list.relationship[2].relationship-data[3].relationship-key", "test3");
293              ctx.setAttribute(prefix + ".relationship-list.relationship[2].relationship-data[3].relationship-value", "testcloudregionid");
294          }
295     
296          
297          
298          public void populateFirstVnfcData(SvcLogicContext ctx, String prefix) throws Exception {
299              
300                     
301                     
302              ctx.setAttribute(prefix + "vnf.vm-count", "4");
303              
304              ctx.setAttribute(prefix+ "vm[0].vnfc-type", "mmc");
305              ctx.setAttribute(prefix+ "vm[0].vnfc-name", "vnfcname1");
306              
307              ctx.setAttribute(prefix+ "vm[1].vnfc-type", "mmc");
308              ctx.setAttribute(prefix+ "vm[1].vnfc-name", "vnfcname2");
309              
310              ctx.setAttribute(prefix+ "vm[2].vnfc-type", "ssc");
311              ctx.setAttribute(prefix+ "vm[2].vnfc-name", "vnfcname3");
312              
313              ctx.setAttribute(prefix+ "vm[3].vnfc-type", "ssc");
314              ctx.setAttribute(prefix+ "vm[3].vnfc-name", "vnfcname4");
315          }
316          
317          
318          
319          public void populateGroupNotation(SvcLogicContext ctx, String prefix) throws Exception {
320              
321                 
322                 
323              ctx.setAttribute(prefix + "vnf.vm-count", "5");
324              
325              ctx.setAttribute(prefix+ "vm[0].vserver-name", "ibcxvm0001");
326              ctx.setAttribute(prefix+ "vm[0].group-notation", "grpNot1");
327              
328              ctx.setAttribute(prefix+ "vm[1].vserver-name", "ibcxvm0002");
329              ctx.setAttribute(prefix+ "vm[1].group-notation", "grpNot2");
330              
331             
332              ctx.setAttribute(prefix+ "vm[2].vserver-name", "ibcxvm0003");
333              ctx.setAttribute(prefix+ "vm[2].group-notation", "grpNot3");
334              
335              ctx.setAttribute(prefix+ "vm[3].vserver-name", "ibcxvm0004");
336              ctx.setAttribute(prefix+ "vm[3].group-notation", "4");
337              
338              ctx.setAttribute(prefix+ "vm[4].vserver-name", "ibcxvm0005");
339              ctx.setAttribute(prefix+ "vm[4].group-notation", "4");
340          }
341          
342          
343          public void populateVnfcRef(SvcLogicContext ctx) throws Exception {
344              
345              for (int i = 0; i < 2; i++ ) {
346              
347                  String vnfcRefKey = "vnfcReference[" + i+ "].";
348                 
349                 
350                 
351                 ctx.setAttribute(vnfcRefKey+ "VM-INSTANCE", String.valueOf(i));
352                 ctx.setAttribute(vnfcRefKey+ "VNFC-INSTANCE", "1");
353                 
354                 
355                 //if ( i == 0 || i == 1 ) {
356                     ctx.setAttribute(vnfcRefKey+ "GROUP-NOTATION-TYPE", "fixed-value");
357                     ctx.setAttribute(vnfcRefKey+ "GROUP-NOTATION-VALUE", "2");
358                 //}
359                 
360                 ctx.setAttribute(vnfcRefKey+ "VNFC-TYPE", "ssc"+i );
361                 
362                 ctx.setAttribute(vnfcRefKey+ "VNFC-FUNCTION-CODE", "func" +i);
363                 
364                 ctx.setAttribute(vnfcRefKey+ "IPADDRESS-V4-OAM-VIP", "Y");
365              }
366              
367          }
368              
369          public void populateAllVnfInfo(SvcLogicContext ctx, String prefix) throws Exception {
370              
371              ctx.setAttribute("vnf-id", "ibcx000000");
372                      
373              ctx.setAttribute("vnf-host-ip-address", "000.00.00.00");
374              ctx.setAttribute(prefix + ".vnf.vm-count", "2");
375              
376              
377              
378              
379              ctx.setAttribute(prefix+ ".vm[0].vserver-name", "ibcxvm0000");
380              ctx.setAttribute(prefix+ ".vm[0].vnfc-name", "VNFCNAME");
381              
382              ctx.setAttribute(prefix+ ".vm[0].vserver-id", "ibcxvm0001id");
383              ctx.setAttribute(prefix+ ".vm[0].tenant-id", "tenantid");
384              ctx.setAttribute(prefix+ ".vm[0].cloud-owner", "cloudOwner");
385              ctx.setAttribute(prefix+ ".vm[0].cloud-region-id", "cloudRegionId");
386              
387              ctx.setAttribute(prefix+ ".vm[0].vf-module-id", "vfModuleId");
388              
389              
390              
391              ctx.setAttribute(prefix+ ".vm[1].vserver-name", "ibcxvm0002");
392              
393              ctx.setAttribute(prefix+ ".vm[1].vserver-id", "ibcx00000");
394              ctx.setAttribute(prefix+ ".vm[1].tenant-id", "tenantId");
395              ctx.setAttribute(prefix+ ".vm[1].cloud-owner", "cloudOwner");
396              ctx.setAttribute(prefix+ ".vm[1].cloud-region-id", "cloudRegionId");
397              
398              ctx.setAttribute(prefix+ ".vm[1].vf-module-id", "vfModuleId");
399              
400             
401              //ctx.setAttribute(prefix+ ".vm[1].vserver-name", "ibcxvm0002");
402                                   
403             
404             
405              
406          }
407          
408          
409          
410          public void populateAllVnfInfo1(SvcLogicContext ctx, String prefix) throws Exception {
411              
412              ctx.setAttribute("vnf-id", "dbjx0001v");
413                      
414              ctx.setAttribute("vnf-host-ip-address", "000.00.00.00");
415              ctx.setAttribute(prefix + ".vnf.vm-count", "2");
416              
417              
418              
419              
420              ctx.setAttribute(prefix+ ".vm[0].vserver-name", "dbjx0001vm001");
421             
422              
423              ctx.setAttribute(prefix+ ".vm[0].vserver-id", "dbjx0001vm0001id");
424              ctx.setAttribute(prefix+ ".vm[0].tenant-id", "tenantid1");
425              ctx.setAttribute(prefix+ ".vm[0].cloud-owner", "cloudOwner1");
426              ctx.setAttribute(prefix+ ".vm[0].cloud-region-id", "cloudRegionId1");
427              
428              ctx.setAttribute(prefix+ ".vm[0].vf-module-id", "vfModuleId1");
429              
430              
431              
432              ctx.setAttribute(prefix+ ".vm[1].vserver-name", "dbjx0001vm002");
433              
434              ctx.setAttribute(prefix+ ".vm[1].vserver-id", "dbjx0001vm0002id");
435              ctx.setAttribute(prefix+ ".vm[1].tenant-id", "tenantId2");
436              ctx.setAttribute(prefix+ ".vm[1].cloud-owner", "cloudOwner2");
437              ctx.setAttribute(prefix+ ".vm[1].cloud-region-id", "cloudRegionId2");
438              
439              ctx.setAttribute(prefix+ ".vm[1].vf-module-id", "vfModuleId2");
440              
441             
442              
443          }
444          
445          public void populateVnfcRefFirstVnfcName(SvcLogicContext ctx) throws Exception {
446              
447             
448              for (int i = 0; i < 2; i++ ) {
449              
450                  String vnfcRefKey = "vnfcReference[" + i+ "].";
451                 
452                 
453                 
454                 ctx.setAttribute(vnfcRefKey+ "VM-INSTANCE", String.valueOf(i));
455                 ctx.setAttribute(vnfcRefKey+ "VNFC-INSTANCE", "1");
456                 
457                 
458                 
459                 ctx.setAttribute(vnfcRefKey+ "GROUP-NOTATION-TYPE", "first-vnfc-name");
460                 ctx.setAttribute(vnfcRefKey+ "GROUP-NOTATION-VALUE", "pair");
461                 
462                 
463                 ctx.setAttribute(vnfcRefKey+ "VNFC-TYPE", "vDBE-I? - DBJX" );
464                 
465                 ctx.setAttribute(vnfcRefKey+ "VNFC-FUNCTION-CODE", "dbj");
466                 
467                 ctx.setAttribute(vnfcRefKey+ "IPADDRESS-V4-OAM-VIP", "Y");
468              }
469              
470          }
471          
472          public void populateVnfcRefRelValueSame(SvcLogicContext ctx) throws Exception {
473              
474                 
475              for (int i = 0; i < 2; i++ ) {
476              
477                  String vnfcRefKey = "vnfcReference[" + i+ "].";
478                 
479                 
480                 
481                 ctx.setAttribute(vnfcRefKey+ "VM-INSTANCE", String.valueOf(i));
482                 ctx.setAttribute(vnfcRefKey+ "VNFC-INSTANCE", "1");
483                 
484                 
485                 
486                 if ( i == 0 ) {
487                     ctx.setAttribute(vnfcRefKey+ "GROUP-NOTATION-TYPE", "fixed-value");
488                     ctx.setAttribute(vnfcRefKey+ "GROUP-NOTATION-VALUE", "1");
489                 }
490                 else {
491                     ctx.setAttribute(vnfcRefKey+ "GROUP-NOTATION-TYPE", "relative-value");
492                     ctx.setAttribute(vnfcRefKey+ "GROUP-NOTATION-VALUE", "same");
493                 }
494                 
495                     
496                 
497                 ctx.setAttribute(vnfcRefKey+ "VNFC-TYPE", "v-I? - DBJX" );
498                 
499                 ctx.setAttribute(vnfcRefKey+ "VNFC-FUNCTION-CODE", "dbj");
500                 
501                 ctx.setAttribute(vnfcRefKey+ "IPADDRESS-V4-OAM-VIP", "Y");
502              }
503              
504          }
505          
506          
507          public void populateVnfcRefRelValueNext(SvcLogicContext ctx) throws Exception {
508              
509                 
510              for (int i = 0; i < 2; i++ ) {
511              
512                  String vnfcRefKey = "vnfcReference[" + i+ "].";
513                 
514                 
515                 
516                 ctx.setAttribute(vnfcRefKey+ "VM-INSTANCE", String.valueOf(i));
517                 ctx.setAttribute(vnfcRefKey+ "VNFC-INSTANCE", "1");
518                 
519                 
520                 
521                 if ( i == 0 ) {
522                     ctx.setAttribute(vnfcRefKey+ "GROUP-NOTATION-TYPE", "fixed-value");
523                     ctx.setAttribute(vnfcRefKey+ "GROUP-NOTATION-VALUE", "1");
524                 }
525                 else {
526                     ctx.setAttribute(vnfcRefKey+ "GROUP-NOTATION-TYPE", "relative-value");
527                     ctx.setAttribute(vnfcRefKey+ "GROUP-NOTATION-VALUE", "next");
528                 }
529                 
530                     
531                 
532                 ctx.setAttribute(vnfcRefKey+ "VNFC-TYPE", "v-I? - DBJX" );
533                 
534                 ctx.setAttribute(vnfcRefKey+ "VNFC-FUNCTION-CODE", "dbj");
535                 
536                 ctx.setAttribute(vnfcRefKey+ "IPADDRESS-V4-OAM-VIP", "Y");
537              }
538              
539          }
540
541 }