[DCAEGEN2] Update son-handler CSIT with CPS
[integration/csit.git] / scripts / dcaegen2-services-son-handler / sonhandler / cps-sonhandler / cps / cps-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 and cps-tbdmt
9 docker-compose up -d
10
11 sleep 80
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=sondataspace
23 sleep 5
24
25 echo "\nCreating schema sets: "
26 curl --location --user cpsuser:cpsr0cks! \
27         --request POST \
28         http://$CPS_IP:8080/cps/api/v1/dataspaces/sondataspace/schema-sets --form 'file=@"ran-network.zip"' --form 'schema-set-name="ran-network-schemaset"'
29
30 curl --location --user cpsuser:cpsr0cks! \
31         --request POST \
32         http://$CPS_IP:8080/cps/api/v1/dataspaces/sondataspace/schema-sets --form 'file=@"cps-ran-updated.zip"' --form 'schema-set-name="cps-ran-schemaset"'
33 sleep 5
34
35 echo "\nCreating anchor: "
36 curl --location --user cpsuser:cpsr0cks!  --request POST \
37         http://$CPS_IP:8080/cps/api/v1/dataspaces/sondataspace/anchors?schema-set-name=ran-network-schemaset \
38         -d anchor-name=ran-network-anchor
39
40 curl --location --user cpsuser:cpsr0cks!  --request POST \
41         http://$CPS_IP:8080/cps/api/v1/dataspaces/sondataspace/anchors?schema-set-name=cps-ran-schemaset \
42         -d anchor-name=cps-ran-anchor
43 sleep 5
44
45 echo "\nUploading cps payload "
46 curl --location --user cpsuser:cpsr0cks! --request POST \
47         http://$CPS_IP:8080/cps/api/v1/dataspaces/sondataspace/anchors/ran-network-anchor/nodes \
48         --header 'Content-Type: application/json' \
49         -d @sim-data/payload-ran-network.json
50 sleep 5
51
52 curl --location --user cpsuser:cpsr0cks! --request POST \
53         http://$CPS_IP:8080/cps/api/v1/dataspaces/sondataspace/anchors/cps-ran-anchor/nodes \
54         --header 'Content-Type: application/json' \
55         -d @sim-data/payload-cps-ran.json
56 sleep 5 
57  
58 echo "\nUploading tbdmt-templates"
59
60 curl --location --request POST \
61 http://$CPS_TBDMT_IP:8080/templates \
62         --header 'Content-Type: application/json' \
63         --data-raw '{"templateId": "get-cell","model": "cps-ran-schemaset","requestType": "query-cps-path","xpathTemplate": "//NRCellCU[@idNRCellCU='\''{{cellId}}'\'']//ancestor::Regions","includeDescendants": true, "transformParam":"Regions"}'
64
65 sleep 3
66
67 curl --location --request POST \
68 http://$CPS_TBDMT_IP:8080/templates \
69         --header 'Content-Type: application/json' \
70         --data-raw '{"templateId": "get-pnf","model": "ran-network-schemaset","requestType": "query-cps-path","xpathTemplate": "//NRCellDU[@idNRCellDU='\''{{cellId}}'\'']/ancestor::GNBDUFunction","includeDescendants": true,"transformParam":"ietf-inet-types:GNBDUFunction"}'
71
72 sleep 3
73
74 curl --location --request POST \
75 http://$CPS_TBDMT_IP:8080/templates \
76         --header 'Content-Type: application/json' \
77         --data-raw '{"templateId": "get-pci","model": "ran-network-schemaset","requestType": "query-cps-path","xpathTemplate": "//NRCellDU[@idNRCellDU='\''{{cellId}}'\'']","includeDescendants": true,"transformParam":"ietf-inet-types:NRCellDU,attributes"}'
78
79 sleep 3
80
81 curl --location --request POST \
82 http://$CPS_TBDMT_IP:8080/templates \
83         --header 'Content-Type: application/json' \
84         --data-raw '{"templateId": "get-nbr-list","model": "cps-ran-schemaset","requestType": "get","xpathTemplate": "/cps-ran-schema/Regions[@regionId='\''{{10000000}}'\'']/cps-region-cell-mapping/NRCellCU[@idNRCellCU='\''{{cellId}}'\'']","includeDescendants": true, "transformParam":"cps-ran-schema-model:NRCellCU"}'
85
86 sleep 3
87