Skip to content

Commit 1dac054

Browse files
committed
nova-net: Add TODOs for remaining nova-network functional tests
These are for the few tests that can't be converted since they're for nova-network. The following APIs have no neutron equivalent and therefore can't be converted: - POST /os-security-group-default-rules Raises 'HTTPNotImplemented' from the neutron security group driver - GET /os-security-group-default-rules Raises 'HTTPNotImplemented' from the neutron security group driver - GET /os-security-group-default-rules/{id} Raises 'HTTPNotImplemented' from the neutron security group driver - POST /os-tenant-networks Raises 'NotImplemented' from the neutron network driver - DELETE /os-tenant-networks/{id} Raises 'NotImplemented' from the neutron network driver - POST /os-networks Raises 'NotImplemented' from the neutron network driver - POST /os-networks/add Raises 'NotImplemented' from the neutron network driver - POST /os-networks/{id}/action Raises 'NotImplemented' from the neutron network driver - DELETE /os-networks/{id} Raises 'NotImplemented' from the neutron network driver The following work but need to be converted separately. We'll do that later when we remove the nova-network side of the APIs. - GET /os-networks - GET /os-networks/{id} - GET /os-tenant-networks Change-Id: Ide357a4e1479cacc8fcee80893dfbffb65ce8712 Signed-off-by: Stephen Finucane <[email protected]>
1 parent 449a5e7 commit 1dac054

File tree

7 files changed

+24
-6
lines changed

7 files changed

+24
-6
lines changed

nova/tests/functional/api_sample_tests/api_sample_base.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ def setUp(self):
122122

123123
super(ApiSampleTestBaseV21, self)._setup_services()
124124

125+
# TODO(stephenfin): Remove once we remove the few remaining
126+
# nova-network-only APIs
125127
if not self.USE_NEUTRON:
126128
# self.network is only setup if USE_NEUTRON=False
127129
self.useFixture(test.SampleNetworks(host=self.network.host))

nova/tests/functional/api_sample_tests/test_networks.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ def call(self, *args, **kwargs):
3939
return call
4040

4141

42+
# TODO(stephenfin): Remove the parts of this test that are nova-network only
4243
class NetworksJsonTests(api_sample_base.ApiSampleTestBaseV21):
43-
USE_NEUTRON = False
44+
USE_NEUTRON = False # partially nova-net only
4445
ADMIN_API = True
4546
sample_dir = "os-networks"
4647

@@ -59,39 +60,46 @@ def setUp(self):
5960
self.stub_out("nova.network.api.API.add_network_to_project",
6061
_fixtures_passthrough('add_network_to_project'))
6162

63+
# TODO(stephenfin): Rework this to work with neutron
6264
def test_network_list(self):
6365
response = self._do_get('os-networks')
6466
self._verify_response('networks-list-resp', {}, response, 200)
6567

68+
# TODO(stephenfin): Rework this to work with neutron
6669
def test_network_show(self):
6770
uuid = test_networks.FAKE_NETWORKS[0]['uuid']
6871
response = self._do_get('os-networks/%s' % uuid)
6972
self._verify_response('network-show-resp', {}, response, 200)
7073

74+
# TODO(stephenfin): Rework this to work with neutron
7175
@mock.patch('nova.network.api.API.get', side_effect=exception.Unauthorized)
7276
def test_network_show_token_expired(self, mock_get):
7377
uuid = test_networks.FAKE_NETWORKS[0]['uuid']
7478
response = self._do_get('os-networks/%s' % uuid)
7579
self.assertEqual(401, response.status_code)
7680

81+
# TODO(stephenfin): Remove this API since it's nova-network only
7782
@mock.patch('nova.network.api.API.create',
7883
side_effect=exception.Forbidden)
7984
def test_network_create_forbidden(self, mock_create):
8085
response = self._do_post("os-networks",
8186
'network-create-req', {})
8287
self.assertEqual(403, response.status_code)
8388

89+
# TODO(stephenfin): Remove this API since it's nova-network only
8490
def test_network_create(self):
8591
response = self._do_post("os-networks",
8692
'network-create-req', {})
8793
self._verify_response('network-create-resp', {}, response, 200)
8894

95+
# TODO(stephenfin): Remove this API since it's nova-network only
8996
def test_network_add(self):
9097
response = self._do_post("os-networks/add",
9198
'network-add-req', {})
9299
self.assertEqual(202, response.status_code)
93100
self.assertEqual("", response.text)
94101

102+
# TODO(stephenfin): Remove this API since it's nova-network only
95103
def test_network_delete(self):
96104
response = self._do_delete('os-networks/always_delete')
97105
self.assertEqual(202, response.status_code)

nova/tests/functional/api_sample_tests/test_networks_associate.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
from nova.tests.functional.api_sample_tests import api_sample_base
1717

1818

19+
# TODO(stephenfin): Remove this API since it's nova-network only
1920
class NetworksAssociateJsonTests(api_sample_base.ApiSampleTestBaseV21):
20-
USE_NEUTRON = False
21+
USE_NEUTRON = False # nova-net only
2122
ADMIN_API = True
2223
sample_dir = "os-networks-associate"
2324

nova/tests/functional/api_sample_tests/test_security_group_default_rules.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
from nova.tests.functional.api_sample_tests import api_sample_base
1616

1717

18+
# TODO(stephenfin): Remove this API since it's nova-network only
1819
class SecurityGroupDefaultRulesSampleJsonTest(
1920
api_sample_base.ApiSampleTestBaseV21):
20-
USE_NEUTRON = False
21+
USE_NEUTRON = False # nova-net only
2122
ADMIN_API = True
2223
sample_dir = 'os-security-group-default-rules'
2324

nova/tests/functional/api_sample_tests/test_tenant_networks.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@
2323
CONF = nova.conf.CONF
2424

2525

26+
# TODO(stephenfin): Remove the parts of this test that are nova-network only
2627
class TenantNetworksJsonTests(api_sample_base.ApiSampleTestBaseV21):
27-
USE_NEUTRON = False
28+
USE_NEUTRON = False # partially nova-net only
2829
ADMIN_API = True
2930
sample_dir = "os-tenant-networks"
3031

@@ -43,14 +44,17 @@ def fake(*args, **kwargs):
4344
self.stub_out("nova.quota.QuotaEngine.commit", fake)
4445
self.stub_out("nova.quota.QuotaEngine.rollback", fake)
4546

47+
# TODO(stephenfin): Rework this to work with neutron
4648
def test_list_networks(self):
4749
response = self._do_get('os-tenant-networks')
4850
self._verify_response('networks-list-res', {}, response, 200)
4951

52+
# TODO(stephenfin): Remove this API since it's nova-network only
5053
def test_create_network(self):
5154
response = self._do_post('os-tenant-networks', "networks-post-req", {})
5255
self._verify_response('networks-post-res', {}, response, 200)
5356

57+
# TODO(stephenfin): Remove this API since it's nova-network only
5458
def test_delete_network(self):
5559
response = self._do_post('os-tenant-networks', "networks-post-req", {})
5660
net = jsonutils.loads(response.content)

nova/tests/functional/integrated_helpers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ class _IntegratedTestBase(test.TestCase):
7979
# Override this in subclasses which use the legacy nova-network service.
8080
# New tests should rely on Neutron and old ones migrated to use this since
8181
# nova-network is deprecated.
82+
# TODO(stephenfin): Remove once we remove the few remaining
83+
# nova-network-only APIs
8284
USE_NEUTRON = True
8385
# This indicates whether to include the project ID in the URL for API
8486
# requests through OSAPIFixture. Overridden by subclasses.
@@ -87,7 +89,6 @@ class _IntegratedTestBase(test.TestCase):
8789
def setUp(self):
8890
super(_IntegratedTestBase, self).setUp()
8991

90-
# TODO(mriedem): Fix the functional tests to work with Neutron.
9192
self.flags(use_neutron=self.USE_NEUTRON)
9293

9394
# NOTE(mikal): this is used to stub away privsep helpers

nova/tests/functional/wsgi/test_interfaces.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def create_request_body():
3737
}
3838

3939

40+
# TODO(stephenfin): Remove this test since it's nova-network only
4041
class InterfaceFullstack(integrated_helpers._IntegratedTestBase):
4142
"""Tests for port interfaces command.
4243
@@ -56,7 +57,7 @@ class InterfaceFullstack(integrated_helpers._IntegratedTestBase):
5657
5758
"""
5859
api_major_version = 'v2.1'
59-
USE_NEUTRON = False
60+
USE_NEUTRON = False # nova-net only
6061
_image_ref_parameter = 'imageRef'
6162
_flavor_ref_parameter = 'flavorRef'
6263

0 commit comments

Comments
 (0)