blob: 5871776f1d58da55b72b1fd5eb6b83c2ed960f79 [file] [log] [blame]
ecaiyanlinuxa3c38de2021-11-29 14:27:09 +01001#!/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 InfoProducer in ICS
23# one InfoType in ICS
24# one InfoJob in ICS
25
26# Run command:
27# ./prepareIcsData.sh [ICS port] [http/https]
28
29ics_port=${1:-8083}
30httpx=${4:-"http"}
31SHELL_FOLDER=$(cd "$(dirname "$0")";pwd)
32
33echo "using ics port: "$ics_port
34echo "using protocol: "$httpx
35echo -e "\n"
36
37echo "ICS status:"
38curl -skw " %{http_code}" $httpx://localhost:$ics_port/status
39echo -e "\n"
40
41# Create InfoType
42echo "Create InfoType:"
43curl -X PUT -skw %{http_code} $httpx://localhost:$ics_port/data-producer/v1/info-types/type1 -H accept:application/json -H Content-Type:application/json --data-binary @${SHELL_FOLDER}/testdata/ICS/InfoType.json
44echo -e "\n"
45
46# Get InfoTypes
47echo "Get InfoTypes:"
48curl -X GET -skw %{http_code} $httpx://localhost:$ics_port/data-producer/v1/info-types -H Content-Type:application/json | jq
49echo -e "\n"
50
51# Get Individual InfoType
52echo "Get Individual InfoType:"
53curl -X GET -skw %{http_code} $httpx://localhost:$ics_port/data-producer/v1/info-types/type1 -H Content-Type:application/json | jq
54echo -e "\n"
55
56# Create InfoProducer
57echo "Create InfoProducer:"
58curl -X PUT -skw %{http_code} $httpx://localhost:$ics_port/data-producer/v1/info-producers/1 -H Content-Type:application/json --data-binary @${SHELL_FOLDER}/testdata/ICS/InfoProducer.json
59echo -e "\n"
60
61# Get InfoProducers
62echo "Get InfoProducers:"
63curl -X GET -skw %{http_code} $httpx://localhost:$ics_port/data-producer/v1/info-producers -H Content-Type:application/json | jq
64echo -e "\n"
65
66# Get Individual InfoProducer
67echo "Get Individual InfoProducer:"
68curl -X GET -skw %{http_code} $httpx://localhost:$ics_port/data-producer/v1/info-producers/1 -H Content-Type:application/json | jq
69echo -e "\n"
70
71# Get Individual InfoProducer Status
72echo "Get Individual InfoProducer:"
73curl -X GET -skw %{http_code} $httpx://localhost:$ics_port/data-producer/v1/info-producers/1/status -H Content-Type:application/json | jq
74echo -e "\n"
75
76# Create InfoJob
77echo "Create InfoJob Of A Certain Type type1:"
78curl -X PUT -skw %{http_code} $httpx://localhost:$ics_port/A1-EI/v1/eijobs/job1 -H Content-Type:application/json --data-binary @${SHELL_FOLDER}/testdata/ICS/InfoJob.json
79echo -e "\n"
80
81# Get InfoJobs
82echo "Get InfoJobs:"
83curl -X GET -skw %{http_code} $httpx://localhost:$ics_port/A1-EI/v1/eijobs -H Content-Type:application/json | jq
84echo -e "\n"
85
86# Get Individual InfoJob:
87echo "Get Individual InfoJob:"
88curl -X GET -skw %{http_code} $httpx://localhost:$ics_port/A1-EI/v1/eijobs/job1 -H Content-Type:application/json | jq
89echo -e "\n"