I took a brief look at this. I started by creating a network:
neutron net-create testnet
Created a new network:
+----------------+--------------------------------------+
| Field | Value |
+----------------+--------------------------------------+
| admin_state_up | True |
| id | 1c49fd1b-042e-40cb-8c94-e09c0fac941a |
| name | testnet |
| shared | False |
| status | ACTIVE |
| subnets | |
| tenant_id | 95d9bbd9b446438a89a353d8adb60704 |
+----------------+--------------------------------------+
The documentation for httplib2
says that the Http.request
method
looks like this:
request(self, uri, method='GET', body=None, headers=None,
redirections=5, connection_type=None)
Which means I can get information about that network like this:
>>> import httplib2
>>> h = httplib2.Http()
>>> response = h.request('http://localhost:9696/v2.0/networks/1c49fd1b-042e-40cb-8c94-e09c0fac941a',
... headers={'x-auth-token': os.environ['TOKEN']})
>>> import pprint
>>> pprint.pprint(response)
({'content-length': '229',
'content-location': 'http://localhost:9696/v2.0/networks/1c49fd1b-042e-40cb-8c94-e09c0fac941a',
'content-type': 'application/json; charset=UTF-8',
'date': 'Sat, 11 Oct 2014 02:03:21 GMT',
'status': '200',
'x-openstack-request-id': 'req-7f52669b-9efb-4587-83ff-20b9312ea757'},
'{"network": {"status": "ACTIVE", "subnets": [], "name": "testnet", "router:external": false, "tenant_id": "95d9bbd9b446438a89a353d8adb60704", "admin_state_up": true, "shared": false, "id": "1c49fd1b-042e-40cb-8c94-e09c0fac941a"}}')
And I can delete the network like this:
>>> response = h.request('http://localhost:9696/v2.0/networks/1c49fd1b-042e-40cb-8c94-e09c0fac941a',
... headers={'x-auth-token': os.environ['TOKEN']}, method='DELETE')
>>> pprint.pprint(response)
({'content-length': '0',
'date': 'Sat, 11 Oct 2014 02:04:41 GMT',
'status': '204',
'x-openstack-request-id': 'req-86a3d684-ba40-4519-9cf9-adc93849e507'},
'')
So that request was successful. I can verify that from the command
line that testnet
no longer exists:
$ neutron net-list
+--------------------------------------+----------+--------------------------------------------------+
| id | name | subnets |
+--------------------------------------+----------+--------------------------------------------------+
| 028d70dd-67b8-4901-8bdd-0c62b06cce2d | ext-nat | 0918b173-9280-4f63-91e0-1df626830f4b |
| 18fc1b31-9b2c-4b6e-8dea-7e04bfd1eb43 | net0 | 55c6da11-cfbe-4443-bb5f-19c4d0ea041a 10.0.0.0/24 |
+--------------------------------------+----------+--------------------------------------------------+
Any idea, folks?
I don't know whether ,{}, is the right way to send the body empty? Did you try {''} perhaps?