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