Merge "migrating to proposed common network settings file"
authorDan Radez <dradez@redhat.com>
Mon, 26 Sep 2016 20:02:30 +0000 (20:02 +0000)
committerGerrit Code Review <gerrit@172.30.200.206>
Mon, 26 Sep 2016 20:02:30 +0000 (20:02 +0000)
1  2 
lib/common-functions.sh
lib/parse-functions.sh

diff --combined lib/common-functions.sh
@@@ -33,12 -33,12 +33,12 @@@ function find_ip 
      af=$2
    fi
  
-   python3.4 -B $LIB/python/apex_python_utils.py find-ip -i $1 -af $af
+   python3 -B $LIB/python/apex_python_utils.py find-ip -i $1 -af $af
  }
  
  ##attach interface to OVS and set the network config correctly
  ##params: bride to attach to, interface to attach, network type (optional)
- ##public indicates attaching to a public interface
+ ##external indicates attaching to a external interface
  function attach_interface_to_ovs {
    local bridge interface
    local if_ip if_mask if_gw if_file ovs_file if_prefix
  
    if [ -z "$if_mask" ]; then
      # we can look for PREFIX here, then convert it to NETMASK
 -    if_prefix=$(sed -n 's/^PREFIX=\(.*\)$/\1/p' ${if_file})
 +    if_prefix=$(sed -n 's/^PREFIX=[^0-9]*\([0-9][0-9]*\)[^0-9]*$/\1/p' ${if_file})
      if_mask=$(prefix2mask ${if_prefix})
    fi
  
    if [[ -z "$if_ip" || -z "$if_mask" ]]; then
      echo "ERROR: IPADDR or NETMASK/PREFIX missing for ${interface}"
      return 1
-   elif [[ -z "$if_gw" && "$3" == "public_network" ]]; then
-     echo "ERROR: GATEWAY missing for ${interface}, which is public"
+   elif [[ -z "$if_gw" && "$3" == "external" ]]; then
+     echo "ERROR: GATEWAY missing for ${interface}, which is external"
      return 1
    fi
  
diff --combined lib/parse-functions.sh
  
  # Parser functions used by OPNFV Apex
  
 -##translates yaml into variables
 -##params: filename, prefix (ex. "config_")
 -##usage: parse_yaml opnfv_ksgen_settings.yml "config_"
 -parse_yaml() {
 -   local prefix=$2
 -   local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
 -   sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \
 -        -e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p"  $1 |
 -   awk -F$fs '{
 -      indent = length($1)/2;
 -      vname[indent] = $2;
 -      for (i in vname) {if (i > indent) {delete vname[i]}}
 -      if (length($3) > 0) {
 -         vn=""; for (i=0; i<indent; i++) {vn=(vn)(vname[i])("_")}
 -         printf("%s%s%s=%s\n", "'$prefix'",vn, $2, $3);
 -      }
 -   }'
 -}
 -
 -##parses variable from a string with '='
 -##and removes global prefix
 -##params: string, prefix
 -##usage: parse_setting_var 'deploy_myvar=2' 'deploy_'
 -parse_setting_var() {
 -  local mystr=$1
 -  local prefix=$2
 -  if echo $mystr | grep -E "^.+\=" > /dev/null; then
 -    echo $(echo $mystr | grep -Eo "^.+\=" | tr -d '=' |  sed 's/^'"$prefix"'//')
 -  else
 -    return 1
 -  fi
 -}
 -##parses value from a string with '='
 -##params: string
 -##usage: parse_setting_value
 -parse_setting_value() {
 -  local mystr=$1
 -  echo $(echo $mystr | grep -Eo "\=.*$" | tr -d '=')
 -}
 -
  ##parses network settings yaml into globals
  parse_network_settings() {
    local output parse_ext
@@@ -38,7 -78,7 +38,7 @@@
        echo -e "${red}ERROR: flat network is not supported with ovs-dpdk ${reset}"
        exit 1
      fi
-     if [[ ! $enabled_network_list =~ "private_network" ]]; then
+     if [[ ! $enabled_network_list =~ "tenant" ]]; then
        echo -e "${red}ERROR: tenant network is not enabled for ovs-dpdk ${reset}"
        exit 1
      fi