Implement api samples test for os-baremetal-nodes Part 2
Implements an API sample test for a GET request for os-baremetal-nodes which was previously manually generated and wrong. Removes api samples for add-interface, create, and remove-interface which were removed for os-baremetal-nodes at some point. This should bring the os-baremetal-nodes plugin in sync with reality for both v2 and v2.1 Partially implements blueprint v2-on-v3-api Change-Id: Ibd55b43368485b7f460ef6564f611df136275562
This commit is contained in:
parent
e11a6de1d9
commit
9b794005fe
@ -1,5 +0,0 @@
|
||||
{
|
||||
"add_interface": {
|
||||
"address": "aa:aa:aa:aa:aa:aa"
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
{
|
||||
"interface": {
|
||||
"address": "aa:aa:aa:aa:aa:aa",
|
||||
"datapath_id": null,
|
||||
"id": 1,
|
||||
"port_no": null
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
{
|
||||
"node": {
|
||||
"service_host": "host",
|
||||
"cpus": 8,
|
||||
"memory_mb": 8192,
|
||||
"local_gb": 128,
|
||||
"pm_address": "10.1.2.3",
|
||||
"pm_user": "pm_user",
|
||||
"pm_password": "pm_pass",
|
||||
"terminal_port": 8000
|
||||
}
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
{
|
||||
"node": {
|
||||
"cpus": 8,
|
||||
"id": 1,
|
||||
"instance_uuid": null,
|
||||
"interfaces": [],
|
||||
"local_gb": 128,
|
||||
"memory_mb": 8192,
|
||||
"pm_address": "10.1.2.3",
|
||||
"pm_user": "pm_user",
|
||||
"service_host": "host",
|
||||
"terminal_port": 8000
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
{
|
||||
"node": {
|
||||
"service_host": "host",
|
||||
"cpus": 8,
|
||||
"memory_mb": 8192,
|
||||
"local_gb": 128,
|
||||
"pm_address": "10.1.2.3",
|
||||
"pm_user": "pm_user",
|
||||
"pm_password": "pm_pass",
|
||||
"prov_mac_address": "12:34:56:78:90:ab",
|
||||
"terminal_port": 8000
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
{
|
||||
"node": {
|
||||
"cpus": 8,
|
||||
"id": 1,
|
||||
"instance_uuid": null,
|
||||
"interfaces": [
|
||||
{
|
||||
"address": "12:34:56:78:90:ab",
|
||||
"datapath_id": null,
|
||||
"id": 1,
|
||||
"port_no": null
|
||||
}
|
||||
],
|
||||
"local_gb": 128,
|
||||
"memory_mb": 8192,
|
||||
"pm_address": "10.1.2.3",
|
||||
"pm_user": "pm_user",
|
||||
"service_host": "host",
|
||||
"terminal_port": 8000
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
{
|
||||
"node": {
|
||||
"cpus": "2",
|
||||
"disk_gb": "10",
|
||||
"host": "IRONIC MANAGED",
|
||||
"id": "058d27fa-241b-445a-a386-08c04f96db43",
|
||||
"instance_uuid": "1ea4e53e-149a-4f02-9515-590c9fb2315a",
|
||||
"interfaces": [],
|
||||
"memory_mb": "1024",
|
||||
"task_state": "active"
|
||||
}
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
{
|
||||
"remove_interface": {
|
||||
"address": "aa:aa:aa:aa:aa:aa"
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
{
|
||||
"node": {
|
||||
"cpus": 8,
|
||||
"id": 1,
|
||||
"instance_uuid": null,
|
||||
"interfaces": [
|
||||
{
|
||||
"address": "aa:aa:aa:aa:aa:aa",
|
||||
"datapath_id": null,
|
||||
"id": 1,
|
||||
"port_no": null
|
||||
}
|
||||
],
|
||||
"local_gb": 128,
|
||||
"memory_mb": 8192,
|
||||
"pm_address": "10.1.2.3",
|
||||
"pm_user": "pm_user",
|
||||
"service_host": "host",
|
||||
"terminal_port": 8000
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
{
|
||||
"node": {
|
||||
"cpus": "2",
|
||||
"disk_gb": "10",
|
||||
"host": "IRONIC MANAGED",
|
||||
"id": "058d27fa-241b-445a-a386-08c04f96db43",
|
||||
"instance_uuid": "1ea4e53e-149a-4f02-9515-590c9fb2315a",
|
||||
"interfaces": [],
|
||||
"memory_mb": "1024",
|
||||
"task_state": "active"
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
{
|
||||
"node": {
|
||||
"cpus": "2",
|
||||
"disk_gb": "10",
|
||||
"host": "IRONIC MANAGED",
|
||||
"id": "058d27fa-241b-445a-a386-08c04f96db43",
|
||||
"instance_uuid": "1ea4e53e-149a-4f02-9515-590c9fb2315a",
|
||||
"interfaces": [],
|
||||
"memory_mb": "1024",
|
||||
"task_state": "active"
|
||||
}
|
||||
}
|
@ -2551,12 +2551,19 @@ class FakeNode(object):
|
||||
self.properties = {'cpus': '2',
|
||||
'memory_mb': '1024',
|
||||
'local_gb': '10'}
|
||||
self.instance_uuid = '1ea4e53e-149a-4f02-9515-590c9fb2315a'
|
||||
|
||||
|
||||
class NodeManager(object):
|
||||
def list(self, detail=False):
|
||||
return [FakeNode(), FakeNode('e2025409-f3ce-4d6a-9788-c565cf3b1b1c')]
|
||||
|
||||
def get(self, id):
|
||||
return FakeNode(id)
|
||||
|
||||
def list_ports(self, id):
|
||||
return []
|
||||
|
||||
|
||||
class fake_client(object):
|
||||
node = NodeManager()
|
||||
@ -2575,6 +2582,16 @@ class BaremetalNodesJsonTest(ApiSampleTestBaseV2):
|
||||
subs = self._get_regexes()
|
||||
self._verify_response('baremetal-node-list-resp', subs, response, 200)
|
||||
|
||||
@mock.patch("nova.api.openstack.compute.contrib.baremetal_nodes"
|
||||
"._get_ironic_client")
|
||||
def test_baremetal_nodes_get(self, mock_get_irc):
|
||||
mock_get_irc.return_value = fake_client()
|
||||
|
||||
response = self._do_get('os-baremetal-nodes/'
|
||||
'058d27fa-241b-445a-a386-08c04f96db43')
|
||||
subs = self._get_regexes()
|
||||
self._verify_response('baremetal-node-get-resp', subs, response, 200)
|
||||
|
||||
|
||||
class CellsSampleJsonTest(ApiSampleTestBaseV2):
|
||||
extension_name = "nova.api.openstack.compute.contrib.cells.Cells"
|
||||
|
@ -0,0 +1,12 @@
|
||||
{
|
||||
"node": {
|
||||
"cpus": "2",
|
||||
"disk_gb": "10",
|
||||
"host": "IRONIC MANAGED",
|
||||
"id": "058d27fa-241b-445a-a386-08c04f96db43",
|
||||
"instance_uuid": "1ea4e53e-149a-4f02-9515-590c9fb2315a",
|
||||
"interfaces": [],
|
||||
"memory_mb": "1024",
|
||||
"task_state": "active"
|
||||
}
|
||||
}
|
@ -24,12 +24,19 @@ class FakeNode(object):
|
||||
self.properties = {'cpus': '2',
|
||||
'memory_mb': '1024',
|
||||
'local_gb': '10'}
|
||||
self.instance_uuid = '1ea4e53e-149a-4f02-9515-590c9fb2315a'
|
||||
|
||||
|
||||
class NodeManager(object):
|
||||
def list(self, detail=False):
|
||||
return [FakeNode(), FakeNode('e2025409-f3ce-4d6a-9788-c565cf3b1b1c')]
|
||||
|
||||
def get(self, id):
|
||||
return FakeNode(id)
|
||||
|
||||
def list_ports(self, id):
|
||||
return []
|
||||
|
||||
|
||||
class fake_client(object):
|
||||
node = NodeManager()
|
||||
@ -46,3 +53,13 @@ class BareMetalNodesSampleJsonTest(api_sample_base.ApiSampleTestBaseV3):
|
||||
response = self._do_get('os-baremetal-nodes')
|
||||
subs = self._get_regexes()
|
||||
self._verify_response('baremetal-node-list-resp', subs, response, 200)
|
||||
|
||||
@mock.patch("nova.api.openstack.compute.plugins.v3.baremetal_nodes"
|
||||
"._get_ironic_client")
|
||||
def test_baremetal_nodes_get(self, mock_get_irc):
|
||||
mock_get_irc.return_value = fake_client()
|
||||
|
||||
response = self._do_get('os-baremetal-nodes/'
|
||||
'058d27fa-241b-445a-a386-08c04f96db43')
|
||||
subs = self._get_regexes()
|
||||
self._verify_response('baremetal-node-get-resp', subs, response, 200)
|
||||
|
Loading…
Reference in New Issue
Block a user