4 echo "Usage: $0 <hostIp> <hostPort> <userId>"
7 function addResource() {
10 echo -e "###################### Adding Element ${ELEMENT_NAME} Start ######################"
11 CURRENT_ZIP_FILE=./${ELEMENT_NAME}/normative-types-new-${ELEMENT_NAME}.zip
12 CURRENT_JSON_FILE=./${ELEMENT_NAME}/${ELEMENT_NAME}.json
13 sed -i 's/"userId": ".*",/"userId": "'${ATT_UID}'",/' ${CURRENT_JSON_FILE}
14 JSON_CONTENT=`paste -s ${CURRENT_JSON_FILE}`
15 http_code=$(curl -s -o /dev/null -w "%{http_code}" -v -F resourceMetadata="${JSON_CONTENT}" -F resourceZip=@${CURRENT_ZIP_FILE} -H USER_ID:${ATT_UID} ${HOST_IP}:${HOST_PORT}/sdc2/rest/v1/catalog/upload/multipart)
16 if [ ${http_code} -eq 201 ]; then
17 echo -e "\n###################### Adding Element ${ELEMENT_NAME} End ########################\n\n\n"
18 elif [ ${http_code} -eq 409 ]; then
19 echo -e "\n###################### Already exists Element ${ELEMENT_NAME} status code:${http_code} End ########################\n\n\n"
20 elif [ ${http_code} -eq 500 ]; then
21 echo -e "\n###################### Failed to add Element ${ELEMENT_NAME} status code:${http_code} End ########################\n\n\n"
35 #Add The CapabilityTypes
36 http_code=$(curl -s -o /dev/null -w "%{http_code}" -v -F capabilityTypeZip=@capabilityTypes.zip -H "USER_ID: jh0003" ${HOST_IP}:${HOST_PORT}/sdc2/rest/v1/catalog/uploadType/capability)
37 if [ ${http_code} -eq 201 ]; then
38 echo -e "\n###################### Adding The CapabilityTypes status code:${http_code} End ########################\n\n\n"
39 elif [ ${http_code} -eq 500 ]; then
40 echo -e "\n###################### Failed to add CapabilityTypes status code:${http_code} End ########################\n\n\n"
43 echo -e "\n###################### Failed to add CapabilityTypes status code:${http_code} End ########################\n\n\n"
46 #Add The InterfaceLifecycleTypes
47 http_code=$(curl -s -o /dev/null -w "%{http_code}" -v -F interfaceLifecycleTypeZip=@interfaceLifecycleTypes.zip -H "USER_ID: jh0003" ${HOST_IP}:${HOST_PORT}/sdc2/rest/v1/catalog/uploadType/interfaceLifecycle)
48 if [ ${http_code} -eq 201 ]; then
49 echo -e "\n###################### Adding The InterfaceLifecycleTypes status code:${http_code} End ########################\n\n\n"
50 elif [ ${http_code} -eq 409 ]; then
51 echo -e "\n###################### Already exists InterfaceLifecycleTypes status code:${http_code} End ########################\n\n\n"
52 elif [ ${http_code} -eq 500 ]; then
53 echo -e "\n###################### Failed to add InterfaceLifecycleTypes status code:${http_code} End ########################\n\n\n"
56 echo -e "\n###################### Failed to add InterfaceLifecycleTypes status code:${http_code} End ########################\n\n\n"
59 #Add The CategoryTypes
60 http_code=$(curl -s -o /dev/null -w "%{http_code}" -v -F categoriesZip=@categoryTypes.zip -H "USER_ID: jh0003" ${HOST_IP}:${HOST_PORT}/sdc2/rest/v1/catalog/uploadType/categories)
61 if [ ${http_code} -eq 201 ]; then
62 echo -e "\n###################### Adding The CategoryTypes status code:${http_code} End ########################\n\n\n"
63 elif [ ${http_code} -eq 409 ]; then
64 echo -e "\n###################### Already exists CategoryTypes status code:${http_code} End ########################\n\n\n"
65 elif [ ${http_code} -eq 500 ]; then
66 echo -e "\n###################### Failed to add CategoryTypes status code:${http_code} End ########################\n\n\n"
69 echo -e "\n###################### Failed to add CategoryTypes status code:${http_code} End ########################\n\n\n"
75 addResource "softwareComponent"
76 addResource "webServer"
77 addResource "webApplication"
79 addResource "database"
80 addResource "objectStorage"
81 addResource "blockStorage"
82 addResource "containerRuntime"
83 addResource "containerApplication"
84 addResource "loadBalancer"