api-ref: Add a sample test for os-interface

In order to add an example creating an interface with
net_id and fixed_ips, add the sample test for it.

Change-Id: I6b2567db82d000e4b1cdf46020ce1b57103c3f46
Implements: blueprint api-ref-in-rst
This commit is contained in:
Takashi NATSUME 2016-05-27 13:57:05 +09:00
parent e9b8f6da55
commit 3838f9cd7f
3 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,10 @@
{
"interfaceAttachment": {
"fixed_ips": [
{
"ip_address": "192.168.1.3"
}
],
"net_id": "3cb9bc59-5699-4588-a4b1-b87f96708bc6"
}
}

View File

@ -0,0 +1,10 @@
{
"interfaceAttachment": {
"fixed_ips": [
{
"ip_address": "192.168.1.3"
}
],
"net_id": "3cb9bc59-5699-4588-a4b1-b87f96708bc6"
}
}

View File

@ -165,6 +165,25 @@ class AttachInterfacesSampleJsonTest(test_servers.ServersSampleBase):
self._verify_response('attach-interfaces-create-resp', subs,
response, 200)
def test_create_interfaces_with_net_id_and_fixed_ips(self,
instance_uuid=None):
if instance_uuid is None:
instance_uuid = self._post_server()
subs = {
'net_id': '3cb9bc59-5699-4588-a4b1-b87f96708bc6',
'port_id': 'ce531f90-199f-48c0-816c-13e38010b442',
'subnet_id': 'f8a6e8f8-c2ec-497c-9f23-da9616de54ef',
'ip_address': '192.168.1.3',
'port_state': 'ACTIVE',
'mac_addr': 'fa:16:3e:4c:2c:30',
}
self._stub_show_for_instance(instance_uuid, subs['port_id'])
response = self._do_post('servers/%s/os-interface'
% instance_uuid,
'attach-interfaces-create-net_id-req', subs)
self._verify_response('attach-interfaces-create-resp', subs,
response, 200)
def test_delete_interfaces(self):
instance_uuid = self._post_server()
port_id = 'ce531f90-199f-48c0-816c-13e38010b442'