aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/dcaegen2-services-son-handler/sonhandler/cps-sonhandler/cps/cps-setup.sh
blob: 4a969f3fa22e6beaa98f753b5de0f7c747b9d94a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash
    
#Building cps-tbdmt image
git clone "https://gerrit.onap.org/r/cps/cps-tbdmt"
mvn -f cps-tbdmt/ -Dmaven.test.skip clean install --settings settings.xml
sudo rm -r cps-tbdmt/

#Creating containers for cps and cps-tbdmt
docker-compose up -d

sleep 80
 
# Uploading data to cps & cps-tbdmt
CPS_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' cps-and-ncmp )
echo $CPS_IP
CPS_TBDMT_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' cps-tbdmt )
echo $CPS_TBDMT_IP

echo "Creating dataspace: "
curl --location --user cpsuser:cpsr0cks! -H "Accept: application/json" -H "Content-Type: application/json" \
	--request POST \
	http://$CPS_IP:8080/cps/api/v1/dataspaces?dataspace-name=sondataspace
sleep 5

echo "\nCreating schema sets: "
curl --location --user cpsuser:cpsr0cks! \
	--request POST \
	http://$CPS_IP:8080/cps/api/v1/dataspaces/sondataspace/schema-sets --form 'file=@"ran-network.zip"' --form 'schema-set-name="ran-network-schemaset"'

curl --location --user cpsuser:cpsr0cks! \
	--request POST \
	http://$CPS_IP:8080/cps/api/v1/dataspaces/sondataspace/schema-sets --form 'file=@"cps-ran-updated.zip"' --form 'schema-set-name="cps-ran-schemaset"'
sleep 5

echo "\nCreating anchor: "
curl --location --user cpsuser:cpsr0cks!  --request POST \
	http://$CPS_IP:8080/cps/api/v1/dataspaces/sondataspace/anchors?schema-set-name=ran-network-schemaset \
	-d anchor-name=ran-network-anchor

curl --location --user cpsuser:cpsr0cks!  --request POST \
	http://$CPS_IP:8080/cps/api/v1/dataspaces/sondataspace/anchors?schema-set-name=cps-ran-schemaset \
	-d anchor-name=cps-ran-anchor
sleep 5

echo "\nUploading cps payload "
curl --location --user cpsuser:cpsr0cks! --request POST \
	http://$CPS_IP:8080/cps/api/v1/dataspaces/sondataspace/anchors/ran-network-anchor/nodes \
	--header 'Content-Type: application/json' \
	-d @sim-data/payload-ran-network.json
sleep 5

curl --location --user cpsuser:cpsr0cks! --request POST \
	http://$CPS_IP:8080/cps/api/v1/dataspaces/sondataspace/anchors/cps-ran-anchor/nodes \
	--header 'Content-Type: application/json' \
	-d @sim-data/payload-cps-ran.json
sleep 5 
 
echo "\nUploading tbdmt-templates"

curl --location --request POST \
http://$CPS_TBDMT_IP:8080/templates \
	--header 'Content-Type: application/json' \
	--data-raw '{"templateId": "get-cell","model": "cps-ran-schemaset","requestType": "query-cps-path","xpathTemplate": "//NRCellCU[@idNRCellCU='\''{{cellId}}'\'']//ancestor::Regions","includeDescendants": true, "transformParam":"Regions"}'

sleep 3

curl --location --request POST \
http://$CPS_TBDMT_IP:8080/templates \
	--header 'Content-Type: application/json' \
	--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"}'

sleep 3

curl --location --request POST \
http://$CPS_TBDMT_IP:8080/templates \
	--header 'Content-Type: application/json' \
	--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"}'

sleep 3

curl --location --request POST \
http://$CPS_TBDMT_IP:8080/templates \
	--header 'Content-Type: application/json' \
	--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"}'

sleep 3