Commit 445a4f56 authored by olivier.gremillet's avatar olivier.gremillet
Browse files

initial scripts from team 7

parent 8e32403f
Loading
Loading
Loading
Loading
Loading
+87 −0
Original line number Diff line number Diff line
#!/bin/bash
#microk8s kubectl get pods -o wide -A

#echo "List OSM ns"
#osm ns-list

E_OPTERR=65
mode=0
OSM_DESC_DIR=""

#Build a matrix of N entry
ns_names[1]="mysql"
nsd_names[1]="mysql_ns"
dir_dath_nsd[1]="mysql-ns"
dir_dath_vnfd[1]="mysql-vnf"

ns_names[2]="oai-nrf"
nsd_names[2]="oai-nrf_ns"
dir_dath_nsd[2]="nrf-ns"
dir_dath_vnfd[2]="nrf-vnf"

ns_names[3]="oai-amf"
nsd_names[3]="oai-amf_ns"
dir_dath_ns[3]="amf-ns"
dir_dath_vnfd[3]="amf-vnf"

#ns_names[3]="oai-smf"
echo "Total number of ns to launch: ${#ns_names[*]}"
#ns_id=["1", "2"]

start_step=1
end_step="${#ns_names[*]}"


if [ $# -eq 0 ] # Script invoked with no command-line args?
then
  echo "Usage: `basename $0` options (-rs) r for reverse   -s X to start at  X -e X to end at step Y"
  exit $E_OPTERROR # Exit and explain usage.
# Usage: scriptname -options
# Note: dash (-) necessary
fi


while getopts ":e:rs:" Option
do
  case $Option in
    e ) # Do something with variable 'g'.
         end_step=$OPTARG
	  ;;
    s ) # Do something with variable 'g'.
         start_step=$OPTARG
	  ;;
    r )
         echo "reserse mode uninstalling"      
	 mode=1
	 ;;
  esac
done
shift $(($OPTIND - 1))




#nbr_of_steps=$1
#mode=0

#if [ $2 -eq "-r" ]
#then
#  mode=1
#fi


#for ((i = 0; i < 3; i++)); do
if [ $mode = 0 ]
then
  for ((i = $start_step ; i < ( $end_step + 1 ) ; i++)); do
     echo "Deploying step $i:  ${ns_names[$i]}"
     echo "osm ns-create --ns_name ${ns_names[$i]} --nsd_name ${nsd_names[$i]} --vim_account hackfest"
     osm ns-create --ns_name "${ns_names[$i]}" --nsd_name "${nsd_names[$i]}" --vim_account hackfest --wait
  done
else
  for ((i = ( $end_step ) ; i> ( $start_step - 1  ); i--)); do
     echo "Undeploying step $i:  ${ns_names[$i]}"
     echo "osm ns-delete  ${ns_names[$i]}"
     osm ns-delete  ${ns_names[$i]}    
  done
fi
+87 −0
Original line number Diff line number Diff line
#!/bin/bash
#microk8s kubectl get pods -o wide -A

#echo "List OSM ns"
#osm ns-list

E_OPTERR=65
mode=0
OSM_DESC_DIR=""

#Build a matrix of N entry
ns_names[1]="mysql"
nsd_names[1]="mysql_ns"
dir_dath_nsd[1]="mysql-ns"
dir_dath_vnfd[1]="mysql-vnf"

ns_names[2]="oai-nrf"
nsd_names[2]="oai-nrf_ns"
dir_dath_nsd[2]="nrf-ns"
dir_dath_vnfd[2]="nrf-vnf"

ns_names[3]="oai-amf"
nsd_names[3]="oai-amf_ns"
dir_dath_ns[3]="amf-ns"
dir_dath_vnfd[3]="amf-vnf"

#ns_names[3]="oai-smf"
echo "Total number of ns to launch: ${#ns_names[*]}"
#ns_id=["1", "2"]

start_step=1
end_step="${#ns_names[*]}"


if [ $# -eq 0 ] # Script invoked with no command-line args?
then
  echo "Usage: `basename $0` options (-rs) r for reverse   -s X to start at  X -e X to end at step Y"
  exit $E_OPTERROR # Exit and explain usage.
# Usage: scriptname -options
# Note: dash (-) necessary
fi


while getopts ":e:rs:" Option
do
  case $Option in
    e ) # Do something with variable 'g'.
         end_step=$OPTARG
	  ;;
    s ) # Do something with variable 'g'.
         start_step=$OPTARG
	  ;;
    r )
         echo "reserse mode uninstalling"      
	 mode=1
	 ;;
  esac
done
shift $(($OPTIND - 1))




#nbr_of_steps=$1
#mode=0

#if [ $2 -eq "-r" ]
#then
#  mode=1
#fi


#for ((i = 0; i < 3; i++)); do
if [ $mode = 0 ]
then
  for ((i = $start_step ; i < ( $end_step + 1 ) ; i++)); do
     echo "Deploying step $i:  ${ns_names[$i]}"
     echo "osm ns-create --ns_name ${ns_names[$i]} --nsd_name ${nsd_names[$i]} --vim_account hackfest"
     osm ns-create --ns_name "${ns_names[$i]}" --nsd_name "${nsd_names[$i]}" --vim_account hackfest --wait
  done
else
  for ((i = ( $end_step ) ; i> ( $start_step - 1  ); i--)); do
     echo "Undeploying step $i:  ${ns_names[$i]}"
     echo "osm ns-delete  ${ns_names[$i]}"
     osm ns-delete  ${ns_names[$i]}    
  done
fi