blob: 205fc8ce6d6b955cf6ae320c2457bbe897a77823 [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"}
31
32echo "using ecs port: "$ecs_port
33echo "using protocol: "$httpx
34echo -e "\n"
35
36echo "ECS status:"
37curl -skw " %{http_code}" $httpx://localhost:$ecs_port/status
38echo -e "\n"
39
ecaiyanlinux8011ac82021-02-03 11:10:23 +010040# Create EiType
41echo "Create EiType:"
42curl -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
43echo -e "\n"
44
ecaiyanlinuxdc962f42020-10-19 11:13:12 +020045# Get EiTypes
46echo "Get EiTypes:"
ecaiyanlinux8011ac82021-02-03 11:10:23 +010047curl -X GET -skw %{http_code} $httpx://localhost:$ecs_port/ei-producer/v1/eitypes -H Content-Type:application/json | jq
ecaiyanlinuxdc962f42020-10-19 11:13:12 +020048echo -e "\n"
49
ecaiyanlinuxc13a5aa2020-12-01 11:25:20 +010050# Get Individual EiType
51echo "Get Individual EiType:"
ecaiyanlinux8011ac82021-02-03 11:10:23 +010052curl -X GET -skw %{http_code} $httpx://localhost:$ecs_port/ei-producer/v1/eitypes/type1 -H Content-Type:application/json | jq
ecaiyanlinuxc13a5aa2020-12-01 11:25:20 +010053echo -e "\n"
54
ecaiyanlinux90ce1622020-12-02 12:50:02 +010055# Create EiProducer
56echo "Create EiProducer:"
ecaiyanlinux8011ac82021-02-03 11:10:23 +010057curl -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
ecaiyanlinux90ce1622020-12-02 12:50:02 +010058echo -e "\n"
59
ecaiyanlinuxdc962f42020-10-19 11:13:12 +020060# Get EiProducers
61echo "Get EiProducers:"
ecaiyanlinux8011ac82021-02-03 11:10:23 +010062curl -X GET -skw %{http_code} $httpx://localhost:$ecs_port/ei-producer/v1/eiproducers -H Content-Type:application/json | jq
ecaiyanlinuxdc962f42020-10-19 11:13:12 +020063echo -e "\n"
64
65# Get Individual EiProducer
66echo "Get Individual EiProducer:"
ecaiyanlinux8011ac82021-02-03 11:10:23 +010067curl -X GET -skw %{http_code} $httpx://localhost:$ecs_port/ei-producer/v1/eiproducers/1 -H Content-Type:application/json | jq
ecaiyanlinuxdc962f42020-10-19 11:13:12 +020068echo -e "\n"
69
70# Get Individual EiProducer Status
71echo "Get Individual EiProducer:"
ecaiyanlinux8011ac82021-02-03 11:10:23 +010072curl -X GET -skw %{http_code} $httpx://localhost:$ecs_port/ei-producer/v1/eiproducers/1/status -H Content-Type:application/json | jq
ecaiyanlinux90ce1622020-12-02 12:50:02 +010073echo -e "\n"
74
75# Create EiJob
76echo "Create EiJob Of A Certain Type type1:"
ecaiyanlinux8011ac82021-02-03 11:10:23 +010077curl -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
ecaiyanlinux90ce1622020-12-02 12:50:02 +010078echo -e "\n"
79
80# Get EiJobs
81echo "Get EiJobs:"
ecaiyanlinux8011ac82021-02-03 11:10:23 +010082curl -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 +010083echo -e "\n"
84
85# Get Individual EiJob:
86echo "Get Individual EiJob:"
ecaiyanlinux8011ac82021-02-03 11:10:23 +010087curl -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 +020088echo -e "\n"