more pep8 goodness
This commit is contained in:
parent
dad5dbb764
commit
7534f9dea7
@ -30,6 +30,7 @@ from quantum.cli import MiniClient
|
|||||||
FORMAT = "json"
|
FORMAT = "json"
|
||||||
CONTENT_TYPE = "application/" + FORMAT
|
CONTENT_TYPE = "application/" + FORMAT
|
||||||
|
|
||||||
|
|
||||||
def delete_all_nets(client, tenant_id):
|
def delete_all_nets(client, tenant_id):
|
||||||
res = client.do_request(tenant_id, 'GET', "/networks." + FORMAT)
|
res = client.do_request(tenant_id, 'GET', "/networks." + FORMAT)
|
||||||
resdict = json.loads(res.read())
|
resdict = json.loads(res.read())
|
||||||
@ -51,14 +52,16 @@ def delete_all_nets(client, tenant_id):
|
|||||||
data = {'port': {'attachment-id': ''}}
|
data = {'port': {'attachment-id': ''}}
|
||||||
body = Serializer().serialize(data, CONTENT_TYPE)
|
body = Serializer().serialize(data, CONTENT_TYPE)
|
||||||
res = client.do_request(tenant_id, 'DELETE',
|
res = client.do_request(tenant_id, 'DELETE',
|
||||||
"/networks/%s/ports/%s/attachment.%s" % (nid, pid, FORMAT), body=body)
|
"/networks/%s/ports/%s/attachment.%s" % \
|
||||||
|
(nid, pid, FORMAT), body=body)
|
||||||
output = res.read()
|
output = res.read()
|
||||||
LOG.debug(output)
|
LOG.debug(output)
|
||||||
if res.status != 202:
|
if res.status != 202:
|
||||||
LOG.error("Failed to unplug iface from port \"%s\": %s" % (vid,
|
LOG.error("Failed to unplug iface from port \"%s\": %s" % (vid,
|
||||||
pid, output))
|
pid, output))
|
||||||
continue
|
continue
|
||||||
LOG.info("Unplugged interface from port:%s on network:%s" % (pid, nid))
|
LOG.info("Unplugged interface from port:%s on network:%s" % (pid,
|
||||||
|
nid))
|
||||||
|
|
||||||
res = client.do_request(tenant_id, 'DELETE',
|
res = client.do_request(tenant_id, 'DELETE',
|
||||||
"/networks/%s/ports/%s.%s" % (nid, pid, FORMAT))
|
"/networks/%s/ports/%s.%s" % (nid, pid, FORMAT))
|
||||||
@ -79,6 +82,7 @@ def delete_all_nets(client, tenant_id):
|
|||||||
else:
|
else:
|
||||||
print "Deleted Virtual Network with ID:%s" % nid
|
print "Deleted Virtual Network with ID:%s" % nid
|
||||||
|
|
||||||
|
|
||||||
def create_net_with_attachments(net_name, iface_ids):
|
def create_net_with_attachments(net_name, iface_ids):
|
||||||
data = {'network': {'network-name': '%s' % net_name}}
|
data = {'network': {'network-name': '%s' % net_name}}
|
||||||
body = Serializer().serialize(data, CONTENT_TYPE)
|
body = Serializer().serialize(data, CONTENT_TYPE)
|
||||||
@ -133,7 +137,8 @@ if __name__ == "__main__":
|
|||||||
parser.add_option("-v", "--verbose", dest="verbose",
|
parser.add_option("-v", "--verbose", dest="verbose",
|
||||||
action="store_true", default=False, help="turn on verbose logging")
|
action="store_true", default=False, help="turn on verbose logging")
|
||||||
parser.add_option("-d", "--delete", dest="delete",
|
parser.add_option("-d", "--delete", dest="delete",
|
||||||
action="store_true", default=False, help="delete existing tenants networks")
|
action="store_true", default=False, \
|
||||||
|
help="delete existing tenants networks")
|
||||||
|
|
||||||
options, args = parser.parse_args()
|
options, args = parser.parse_args()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user