Skip to content

Instantly share code, notes, and snippets.

@ajayhn
Last active August 29, 2015 14:14
Show Gist options
  • Save ajayhn/85abc60ed24ff1c5218d to your computer and use it in GitHub Desktop.
Save ajayhn/85abc60ed24ff1c5218d to your computer and use it in GitHub Desktop.
delete nets/ports/routers
#!/bin/bash
set -x
nova list | grep scalevm | awk '{ print $2 }' | xargs nova delete
for p in $(neutron port-list | grep scalemgmtport | awk '{ print $2 }'); do neutron port-delete $p; done
for p in $(neutron port-list | grep scaleport | awk '{ print $2 }'); do neutron port-delete $p; done
for r in $(neutron router-list | grep scalertr | awk '{ print $2 }'); do for x in $(neutron router-port-list $r | grep subnet_id | awk '{ prin
t $9 }' | sed -e 's/"//g' -e 's/,//'); do neutron router-interface-delete $r $x; done; done
for x in $(neutron net-list | grep scalenet | awk '{ print $2 }'); do neutron net-delete $x; done
for x in $(neutron router-list | grep scalertr | awk '{ print $2 }'); do neutron router-delete $x; done
neutron net-delete mgmtnet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment