#!/bin/bash set -o errexit set -o nounset set -o pipefail source _functions.sh base_url_clm=${base_url_clm:-"http://10.10.10.6:31856/v2"} base_url_ncm=${base_url_ncm:-"http://10.10.10.6:32737/v2"} base_url_orchestrator=${base_url_orchestrator:-"http://10.10.10.6:31298/v2"} base_url_ovnaction=${base_url_ovnaction:-"http://10.10.10.6:31181/v2"} # add clusters to clm # TODO one is added by default, add more if vfw demo is # extended to multiple clusters clusterprovidername="vfw-cluster-provider" clusterproviderdata="$(cat<" echo " kubeconfigfile2=" echo " packetgen_helm_path=" echo " firewall_helm_path=" echo " sink_helm_path=" echo " packetgen_profile_targz=" echo " firewall_profile_targz=" echo " sink_profile_targz=" echo " get - queries all resources in ncm, ovnaction, clm resources created for vfw" echo " delete - deletes all resources in ncm, ovnaction, clm resources created for vfw" echo " apply - applys the network intents - e.g. networks created in ncm" echo " instantiate - approves and instantiates the composite app via the generic deployment intent" echo " status - get status of deployed resources" echo " terminate - remove the vFW composite app resources and network resources create by 'instantiate' and 'apply'" echo "" echo " a reasonable test sequence:" echo " 1. create" echo " 2. apply" echo " 3. instantiate" echo " 4. status" echo " 5. terminate" exit } function check_for_env_settings { ok="" if [ "${kubeconfigfile}" == "oops" ] ; then echo -e "ERROR - kubeconfigfile environment variable needs to be set" ok="no" fi if [ "${kubeconfigfile2}" == "oops" ] ; then echo -e "ERROR - kubeconfigfile2 environment variable needs to be set" ok="no" fi if [ "${packetgen_helm_chart}" == "oops" ] ; then echo -e "ERROR - packetgen_helm_path environment variable needs to be set" ok="no" fi if [ "${firewall_helm_chart}" == "oops" ] ; then echo -e "ERROR - firewall_helm_path environment variable needs to be set" ok="no" fi if [ "${sink_helm_chart}" == "oops" ] ; then echo -e "ERROR - sink_helm_path environment variable needs to be set" ok="no" fi if [ "${packetgen_profile_file}" == "oops" ] ; then echo -e "ERROR - packetgen_profile_targz environment variable needs to be set" ok="no" fi if [ "${firewall_profile_file}" == "oops" ] ; then echo -e "ERROR - firewall_profile_targz environment variable needs to be set" ok="no" fi if [ "${sink_profile_file}" == "oops" ] ; then echo -e "ERROR - sink_profile_targz environment variable needs to be set" ok="no" fi if [ "${ok}" == "no" ] ; then echo "" usage fi } if [ "$#" -lt 1 ] ; then usage fi case "$1" in "create" ) check_for_env_settings createData ;; "get" ) getData ;; "delete" ) deleteData ;; "apply" ) applyNcmData ;; "instantiate" ) instantiateVfw ;; "terminate" ) terminateVfw ;; "status" ) query="" if [ "$#" -eq 2 ] ; then query="?$2" fi statusVfw ${query} ;; *) usage ;; esac