1 package jtest.org.onap.ccsdk.sli.adaptors.ra;
3 import java.util.ArrayList;
4 import java.util.HashMap;
7 import org.junit.Assert;
8 import org.junit.FixMethodOrder;
10 import org.junit.runner.RunWith;
11 import org.junit.runners.MethodSorters;
12 import org.onap.ccsdk.sli.adaptors.ra.ResourceAllocator;
13 import org.onap.ccsdk.sli.adaptors.ra.comp.ResourceEntity;
14 import org.onap.ccsdk.sli.adaptors.ra.comp.ResourceRequest;
15 import org.onap.ccsdk.sli.adaptors.ra.comp.ResourceResponse;
16 import org.onap.ccsdk.sli.adaptors.ra.comp.ResourceTarget;
17 import org.onap.ccsdk.sli.adaptors.rm.data.AllocationStatus;
18 import org.onap.ccsdk.sli.adaptors.util.str.StrUtil;
19 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
20 import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus;
21 import org.slf4j.Logger;
22 import org.slf4j.LoggerFactory;
23 import org.springframework.beans.factory.annotation.Autowired;
24 import org.springframework.jdbc.core.JdbcTemplate;
25 import org.springframework.test.context.ContextConfiguration;
26 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
27 import jtest.util.org.onap.ccsdk.sli.adaptors.ra.TestTable;
29 @RunWith(SpringJUnit4ClassRunner.class)
30 @ContextConfiguration(locations = {"classpath:test-context.xml"})
31 @FixMethodOrder(MethodSorters.NAME_ASCENDING)
32 public class TestReserve {
34 private static final Logger log = LoggerFactory.getLogger(TestReserve.class);
36 private JdbcTemplate jdbcTemplate;
38 private static final String[] RESOURCE_COLUMNS = {"asset_id", "resource_name", "resource_type", "lt_used"};
40 private static final String[] ALLOCATION_ITEM_COLUMNS = {"resource_id", "application_id", "resource_set_id",
41 "resource_union_id", "resource_share_group_list", "lt_used", "allocation_time"};
45 public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
46 this.jdbcTemplate = jdbcTemplate;
49 @Autowired(required = true)
50 private ResourceAllocator resourceAllocator;
53 * @Autowired(required = true) private ResourceAllocatorApi resourceAllocatorApi;
56 @Autowired(required = true)
57 private DataSetup dataSetup;
60 public void test001() throws Exception {
62 log.info("============== reserve " + t + " ================================");
63 log.info("=== Test successful response - new start - all resources available");
65 // String service1 = "reserve" + t + "/service1";
69 TestTable resource = new TestTable(jdbcTemplate, "RESOURCE", "resource_id", RESOURCE_COLUMNS);
70 TestTable allocationItem =
71 new TestTable(jdbcTemplate, "ALLOCATION_ITEM", "allocation_item_id", ALLOCATION_ITEM_COLUMNS);
74 SvcLogicContext ctx = new SvcLogicContext();
75 ctx.setAttribute("ra-input.service-model", "ADIG");
76 ctx.setAttribute("ra-input.check-only", "false");
77 ctx.setAttribute("ra-input.reservation-entity-type", "SI");
78 ctx.setAttribute("ra-input.reservation-entity-id", "ICOREPVCID-123456");
79 ctx.setAttribute("ra-input.reservation-entity-data.service-speed", "100");
80 ctx.setAttribute("ra-input.reservation-entity-data.service-speed-unit", "Mbps");
82 ctx.setAttribute("ra-input.reservation-target-data.vnf-type", "VPE");
83 ctx.setAttribute("ra-input.reservation-target-data.vpe-name", "mdt300vpe54");
84 ctx.setAttribute("ra-input.reservation-target-id", "mdt300vpe54");
85 ctx.setAttribute("ra-input.reservation-target-type", "VNF");
87 ctx.setAttribute("ra-input.reservation-target-data.max-vpe-bandwidth-mbps", "5000");
90 QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx);
92 Assert.assertTrue(st == QueryStatus.SUCCESS);
95 allocationItem.print();
97 ctx.setAttribute("ra-input.service-model", "ADIG");
98 ctx.setAttribute("ra-input.check-only", "false");
99 ctx.setAttribute("ra-input.reservation-entity-type", "SI");
100 ctx.setAttribute("ra-input.reservation-entity-id", "ICOREPVCID-123456");
101 ctx.setAttribute("ra-input.reservation-entity-data.service-speed", "100");
102 ctx.setAttribute("ra-input.reservation-entity-data.service-speed-unit", "Mbps");
104 ctx.setAttribute("ra-input.reservation-target-data.service-speed", "100");
105 ctx.setAttribute("ra-input.reservation-target-data.service-speed-unit", "Mbps");
106 ctx.setAttribute("ra-input.reservation-target-id", "ICORESITEID-123456");
107 ctx.setAttribute("ra-input.reservation-target-type", "Port");
110 st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx);
112 Assert.assertTrue(st == QueryStatus.SUCCESS);
114 ctx.setAttribute("ra-input.service-model", "ADIG");
115 ctx.setAttribute("ra-input.check-only", "false");
116 ctx.setAttribute("ra-input.reservation-entity-type", "SI");
117 ctx.setAttribute("ra-input.reservation-entity-id", "ICOREPVCID-123456");
118 ctx.setAttribute("ra-input.reservation-entity-data.service-speed", "100");
119 ctx.setAttribute("ra-input.reservation-entity-data.service-speed-unit", "Mbps");
121 ctx.setAttribute("ra-input.reservation-target-data.vnf-type", "VPE");
122 ctx.setAttribute("ra-input.reservation-target-data.vpe-name", "mdt300vpe54");
123 ctx.setAttribute("ra-input.reservation-target-id", "mdt300vpe54");
124 ctx.setAttribute("ra-input.reservation-target-type", "AffinityLink");
127 st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx);
129 Assert.assertTrue(st == QueryStatus.SUCCESS);
132 allocationItem.print();
135 /* Query Using ReservationEntityId using ServiceLogicContext */
136 ctx = new SvcLogicContext();
137 ctx.setAttribute("ra-input.service-model", "ADIG");
138 ctx.setAttribute("ra-input.reservation-entity-id", "ICOREPVCID-123456");
139 ctx.setAttribute("ra-input.reservation-entity-type", "SI");
142 st = resourceAllocator.query("NetworkCapacity", false, null, null, null, null, ctx);
143 Assert.assertTrue(st == QueryStatus.SUCCESS);
146 /* Query Using ReservationTargetId using ServiceLogicContext */
147 ctx = new SvcLogicContext();
148 ctx.setAttribute("ra-input.service-model", "ADIG");
149 ctx.setAttribute("ra-input.reservation-target-id", "ICORESITEID-123456");
150 ctx.setAttribute("ra-input.reservation-target-type", "Port");
151 ctx.setAttribute("ra-input.resource-name", "Bandwidth");
153 st = resourceAllocator.query("NetworkCapacity", false, null, null, null, null, ctx);
154 Assert.assertTrue(st == QueryStatus.SUCCESS);
156 log.info("======================== Query Using ResourceEntity==============================");
157 /* Query Using ResourceEntity bean */
158 ResourceEntity sd = new ResourceEntity();
159 sd.resourceEntityId = "ICOREPVCID-123456";
160 sd.resourceEntityType = "SI";
163 ResourceRequest rr = new ResourceRequest();
164 rr.serviceModel = "ADIG";
165 rr.resourceName = "cust-vlan-id";
166 rr.requestType = "New";
167 rr.rangeMaxOverride = -1;
168 rr.rangeMinOverride = -1;
170 List<ResourceResponse> rsList = new ArrayList<>();
171 resourceAllocator.query(sd, null, null, rsList);
173 rsList.forEach(r -> {
174 StrUtil.info(log, r);
177 log.info("======================== release Using ResourceEntity==============================");
178 rsList = new ArrayList<>();
179 AllocationStatus status = resourceAllocator.release(sd);
180 Assert.assertTrue(status == AllocationStatus.Success);
183 log.info("======================== Query Using ResourceEntity==============================");
184 rsList = new ArrayList<>();
185 resourceAllocator.query(sd, null, null, rsList);
188 rsList.forEach(r -> {
189 StrUtil.info(log, r);
195 public void test002() throws Exception {
197 log.info("============== reserve " + t + " ================================");
198 log.info("=== Test successful response - new start - all resources available");
200 Map<String, String> data = new HashMap<>();
201 data.put("service-speed", "100");
202 data.put("service-speed-unit", "Mbps");
204 ResourceEntity sd = new ResourceEntity();
205 sd.resourceEntityId = "ICOREPVCID-123456";
206 sd.resourceEntityType = "SI";
209 data = new HashMap<>();
210 data.put("vnf-type", "VPE");
211 data.put("vpe-name", "mdt300vpe54");
212 data.put("max-vpe-bandwidth-mbps", "5000");
214 ResourceTarget rt = new ResourceTarget();
215 rt.resourceTargetId = "mdt300vpe54";
216 rt.resourceTargetType = "VNF";
219 ResourceRequest rr = new ResourceRequest();
220 rr.serviceModel = "ADIG";
221 // rr.resourceName = "cust-vlan-id";
222 rr.requestType = "New";
223 rr.rangeMaxOverride = -1;
224 rr.rangeMinOverride = -1;
226 List<ResourceResponse> rsList = new ArrayList<>();
228 resourceAllocator.reserve(sd, rt, rr, rsList);
230 rsList.forEach(r -> {
231 StrUtil.info(log, r);
234 log.info("======================== Query + t ==============================");
235 rsList = new ArrayList<>();
236 resourceAllocator.query(sd, null, rr, rsList);
238 rsList.forEach(r -> {
239 StrUtil.info(log, r);
246 public void test003() throws Exception {
248 log.info("============== reserve " + t + " ================================");
249 log.info("=== Test successful response - new start - all resources available");
251 ResourceEntity sd = new ResourceEntity();
252 sd.resourceEntityId = "gblond2003me6";
253 sd.resourceEntityType = "VNF";
255 ResourceTarget rt = new ResourceTarget();
256 rt.resourceTargetId = "MDTWNJ21A5";
257 rt.resourceTargetType = "Site";
260 ResourceRequest rr = new ResourceRequest();
261 rr.serviceModel = "MY-SERV-MODEL";
262 rr.resourceName = "VPE-Cust";
263 // rr.requestType = "New";
264 // rr.rangeMaxOverride = 5;
265 // rr.rangeMinOverride = 5;
267 List<ResourceResponse> rsList = new ArrayList<>();
268 resourceAllocator.reserve(sd, rt, rr, rsList);
270 rsList.forEach(r -> {
271 StrUtil.info(log, r);
274 log.info("======================== Query + t ==============================");
275 rsList = new ArrayList<>();
276 resourceAllocator.query(sd, null, rr, rsList);
278 rsList.forEach(r -> {
279 StrUtil.info(log, r);
287 public void test004() throws Exception {
289 log.info("============== reserve " + t + " ================================");
290 log.info("=== Test successful response - new start - all resources available");
292 ResourceEntity sd = new ResourceEntity();
293 sd.resourceEntityId = "gblond2003me6";
294 sd.resourceEntityType = "VNF";
296 ResourceTarget rt = new ResourceTarget();
297 rt.resourceTargetId = "MDTWNJ21A5";
298 rt.resourceTargetType = "Site";
300 List<ResourceRequest> rrs = new ArrayList<>();
301 ResourceRequest rr = new ResourceRequest();
302 rr.serviceModel = "MY-SERV-MODEL";
303 rr.resourceName = "VPE-Cust";
306 rr = new ResourceRequest();
307 rr.serviceModel = "MY-SERV-MODEL";
308 rr.resourceName = "VPE-Core1";
311 rr = new ResourceRequest();
312 rr.serviceModel = "MY-SERV-MODEL";
313 rr.resourceName = "VPE-Core2";
318 List<ResourceResponse> rsList = new ArrayList<>();
319 // resourceAllocator.reserve(sd, rt, rrs, rsList);
321 rsList.forEach(r -> {
322 StrUtil.info(log, r);
325 log.info("======================== Query + t ==============================");
326 rsList = new ArrayList<>();
327 resourceAllocator.query(sd, null, rr, rsList);
329 rsList.forEach(r -> {
330 StrUtil.info(log, r);
337 public void test005() throws Exception {
339 log.info("============== reserve " + t + " ================================");
340 log.info("=== Test successful response - new start - all resources available");
342 // String service1 = "reserve" + t + "/service1";
346 TestTable resource = new TestTable(jdbcTemplate, "RESOURCE", "resource_id", RESOURCE_COLUMNS);
347 TestTable allocationItem =
348 new TestTable(jdbcTemplate, "ALLOCATION_ITEM", "allocation_item_id", ALLOCATION_ITEM_COLUMNS);
351 SvcLogicContext ctx = new SvcLogicContext();
352 ctx.setAttribute("ra-input.service-model", "MY-SERV-MODEL-1");
353 ctx.setAttribute("ra-input.check-only", "false");
354 ctx.setAttribute("ra-input.reservation-entity-type", "VPE-Cust");
355 ctx.setAttribute("ra-input.reservation-entity-id", "gblond2003me6");
357 ctx.setAttribute("ra-input.reservation-target-id", "MDTWNJ21A5");
358 ctx.setAttribute("ra-input.reservation-target-type", "Site");
360 ctx.setAttribute("ra-input.resource-name", "cust-vlan-id");
363 QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx);
365 Assert.assertTrue(st == QueryStatus.SUCCESS);
368 allocationItem.print();
370 ctx = new SvcLogicContext();
371 ctx.setAttribute("ra-input.service-model", "MY-SERV-MODEL-1");
372 ctx.setAttribute("ra-input.check-only", "false");
373 ctx.setAttribute("ra-input.reservation-entity-type", "VPE-Core1");
374 ctx.setAttribute("ra-input.reservation-entity-id", "gblond2003me6");
376 ctx.setAttribute("ra-input.reservation-target-id", "MDTWNJ21A5");
377 ctx.setAttribute("ra-input.reservation-target-type", "Site");
379 ctx.setAttribute("ra-input.resource-name", "vlan-id-inner");
382 st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx);
384 Assert.assertTrue(st == QueryStatus.SUCCESS);
387 allocationItem.print();
389 ctx = new SvcLogicContext();
390 ctx.setAttribute("ra-input.service-model", "MY-SERV-MODEL-1");
391 ctx.setAttribute("ra-input.check-only", "false");
392 ctx.setAttribute("ra-input.reservation-entity-type", "VPE-Core2");
393 ctx.setAttribute("ra-input.reservation-entity-id", "gblond2003me6");
395 ctx.setAttribute("ra-input.reservation-target-id", "MDTWNJ21A5");
396 ctx.setAttribute("ra-input.reservation-target-type", "Site");
398 ctx.setAttribute("ra-input.resource-name", "vlan-id-inner");
399 ctx.setAttribute("ra-input.replace", "false");
402 st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx);
404 Assert.assertTrue(st == QueryStatus.SUCCESS);
407 allocationItem.print();
410 /* Query Using ReservationEntityId using ServiceLogicContext */
411 ctx = new SvcLogicContext();
412 ctx.setAttribute("ra-input.service-model", "MY-SERV-MODEL-1");
413 ctx.setAttribute("ra-input.reservation-entity-id", "gblond2003me6");
414 ctx.setAttribute("ra-input.reservation-entity-type", "VPE-Core1");
417 st = resourceAllocator.query("NetworkCapacity", false, null, null, null, null, ctx);
418 Assert.assertTrue(st == QueryStatus.SUCCESS);
421 /* Query Using ReservationTargetId using ServiceLogicContext */
422 ctx = new SvcLogicContext();
423 ctx.setAttribute("ra-input.service-model", "MY-SERV-MODEL-1");
424 ctx.setAttribute("ra-input.reservation-target-id", "MDTWNJ21A5");
425 ctx.setAttribute("ra-input.reservation-target-type", "Site");
426 ctx.setAttribute("ra-input.resource-name", "vlan-id-inner");
428 st = resourceAllocator.query("NetworkCapacity", false, null, null, null, null, ctx);
429 Assert.assertTrue(st == QueryStatus.SUCCESS);
431 log.info("======================== Query Using ResourceEntity==============================");
432 /* Query Using ResourceEntity bean */
433 ResourceEntity sd = new ResourceEntity();
434 sd.resourceEntityId = "gblond2003me6";
435 sd.resourceEntityType = "VPE-Core1";
438 ResourceRequest rr = new ResourceRequest();
439 rr.serviceModel = "MY-SERV-MODEL-1";
440 rr.resourceName = "vlan-id-inner";
441 rr.requestType = "New";
442 rr.rangeMaxOverride = -1;
443 rr.rangeMinOverride = -1;
445 List<ResourceResponse> rsList = new ArrayList<>();
446 resourceAllocator.query(sd, null, null, rsList);
448 rsList.forEach(r -> {
449 StrUtil.info(log, r);
453 * log.info("======================== release Using ResourceEntity==============================");
454 * rsList = new ArrayList<ResourceResponse>(); AllocationStatus status =
455 * resourceAllocator.release(sd); Assert.assertTrue(status == AllocationStatus.Success);
458 * log.info("======================== Query Using ResourceEntity==============================");
459 * rsList = new ArrayList<ResourceResponse>(); resourceAllocator.query(sd, null, null, rsList);
462 * rsList.forEach(r -> { StrUtil.info(log, r); });
470 public void test006() throws Exception {
472 log.info("============== reserve " + t + " ================================");
473 log.info("=== Test successful response - new start - all resources available");
475 ResourceEntity sd = new ResourceEntity();
476 sd.resourceEntityId = "gblond2003me6";
477 sd.resourceEntityType = "VPE-Cust";
479 ResourceTarget rt = new ResourceTarget();
480 rt.resourceTargetId = "MDTWNJ21A5";
481 rt.resourceTargetType = "Site";
484 ResourceRequest rr = new ResourceRequest();
485 rr.serviceModel = "MY-SERV-MODEL-1";
486 rr.resourceName = "cust-vlan-id";
489 List<ResourceResponse> rsList = new ArrayList<>();
490 resourceAllocator.reserve(sd, rt, rr, rsList);
492 rsList.forEach(r -> {
493 StrUtil.info(log, r);
496 log.info("======================== Query + t ==============================");
497 rsList = new ArrayList<>();
498 resourceAllocator.query(sd, null, rr, rsList);
500 rsList.forEach(r -> {
501 StrUtil.info(log, r);
507 public void test007() throws Exception {
509 log.info("============== reserve " + t + " ================================");
510 log.info("=== Test successful response - new start - all resources available");
514 TestTable resource = new TestTable(jdbcTemplate, "RESOURCE", "resource_id", RESOURCE_COLUMNS);
515 TestTable allocationItem =
516 new TestTable(jdbcTemplate, "ALLOCATION_ITEM", "allocation_item_id", ALLOCATION_ITEM_COLUMNS);
519 ResourceEntity sd = new ResourceEntity();
520 sd.resourceEntityId = "gblond2003me6";
521 sd.resourceEntityType = "VPE";
522 sd.resourceEntityVersion = "1";
524 ResourceTarget rt = new ResourceTarget();
525 rt.resourceTargetId = "MDTWNJ21A5";
526 rt.resourceTargetType = "Site";
529 ResourceRequest rr = new ResourceRequest();
530 rr.serviceModel = "MY-SERV-MODEL";
531 // rr.resourceName = "vlan-id-outer";
532 rr.endPointPosition = "VPE-Cust";
533 rr.rangeMaxOverride = -1;
534 rr.rangeMinOverride = -1;
537 List<ResourceResponse> rsList = new ArrayList<>();
538 resourceAllocator.reserve(sd, rt, rr, rsList);
541 sd = new ResourceEntity();
542 sd.resourceEntityId = "gblond2003me6";
543 sd.resourceEntityType = "VPE";
544 sd.resourceEntityVersion = "1";
546 rt = new ResourceTarget();
547 rt.resourceTargetId = "MDTWNJ21A5";
548 rt.resourceTargetType = "Site";
551 rr = new ResourceRequest();
552 rr.serviceModel = "MY-SERV-MODEL";
553 // rr.resourceName = "vlan-id-filter";
554 rr.endPointPosition = "VPE-Core1";
555 rr.rangeMaxOverride = -1;
556 rr.rangeMinOverride = -1;
559 rsList = new ArrayList<>();
560 resourceAllocator.reserve(sd, rt, rr, rsList);
564 sd = new ResourceEntity();
565 sd.resourceEntityId = "gblond2003me6";
566 sd.resourceEntityType = "VPE";
567 sd.resourceEntityVersion = "1";
569 rt = new ResourceTarget();
570 rt.resourceTargetId = "MDTWNJ21A5";
571 rt.resourceTargetType = "Site";
574 rr = new ResourceRequest();
575 rr.serviceModel = "MY-SERV-MODEL";
576 // rr.resourceName = "vlan-id-filter";
577 rr.endPointPosition = "VPE-Core2";
578 rr.rangeMaxOverride = -1;
579 rr.rangeMinOverride = -1;
582 rsList = new ArrayList<>();
583 resourceAllocator.reserve(sd, rt, rr, rsList);
587 sd = new ResourceEntity();
588 sd.resourceEntityId = "gblond2003me6";
589 sd.resourceEntityType = "VPE";
590 sd.resourceEntityVersion = "1";
592 rt = new ResourceTarget();
593 rt.resourceTargetId = "MDTWNJ21A5";
594 rt.resourceTargetType = "Site";
597 rr = new ResourceRequest();
598 rr.serviceModel = "MY-SERV-MODEL";
599 // rr.resourceName = "vlan-id-filter";
600 rr.endPointPosition = "VPE-Core3";
601 rr.rangeMaxOverride = -1;
602 rr.rangeMinOverride = -1;
605 rsList = new ArrayList<>();
606 resourceAllocator.reserve(sd, rt, rr, rsList);
608 rsList.forEach(r -> {
609 StrUtil.info(log, r);
613 allocationItem.print();
615 log.info("======================== Query + t ==============================");
616 rsList = new ArrayList<>();
617 resourceAllocator.query(sd, null, rr, rsList);
619 rsList.forEach(r -> {
620 StrUtil.info(log, r);
625 SvcLogicContext ctx = new SvcLogicContext();
626 ctx.setAttribute("ra-input.reservation-entity-id", "gblond2003me6");
627 ctx.setAttribute("ra-input.reservation-entity-type", "VPE");
630 QueryStatus st = resourceAllocator.release("NetworkCapacity", "gblond2003me6", ctx);
631 Assert.assertTrue(st == QueryStatus.SUCCESS);
636 public void test008() throws Exception {
638 log.info("============== reserve " + t + " ================================");
639 log.info("=== Test range-force-new-numbers = false");
641 String entityId = "reserve" + t;
642 String targetId = "port-id-1";
643 String resourceName = "cust-vlan-id";
645 String assetId = "VNF::" + targetId;
646 String resourceUnion = "SI::" + entityId;
647 String resourceSet1 = resourceUnion + "::1";
648 String resourceSet2 = resourceUnion + "::2";
652 dataSetup.setupRangeItem(resourceName, assetId, resourceSet1, resourceUnion, "201");
654 SvcLogicContext ctx = new SvcLogicContext();
655 ctx.setAttribute("ra-input.service-model", "ADIG");
656 ctx.setAttribute("ra-input.check-only", "false");
658 ctx.setAttribute("ra-input.resource-name", resourceName);
659 ctx.setAttribute("ra-input.range-force-new-numbers", "false");
661 ctx.setAttribute("ra-input.reservation-entity-type", "SI");
662 ctx.setAttribute("ra-input.reservation-entity-id", entityId);
663 ctx.setAttribute("ra-input.reservation-entity-version", "2");
665 ctx.setAttribute("ra-input.reservation-target-id", targetId);
666 ctx.setAttribute("ra-input.reservation-target-type", "VNF");
668 QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx);
670 Assert.assertTrue(st == QueryStatus.SUCCESS);
671 Assert.assertTrue(dataSetup.checkRangeItem(resourceName, assetId, resourceSet1, "201"));
672 Assert.assertTrue(dataSetup.checkRangeItem(resourceName, assetId, resourceSet2, "201"));
676 public void test009() throws Exception {
678 log.info("============== reserve " + t + " ================================");
679 log.info("=== Test range-force-new-numbers = true");
681 String entityId = "reserve" + t;
682 String targetId = "port-id-1";
683 String resourceName = "cust-vlan-id";
685 String assetId = "VNF::" + targetId;
686 String resourceUnion = "SI::" + entityId;
687 String resourceSet1 = resourceUnion + "::1";
688 String resourceSet2 = resourceUnion + "::2";
692 dataSetup.setupRangeItem(resourceName, assetId, resourceSet1, resourceUnion, "201");
694 SvcLogicContext ctx = new SvcLogicContext();
695 ctx.setAttribute("ra-input.service-model", "ADIG");
696 ctx.setAttribute("ra-input.check-only", "false");
698 ctx.setAttribute("ra-input.resource-name", resourceName);
699 ctx.setAttribute("ra-input.range-force-new-numbers", "true");
701 ctx.setAttribute("ra-input.reservation-entity-type", "SI");
702 ctx.setAttribute("ra-input.reservation-entity-id", entityId);
703 ctx.setAttribute("ra-input.reservation-entity-version", "2");
705 ctx.setAttribute("ra-input.reservation-target-id", targetId);
706 ctx.setAttribute("ra-input.reservation-target-type", "VNF");
708 QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx);
710 Assert.assertTrue(st == QueryStatus.SUCCESS);
711 Assert.assertTrue(dataSetup.checkRangeItem(resourceName, assetId, resourceSet1, "201"));
712 Assert.assertFalse(dataSetup.checkRangeItem(resourceName, assetId, resourceSet2, "201"));