Add test folder to the smo package installation
[it/dep.git] / smo-install / test / a1-validation / subscripts / prepareEcsData.sh
1 #!/bin/bash
2
3 #  ============LICENSE_START===============================================
4 #  Copyright (C) 2020 Nordix Foundation. All rights reserved.
5 #  ========================================================================
6 #  Licensed under the Apache License, Version 2.0 (the "License");
7 #  you may not use this file except in compliance with the License.
8 #  You may obtain a copy of the License at
9 #
10 #       http://www.apache.org/licenses/LICENSE-2.0
11 #
12 #  Unless required by applicable law or agreed to in writing, software
13 #  distributed under the License is distributed on an "AS IS" BASIS,
14 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 #  See the License for the specific language governing permissions and
16 #  limitations under the License.
17 #  ============LICENSE_END=================================================
18 #
19
20 # The scripts in data/ will generate some dummy data in the running system.
21 # It will create:
22 # one EiProducer in ECS
23 # one EiType in ECS
24 # one EiJob in ECS
25
26 # Run command:
27 # ./prepareEcsData.sh [ECS host]
28
29 ecs_url=${1:-localhost:9083}
30 httpx="http"
31
32 echo -e "\n"
33 echo "using ecs port: "$ecs_url
34 echo "using protocol: "$httpx
35 echo -e "\n"
36
37 echo "ECS status:"
38 curl -skw " %{http_code}" $httpx://$ecs_url/status
39 echo -e "\n"
40
41 # Create EiType
42 echo "Create EiType:"
43 curl -X PUT -skw %{http_code} $httpx://$ecs_url/data-producer/v1/info-types/type1 -H accept:application/json -H Content-Type:application/json --data-binary @../data/ECS/EiType.json
44 echo -e "\n"
45
46 # Get EiTypes
47 echo "Get EiTypes:"
48 curl -X GET -skw %{http_code} $httpx://$ecs_url/data-producer/v1/info-types -H Content-Type:application/json | jq
49 echo -e "\n"
50
51 # Get Individual EiType
52 echo "Get Individual EiType:"
53 curl -X GET -skw %{http_code} $httpx://$ecs_url/data-producer/v1/info-types/type1 -H Content-Type:application/json | jq
54 echo -e "\n"
55
56 # Create EiProducer
57 echo "Create EiProducer:"
58 curl -X PUT -skw %{http_code} $httpx://$ecs_url/data-producer/v1/info-producers/1 -H Content-Type:application/json --data-binary @../data/ECS/EiProducer.json
59 echo -e "\n"
60
61 # Get EiProducers
62 echo "Get EiProducers:"
63 curl -X GET -skw %{http_code} $httpx://$ecs_url/data-producer/v1/info-producers -H Content-Type:application/json | jq
64 echo -e "\n"
65
66 # Get Individual EiProducer
67 echo "Get Individual EiProducer:"
68 curl -X GET -skw %{http_code} $httpx://$ecs_url/data-producer/v1/info-producers/1 -H Content-Type:application/json | jq
69 echo -e "\n"
70
71 # Get Individual EiProducer Status
72 echo "Get Individual EiProducer:"
73 curl -X GET -skw %{http_code} $httpx://$ecs_url/data-producer/v1/info-producers/1/status -H Content-Type:application/json | jq
74 echo -e "\n"
75
76 # Create EiJob
77 echo "Create EiJob Of A Certain Type type1:"
78 curl -X PUT -skw %{http_code} $httpx://$ecs_url/A1-EI/v1/eijobs/job1 -H Content-Type:application/json --data-binary @../data/ECS/EiJob.json
79 echo -e "\n"
80
81 # Get EiJobs
82 echo "Get EiJobs:"
83 curl -X GET -skw %{http_code} $httpx://$ecs_url/A1-EI/v1/eijobs -H Content-Type:application/json | jq
84 echo -e "\n"
85
86 # Get Individual EiJob:
87 echo "Get Individual EiJob:"
88 curl -X GET -skw %{http_code} $httpx://$ecs_url/A1-EI/v1/eijobs/job1 -H Content-Type:application/json | jq
89 echo -e "\n"