| tierno | f7aa8c4 | 2016-09-06 16:43:04 +0200 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | ## |
| 4 | # Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U. |
| tierno | 9a61c6b | 2016-09-08 10:57:02 +0200 | [diff] [blame] | 5 | # This file is part of openvim |
| tierno | f7aa8c4 | 2016-09-06 16:43:04 +0200 | [diff] [blame] | 6 | # All Rights Reserved. |
| 7 | # |
| 8 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 9 | # not use this file except in compliance with the License. You may obtain |
| 10 | # a copy of the License at |
| 11 | # |
| 12 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 13 | # |
| 14 | # Unless required by applicable law or agreed to in writing, software |
| 15 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 16 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 17 | # License for the specific language governing permissions and limitations |
| 18 | # under the License. |
| 19 | # |
| 20 | # For those usages not covered by the Apache License, Version 2.0 please |
| 21 | # contact with: nfvlabs@tid.es |
| 22 | ## |
| 23 | |
| 24 | # |
| 25 | #author Alfonso Tierno |
| 26 | # |
| 27 | #script that obtain the parameters from the configuration file |
| 28 | #it is a bit unsafe because a comment in the yaml configuration file |
| 29 | #can wrong this script |
| 30 | |
| 31 | #get params from configuration file |
| 32 | |
| 33 | [ -z "$1" ] && echo "usage: $0 [openvim_cfg_file]" && exit |
| 34 | |
| 35 | OPENVIM_PORT=`grep http_port: $1` |
| 36 | OPENVIM_PORT=${OPENVIM_PORT#http_port:} |
| 37 | OPENVIM_PORT=${OPENVIM_PORT%%#*} |
| 38 | OPENVIM_PORT=`eval echo ${OPENVIM_PORT}` # remove white spaces |
| 39 | |
| 40 | OPENVIM_ADMIN_PORT=`grep http_admin_port: $1` |
| 41 | OPENVIM_ADMIN_PORT=${OPENVIM_ADMIN_PORT#http_admin_port:} |
| 42 | OPENVIM_ADMIN_PORT=${OPENVIM_ADMIN_PORT%%#*} |
| 43 | OPENVIM_ADMIN_PORT=`eval echo ${OPENVIM_ADMIN_PORT}` # remove white spaces |
| 44 | |
| 45 | OPENVIM_HOST=`grep http_host: $1` |
| 46 | OPENVIM_HOST=${OPENVIM_HOST#http_host:} |
| 47 | OPENVIM_HOST=${OPENVIM_HOST%%#*} |
| 48 | OPENVIM_HOST=`eval echo ${OPENVIM_HOST}` # remove white spaces |
| 49 | |
| 50 | OPENVIM_OF_IP=`grep of_controller_ip: $1` |
| 51 | OPENVIM_OF_IP=${OPENVIM_OF_IP#of_controller_ip:} |
| 52 | OPENVIM_OF_IP=${OPENVIM_OF_IP%%#*} |
| 53 | OPENVIM_OF_IP=`eval echo ${OPENVIM_OF_IP}` # remove white spaces |
| 54 | |
| 55 | OPENVIM_OF_PORT=`grep of_controller_port: $1` |
| 56 | OPENVIM_OF_PORT=${OPENVIM_OF_PORT#of_controller_port:} |
| 57 | OPENVIM_OF_PORT=${OPENVIM_OF_PORT%%#*} |
| 58 | OPENVIM_OF_PORT=`eval echo ${OPENVIM_OF_PORT}` # remove white spaces |
| 59 | |
| 60 | OPENVIM_OF_DPID=`grep of_controller_dpid: $1` |
| 61 | OPENVIM_OF_DPID=${OPENVIM_OF_DPID#of_controller_dpid:} |
| 62 | OPENVIM_OF_DPID=${OPENVIM_OF_DPID%%#*} |
| 63 | OPENVIM_OF_DPID=`eval echo ${OPENVIM_OF_DPID}` # remove white spaces |
| 64 | |