From d1f41687819af6a6f1254b8f2d3ecdd428a0c2fd Mon Sep 17 00:00:00 2001 From: fmenguy Date: Fri, 4 Jun 2021 14:34:49 +0200 Subject: NFVBENCH-213 Add clouds.yaml management in generator VM Change-Id: Ia741847f886a291f0b0d7276e36d5c18f7819185 Signed-off-by: fmenguy --- .../nfvbenchvm/static/etc/rc.d/rc.local.generator | 9 ++------- .../static/nfvbench/configure-nfvbench.sh | 23 +++++++++------------- 2 files changed, 11 insertions(+), 21 deletions(-) (limited to 'nfvbenchvm/dib/elements/nfvbenchvm/static') diff --git a/nfvbenchvm/dib/elements/nfvbenchvm/static/etc/rc.d/rc.local.generator b/nfvbenchvm/dib/elements/nfvbenchvm/static/etc/rc.d/rc.local.generator index 0746fd6..633403c 100644 --- a/nfvbenchvm/dib/elements/nfvbenchvm/static/etc/rc.d/rc.local.generator +++ b/nfvbenchvm/dib/elements/nfvbenchvm/static/etc/rc.d/rc.local.generator @@ -4,7 +4,6 @@ touch /var/lock/subsys/local # Waiting for cloud-init to generate $NFVBENCH_CONF, retry 60 seconds NFVBENCH_CONF=/etc/nfvbenchvm.conf -OPENRC=/etc/nfvbench/openrc retry=30 until [ $retry -eq 0 ]; do if [ -f $NFVBENCH_CONF ]; then break; fi @@ -20,10 +19,6 @@ echo "Generating configurations for NFVbench and TRex..." eval $(cat $NFVBENCH_CONF) touch /nfvbench_configured.flag -if [ -f $OPENRC ]; then - source $OPENRC -fi - # Add DNS entry if [ $DNS_SERVERS ]; then IFS="," read -a dns <<< $DNS_SERVERS @@ -80,8 +75,8 @@ get_eth_port() { if [ $INTF_MGMT_CIDR ] && [ $INTF_MGMT_IP_GW ]; then if [ $INTF_MAC_MGMT ]; then ETH_PORT=$(get_eth_port $INTF_MAC_MGMT) - elif [ -f $OPENRC ] && [ "$PORT_MGMT_NAME" ]; then - $INTF_MAC_MGMT=$(openstack port list | grep $PORT_MGMT_NAME | grep -o -Ei '([a-fA-F0-9:]{17}|[a-fA-F0-9]{12}$)' | head -1) + elif [ "$CLOUD_DETAIL" ] && [ "$PORT_MGMT_NAME" ]; then + $INTF_MAC_MGMT=$(openstack --os-cloud $CLOUD_DETAIL port list | grep $PORT_MGMT_NAME | grep -o -Ei '([a-fA-F0-9:]{17}|[a-fA-F0-9]{12}$)' | head -1) ETH_PORT=$(get_eth_port $INTF_MAC_MGMT) else ETH_PORT="" diff --git a/nfvbenchvm/dib/elements/nfvbenchvm/static/nfvbench/configure-nfvbench.sh b/nfvbenchvm/dib/elements/nfvbenchvm/static/nfvbench/configure-nfvbench.sh index 5ec584b..3bf1d8d 100644 --- a/nfvbenchvm/dib/elements/nfvbenchvm/static/nfvbench/configure-nfvbench.sh +++ b/nfvbenchvm/dib/elements/nfvbenchvm/static/nfvbench/configure-nfvbench.sh @@ -6,15 +6,10 @@ NFVBENCH_CONF=/etc/nfvbenchvm.conf E2E_CFG=/etc/nfvbench/e2e.cfg LOOPBACK_CFG=/etc/nfvbench/loopback.cfg NFVBENCH_CFG=/etc/nfvbench/nfvbench.cfg -OPENRC=/etc/nfvbench/openrc # Parse and obtain all configurations eval $(cat $NFVBENCH_CONF) -if [ -f $OPENRC ]; then - source $OPENRC -fi - # WE assume there are at least 2 cores available for the VM CPU_CORES=$(grep -c ^processor /proc/cpuinfo) @@ -88,21 +83,21 @@ get_interfaces_mac_values(){ # Set dynamically interfaces mac values, if VM is spawn with SRIOV PF ports # and openstack API are accessible if [ -z "$LOOPBACK_INTF_MAC1" ] && [ -z "$LOOPBACK_INTF_MAC2" ]; then - if [ -f $OPENRC ] && [ "$LOOPBACK_PORT_NAME1" ] && [ "$LOOPBACK_PORT_NAME2" ]; then - LOOPBACK_INTF_MAC1=$(openstack port list | grep $LOOPBACK_PORT_NAME1 | grep -o -Ei '([a-fA-F0-9:]{17}|[a-fA-F0-9]{12}$)' | head -1) - LOOPBACK_INTF_MAC2=$(openstack port list | grep $LOOPBACK_PORT_NAME2 | grep -o -Ei '([a-fA-F0-9:]{17}|[a-fA-F0-9]{12}$)' | head -1) + if [ "$CLOUD_DETAIL" ] && [ "$LOOPBACK_PORT_NAME1" ] && [ "$LOOPBACK_PORT_NAME2" ]; then + LOOPBACK_INTF_MAC1=$(openstack --os-cloud $CLOUD_DETAIL port list | grep $LOOPBACK_PORT_NAME1 | grep -o -Ei '([a-fA-F0-9:]{17}|[a-fA-F0-9]{12}$)' | head -1) + LOOPBACK_INTF_MAC2=$(openstack --os-cloud $CLOUD_DETAIL port list | grep $LOOPBACK_PORT_NAME2 | grep -o -Ei '([a-fA-F0-9:]{17}|[a-fA-F0-9]{12}$)' | head -1) fi fi if [ -z "$E2E_INTF_MAC1" ] && [ -z "$E2E_INTF_MAC2" ]; then - if [ -f $OPENRC ] && [ "$E2E_PORT_NAME1" ] && [ "$E2E_PORT_NAME2" ]; then - E2E_INTF_MAC1=$(openstack port list | grep $E2E_PORT_NAME1 | grep -o -Ei '([a-fA-F0-9:]{17}|[a-fA-F0-9]{12}$)' | head -1) - E2E_INTF_MAC2=$(openstack port list | grep $E2E_PORT_NAME2 | grep -o -Ei '([a-fA-F0-9:]{17}|[a-fA-F0-9]{12}$)' | head -1) + if [ "$CLOUD_DETAIL" ] && [ "$E2E_PORT_NAME1" ] && [ "$E2E_PORT_NAME2" ]; then + E2E_INTF_MAC1=$(openstack --os-cloud $CLOUD_DETAIL port list | grep $E2E_PORT_NAME1 | grep -o -Ei '([a-fA-F0-9:]{17}|[a-fA-F0-9]{12}$)' | head -1) + E2E_INTF_MAC2=$(openstack --os-cloud $CLOUD_DETAIL port list | grep $E2E_PORT_NAME2 | grep -o -Ei '([a-fA-F0-9:]{17}|[a-fA-F0-9]{12}$)' | head -1) fi fi if [ -z "$INTF_MAC1" ] && [ -z "$INTF_MAC2" ]; then - if [ -f $OPENRC ] && [ "$PORT_NAME1" ] && [ "$PORT_NAME2" ]; then - INTF_MAC1=$(openstack port list | grep $PORT_NAME1 | grep -o -Ei '([a-fA-F0-9:]{17}|[a-fA-F0-9]{12}$)' | head -1) - INTF_MAC2=$(openstack port list | grep $PORT_NAME2 | grep -o -Ei '([a-fA-F0-9:]{17}|[a-fA-F0-9]{12}$)' | head -1) + if [ "$CLOUD_DETAIL" ] && [ "$PORT_NAME1" ] && [ "$PORT_NAME2" ]; then + INTF_MAC1=$(openstack --os-cloud $CLOUD_DETAIL port list | grep $PORT_NAME1 | grep -o -Ei '([a-fA-F0-9:]{17}|[a-fA-F0-9]{12}$)' | head -1) + INTF_MAC2=$(openstack --os-cloud $CLOUD_DETAIL port list | grep $PORT_NAME2 | grep -o -Ei '([a-fA-F0-9:]{17}|[a-fA-F0-9]{12}$)' | head -1) fi fi } -- cgit 1.2.3-korg