Add new testcase for network slicing capacity in slice-analysis-ms
[integration/csit.git] / scripts / dcaegen2-services-slice-analysis-ms / slice-analysis-ms / cps-aai / cps-aai-setup.sh
1 #!/bin/bash
2
3 #Building cps-tbdmt image
4 git clone "https://gerrit.onap.org/r/cps/cps-tbdmt"
5 mvn -f cps-tbdmt/ -Dmaven.test.skip clean install --settings settings.xml
6 sudo rm -r cps-tbdmt/
7
8 #Creating containers for cps, cps-tbdmt & aai-resources
9 docker-compose up -d
10
11 sleep 50
12
13 # uploading data to cps & cps-tbdmt
14 CPS_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' cps-and-ncmp )
15 echo $CPS_IP
16 CPS_TBDMT_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' cps-tbdmt )
17 echo $CPS_TBDMT_IP
18
19 echo "Creating dataspace: "
20 curl --location --user cpsuser:cpsr0cks! -H "Accept: application/json" -H "Content-Type: application/json" \
21 --request POST \
22 http://$CPS_IP:8080/cps/api/v1/dataspaces?dataspace-name=E2EDemo
23
24 echo "\nCreating schema set: "
25 curl --location --user cpsuser:cpsr0cks! \
26 --request POST \
27 http://$CPS_IP:8080/cps/api/v1/dataspaces/E2EDemo/schema-sets --form 'file=@"ran-network.zip"' --form 'schema-set-name="ran-network"'
28
29 echo "\nCreating anchor: "
30 curl --location --user cpsuser:cpsr0cks!  --request POST \
31 http://$CPS_IP:8080/cps/api/v1/dataspaces/E2EDemo/anchors?schema-set-name=ran-network \
32 -d anchor-name=ran-network-anchor
33
34 echo "\nUploading cps payload "
35 curl --location --user cpsuser:cpsr0cks! --request POST \
36 http://$CPS_IP:8080/cps/api/v1/dataspaces/E2EDemo/anchors/ran-network-anchor/nodes \
37 --header 'Content-Type: application/json' \
38 -d @sim-data/payload-ran-network.json
39
40
41 echo "\nuploading tbdmt-templates"
42 curl --location --request POST \
43 http://$CPS_TBDMT_IP:8080/templates \
44 --header 'Content-Type: application/json' \
45 --data-raw '{"templateId": "get-nearrtric-config","model": "ran-network","requestType": "query-cps-path","xpathTemplate": "//sNSSAIList[@sNssai='\''{{sNssai}}'\'']/ancestor::NearRTRIC","includeDescendants": true,"transformParam":"NearRTRIC"}'
46
47 curl --location --request POST \
48 http://$CPS_TBDMT_IP:8080/templates \
49 --header 'Content-Type: application/json' \
50 --data-raw '{"templateId": "get-gnbdufunction-by-snssai","model": "ran-network","requestType": "query-cps-path","xpathTemplate": "//sNSSAIList[@sNssai='\''{{sNssai}}'\'']/ancestor::GNBDUFunction","includeDescendants": true,"transformParam":"GNBDUFunction"}'
51
52 curl --location --request POST \
53 http://$CPS_TBDMT_IP:8080/templates \
54 --header 'Content-Type: application/json' \
55 --data-raw '{"templateId": "get-nrcelldu-by-snssai","model": "ran-network","requestType": "query-cps-path","xpathTemplate": "//sNSSAIList[@sNssai='\''{{sNssai}}'\'']/ancestor::NearRTRIC","includeDescendants": true,"transformParam":"NearRTRIC"}'
56
57
58 ##Uploading aai data
59 AAI_RESOURCES_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' aai-resources )
60 echo "\nUploading data to aai-resources"
61 curl --request PUT -H "X-FromAppId:AAI " -H  "X-TransactionId:get_aai_subscr" -H "Accept:application/json" -H "Content-Type:application/json" -k \
62 https://$AAI_RESOURCES_IP:8447/aai/v21/business/customers/customer/5GCustomer \
63 -d @sim-data/customers.json -i
64
65 curl --request PUT -H "X-FromAppId:AAI " -H  "X-TransactionId:get_aai_subscr" -H "Accept:application/json" -H "Content-Type:application/json" -k \
66 https://$AAI_RESOURCES_IP:8447/aai/v21/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G \
67 -d @sim-data/service_subscriptions.json -i
68
69 curl --request PUT -H "X-FromAppId:AAI " -H  "X-TransactionId:get_aai_subscr" -H "Accept:application/json" -H "Content-Type:application/json" -k \
70 https://$AAI_RESOURCES_IP:8447/aai/v21/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/3f2f23fa-c567-4dd8-8f15-f95ae3e6fd84 \
71 -d @sim-data/service_instances.json -i
72
73 curl --request PUT -H "X-FromAppId:AAI " -H  "X-TransactionId:get_aai_subscr" -H "Accept:application/json" -H "Content-Type:application/json" -k \
74 https://$AAI_RESOURCES_IP:8447/aai/v24/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/3f2f23fa-c567-4dd8-8f15-f95ae3e6fd84/slice-profiles/slice-profile/684hf846f-863b-4901-b202-0ab86a638555 \
75 -d @sim-data/slice_profile.json -i
76
77 curl --request PUT -H "X-FromAppId:AAI " -H  "X-TransactionId:get_aai_subscr" -H "Accept:application/json" -H "Content-Type:application/json" -k \
78 https://$AAI_RESOURCES_IP:8447/aai/v21/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/b2ae730f-1d5f-495a-8112-dac017a7348c \
79 -d @sim-data/sliceprofile_an_sa1.json -i
80
81 curl --request PUT -H "X-FromAppId:AAI " -H  "X-TransactionId:get_aai_subscr" -H "Accept:application/json" -H "Content-Type:application/json" -k \
82 https://$AAI_RESOURCES_IP:8447/aai/v21/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/cad8fa36-2d55-4c12-a92e-1bd551517a0c \
83 -d @sim-data/sliceprofile_cn_sa1.json -i
84
85 curl --request PUT -H "X-FromAppId:AAI " -H  "X-TransactionId:get_aai_subscr" -H "Accept:application/json" -H "Content-Type:application/json" -k \
86 https://$AAI_RESOURCES_IP:8447/aai/v21/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/8d0d698e-77f4-4453-8c09-ae2cbe6a9a04 \
87 -d @sim-data/sliceprofile_tn_sa1.json -i
88
89 curl --request PUT -H "X-FromAppId:AAI " -H  "X-TransactionId:get_aai_subscr" -H "Accept:application/json" -H "Content-Type:application/json" -k \
90 https://$AAI_RESOURCES_IP:8447/aai/v21/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/0835fd19-6726-4081-befb-cc8932c47767 \
91 -d @sim-data/alloted-resource.json -i
92
93 curl --request PUT -H "X-FromAppId:AAI " -H  "X-TransactionId:get_aai_subscr" -H "Accept:application/json" -H "Content-Type:application/json" -k \
94 https://$AAI_RESOURCES_IP:8447/aai/v21/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/0835fd19-6726-4081-befb-cc8932c47767/allotted-resources/allotted-resource/530d188d-9087-49af-a44a-90c40e0c2d47 \
95 -d @sim-data/alloted-resource-data.json -i
96
97 curl --request PUT -H "X-FromAppId:AAI " -H  "X-TransactionId:get_aai_subscr" -H "Accept:application/json" -H "Content-Type:application/json" -k \
98 https://$AAI_RESOURCES_IP:8447/aai/v21/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/50f418a6-804f-4453-bf70-21f0efaf6fcd \
99 -d @sim-data/nssi.json -i
100
101 curl --request PUT -H "X-FromAppId:AAI " -H  "X-TransactionId:get_aai_subscr" -H "Accept:application/json" -H "Content-Type:application/json" -k \
102 https://$AAI_RESOURCES_IP:8447/aai/v21/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/09cad94e-fbb8-4c70-9c4d-74ec75e97683 \
103 -d @sim-data/nsi.json -i
104