[AAI] Update the gatling scripts to have proper structure, pom, and readme
[aai/test-config.git] / gatling / src / test / gatling / simulations / ONAP Stress 2022.scala
1 import io.gatling.core.Predef.{exec, _}
2 import io.gatling.http.Predef._
3 import _root_.io.gatling.core.scenario.Simulation
4 import java.util.UUID
5 import scala.concurrent.duration._
6
7 import scala.util.Random
8
9 class ONAP_2204_Stress extends Simulation {
10   val httpHeaders = Map(
11     "Accept" -> """application/json""",
12     "Content-Type"-> """application/json""",
13       "X-FromAppId"-> """ONAP-fromappId""",
14     "X-TransactionId"-> """ONAP-transId""",
15     "Connection"-> """Keep-Alive"""
16   )
17
18   def idGenerator() = "random-" + UUID.randomUUID().toString;
19   val r = scala.util.Random
20   val feeder = Iterator.continually(Map("randVal" -> (Random.alphanumeric.take(20).mkString)))
21
22
23
24   val PServerFeeder = csv("./src/test/gatling/bodies/onappservers.csv").random
25   val serviceInstanceFeeder = csv("./src/test/gatling/bodies/onapserviceinstance.csv").random
26   val genericvnfFeeder = csv("./src/test/gatling/bodies/onapvnfs.csv").random
27   val customerFeeder = csv("./src/test/gatling/bodies/onapcustomers.csv").random
28   val vnfcFeeder = csv("./src/test/gatling/bodies/onapvnfcs.csv").random
29   val platformFeeder = csv("./src/test/gatling/bodies/onapplatform.csv").random
30   val pnfFeeder = csv("./src/test/gatling/bodies/onappnfs.csv").random
31   val configurationFeeder = csv("./src/test/gatling/bodies/onapconfigurations.csv").random
32   val owningentityFeeder = csv("./src/test/gatling/bodies/onapowning_entity.csv").random
33   val projectFeeder = csv("./src/test/gatling/bodies/onapproject.csv").random
34   val lobFeeder = csv("./src/test/gatling/bodies/onapLOB.csv").random
35
36   val host = System.getProperty("TARGET_HOST", "Enter Host with Port");
37   val url = "Enter Host without Port"
38
39   val httpBuilder = http.baseURL(host);
40
41
42   /***
43     *
44     * @param env
45     * Sends a PUT tenant request
46     */
47   def PutTenant(env: String) = scenario("Put Tenant " + env)
48     .forever(){
49       exec(session => {
50         session.set("stenant", idGenerator())
51       })
52       .exec(
53         http("PutTenant " + env)
54         .put("/aai/v23/cloud-infrastructure/cloud-regions/cloud-region/onap-CROwner4/onap-CRId4/tenants/tenant/${stenant}")
55         .body(ElFileBody("newtenant_valid.json"))
56         .headers(httpHeaders)
57         .check(
58           status.find.in(201)
59         )
60       )
61       .pause(2,13)
62       .exec(
63         http("GetTenant " + env)
64         .get("/aai/v23/cloud-infrastructure/cloud-regions/cloud-region/onap-CROwner4/onap-CRId4/tenants/tenant/${stenant}")
65         .headers(httpHeaders)
66         .check(
67           status.find.in(200)
68         )
69         .check(jsonPath("$.resource-version").saveAs("resourcever"))
70       )
71       .exec(
72         http("DelTenant " + env)
73         .delete("/aai/v23/cloud-infrastructure/cloud-regions/cloud-region/onap-CROwner4/onap-CRId4/tenants/tenant/${stenant}?resource-version=${resourcever}")
74         .headers(httpHeaders)
75         .check(status.find.in(204))
76       )
77       .pause(1,1)
78    }
79
80      /***
81     *
82     * @param env
83     * Sends a PATCH tenant request
84     */
85   def PatchTenant(env: String) = scenario("Patch Tenant " + env)
86     .forever(){
87 // Get the resource version before doing the PATCH
88       exec(
89         http("Get Tenant " + env)
90         .get("/aai/v23/cloud-infrastructure/cloud-regions/cloud-region/onap-CROwner/onap-CRId/tenants/tenant/onap-tenant-patch")
91         .headers(httpHeaders)
92         .check(
93           status.find.in(200)
94         )
95         .check(
96           jsonPath("$.resource-version").saveAs("rsrcver")
97           )
98       )
99       .pause(1,1)
100
101       .exec(
102         http("Patch Tenant " + env)
103         .patch("/aai/v23/cloud-infrastructure/cloud-regions/cloud-region/onap-CROwner/onap-CRId/tenants/tenant/onap-tenant-patch?resource-version=${rsrcver}")
104         .headers(httpHeaders)
105         .headers(Map(
106           "Content-Type"-> """application/merge-patch+json"""
107         ))
108         .body(ElFileBody("patch-tenant.json"))
109         .check(
110           status.find.in(200)
111         )
112       )
113       .pause(2,5)
114     }
115
116  /***
117     *
118     * @param env
119     * @return Tenant Get depth0
120     */
121   def GetTenant(env: String) = scenario("Get Tenantdepth0 " + env)
122     .forever(){
123       exec(
124         http("Get Tenantdepth0 " + env)
125         .get("/aai/v23/cloud-infrastructure/cloud-regions/cloud-region/onap-CROwner3/onap-CRId3/tenants/tenant/onap-tenantId3?depth=0")
126         .headers(httpHeaders)
127         .check(
128           status.find.in(200)
129         )
130       )
131       .pause(2,6)
132 }
133
134   /***
135     *
136     * @param env
137     * Sends a DELETE tenant request
138     */
139   def DeleteTenant(env: String) = scenario("Delete Tenant " + env)
140     .forever(){
141       exec(session => {
142         session.set("stenant", idGenerator())
143       })
144       .exec(
145         http("PutTenant " + env)
146         .put("/aai/v23/cloud-infrastructure/cloud-regions/cloud-region/onap-CROwner5/onap-CRId5/tenants/tenant/${stenant}")
147         .body(ElFileBody("newtenant_valid.json"))
148         .headers(httpHeaders)
149         .check(
150           status.find.in(201)
151         )
152       )
153       .pause(1,1)
154       .exec(
155         http("GetTenant " + env)
156         .get("/aai/v23/cloud-infrastructure/cloud-regions/cloud-region/onap-CROwner5/onap-CRId5/tenants/tenant/${stenant}")
157         .headers(httpHeaders)
158         .check(
159           status.find.in(200)
160         )
161         .check(jsonPath("$.resource-version").saveAs("resourcever"))
162       )
163       .exec(
164         http("DeleteTenant " + env)
165         .delete("/aai/v23/cloud-infrastructure/cloud-regions/cloud-region/onap-CROwner5/onap-CRId5/tenants/tenant/${stenant}?resource-version=${resourcever}")
166         .headers(httpHeaders)
167         .check(status.find.in(204))
168       )
169       .pause(1,1)
170    }
171
172   /**
173     *
174     * @param env
175     * @Send a GET Vserver depth=all request
176     */
177     def Getvserver1(env: String) = scenario("Get Vserverdepthall " + env)
178       .forever(){
179          exec(
180           http("Get Vserverdepthall " + env)
181           .get("/aai/v23/cloud-infrastructure/cloud-regions/cloud-region/onap-CROwner2/onap-CRId2/tenants/tenant/onap-tenantId2/vservers/vserver/onap-vserverId2?depth=all")
182           .headers(httpHeaders)
183           .check(
184             status.find.in(200)
185           )
186         )
187         .pause(2,5)
188       }
189
190   /**
191     *
192     * @param env
193     * @Send a GET VF-Module depth=1request
194     */
195     def GetVFModule1(env: String) = scenario("Get VF-Moduledepth1 " + env)
196       .forever(){
197         exec(
198           http("Get VF-Moduledepthl " + env)
199           .get("/aai/v23/network/generic-vnfs/generic-vnf/onap-genericvnfId/vf-modules/vf-module/onap-vnfmoduleId?depth=1")
200           .headers(httpHeaders)
201           .check(
202             status.find.in(200)
203           )
204         )
205         .pause(2,5)
206       }
207
208   /**
209     *
210     * @param env
211     * @Send a GET Vserver request
212     */
213     def Getvserver2(env: String) = scenario("Get Vserver " + env)
214       .forever(){
215          exec(
216           http("Get Vserver " + env)
217           .get("/aai/v23/cloud-infrastructure/cloud-regions/cloud-region/onap-CROwner2/onap-CRId2/tenants/tenant/onap-tenantId2/vservers/vserver/onap-vserverId2")
218           .headers(httpHeaders)
219           .check(
220             status.find.in(200)
221           )
222         )
223         .pause(2,6)
224       }
225
226   /**
227     *
228     * @param env
229     * @Send a GET SI format=pathed request
230     */
231     def GetSI1(env: String) = scenario("Get SIpathed " + env)
232       .forever(){
233         feed(serviceInstanceFeeder)
234         .exec(
235           http("Get SIpathed " + env)
236           .get("/aai/v23/nodes/service-instances/service-instance/${service-instance-id}?format=pathed")
237           .headers(httpHeaders)
238           .check(
239             status.find.in(200)
240           )
241         )
242         .pause(2,3)
243       }
244
245             /**
246     *
247     * @param env
248     * @Send a V23 GET vnf request
249     */
250     def GetVNF1(env: String) = scenario("Get VNF " + env)
251       .forever(){
252         feed(genericvnfFeeder)
253         .exec(
254           http("Get VNF " + env)
255           .get("/aai/v23/network/generic-vnfs/generic-vnf/${vnf-id}")
256           .headers(httpHeaders)
257           .check(
258             status.find.in(200)
259           )
260         )
261         .pause(2,5)
262       }
263
264   /**
265     *
266     * @param env
267     * @Send a GET vnf depth=1 request
268     */
269     def GetVNF2(env: String) = scenario("Get VNFdepth1 " + env)
270       .forever(){
271         feed(genericvnfFeeder)
272         .exec(
273           http("Get VNFdepth1 " + env)
274           .get("/aai/v23/network/generic-vnfs/generic-vnf/${vnf-id}?depth=1")
275           .headers(httpHeaders)
276           .check(
277             status.find.in(200)
278           )
279         )
280         .pause(2,5)
281       }
282
283
284             /**
285     *
286     * @param env
287     * @Send a GET pservers depth=all request
288     */
289     def GetPserver1(env: String) = scenario("Get Pserverdepthall " + env)
290       .forever(){
291         feed(PServerFeeder)
292         .exec(
293           http("Get Pserverdepthall " + env)
294           .get("/aai/v22/cloud-infrastructure/pservers/pserver/${hostname}?depth=all")
295           .headers(httpHeaders)
296           .check(
297             status.find.in(200)
298           )
299         )
300         .pause(2,5)
301       }
302
303   /**
304     *
305     * @param env
306     * @Send a GET volume-group request
307     */
308     def Getvolumegroup(env: String) = scenario("Get volume-group " + env)
309       .forever(){
310          exec(
311           http("Get volume-group " + env)
312           .get("/aai/v23/cloud-infrastructure/cloud-regions/cloud-region/onap-CROwner/onap-CRId/volume-groups/volume-group/onap-volumegpId")
313           .headers(httpHeaders)
314           .check(
315             status.find.in(200)
316           )
317         )
318         .pause(2,6)
319       }
320
321     /**
322     *
323     * @param env
324     * @Send a GET platform request
325     */
326     def Getplatform(env: String) = scenario("Get platformnodes-only " + env)
327       .forever(){
328         feed(platformFeeder)
329         .exec(
330           http("Get platformnodes-only " + env)
331           .get("/aai/v22/business/platforms/platform/${platform-name}?nodes-only=")
332           .headers(httpHeaders)
333           .check(
334             status.find.in(200)
335           )
336         )
337         .pause(2,6)
338       }
339
340   /**
341     *
342     * @param env
343     * @Send a GET sriov-vf depth=all request
344     */
345     def Getsriovvf1(env: String) = scenario("Get sriov-vfdepthall " + env)
346       .forever(){
347          exec(
348           http("Get sriov-vfdepthall " + env)
349           .get("/aai/v23/cloud-infrastructure/cloud-regions/cloud-region/onap-CROwner/onap-CRId/tenants/tenant/onap-tenantId/vservers/vserver/onap-vserverId/l-interfaces/l-interface/onap-linterfaceName/sriov-vfs/sriov-vf/onap-PciId?depth=all")
350           .headers(httpHeaders)
351           .check(
352             status.find.in(200)
353           )
354         )
355         .pause(2,6)
356       }
357
358     /**
359     *
360     * @param env
361     * @Send a GET pnf request
362     */
363     def Getpnf1(env: String) = scenario("Get pnf " + env)
364       .forever(){
365         feed(pnfFeeder)
366         .exec(
367           http("Get pnf " + env)
368           .get("/aai/v22/network/pnfs/pnf/${pnf-name}")
369           .headers(httpHeaders)
370           .check(
371             status.find.in(200)
372           )
373         )
374         .pause(2,6)
375       }
376
377               /**
378     *
379     * @param env
380     * @Send a vnfc depth=1 request
381     */
382     def Getvnfc1(env: String) = scenario("Get vnfcdepth1 " + env)
383       .forever(){
384         feed(vnfcFeeder)
385         .exec(
386           http("Get vnfcdepth1 " + env)
387           .get("/aai/v22/network/vnfcs/vnfc/${vnfc-name}?depth=1")
388           .headers(httpHeaders)
389           .check(
390             status.find.in(200)
391           )
392         )
393         .pause(2,5)
394       }
395
396   /**
397     *
398     * @param env
399     * @Send a GET vlan depth=1 request
400     */
401     def Getvlan(env: String) = scenario("Get vlandepth1 " + env)
402       .forever(){
403          exec(
404           http("Get vlandepth1 " + env)
405           .get("/aai/v22/network/generic-vnfs/generic-vnf/onap-genericvnfId/l-interfaces/l-interface/onap-linterfaceId/vlans/vlan/onap-vlanInterface?depth=1")
406           .headers(httpHeaders)
407           .check(
408             status.find.in(200)
409           )
410         )
411         .pause(2,5)
412       }
413
414   /**
415     *
416     * @param env
417     * @Send a GET SI depth=2 request
418     */
419     def GetSI2(env: String) = scenario("Get SIdepth2 " + env)
420       .forever(){
421          exec(
422           http("Get SIdepth2 " + env)
423           .get("/aai/v22/business/customers/customer/onap-customerId/service-subscriptions/service-subscription/onap-subscription-ServiceType/service-instances/service-instance/onap-serviceinstanceId?depth=2")
424           .headers(httpHeaders)
425           .check(
426             status.find.in(200)
427           )
428         )
429         .pause(2,4)
430       }
431
432             /**
433     *
434     * @param env
435     * @Send a GET pserver  request
436     */
437     def GetPserver2(env: String) = scenario("Get Pserver " + env)
438       .forever(){
439         feed(PServerFeeder)
440         .exec(
441           http("Get Pserver " + env)
442           .get("/aai/v22/cloud-infrastructure/pservers/pserver/${hostname}")
443           .headers(httpHeaders)
444           .check(
445             status.find.in(200)
446           )
447         )
448         .pause(2,5)
449       }
450
451                     /**
452     *
453     * @param env
454     * @Send a GET configuration depth=1 request
455     */
456     def Getconfiguration(env: String) = scenario("Get configurationdepth1 " + env)
457       .forever(){
458         feed(configurationFeeder)
459         .exec(
460           http("Get configurationdepth1 " + env)
461           .get("/aai/v22/network/configurations/configuration/${configuration-id}?depth=1")
462           .headers(httpHeaders)
463           .check(
464             status.find.in(200)
465           )
466         )
467         .pause(2,5)
468       }
469
470   /**
471     *
472     * @param env
473     * @Send a GET service-subscription request
474     */
475     def Getservicesubscription(env: String) = scenario("Get service-subscription " + env)
476       .forever(){
477          exec(
478           http("Getservice-subscription " + env)
479           .get("/aai/v22/business/customers/customer/onap-customerId/service-subscriptions/service-subscription/onap-subscription-ServiceType")
480           .headers(httpHeaders)
481           .check(
482             status.find.in(200)
483           )
484         )
485         .pause(2,5)
486       }
487
488     /**
489     *
490     * @param env
491     * @Send a GET pnf depth=all request
492     */
493     def Getpnf2(env: String) = scenario("Get pnfdepthall " + env)
494       .forever(){
495         feed(pnfFeeder)
496         .exec(
497           http("Get pnfdepthall " + env)
498           .get("/aai/v22/network/pnfs/pnf/${pnf-name}?depth=all")
499           .headers(httpHeaders)
500           .check(
501             status.find.in(200)
502           )
503         )
504         .pause(2,3)
505       }
506
507     /**
508     *
509     * @param env
510     * @Send a GET customer request
511     */
512     def Getcustomer(env: String) = scenario("Get customer " + env)
513       .forever(){
514         feed(customerFeeder)
515         .exec(
516           http("Get customer " + env)
517           .get("/aai/v21/business/customers/customer/${global-customer-id}")
518           .headers(httpHeaders)
519           .check(
520             status.find.in(200)
521           )
522         )
523         .pause(2,6)
524       }
525
526     /**
527     *
528     * @param env
529     * @Send a GET owningentity node-only request
530     */
531     def Getowningentity(env: String) = scenario("Get owningentitynodesonly " + env)
532       .forever(){
533         feed(owningentityFeeder)
534         .exec(
535           http("Get owningentitynodesonly " + env)
536           .get("/aai/v21/business/owning-entities/owning-entity/${owning-entity-id}?nodes-only=")
537           .headers(httpHeaders)
538           .check(
539             status.find.in(200)
540           )
541         )
542         .pause(2,6)
543       }
544
545               /**
546     *
547     * @param env
548     * @Send a GET vnfc request
549     */
550     def Getvnfc2(env: String) = scenario("Get vnfc " + env)
551       .forever(){
552         feed(vnfcFeeder)
553         .exec(
554           http("Get vnfc " + env)
555           .get("/aai/v22/network/vnfcs/vnfc/${vnfc-name}")
556           .headers(httpHeaders)
557           .check(
558             status.find.in(200)
559           )
560         )
561         .pause(2,6)
562       }
563
564   /**
565     *
566     * @param env
567     * @Send a GET vlan-tag depth=1 request
568     */
569     def Getvlantag(env: String) = scenario("Get vlantagdepth1 " + env)
570       .forever(){
571          exec(
572           http("Get vlantagdepth1 " + env)
573           .get("/aai/v23/cloud-infrastructure/cloud-regions/cloud-region/onap-CROwner/onap-CRId/vlan-ranges/vlan-range/onap-vlanrangeId/vlan-tags?vlan-id-outer=168&depth=1")
574           .headers(httpHeaders)
575           .check(
576             status.find.in(200)
577           )
578         )
579         .pause(2,5)
580       }
581
582   /**
583     *
584     * @param env
585     * @Send a GET project nodes-only request
586     */
587     def Getproject(env: String) = scenario("Get projectnodes-only " + env)
588       .forever(){
589            feed(projectFeeder)
590          .exec(
591           http("Get projectnodes-only " + env)
592           .get("/aai/v21/business/projects/project/${project-name}?nodes-only=")
593           .headers(httpHeaders)
594           .check(
595             status.find.in(200)
596           )
597         )
598         .pause(2,6)
599       }
600
601   /**
602     *
603     * @param env
604     * @Send a GET LOB request
605     */
606     def Getlob(env: String) = scenario("Get LOB " + env)
607       .forever(){
608            feed(lobFeeder)
609          .exec(
610           http("Get LOB " + env)
611           .get("/aai/v21/business/lines-of-business/line-of-business/${line-of-business-name}")
612           .headers(httpHeaders)
613           .check(
614             status.find.in(200)
615           )
616         )
617         .pause(1,3)
618       }
619
620   /**
621     *
622     * @param env
623     * @Send a GET sriov-vf request
624     */
625     def Getsriovvf2(env: String) = scenario("Get sriov-vfcountIndexSize " + env)
626       .forever(){
627          exec(
628           http("Get sriov-vfcountIndexSize " + env)
629                   .get("/aai/v23/cloud-infrastructure/cloud-regions/cloud-region/onap-CROwner/onap-CRId/tenants/tenant/onap-tenantId/vservers/vserver/onap-vserverId/l-interfaces/l-interface/onap-linterfaceName/sriov-vfs/sriov-vf/onap-PciId?format=count&resultIndex=0&resultSize=1")
630           .headers(httpHeaders)
631           .check(
632             status.find.in(200)
633           )
634         )
635         .pause(2,6)
636       }
637
638   /**
639     *
640     * @param env
641     * @Send a GET snapshot depth=all request
642     */
643     def Getsnapshot(env: String) = scenario("Get snapshotdepthall " + env)
644       .forever(){
645          exec(
646           http("Get snapshotdepthall " + env)
647                   .get("/aai/v23/cloud-infrastructure/cloud-regions/cloud-region/onap-CROwner/onap-CRId/snapshots/snapshot/onapsnapshotId?depth=all")
648           .headers(httpHeaders)
649           .check(
650             status.find.in(200)
651           )
652         )
653         .pause(2,6)
654       }
655
656   /**
657     *
658     * @param env
659     * @Send a GET volume depth=all request
660     */
661     def Getvolume(env: String) = scenario("Get volumedepthall " + env)
662       .forever(){
663          exec(
664           http("Get volumedepthall " + env)
665                   .get("/aai/v23/cloud-infrastructure/cloud-regions/cloud-region/onap-CROwner/onap-CRId/tenants/tenant/onap-tenantId/vservers/vserver/onap-vserverId/volumes/volume/onap-volumeid?depth=all")
666           .headers(httpHeaders)
667           .check(
668             status.find.in(200)
669           )
670         )
671         .pause(2,6)
672       }
673
674             /**
675     *
676     * @param env
677     * @Send a GET CR with CRid request
678     */
679     def GetCR(env: String) = scenario("Get CRwithregionid " + env)
680       .forever(){
681          exec(
682           http("Get CRwithregionid " + env)
683                   .get("/aai/v22/cloud-infrastructure/cloud-regions/?cloud-region-id=onap-CRId")
684           .headers(httpHeaders)
685           .check(
686             status.find.in(200)
687           )
688         )
689         .pause(1,2)
690       }
691
692   /***
693     *
694     * @param env
695     * Sends a PUT then del vf-module request
696     */
697   def PUTvfmodule(env: String) = scenario("PUT vf-module " + env)
698     .forever(){
699         feed(genericvnfFeeder)
700       exec(session => {
701         session.set("svfmodule", idGenerator())
702       })
703       .exec(
704         http("PUT vf-module " + env)
705         .put("/aai/v23/network/generic-vnfs/generic-vnf/onap-genericvnfId/vf-modules/vf-module/${svfmodule}")
706         .body(ElFileBody("newvf-module_valid.json"))
707         .headers(httpHeaders)
708         .check(
709           status.find.in(201)
710         )
711       )
712       .pause(2,14)
713       .exec(
714         http("Getvfmodule " + env)
715         .get("/aai/v23/network/generic-vnfs/generic-vnf/onap-genericvnfId/vf-modules/vf-module/${svfmodule}")
716         .headers(httpHeaders)
717         .check(
718           status.find.in(200)
719         )
720         .check(jsonPath("$.resource-version").saveAs("resourcever"))
721       )
722       .exec(
723         http("Deletevfmodule " + env)
724         .delete("/aai/v23/network/generic-vnfs/generic-vnf/onap-genericvnfId/vf-modules/vf-module/${svfmodule}?resource-version=${resourcever}")
725         .headers(httpHeaders)
726         .check(status.find.in(204))
727       )
728       .pause(1,1)
729    }
730
731             /**
732     *
733     * @param env
734     * @Send a GET all services request
735     */
736     def Getallservices(env: String) = scenario("Get all services " + env)
737       .forever(){
738          exec(
739           http("Get all services " + env)
740                   .get("/aai/v22/service-design-and-creation/services")
741           .headers(httpHeaders)
742 .headers(Map(
743           "X-FromAppId"-> """ONAP-fromappId"""
744         ))
745           .check(
746             status.find.in(200)
747           )
748         )
749         .pause(2,20)
750       }
751
752   /***
753     *
754     * @param env
755     * Sends a PUT pservervserver request
756     */
757   def PostBulkSingleTx1(env: String) = scenario("BulkSingleTx1" + env)
758     //.feed(tenantFeeder)
759         .forever(){
760       exec(session => {
761         session.set("sPServer", idGenerator())
762       })
763       .exec(session => {
764         session.set("sVServer", idGenerator())
765       })
766       .exec(
767         http("BulkSingleTx1 " + env)
768         .post("/aai/v22/bulk/single-transaction")
769         .body(ElFileBody("onapbulk-single-tx_putPServerVServer.json"))
770         .headers(httpHeaders)
771         .check(
772           status.find.in(201)
773         )
774       )
775         .pause(2,5)
776         .exec(
777           http("Vserver " + env)
778           .get("/aai/v22/cloud-infrastructure/cloud-regions/cloud-region/onap-CROwner/onap-CRId/tenants/tenant/onap-tenantId1/vservers/vserver/${sVServer}?depth=0&nodes-only=true")
779           .headers(httpHeaders)
780           .check(
781             status.find.in(200)
782           )
783           .check(jsonPath("$.resource-version").saveAs("rsrcver"))
784         )
785         .exec(
786          http("Vserver " + env)
787           .delete("/aai/v22/cloud-infrastructure/cloud-regions/cloud-region/onap-CROwner/onap-CRId/tenants/tenant/onap-tenantId1/vservers/vserver/${sVServer}?resource-version=${rsrcver}")
788           .headers(httpHeaders)
789
790           .check(status.find.in(204))
791         )
792         .exec(
793           http("Pserver " + env)
794           .get("/aai/v22/cloud-infrastructure/pservers/pserver/${sPServer}?depth=0&nodes-only=true")
795           .headers(httpHeaders)
796           .check(
797             status.find.in(200)
798           )
799           .check(jsonPath("$.resource-version").saveAs("rsrcver"))
800         )
801         .exec(
802          http("Pserver " + env)
803           .delete("/aai/v22/cloud-infrastructure/pservers/pserver/${sPServer}?resource-version=${rsrcver}")
804           .headers(httpHeaders)
805           .check(status.find.in(204))
806         )
807       .pause(1,9)
808     }
809
810  /***
811     *
812     * @param env
813     * Sends a PUT pservervserver2 request
814     */
815   def PostBulkSingleTx2(env: String) = scenario("BulkSingleTx2 " + env)
816         .forever(){
817       exec(session => {
818         session.set("sPServer", idGenerator())
819       })
820       .exec(session => {
821         session.set("sVServer", idGenerator())
822       })
823       .exec(
824         http("BulkSingleTx2" + env)
825         .post("/aai/v22/bulk/single-transaction")
826         .body(ElFileBody("onapbulk-single-tx_putPServerVServer.json"))
827         .headers(httpHeaders)
828         .check(
829           status.find.in(201)
830         )
831       )
832         .pause(2,33)
833         .exec(
834           http("Vserver " + env)
835           .get("/aai/v22/cloud-infrastructure/cloud-regions/cloud-region/onap-CROwner/onap-CRId/tenants/tenant/onap-tenantId1/vservers/vserver/${sVServer}?depth=0&nodes-only=true")
836           .headers(httpHeaders)
837           .check(
838             status.find.in(200)
839           )
840           .check(jsonPath("$.resource-version").saveAs("rsrcver"))
841         )
842         .exec(
843          http("Vserver  " + env)
844           .delete("/aai/v22/cloud-infrastructure/cloud-regions/cloud-region/onap-CROwner/onap-CRId/tenants/tenant/onap-tenantId1/vservers/vserver/${sVServer}?resource-version=${rsrcver}")
845           .headers(httpHeaders)
846
847           .check(status.find.in(204))
848         )
849         .exec(
850           http("Pserver " + env)
851           .get("/aai/v22/cloud-infrastructure/pservers/pserver/${sPServer}?depth=0&nodes-only=true")
852           .headers(httpHeaders)
853           .check(
854             status.find.in(200)
855           )
856           .check(jsonPath("$.resource-version").saveAs("rsrcver"))
857         )
858         .exec(
859          http("Pserver " + env)
860           .delete("/aai/v22/cloud-infrastructure/pservers/pserver/${sPServer}?resource-version=${rsrcver}")
861           .headers(httpHeaders)
862           .check(status.find.in(204))
863         )
864       .pause(1,9)
865     }
866
867      /***
868     *
869     * @param env
870     * Sends a patch request
871     */
872         def PostBulkSingleTx3(env: String) = scenario("BulkSingleTx3 " + env)
873     .forever(){
874       exec(session => {
875         session.set("CR1", idGenerator())
876       })
877       .exec(session => {
878         session.set("AZ1", idGenerator())
879       })
880                 .exec(session => {
881         session.set("flavor1", idGenerator())
882       })
883                 .exec(session => {
884         session.set("image1", idGenerator())
885       })
886                 .exec(session => {
887         session.set("complex1", idGenerator())
888       })
889                 .exec(session => {
890         session.set("pserver1", idGenerator())
891       })
892                 .exec(session => {
893         session.set("pserver2", idGenerator())
894       })
895                 .exec(session => {
896         session.set("pserver3", idGenerator())
897       })
898       .exec(
899         http("BulkSingleTx3 " + env)
900         .post("/aai/v21/bulk/single-transaction")
901         .body(ElFileBody("onap-patch-bulk-single-tx.json"))
902         .headers(httpHeaders)
903         .check(
904           status.find.in(201)
905         )
906       )
907       .pause(2,5)
908     }
909
910   /***
911     *
912     * @param env
913     * @CQ-pserver-zdevice1
914     */
915   def CQpserverzdevice1(env: String) = scenario("CQ pserverzdeviceresurldepth1 " + env)
916      .forever(){
917         exec(
918           http("CQ pserverzdeviceresurldepth1 " + env)
919           .put("/aai/v22/query?format=resource_and_url&depth=1")
920           .headers(httpHeaders)
921           .body(ElFileBody("onap-CQ-pserver-zdevice.json"))
922           .check(
923             status.find.in(200)
924           )
925         )
926         .pause(2,4)
927      }
928
929   /***
930     *
931     * @param env
932     * @CQ-pserver-zdevice2
933     */
934   def CQpserverzdevice2(env: String) = scenario("CQ pserverzdeviceres " + env)
935      .forever(){
936         exec(
937           http("CQ pserverzdeviceres " + env)
938           .put("/aai/v22/query?format=resource")
939           .headers(httpHeaders)
940           .body(ElFileBody("onap-CQ-pserver-zdevice.json"))
941           .check(
942             status.find.in(200)
943           )
944         )
945         .pause(2,4)
946      }
947
948   /***
949     *
950     * @param env
951     * @CQ-vlanrange-fromVlantag
952     */
953   def CQvlanrangefromVlantag(env: String) = scenario("CQ vlanrangefromVlantag " + env)
954      .forever(){
955         exec(
956           http("CQ vlanrangefromVlantag " + env)
957           .put("/aai/v22/query?format=resource")
958           .headers(httpHeaders)
959           .body(ElFileBody("onap-CQ-vlanrange-fromVlantag.json"))
960           .check(
961             status.find.in(200)
962           )
963         )
964         .pause(1,1)
965      }
966
967   /***
968     *
969     * @param env
970     * @CQ-getClfiRoadmTailSummary
971     */
972   def CQgetClfiRoadmTailSummary(env: String) = scenario("CQ getClfiRoadmTailSummary " + env)
973      .forever(){
974         exec(
975           http("CQ getClfiRoadmTailSummary " + env)
976           .put("/aai/v22/query?format=simple&nodesOnly=true")
977           .headers(httpHeaders)
978           .body(ElFileBody("onap-CQ-getClfiRoadmTailSummary.json"))
979           .check(
980             status.find.in(200)
981           )
982         )
983         .pause(1,1)
984      }
985
986   /***
987     *
988     * @param env
989     * @CQ-vrfs-fromVlantag
990     */
991   def CQvrfsfromVlantag(env: String) = scenario("CQ vrfsfromVlantag " + env)
992      .forever(){
993         exec(
994           http("CQ vrfsfromVlantag " + env)
995           .put("/aai/v22/query?format=resource")
996           .headers(httpHeaders)
997           .body(ElFileBody("onap-CQ-vrfs-fromVlantag.json"))
998           .check(
999             status.find.in(200)
1000           )
1001         )
1002         .pause(1,1)
1003      }
1004
1005   /***
1006     *
1007     * @param env
1008     * @CQ-genericVnfs-fromPserver
1009     */
1010   def CQgenericVnfsfromPserver(env: String) = scenario("CQ genericVnfsfromPserver " + env)
1011      .forever(){
1012         exec(
1013           http("CQ genericVnfsfromPserver " + env)
1014           .put("/aai/v22/query?format=resource&depth=0")
1015           .headers(httpHeaders)
1016           .body(ElFileBody("onap-CQ-genericVnfs-fromPserver.json"))
1017           .check(
1018             status.find.in(200)
1019           )
1020         )
1021         .pause(2,11)
1022      }
1023
1024   /***
1025     *
1026     * @param env
1027     * @CQ-zPnfs-fromPnf
1028     */
1029   def CQzPnfsfromPnf(env: String) = scenario("CQ zPnfsfromPnf " + env)
1030      .forever(){
1031         exec(
1032           http("CQ zPnfsfromPnf " + env)
1033           .put("/aai/v22/query?format=resource_and_url&depth=1")
1034           .headers(httpHeaders)
1035           .body(ElFileBody("onap-CQ-zPnfs-fromPnf.json"))
1036           .check(
1037             status.find.in(200)
1038           )
1039         )
1040         .pause(2,11)
1041      }
1042
1043     /***
1044     *
1045     * @param env
1046     * @DSL1
1047     */
1048  def DslQuery1(env: String) = scenario("DSL Query1 " + env)
1049     .forever(){
1050       exec(
1051         http("DSL Query1 PUT")
1052         .put("/aai/v21/dsl?format=resource")
1053         .headers(httpHeaders)
1054         .body(ElFileBody("onap-DSL1.json"))
1055         .check(
1056           status.find.in(200)
1057         )
1058       )
1059       .pause(2,3)
1060     }
1061
1062             /***
1063     *
1064     * @param env
1065     * @DSL2
1066     */
1067  def DslQuery2(env: String) = scenario("DSL Query2 " + env)
1068     .forever(){
1069       exec(
1070         http("DSL Query2 PUT")
1071         .put("/aai/v21/dsl?format=resource")
1072         .headers(httpHeaders)
1073         .body(ElFileBody("onap-DSL2.json"))
1074         .check(
1075           status.find.in(200)
1076         )
1077       )
1078       .pause(1,1)
1079     }
1080
1081             /***
1082     *
1083     * @param env
1084     * @DSL3
1085     */
1086  def DslQuery3(env: String) = scenario("DSL Query3 " + env)
1087     .forever(){
1088       exec(
1089         http("DSL Query3 PUT")
1090         .put("/aai/v21/dsl?format=resource")
1091         .headers(httpHeaders)
1092         .body(ElFileBody("onap-DSL3.json"))
1093         .check(
1094           status.find.in(200)
1095         )
1096       )
1097       .pause(2,4)
1098     }
1099
1100             /***
1101     *
1102     * @param env
1103     * @DSL4
1104     */
1105  def DslQuery4(env: String) = scenario("DSL Query4 " + env)
1106     .forever(){
1107       exec(
1108         http("DSL Query4 PUT")
1109         .put("/aai/v21/dsl?format=resource")
1110         .headers(httpHeaders)
1111         .body(ElFileBody("onap-DSL4.json"))
1112         .check(
1113           status.find.in(200)
1114         )
1115       )
1116       .pause(2,12)
1117     }
1118
1119             /***
1120     *
1121     * @param env
1122     * @DSL5
1123     */
1124  def DslQuery5(env: String) = scenario("DSL Query5 " + env)
1125     .forever(){
1126       exec(
1127         http("DSL Query5 PUT")
1128         .put("/aai/v21/dsl?format=resource")
1129         .headers(httpHeaders)
1130         .body(ElFileBody("onap-DSL5.json"))
1131         .check(
1132           status.find.in(200)
1133         )
1134       )
1135       .pause(2,13)
1136     }
1137
1138             /***
1139     *
1140     * @param env
1141     * @DSL6
1142     */
1143  def DslQuery6(env: String) = scenario("DSL Query6 " + env)
1144     .forever(){
1145       exec(
1146         http("DSL Query6 PUT")
1147         .put("/aai/v21/dsl?format=resource")
1148         .headers(httpHeaders)
1149         .body(ElFileBody("onap-DSL6.json"))
1150         .check(
1151           status.find.in(200)
1152         )
1153       )
1154       .pause(2,14)
1155     }
1156
1157             /***
1158     *
1159     * @param env
1160     * @DSL7
1161     */
1162  def DslQuery7(env: String) = scenario("DSL Query7 " + env)
1163     .forever(){
1164       exec(
1165         http("DSL Query7 PUT")
1166         .put("/aai/v21/dsl?format=resource")
1167         .headers(httpHeaders)
1168         .body(ElFileBody("onap-DSL7.json"))
1169         .check(
1170           status.find.in(200)
1171         )
1172       )
1173       .pause(2,19)
1174     }
1175
1176             /***
1177     *
1178     * @param env
1179     * @DSL8
1180     */
1181  def DslQuery8(env: String) = scenario("DSL Query8 " + env)
1182     .forever(){
1183       exec(
1184         http("DSL Query8 PUT")
1185         .put("/aai/v21/dsl?format=resource")
1186         .headers(httpHeaders)
1187         .body(ElFileBody("onap-DSL8.json"))
1188         .check(
1189           status.find.in(200)
1190         )
1191       )
1192       .pause(2,9)
1193     }
1194
1195             /***
1196     *
1197     * @param env
1198     * @DSL9
1199     */
1200  def DslQuery9(env: String) = scenario("DSL Query9 " + env)
1201     .forever(){
1202       exec(
1203         http("DSL Query9 PUT")
1204         .put("/aai/v21/dsl?format=resource")
1205         .headers(httpHeaders)
1206         .body(ElFileBody("onap-DSL9.json"))
1207         .check(
1208           status.find.in(200)
1209         )
1210       )
1211       .pause(2,7)
1212     }
1213
1214             /***
1215     *
1216     * @param env
1217     * @DSL10
1218     */
1219  def DslQuery10(env: String) = scenario("DSL Query10 " + env)
1220     .forever(){
1221       exec(
1222         http("DSL Query10 PUT")
1223         .put("/aai/v21/dsl?format=resource")
1224         .headers(httpHeaders)
1225         .headers(Map(
1226           "X-DslApiVersion"-> """V2"""
1227         ))
1228         .body(ElFileBody("onap-DSL10.json"))
1229         .check(
1230           status.find.in(200)
1231         )
1232       )
1233       .pause(2,32)
1234     }
1235
1236
1237   /***
1238     *
1239     * @param env
1240     * @Does a Search NodesQuery request
1241     */
1242   def SearchNodesQuery(env: String) = scenario("GET VNF Search Nodes Query " + env)
1243     .forever(){
1244        exec(
1245         http("GET VNF Search Nodes Query " + env)
1246         .get("/aai/v23/search/nodes-query?search-node-type=generic-vnf&filter=vnf-name:EQUALS:onap-genericvnfname")
1247         .headers(httpHeaders)
1248         .headers(Map(
1249           "X-FromAppId"-> """ONAP-fromappId"""
1250         ))
1251         .check(
1252           status.find.in(200)
1253         )
1254       )
1255     .pause(2,36)
1256     }
1257
1258
1259   setUp(
1260       PutTenant("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1261 PatchTenant("ePerf02").inject(atOnceUsers(115)).protocols(http.baseURL("Enter Host with Port")),
1262 GetTenant("ePerf02").inject(atOnceUsers(35)).protocols(http.baseURL("Enter Host with Port")),
1263 DeleteTenant("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1264 Getvserver1("ePerf02").inject(atOnceUsers(20)).protocols(http.baseURL("Enter Host with Port")),
1265 GetVFModule1("ePerf02").inject(atOnceUsers(10)).protocols(http.baseURL("Enter Host with Port")),
1266 Getvserver2("ePerf02").inject(atOnceUsers(10)).protocols(http.baseURL("Enter Host with Port")),
1267 GetSI1("ePerf02").inject(atOnceUsers(10)).protocols(http.baseURL("Enter Host with Port")),
1268 GetVNF1("ePerf02").inject(atOnceUsers(10)).protocols(http.baseURL("Enter Host with Port")),
1269 GetVNF2("ePerf02").inject(atOnceUsers(10)).protocols(http.baseURL("Enter Host with Port")),
1270 GetPserver1("ePerf02").inject(atOnceUsers(10)).protocols(http.baseURL("Enter Host with Port")),
1271 Getvolumegroup("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1272 Getplatform("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1273 Getsriovvf1("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1274 Getpnf1("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1275 Getvnfc1("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1276 Getvlan("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1277 GetSI2("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1278 GetPserver2("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1279 Getconfiguration("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1280 Getservicesubscription("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1281 Getpnf2("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1282 Getcustomer("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1283 Getowningentity("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1284 Getvnfc2("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1285 Getvlantag("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1286 Getproject("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1287 Getlob("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1288 Getsriovvf2("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1289 Getsnapshot("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1290 Getvolume("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1291 GetCR("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1292 PUTvfmodule("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1293 Getallservices("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1294 PostBulkSingleTx1("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1295 PostBulkSingleTx2("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1296 PostBulkSingleTx3("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1297 CQpserverzdevice1("ePerf02").inject(atOnceUsers(20)).protocols(http.baseURL("Enter Host with Port")),
1298 CQpserverzdevice2("ePerf02").inject(atOnceUsers(10)).protocols(http.baseURL("Enter Host with Port")),
1299 CQvlanrangefromVlantag("ePerf02").inject(atOnceUsers(10)).protocols(http.baseURL("Enter Host with Port")),
1300 CQgetClfiRoadmTailSummary("ePerf02").inject(atOnceUsers(10)).protocols(http.baseURL("Enter Host with Port")),
1301 CQvrfsfromVlantag("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1302 CQgenericVnfsfromPserver("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1303 CQzPnfsfromPnf("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1304 DslQuery1("ePerf02").inject(atOnceUsers(10)).protocols(http.baseURL("Enter Host with Port")),
1305 DslQuery2("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1306 DslQuery3("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1307 DslQuery4("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1308 DslQuery5("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1309 DslQuery6("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1310 DslQuery7("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1311 DslQuery8("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1312 DslQuery9("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1313 DslQuery10("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port")),
1314 SearchNodesQuery("ePerf02").inject(atOnceUsers(5)).protocols(http.baseURL("Enter Host with Port"))
1315
1316   ).maxDuration(10 minutes)
1317 }
1318