14edb818e7ec5ba3174d20519a456a67b6a7a4b1
[it/dep.git] / nonrtric / data / run_in_k8s / populate_enrichment_data.sh
1 #!/bin/bash
2
3 #  ============LICENSE_START===============================================
4 #  Copyright (C) 2021 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 # This script will generate some dummy enrichment 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 ecs_host="enrichmentservice"
27 ecs_port="9082"
28 httpx=http
29
30 echo "ECS status:"
31 curl -skw " %{http_code}" $httpx://$ecs_host:$ecs_port/status
32 echo -e "\n"
33
34 # Create EiType
35 echo "Create EiType:"
36 curl -X PUT -skw %{http_code} $httpx://$ecs_host:$ecs_port/data-producer/v1/info-types/type1 -H accept:application/json -H Content-Type:application/json --data-binary @testdata/ECS/EiType.json
37 echo -e "\n"
38
39 # Get EiTypes
40 echo "Get EiTypes:"
41 curl -X GET -skw %{http_code} $httpx://$ecs_host:$ecs_port/data-producer/v1/info-types -H Content-Type:application/json
42 echo -e "\n"
43
44 # Get Individual EiType
45 echo "Get Individual EiType:"
46 curl -X GET -skw %{http_code} $httpx://$ecs_host:$ecs_port/data-producer/v1/info-types/type1 -H Content-Type:application/json
47 echo -e "\n"
48
49 # Create EiProducer
50 echo "Create EiProducer:"
51 curl -X PUT -skw %{http_code} $httpx://$ecs_host:$ecs_port/data-producer/v1/info-producers/1 -H Content-Type:application/json --data-binary @testdata/ECS/EiProducer.json
52 echo -e "\n"
53
54 # Get EiProducers
55 echo "Get EiProducers:"
56 curl -X GET -skw %{http_code} $httpx://$ecs_host:$ecs_port/data-producer/v1/info-producers -H Content-Type:application/json
57 echo -e "\n"
58
59 # Get Individual EiProducer
60 echo "Get Individual EiProducer:"
61 curl -X GET -skw %{http_code} $httpx://$ecs_host:$ecs_port/data-producer/v1/info-producers/1 -H Content-Type:application/json
62 echo -e "\n"
63
64 # Get Individual EiProducer Status
65 echo "Get Individual EiProducer:"
66 curl -X GET -skw %{http_code} $httpx://$ecs_host:$ecs_port/data-producer/v1/info-producers/1/status -H Content-Type:application/json
67 echo -e "\n"
68
69 # Create EiJob
70 echo "Create EiJob Of A Certain Type type1:"
71 curl -X PUT -skw %{http_code} $httpx://$ecs_host:$ecs_port/data-consumer/v1/info-jobs/job1 -H Content-Type:application/json --data-binary @testdata/ECS/EiJob.json
72 echo -e "\n"
73
74 # Get EiJobs
75 echo "Get EiJobs:"
76 curl -X GET -skw %{http_code} $httpx://$ecs_host:$ecs_port/data-consumer/v1/info-jobs -H Content-Type:application/json
77 echo -e "\n"
78
79 # Get Individual EiJob:
80 echo "Get Individual EiJob:"
81 curl -X GET -skw %{http_code} $httpx://$ecs_host:$ecs_port/data-consumer/v1/info-jobs/job1 -H Content-Type:application/json
82 echo -e "\n"