ecaiyanlinux | dc962f4 | 2020-10-19 11:13:12 +0200 | [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 EiProducer in ECS |
| 23 | # one EiType in ECS |
| 24 | # one EiJob in ECS |
| 25 | |
| 26 | # Run command: |
| 27 | # ./prepareEcsData.sh [ECS port] [http/https] |
| 28 | |
| 29 | ecs_port=${1:-8083} |
| 30 | httpx=${4:-"http"} |
| 31 | |
| 32 | echo "using ecs port: "$ecs_port |
| 33 | echo "using protocol: "$httpx |
| 34 | echo -e "\n" |
| 35 | |
| 36 | echo "ECS status:" |
| 37 | curl -skw " %{http_code}" $httpx://localhost:$ecs_port/status |
| 38 | echo -e "\n" |
| 39 | |
ecaiyanlinux | 8011ac8 | 2021-02-03 11:10:23 +0100 | [diff] [blame^] | 40 | # Create EiType |
| 41 | echo "Create EiType:" |
| 42 | curl -X PUT -skw %{http_code} $httpx://localhost:$ecs_port/ei-producer/v1/eitypes/type1 -H accept:application/json -H Content-Type:application/json --data-binary @testdata/ECS/EiType.json |
| 43 | echo -e "\n" |
| 44 | |
ecaiyanlinux | dc962f4 | 2020-10-19 11:13:12 +0200 | [diff] [blame] | 45 | # Get EiTypes |
| 46 | echo "Get EiTypes:" |
ecaiyanlinux | 8011ac8 | 2021-02-03 11:10:23 +0100 | [diff] [blame^] | 47 | curl -X GET -skw %{http_code} $httpx://localhost:$ecs_port/ei-producer/v1/eitypes -H Content-Type:application/json | jq |
ecaiyanlinux | dc962f4 | 2020-10-19 11:13:12 +0200 | [diff] [blame] | 48 | echo -e "\n" |
| 49 | |
ecaiyanlinux | c13a5aa | 2020-12-01 11:25:20 +0100 | [diff] [blame] | 50 | # Get Individual EiType |
| 51 | echo "Get Individual EiType:" |
ecaiyanlinux | 8011ac8 | 2021-02-03 11:10:23 +0100 | [diff] [blame^] | 52 | curl -X GET -skw %{http_code} $httpx://localhost:$ecs_port/ei-producer/v1/eitypes/type1 -H Content-Type:application/json | jq |
ecaiyanlinux | c13a5aa | 2020-12-01 11:25:20 +0100 | [diff] [blame] | 53 | echo -e "\n" |
| 54 | |
ecaiyanlinux | 90ce162 | 2020-12-02 12:50:02 +0100 | [diff] [blame] | 55 | # Create EiProducer |
| 56 | echo "Create EiProducer:" |
ecaiyanlinux | 8011ac8 | 2021-02-03 11:10:23 +0100 | [diff] [blame^] | 57 | curl -X PUT -skw %{http_code} $httpx://localhost:$ecs_port/ei-producer/v1/eiproducers/1 -H Content-Type:application/json --data-binary @testdata/ECS/EiProducer.json |
ecaiyanlinux | 90ce162 | 2020-12-02 12:50:02 +0100 | [diff] [blame] | 58 | echo -e "\n" |
| 59 | |
ecaiyanlinux | dc962f4 | 2020-10-19 11:13:12 +0200 | [diff] [blame] | 60 | # Get EiProducers |
| 61 | echo "Get EiProducers:" |
ecaiyanlinux | 8011ac8 | 2021-02-03 11:10:23 +0100 | [diff] [blame^] | 62 | curl -X GET -skw %{http_code} $httpx://localhost:$ecs_port/ei-producer/v1/eiproducers -H Content-Type:application/json | jq |
ecaiyanlinux | dc962f4 | 2020-10-19 11:13:12 +0200 | [diff] [blame] | 63 | echo -e "\n" |
| 64 | |
| 65 | # Get Individual EiProducer |
| 66 | echo "Get Individual EiProducer:" |
ecaiyanlinux | 8011ac8 | 2021-02-03 11:10:23 +0100 | [diff] [blame^] | 67 | curl -X GET -skw %{http_code} $httpx://localhost:$ecs_port/ei-producer/v1/eiproducers/1 -H Content-Type:application/json | jq |
ecaiyanlinux | dc962f4 | 2020-10-19 11:13:12 +0200 | [diff] [blame] | 68 | echo -e "\n" |
| 69 | |
| 70 | # Get Individual EiProducer Status |
| 71 | echo "Get Individual EiProducer:" |
ecaiyanlinux | 8011ac8 | 2021-02-03 11:10:23 +0100 | [diff] [blame^] | 72 | curl -X GET -skw %{http_code} $httpx://localhost:$ecs_port/ei-producer/v1/eiproducers/1/status -H Content-Type:application/json | jq |
ecaiyanlinux | 90ce162 | 2020-12-02 12:50:02 +0100 | [diff] [blame] | 73 | echo -e "\n" |
| 74 | |
| 75 | # Create EiJob |
| 76 | echo "Create EiJob Of A Certain Type type1:" |
ecaiyanlinux | 8011ac8 | 2021-02-03 11:10:23 +0100 | [diff] [blame^] | 77 | curl -X PUT -skw %{http_code} $httpx://localhost:$ecs_port/A1-EI/v1/eijobs/job1 -H Content-Type:application/json --data-binary @testdata/ECS/EiJob.json |
ecaiyanlinux | 90ce162 | 2020-12-02 12:50:02 +0100 | [diff] [blame] | 78 | echo -e "\n" |
| 79 | |
| 80 | # Get EiJobs |
| 81 | echo "Get EiJobs:" |
ecaiyanlinux | 8011ac8 | 2021-02-03 11:10:23 +0100 | [diff] [blame^] | 82 | curl -X GET -skw %{http_code} $httpx://localhost:$ecs_port/A1-EI/v1/eijobs -H Content-Type:application/json | jq |
ecaiyanlinux | 90ce162 | 2020-12-02 12:50:02 +0100 | [diff] [blame] | 83 | echo -e "\n" |
| 84 | |
| 85 | # Get Individual EiJob: |
| 86 | echo "Get Individual EiJob:" |
ecaiyanlinux | 8011ac8 | 2021-02-03 11:10:23 +0100 | [diff] [blame^] | 87 | curl -X GET -skw %{http_code} $httpx://localhost:$ecs_port/A1-EI/v1/eijobs/job1 -H Content-Type:application/json | jq |
ecaiyanlinux | dc962f4 | 2020-10-19 11:13:12 +0200 | [diff] [blame] | 88 | echo -e "\n" |