blob: 21cc35b3180649c5887be880bde34c564468897d [file] [log] [blame]
ecaiyanlinuxdc962f42020-10-19 11:13:12 +02001#!/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
29ecs_port=${1:-8083}
30httpx=${4:-"http"}
ecaiyanlinux586432b2021-10-25 15:24:37 +020031SHELL_FOLDER=$(cd "$(dirname "$0")";pwd)
ecaiyanlinuxdc962f42020-10-19 11:13:12 +020032
33echo "using ecs port: "$ecs_port
34echo "using protocol: "$httpx
35echo -e "\n"
36
37echo "ECS status:"
38curl -skw " %{http_code}" $httpx://localhost:$ecs_port/status
39echo -e "\n"
40
ecaiyanlinux8011ac82021-02-03 11:10:23 +010041# Create EiType
42echo "Create EiType:"
ecaiyanlinux586432b2021-10-25 15:24:37 +020043curl -X PUT -skw %{http_code} $httpx://localhost:$ecs_port/data-producer/v1/info-types/type1 -H accept:application/json -H Content-Type:application/json --data-binary @${SHELL_FOLDER}/testdata/ECS/EiType.json
ecaiyanlinux8011ac82021-02-03 11:10:23 +010044echo -e "\n"
45
ecaiyanlinuxdc962f42020-10-19 11:13:12 +020046# Get EiTypes
47echo "Get EiTypes:"
ecaiyanlinux192aa4e2021-06-06 00:13:42 +080048curl -X GET -skw %{http_code} $httpx://localhost:$ecs_port/data-producer/v1/info-types -H Content-Type:application/json | jq
ecaiyanlinuxdc962f42020-10-19 11:13:12 +020049echo -e "\n"
50
ecaiyanlinuxc13a5aa2020-12-01 11:25:20 +010051# Get Individual EiType
52echo "Get Individual EiType:"
ecaiyanlinux192aa4e2021-06-06 00:13:42 +080053curl -X GET -skw %{http_code} $httpx://localhost:$ecs_port/data-producer/v1/info-types/type1 -H Content-Type:application/json | jq
ecaiyanlinuxc13a5aa2020-12-01 11:25:20 +010054echo -e "\n"
55
ecaiyanlinux90ce1622020-12-02 12:50:02 +010056# Create EiProducer
57echo "Create EiProducer:"
ecaiyanlinux586432b2021-10-25 15:24:37 +020058curl -X PUT -skw %{http_code} $httpx://localhost:$ecs_port/data-producer/v1/info-producers/1 -H Content-Type:application/json --data-binary @${SHELL_FOLDER}/testdata/ECS/EiProducer.json
ecaiyanlinux90ce1622020-12-02 12:50:02 +010059echo -e "\n"
60
ecaiyanlinuxdc962f42020-10-19 11:13:12 +020061# Get EiProducers
62echo "Get EiProducers:"
ecaiyanlinux192aa4e2021-06-06 00:13:42 +080063curl -X GET -skw %{http_code} $httpx://localhost:$ecs_port/data-producer/v1/info-producers -H Content-Type:application/json | jq
ecaiyanlinuxdc962f42020-10-19 11:13:12 +020064echo -e "\n"
65
66# Get Individual EiProducer
67echo "Get Individual EiProducer:"
ecaiyanlinux192aa4e2021-06-06 00:13:42 +080068curl -X GET -skw %{http_code} $httpx://localhost:$ecs_port/data-producer/v1/info-producers/1 -H Content-Type:application/json | jq
ecaiyanlinuxdc962f42020-10-19 11:13:12 +020069echo -e "\n"
70
71# Get Individual EiProducer Status
72echo "Get Individual EiProducer:"
ecaiyanlinux192aa4e2021-06-06 00:13:42 +080073curl -X GET -skw %{http_code} $httpx://localhost:$ecs_port/data-producer/v1/info-producers/1/status -H Content-Type:application/json | jq
ecaiyanlinux90ce1622020-12-02 12:50:02 +010074echo -e "\n"
75
76# Create EiJob
77echo "Create EiJob Of A Certain Type type1:"
ecaiyanlinux586432b2021-10-25 15:24:37 +020078curl -X PUT -skw %{http_code} $httpx://localhost:$ecs_port/A1-EI/v1/eijobs/job1 -H Content-Type:application/json --data-binary @${SHELL_FOLDER}/testdata/ECS/EiJob.json
ecaiyanlinux90ce1622020-12-02 12:50:02 +010079echo -e "\n"
80
81# Get EiJobs
82echo "Get EiJobs:"
ecaiyanlinux8011ac82021-02-03 11:10:23 +010083curl -X GET -skw %{http_code} $httpx://localhost:$ecs_port/A1-EI/v1/eijobs -H Content-Type:application/json | jq
ecaiyanlinux90ce1622020-12-02 12:50:02 +010084echo -e "\n"
85
86# Get Individual EiJob:
87echo "Get Individual EiJob:"
ecaiyanlinux8011ac82021-02-03 11:10:23 +010088curl -X GET -skw %{http_code} $httpx://localhost:$ecs_port/A1-EI/v1/eijobs/job1 -H Content-Type:application/json | jq
ecaiyanlinuxdc962f42020-10-19 11:13:12 +020089echo -e "\n"