Add api samples to fping extension
Partially implements bp nova-api-samples Fix bug 1091747 Change-Id: Ic0060b8ea2a01a304c337a31dc276cbf395c2e5d
This commit is contained in:
parent
b919a33008
commit
1b30c9a827
7
doc/api_samples/os-fping/fping-get-details-resp.json
Normal file
7
doc/api_samples/os-fping/fping-get-details-resp.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"server": {
|
||||
"alive": false,
|
||||
"id": "f5e6fd6d-c0a3-4f9e-aabf-d69196b6d11a",
|
||||
"project_id": "openstack"
|
||||
}
|
||||
}
|
6
doc/api_samples/os-fping/fping-get-details-resp.xml
Normal file
6
doc/api_samples/os-fping/fping-get-details-resp.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<server>
|
||||
<project_id>openstack</project_id>
|
||||
<id>69d3caab-ed51-4ee7-9d4b-941ee1b45484</id>
|
||||
<alive>False</alive>
|
||||
</server>
|
9
doc/api_samples/os-fping/fping-get-resp.json
Normal file
9
doc/api_samples/os-fping/fping-get-resp.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"servers": [
|
||||
{
|
||||
"alive": false,
|
||||
"id": "1d1aea35-472b-40cf-9337-8eb68480aaa1",
|
||||
"project_id": "openstack"
|
||||
}
|
||||
]
|
||||
}
|
8
doc/api_samples/os-fping/fping-get-resp.xml
Normal file
8
doc/api_samples/os-fping/fping-get-resp.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<servers>
|
||||
<server>
|
||||
<project_id>openstack</project_id>
|
||||
<id>6a576ebe-8777-473a-ab95-8df34a50dedd</id>
|
||||
<alive>False</alive>
|
||||
</server>
|
||||
</servers>
|
16
doc/api_samples/os-fping/server-post-req.json
Normal file
16
doc/api_samples/os-fping/server-post-req.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"server" : {
|
||||
"name" : "new-server-test",
|
||||
"imageRef" : "http://openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b",
|
||||
"flavorRef" : "http://openstack.example.com/openstack/flavors/1",
|
||||
"metadata" : {
|
||||
"My Server Name" : "Apache1"
|
||||
},
|
||||
"personality" : [
|
||||
{
|
||||
"path" : "/etc/banner.txt",
|
||||
"contents" : "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
19
doc/api_samples/os-fping/server-post-req.xml
Normal file
19
doc/api_samples/os-fping/server-post-req.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<server xmlns="http://docs.openstack.org/compute/api/v1.1" imageRef="http://openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b" flavorRef="http://openstack.example.com/openstack/flavors/1" name="new-server-test">
|
||||
<metadata>
|
||||
<meta key="My Server Name">Apache1</meta>
|
||||
</metadata>
|
||||
<personality>
|
||||
<file path="/etc/banner.txt">
|
||||
ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBp
|
||||
dCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5k
|
||||
IGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVs
|
||||
c2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4g
|
||||
QnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRo
|
||||
ZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlv
|
||||
dSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vy
|
||||
c2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6
|
||||
b25zLiINCg0KLVJpY2hhcmQgQmFjaA==
|
||||
</file>
|
||||
</personality>
|
||||
</server>
|
16
doc/api_samples/os-fping/server-post-resp.json
Normal file
16
doc/api_samples/os-fping/server-post-resp.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"server": {
|
||||
"adminPass": "xrDLoBeMD28B",
|
||||
"id": "3f69b6bd-00a8-4636-96ee-650093624304",
|
||||
"links": [
|
||||
{
|
||||
"href": "http://openstack.example.com/v2/openstack/servers/3f69b6bd-00a8-4636-96ee-650093624304",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "http://openstack.example.com/openstack/servers/3f69b6bd-00a8-4636-96ee-650093624304",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
6
doc/api_samples/os-fping/server-post-resp.xml
Normal file
6
doc/api_samples/os-fping/server-post-resp.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<server xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" id="6ed1d112-6c33-4c8b-9780-e2f978bf5ffd" adminPass="uF9wWxBh3mWL">
|
||||
<metadata/>
|
||||
<atom:link href="http://openstack.example.com/v2/openstack/servers/6ed1d112-6c33-4c8b-9780-e2f978bf5ffd" rel="self"/>
|
||||
<atom:link href="http://openstack.example.com/openstack/servers/6ed1d112-6c33-4c8b-9780-e2f978bf5ffd" rel="bookmark"/>
|
||||
</server>
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"server": {
|
||||
"alive": false,
|
||||
"id": "%(uuid)s",
|
||||
"project_id": "openstack"
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<server>
|
||||
<project_id>openstack</project_id>
|
||||
<id>%(uuid)s</id>
|
||||
<alive>False</alive>
|
||||
</server>
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"servers": [
|
||||
{
|
||||
"alive": false,
|
||||
"id": "%(uuid)s",
|
||||
"project_id": "openstack"
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<servers>
|
||||
<server>
|
||||
<project_id>openstack</project_id>
|
||||
<id>%(uuid)s</id>
|
||||
<alive>False</alive>
|
||||
</server>
|
||||
</servers>
|
@ -0,0 +1,16 @@
|
||||
{
|
||||
"server" : {
|
||||
"name" : "new-server-test",
|
||||
"imageRef" : "%(host)s/openstack/images/%(image_id)s",
|
||||
"flavorRef" : "%(host)s/openstack/flavors/1",
|
||||
"metadata" : {
|
||||
"My Server Name" : "Apache1"
|
||||
},
|
||||
"personality" : [
|
||||
{
|
||||
"path" : "/etc/banner.txt",
|
||||
"contents" : "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<server xmlns="http://docs.openstack.org/compute/api/v1.1" imageRef="%(host)s/openstack/images/%(image_id)s" flavorRef="%(host)s/openstack/flavors/1" name="new-server-test">
|
||||
<metadata>
|
||||
<meta key="My Server Name">Apache1</meta>
|
||||
</metadata>
|
||||
<personality>
|
||||
<file path="/etc/banner.txt">
|
||||
ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBp
|
||||
dCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5k
|
||||
IGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVs
|
||||
c2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4g
|
||||
QnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRo
|
||||
ZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlv
|
||||
dSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vy
|
||||
c2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6
|
||||
b25zLiINCg0KLVJpY2hhcmQgQmFjaA==
|
||||
</file>
|
||||
</personality>
|
||||
</server>
|
@ -0,0 +1,16 @@
|
||||
{
|
||||
"server": {
|
||||
"adminPass": "%(password)s",
|
||||
"id": "%(id)s",
|
||||
"links": [
|
||||
{
|
||||
"href": "%(host)s/v2/openstack/servers/%(uuid)s",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "%(host)s/openstack/servers/%(uuid)s",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<server xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" id="%(id)s" adminPass="%(password)s">
|
||||
<metadata/>
|
||||
<atom:link href="%(host)s/v2/openstack/servers/%(uuid)s" rel="self"/>
|
||||
<atom:link href="%(host)s/openstack/servers/%(uuid)s" rel="bookmark"/>
|
||||
</server>
|
@ -27,6 +27,7 @@ from lxml import etree
|
||||
|
||||
from nova.api.metadata import password
|
||||
from nova.api.openstack.compute.contrib import coverage_ext
|
||||
from nova.api.openstack.compute.contrib import fping
|
||||
# Import extensions to pull in osapi_compute_extension CONF option used below.
|
||||
from nova.cloudpipe import pipelib
|
||||
from nova import context
|
||||
@ -43,10 +44,12 @@ from nova.openstack.common import timeutils
|
||||
import nova.quota
|
||||
from nova.scheduler import driver
|
||||
from nova import test
|
||||
from nova.tests.api.openstack.compute.contrib import test_fping
|
||||
from nova.tests.baremetal.db import base as bm_db_base
|
||||
from nova.tests import fake_network
|
||||
from nova.tests.image import fake
|
||||
from nova.tests.integrated import integrated_helpers
|
||||
from nova import utils
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.import_opt('allow_resize_to_same_host', 'nova.compute.api')
|
||||
@ -379,7 +382,6 @@ class ApiSamplesTrap(ApiSampleTestBase):
|
||||
do_not_approve_additions.append('os-flavor-access')
|
||||
do_not_approve_additions.append('os-flavor-extra-specs')
|
||||
do_not_approve_additions.append('os-floating-ip-dns')
|
||||
do_not_approve_additions.append('os-fping')
|
||||
do_not_approve_additions.append('os-hypervisors')
|
||||
do_not_approve_additions.append('os-networks')
|
||||
do_not_approve_additions.append('os-services')
|
||||
@ -2713,3 +2715,34 @@ class InstanceUsageAuditLogJsonTest(ApiSampleTestBase):
|
||||
|
||||
class InstanceUsageAuditLogXmlTest(InstanceUsageAuditLogJsonTest):
|
||||
ctype = 'xml'
|
||||
|
||||
|
||||
class FpingSampleJsonTests(ServersSampleBase):
|
||||
extension_name = ("nova.api.openstack.compute.contrib.fping.Fping")
|
||||
|
||||
def setUp(self):
|
||||
super(FpingSampleJsonTests, self).setUp()
|
||||
|
||||
def fake_check_fping(self):
|
||||
pass
|
||||
self.stubs.Set(utils, "execute", test_fping.execute)
|
||||
self.stubs.Set(fping.FpingController, "check_fping",
|
||||
fake_check_fping)
|
||||
|
||||
def test_get_fping(self):
|
||||
self._post_server()
|
||||
response = self._do_get('os-fping')
|
||||
self.assertEqual(response.status, 200)
|
||||
subs = self._get_regexes()
|
||||
return self._verify_response('fping-get-resp', subs, response)
|
||||
|
||||
def test_get_fping_details(self):
|
||||
uuid = self._post_server()
|
||||
response = self._do_get('os-fping/%s' % (uuid))
|
||||
self.assertEqual(response.status, 200)
|
||||
subs = self._get_regexes()
|
||||
return self._verify_response('fping-get-details-resp', subs, response)
|
||||
|
||||
|
||||
class FpingSampleXmlTests(FpingSampleJsonTests):
|
||||
ctype = 'xml'
|
||||
|
Loading…
Reference in New Issue
Block a user