Fix for radio buttons
[sdc.git] / asdc-tests / src / test / resources / CI / importResource / deleteNormative.sh
1 #!/bin/bash
2
3 function usage {
4         echo "Usage: $0 <hostIp> <hostPort>"
5 }
6
7 function deleteResource() {
8         
9         ELEMENT_NAME=$1
10         echo -e "############### Removing Element ${ELEMENT_NAME} Start ######################"
11         http_code=$(curl -s -o /dev/null -w "%{http_code}" -X "DELETE" -H "USER_ID: jh0003" ${HOST_IP}:${HOST_PORT}/sdc2/rest/v1/catalog/resources/res_${ELEMENT_NAME}".1.0")
12         if [ ${http_code} -eq 204  ]; then
13                 echo -e "\n############### Removing Element ${ELEMENT_NAME} status code:${http_code} End #######\n\n\n"
14         elif [ ${http_code} -eq 500 ]; then
15                 echo -e "\n############### Failed to remove Element ${ELEMENT_NAME} status code:${http_code} End #######\n\n\n"
16                 exit 1
17         elif [ ${http_code} -eq 404 ]; then
18                 echo -e "\n############### Element ${ELEMENT_NAME} not found status code:${http_code} End #######\n\n\n"
19         else
20                 echo -e "\n############### Failed to remove Element ${ELEMENT_NAME} status code:${http_code} End #######\n\n\n"
21                 exit 1
22         fi
23 }
24 if [ $# -lt 2 ]
25 then
26         usage
27         exit 2
28 fi
29
30 HOST_IP=$1
31 HOST_PORT=$2
32
33 deleteResource "tosca.nodes.Root"
34 deleteResource "tosca.nodes.Compute"
35 deleteResource "tosca.nodes.SoftwareComponent"
36 deleteResource "tosca.nodes.WebServer"
37 deleteResource "tosca.nodes.WebApplication"
38 deleteResource "tosca.nodes.DBMS"
39 deleteResource "tosca.nodes.Database"
40 deleteResource "tosca.nodes.ObjectStorage"
41 deleteResource "tosca.nodes.BlockStorage"
42 deleteResource "tosca.nodes.Container.Runtime"
43 deleteResource "tosca.nodes.Container.Application"
44 deleteResource "tosca.nodes.LoadBalancer"
45 deleteResource "tosca.nodes.network.Port"
46 deleteResource "tosca.nodes.network.Network"
47
48 exit 0
49