Skip to content

Commit

Permalink
Neutron: use "OSC show -f value -c id" instead of "OSC list + grep"
Browse files Browse the repository at this point in the history
We should leverage server-side filtering.

Change-Id: I3deef791868769b0b7cfc405d73dff57458ca427
  • Loading branch information
Jordan Pittier committed Nov 18, 2016
1 parent 1493bde commit d038b60
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion exercises/neutron-adv-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
3 changes: 1 addition & 2 deletions lib/tempest
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tools/ping_neutron.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d038b60

Please sign in to comment.