2 # SPDX-license-identifier: Apache-2.0
3 ##############################################################################
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
16 source _common_test.sh
19 base_url="http://localhost:8081/v1/vnf_instances/"
22 csar_id=cb009bfe-bbee-11e8-9766-525400435678
26 _checks_args ${csar_id}
27 cp -R ./edgex/* ${CSAR_DIR}/${csar_id}/
32 \"cloud_region_id\": \"$cloud_region_id\",
33 \"namespace\": \"$namespace\",
34 \"csar_id\": \"$csar_id\"
37 payload=$(echo $payload_raw | tr '\n' ' ')
39 echo "Creating EdgeX VNF Instance"
41 vnf_id=$(curl -s -d "$payload" "${base_url}" | jq -r '.vnf_id')
43 echo "=== Validating Kubernetes ==="
44 kubectl get --no-headers=true --namespace=${namespace} deployment ${cloud_region_id}-${namespace}-${vnf_id}-edgex-core-command
45 kubectl get --no-headers=true --namespace=${namespace} service ${cloud_region_id}-${namespace}-${vnf_id}-edgex-core-command
46 echo "VNF Instance created succesfully with id: $vnf_id"
48 # TODO: Add heath checks to verify EdgeX services
50 vnf_id_list=$(curl -s -X GET "${base_url}${cloud_region_id}/${namespace}" | jq -r '.vnf_id_list')
51 if [[ "$vnf_id_list" != *"${vnf_id}"* ]]; then
53 echo "VNF Instance not stored"
57 vnf_details=$(curl -s -X GET "${base_url}${cloud_region_id}/${namespace}/${vnf_id}")
58 if [[ -z "$vnf_details" ]]; then
59 echo "Cannot retrieved VNF Instance details"
62 echo "VNF details $vnf_details"
64 echo "Deleting $vnf_id VNF Instance"
65 curl -X DELETE "${base_url}${cloud_region_id}/${namespace}/${vnf_id}"
66 if [[ -n $(curl -s -X GET "${base_url}${cloud_region_id}/${namespace}/${vnf_id}") ]]; then
67 echo "VNF Instance not deleted"