get_network in nvp plugin didn't return subnet information
Adds unit test for show network which checks for subnet. Fixes bug 1061781 Change-Id: I459a1f11a9e4294c31d002c8dbcfde873e43c800
This commit is contained in:
parent
632e3c8d5a
commit
2504f62821
|
@ -453,13 +453,15 @@ class NvpPluginV2(db_base_plugin_v2.QuantumDbPluginV2):
|
||||||
if 'lswitch-display-name' not in result:
|
if 'lswitch-display-name' not in result:
|
||||||
raise exception.NetworkNotFound(net_id=id)
|
raise exception.NetworkNotFound(net_id=id)
|
||||||
|
|
||||||
|
# Fetch network in quantum
|
||||||
|
quantum_db = super(NvpPluginV2, self).get_network(context, id, fields)
|
||||||
d = {'id': id,
|
d = {'id': id,
|
||||||
'name': result['lswitch-display-name'],
|
'name': result['lswitch-display-name'],
|
||||||
'tenant_id': network['tenant_id'],
|
'tenant_id': network['tenant_id'],
|
||||||
'admin_state_up': True,
|
'admin_state_up': True,
|
||||||
'status': constants.NET_STATUS_ACTIVE,
|
'status': constants.NET_STATUS_ACTIVE,
|
||||||
'shared': network['shared'],
|
'shared': network['shared'],
|
||||||
'subnets': []}
|
'subnets': quantum_db.get('subnets', [])}
|
||||||
|
|
||||||
LOG.debug("get_network() completed for tenant %s: %s" % (
|
LOG.debug("get_network() completed for tenant %s: %s" % (
|
||||||
context.tenant_id, d))
|
context.tenant_id, d))
|
||||||
|
|
|
@ -1683,6 +1683,14 @@ class TestNetworksV2(QuantumDbPluginV2TestCase):
|
||||||
self.assertEquals(res['network']['name'],
|
self.assertEquals(res['network']['name'],
|
||||||
net['network']['name'])
|
net['network']['name'])
|
||||||
|
|
||||||
|
def test_show_network_with_subnet(self):
|
||||||
|
with self.network(name='net1') as net:
|
||||||
|
with self.subnet(net) as subnet:
|
||||||
|
req = self.new_show_request('networks', net['network']['id'])
|
||||||
|
res = self.deserialize('json', req.get_response(self.api))
|
||||||
|
self.assertEquals(res['network']['subnets'][0],
|
||||||
|
subnet['subnet']['id'])
|
||||||
|
|
||||||
def test_invalid_admin_status(self):
|
def test_invalid_admin_status(self):
|
||||||
fmt = 'json'
|
fmt = 'json'
|
||||||
value = [[7, False, 400], [True, True, 201], ["True", True, 201],
|
value = [[7, False, 400], [True, True, 201], ["True", True, 201],
|
||||||
|
|
Loading…
Reference in New Issue