From d038b60e65dcf6916445a03fe87a11a39c6516c8 Mon Sep 17 00:00:00 2001 From: Jordan Pittier Date: Fri, 4 Nov 2016 13:32:39 +0100 Subject: [PATCH] Neutron: use "OSC show -f value -c id" instead of "OSC list + grep" We should leverage server-side filtering. Change-Id: I3deef791868769b0b7cfc405d73dff57458ca427 --- exercises/neutron-adv-test.sh | 2 +- lib/tempest | 3 +-- tools/ping_neutron.sh | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/exercises/neutron-adv-test.sh b/exercises/neutron-adv-test.sh index bfd45eca5c..e8c8f62140 100755 --- a/exercises/neutron-adv-test.sh +++ b/exercises/neutron-adv-test.sh @@ -156,7 +156,7 @@ function get_role_id { function get_network_id { local NETWORK_NAME="$1" local NETWORK_ID - NETWORK_ID=`openstack network list | grep $NETWORK_NAME | awk '{print $2}'` + NETWORK_ID=`openstack network show -f value -c id $NETWORK_NAME` echo $NETWORK_ID } diff --git a/lib/tempest b/lib/tempest index f43036e12b..2816740180 100644 --- a/lib/tempest +++ b/lib/tempest @@ -242,8 +242,7 @@ function configure_tempest { # the public network (for floating ip access) is only available # if the extension is enabled. if is_networking_extension_supported 'external-net'; then - public_network_id=$(openstack network list | grep $PUBLIC_NETWORK_NAME | \ - awk '{print $2}') + public_network_id=$(openstack network show -f value -c id $PUBLIC_NETWORK_NAME) fi iniset $TEMPEST_CONFIG DEFAULT use_syslog $SYSLOG diff --git a/tools/ping_neutron.sh b/tools/ping_neutron.sh index c75575406a..73fe3f3bdf 100755 --- a/tools/ping_neutron.sh +++ b/tools/ping_neutron.sh @@ -54,7 +54,7 @@ fi REMAINING_ARGS="${@:2}" # BUG: with duplicate network names, this fails pretty hard. -NET_ID=$(openstack network list | grep "$NET_NAME" | awk '{print $2}') +NET_ID=$(openstack network show -f value -c id "$NET_NAME") PROBE_ID=$(neutron-debug probe-list -c id -c network_id | grep "$NET_ID" | awk '{print $2}' | head -n 1) # This runs a command inside the specific netns