summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkihiro Motoki <amotoki@gmail.com>2017-05-22 08:31:56 +0000
committerAkihiro Motoki <amotoki@gmail.com>2017-06-04 17:51:25 +0000
commit9067ae8b0fe6dd57906d0eb5fe31ee96eb021fd4 (patch)
tree88d670ed760ac97186f40e5b55265c5ab2d3e9bc
parentb88461882fa711f26b347970825597b5b8e2b5ec (diff)
Move SG and FIP API wrapper to api.neutron
We no longer need to have SG and FIP API wrapper in api.network as we only supports a single network back-end. Completes blueprint drop-nova-network Change-Id: I4e59d897508b497a3cd2ae2fda93b30b786610dc
Notes
Notes (review): Code-Review+1: Cao Xuan Hoang <hoangcx@vn.fujitsu.com> Code-Review+2: Rob Cresswell <robert.cresswell@outlook.com> Workflow+1: Akihiro Motoki <amotoki@gmail.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Mon, 05 Jun 2017 06:07:37 +0000 Reviewed-on: https://review.openstack.org/466645 Project: openstack/horizon Branch: refs/heads/master
-rw-r--r--openstack_dashboard/api/network.py122
-rw-r--r--openstack_dashboard/api/neutron.py95
-rw-r--r--openstack_dashboard/api/rest/network.py12
-rw-r--r--openstack_dashboard/api/rest/nova.py2
-rw-r--r--openstack_dashboard/dashboards/admin/aggregates/tests.py8
-rw-r--r--openstack_dashboard/dashboards/admin/floating_ips/forms.py2
-rw-r--r--openstack_dashboard/dashboards/admin/floating_ips/tables.py2
-rw-r--r--openstack_dashboard/dashboards/admin/floating_ips/tests.py60
-rw-r--r--openstack_dashboard/dashboards/admin/floating_ips/views.py4
-rw-r--r--openstack_dashboard/dashboards/admin/overview/tests.py18
-rw-r--r--openstack_dashboard/dashboards/identity/projects/tests.py12
-rw-r--r--openstack_dashboard/dashboards/project/floating_ips/forms.py2
-rw-r--r--openstack_dashboard/dashboards/project/floating_ips/tables.py4
-rw-r--r--openstack_dashboard/dashboards/project/floating_ips/tests.py103
-rw-r--r--openstack_dashboard/dashboards/project/floating_ips/views.py6
-rw-r--r--openstack_dashboard/dashboards/project/floating_ips/workflows.py8
-rw-r--r--openstack_dashboard/dashboards/project/instances/tables.py12
-rw-r--r--openstack_dashboard/dashboards/project/instances/tests.py238
-rw-r--r--openstack_dashboard/dashboards/project/instances/views.py2
-rw-r--r--openstack_dashboard/dashboards/project/instances/workflows/create_instance.py2
-rw-r--r--openstack_dashboard/dashboards/project/instances/workflows/update_instance.py6
-rw-r--r--openstack_dashboard/dashboards/project/overview/tests.py20
-rw-r--r--openstack_dashboard/dashboards/project/security_groups/forms.py6
-rw-r--r--openstack_dashboard/dashboards/project/security_groups/tables.py4
-rw-r--r--openstack_dashboard/dashboards/project/security_groups/tests.py152
-rw-r--r--openstack_dashboard/dashboards/project/security_groups/views.py8
-rw-r--r--openstack_dashboard/test/api_tests/network_rest_tests.py12
-rw-r--r--openstack_dashboard/test/api_tests/network_tests.py533
-rw-r--r--openstack_dashboard/test/api_tests/neutron_tests.py443
-rw-r--r--openstack_dashboard/test/api_tests/nova_rest_tests.py2
-rw-r--r--openstack_dashboard/test/tests/quotas.py28
-rw-r--r--openstack_dashboard/usage/base.py6
-rw-r--r--openstack_dashboard/usage/quotas.py7
33 files changed, 906 insertions, 1035 deletions
diff --git a/openstack_dashboard/api/network.py b/openstack_dashboard/api/network.py
index 21a3590..6e4d1c7 100644
--- a/openstack_dashboard/api/network.py
+++ b/openstack_dashboard/api/network.py
@@ -19,132 +19,10 @@ introduced to abstract the differences between them for seamless consumption by
19different dashboard implementations. 19different dashboard implementations.
20""" 20"""
21 21
22from horizon.utils.memoized import memoized
23from openstack_dashboard.api import base 22from openstack_dashboard.api import base
24from openstack_dashboard.api import neutron 23from openstack_dashboard.api import neutron
25 24
26 25
27class NetworkClient(object):
28 def __init__(self, request):
29 # TODO(amotoki): neutron check needs to be dropped.
30 # The network API wrapper can depend on neutron.
31 neutron_enabled = base.is_service_enabled(request, 'network')
32
33 if neutron_enabled:
34 self.floating_ips = neutron.FloatingIpManager(request)
35 else:
36 self.floating_ips = None
37
38 if (neutron_enabled and
39 neutron.is_extension_supported(request, 'security-group')):
40 self.secgroups = neutron.SecurityGroupManager(request)
41 else:
42 self.secgroups = None
43
44 @property
45 def enabled(self):
46 return self.floating_ips is not None
47
48
49def floating_ip_pools_list(request):
50 return NetworkClient(request).floating_ips.list_pools()
51
52
53@memoized
54def tenant_floating_ip_list(request, all_tenants=False):
55 return NetworkClient(request).floating_ips.list(all_tenants=all_tenants)
56
57
58def tenant_floating_ip_get(request, floating_ip_id):
59 return NetworkClient(request).floating_ips.get(floating_ip_id)
60
61
62def tenant_floating_ip_allocate(request, pool=None, tenant_id=None, **params):
63 return NetworkClient(request).floating_ips.allocate(pool,
64 tenant_id,
65 **params)
66
67
68def tenant_floating_ip_release(request, floating_ip_id):
69 return NetworkClient(request).floating_ips.release(floating_ip_id)
70
71
72def floating_ip_associate(request, floating_ip_id, port_id):
73 return NetworkClient(request).floating_ips.associate(floating_ip_id,
74 port_id)
75
76
77def floating_ip_disassociate(request, floating_ip_id):
78 return NetworkClient(request).floating_ips.disassociate(floating_ip_id)
79
80
81def floating_ip_target_list(request):
82 return NetworkClient(request).floating_ips.list_targets()
83
84
85def floating_ip_target_get_by_instance(request, instance_id, cache=None):
86 return NetworkClient(request).floating_ips.get_target_id_by_instance(
87 instance_id, cache)
88
89
90def floating_ip_target_list_by_instance(request, instance_id, cache=None):
91 floating_ips = NetworkClient(request).floating_ips
92 return floating_ips.list_target_id_by_instance(instance_id, cache)
93
94
95def floating_ip_simple_associate_supported(request):
96 return NetworkClient(request).floating_ips.is_simple_associate_supported()
97
98
99def floating_ip_supported(request):
100 nwc = NetworkClient(request)
101 return nwc.enabled and nwc.floating_ips.is_supported()
102
103
104@memoized
105def security_group_list(request):
106 return NetworkClient(request).secgroups.list()
107
108
109def security_group_get(request, sg_id):
110 return NetworkClient(request).secgroups.get(sg_id)
111
112
113def security_group_create(request, name, desc):
114 return NetworkClient(request).secgroups.create(name, desc)
115
116
117def security_group_delete(request, sg_id):
118 return NetworkClient(request).secgroups.delete(sg_id)
119
120
121def security_group_update(request, sg_id, name, desc):
122 return NetworkClient(request).secgroups.update(sg_id, name, desc)
123
124
125def security_group_rule_create(request, parent_group_id,
126 direction, ethertype,
127 ip_protocol, from_port, to_port,
128 cidr, group_id):
129 return NetworkClient(request).secgroups.rule_create(
130 parent_group_id, direction, ethertype, ip_protocol,
131 from_port, to_port, cidr, group_id)
132
133
134def security_group_rule_delete(request, sgr_id):
135 return NetworkClient(request).secgroups.rule_delete(sgr_id)
136
137
138def server_security_groups(request, instance_id):
139 return NetworkClient(request).secgroups.list_by_instance(instance_id)
140
141
142def server_update_security_groups(request, instance_id,
143 new_security_group_ids):
144 return NetworkClient(request).secgroups.update_instance_security_group(
145 instance_id, new_security_group_ids)
146
147
148def servers_update_addresses(request, servers, all_tenants=False): 26def servers_update_addresses(request, servers, all_tenants=False):
149 """Retrieve servers networking information from Neutron if enabled. 27 """Retrieve servers networking information from Neutron if enabled.
150 28
diff --git a/openstack_dashboard/api/neutron.py b/openstack_dashboard/api/neutron.py
index 7c8892c..1c2f017 100644
--- a/openstack_dashboard/api/neutron.py
+++ b/openstack_dashboard/api/neutron.py
@@ -1246,6 +1246,101 @@ def provider_list(request):
1246 return providers['service_providers'] 1246 return providers['service_providers']
1247 1247
1248 1248
1249def floating_ip_pools_list(request):
1250 return FloatingIpManager(request).list_pools()
1251
1252
1253@memoized
1254def tenant_floating_ip_list(request, all_tenants=False):
1255 return FloatingIpManager(request).list(all_tenants=all_tenants)
1256
1257
1258def tenant_floating_ip_get(request, floating_ip_id):
1259 return FloatingIpManager(request).get(floating_ip_id)
1260
1261
1262def tenant_floating_ip_allocate(request, pool=None, tenant_id=None, **params):
1263 return FloatingIpManager(request).allocate(pool, tenant_id, **params)
1264
1265
1266def tenant_floating_ip_release(request, floating_ip_id):
1267 return FloatingIpManager(request).release(floating_ip_id)
1268
1269
1270def floating_ip_associate(request, floating_ip_id, port_id):
1271 return FloatingIpManager(request).associate(floating_ip_id, port_id)
1272
1273
1274def floating_ip_disassociate(request, floating_ip_id):
1275 return FloatingIpManager(request).disassociate(floating_ip_id)
1276
1277
1278def floating_ip_target_list(request):
1279 return FloatingIpManager(request).list_targets()
1280
1281
1282def floating_ip_target_get_by_instance(request, instance_id, cache=None):
1283 return FloatingIpManager(request).get_target_id_by_instance(
1284 instance_id, cache)
1285
1286
1287def floating_ip_target_list_by_instance(request, instance_id, cache=None):
1288 return FloatingIpManager(request).list_target_id_by_instance(
1289 instance_id, cache)
1290
1291
1292def floating_ip_simple_associate_supported(request):
1293 return FloatingIpManager(request).is_simple_associate_supported()
1294
1295
1296def floating_ip_supported(request):
1297 return FloatingIpManager(request).is_supported()
1298
1299
1300@memoized
1301def security_group_list(request):
1302 return SecurityGroupManager(request).list()
1303
1304
1305def security_group_get(request, sg_id):
1306 return SecurityGroupManager(request).get(sg_id)
1307
1308
1309def security_group_create(request, name, desc):
1310 return SecurityGroupManager(request).create(name, desc)
1311
1312
1313def security_group_delete(request, sg_id):
1314 return SecurityGroupManager(request).delete(sg_id)
1315
1316
1317def security_group_update(request, sg_id, name, desc):
1318 return SecurityGroupManager(request).update(sg_id, name, desc)
1319
1320
1321def security_group_rule_create(request, parent_group_id,
1322 direction, ethertype,
1323 ip_protocol, from_port, to_port,
1324 cidr, group_id):
1325 return SecurityGroupManager(request).rule_create(
1326 parent_group_id, direction, ethertype, ip_protocol,
1327 from_port, to_port, cidr, group_id)
1328
1329
1330def security_group_rule_delete(request, sgr_id):
1331 return SecurityGroupManager(request).rule_delete(sgr_id)
1332
1333
1334def server_security_groups(request, instance_id):
1335 return SecurityGroupManager(request).list_by_instance(instance_id)
1336
1337
1338def server_update_security_groups(request, instance_id,
1339 new_security_group_ids):
1340 return SecurityGroupManager(request).update_instance_security_group(
1341 instance_id, new_security_group_ids)
1342
1343
1249# TODO(pkarikh) need to uncomment when osprofiler will have no 1344# TODO(pkarikh) need to uncomment when osprofiler will have no
1250# issues with unicode in: 1345# issues with unicode in:
1251# openstack_dashboard/test/test_data/nova_data.py#L470 data 1346# openstack_dashboard/test/test_data/nova_data.py#L470 data
diff --git a/openstack_dashboard/api/rest/network.py b/openstack_dashboard/api/rest/network.py
index 8a20fbb..9b87544 100644
--- a/openstack_dashboard/api/rest/network.py
+++ b/openstack_dashboard/api/rest/network.py
@@ -42,7 +42,7 @@ class SecurityGroups(generic.View):
42 http://localhost/api/network/securitygroups 42 http://localhost/api/network/securitygroups
43 """ 43 """
44 44
45 security_groups = api.network.security_group_list(request) 45 security_groups = api.neutron.security_group_list(request)
46 46
47 return {'items': [sg.to_dict() for sg in security_groups]} 47 return {'items': [sg.to_dict() for sg in security_groups]}
48 48
@@ -63,7 +63,7 @@ class FloatingIP(generic.View):
63 :return: JSON representation of the new floating IP address 63 :return: JSON representation of the new floating IP address
64 """ 64 """
65 pool = request.DATA['pool_id'] 65 pool = request.DATA['pool_id']
66 result = api.network.tenant_floating_ip_allocate(request, pool) 66 result = api.neutron.tenant_floating_ip_allocate(request, pool)
67 return result.to_dict() 67 return result.to_dict()
68 68
69 @rest_utils.ajax(data_required=True) 69 @rest_utils.ajax(data_required=True)
@@ -77,9 +77,9 @@ class FloatingIP(generic.View):
77 address = request.DATA['address_id'] 77 address = request.DATA['address_id']
78 port = request.DATA.get('port_id') 78 port = request.DATA.get('port_id')
79 if port is None: 79 if port is None:
80 api.network.floating_ip_disassociate(request, address) 80 api.neutron.floating_ip_disassociate(request, address)
81 else: 81 else:
82 api.network.floating_ip_associate(request, address, port) 82 api.neutron.floating_ip_associate(request, address, port)
83 83
84 84
85@urls.register 85@urls.register
@@ -98,7 +98,7 @@ class FloatingIPs(generic.View):
98 Example: 98 Example:
99 http://localhost/api/network/floatingips 99 http://localhost/api/network/floatingips
100 """ 100 """
101 result = api.network.tenant_floating_ip_list(request) 101 result = api.neutron.tenant_floating_ip_list(request)
102 return {'items': [ip.to_dict() for ip in result]} 102 return {'items': [ip.to_dict() for ip in result]}
103 103
104 104
@@ -118,5 +118,5 @@ class FloatingIPPools(generic.View):
118 Example: 118 Example:
119 http://localhost/api/network/floatingippools 119 http://localhost/api/network/floatingippools
120 """ 120 """
121 result = api.network.floating_ip_pools_list(request) 121 result = api.neutron.floating_ip_pools_list(request)
122 return {'items': [p.to_dict() for p in result]} 122 return {'items': [p.to_dict() for p in result]}
diff --git a/openstack_dashboard/api/rest/nova.py b/openstack_dashboard/api/rest/nova.py
index bf7ff4c..9aec494 100644
--- a/openstack_dashboard/api/rest/nova.py
+++ b/openstack_dashboard/api/rest/nova.py
@@ -233,7 +233,7 @@ class SecurityGroups(generic.View):
233 Example GET: 233 Example GET:
234 http://localhost/api/nova/servers/abcd/security-groups/ 234 http://localhost/api/nova/servers/abcd/security-groups/
235 """ 235 """
236 groups = api.network.server_security_groups(request, server_id) 236 groups = api.neutron.server_security_groups(request, server_id)
237 return {'items': [s.to_dict() for s in groups]} 237 return {'items': [s.to_dict() for s in groups]}
238 238
239 239
diff --git a/openstack_dashboard/dashboards/admin/aggregates/tests.py b/openstack_dashboard/dashboards/admin/aggregates/tests.py
index a5f4515..97d1697 100644
--- a/openstack_dashboard/dashboards/admin/aggregates/tests.py
+++ b/openstack_dashboard/dashboards/admin/aggregates/tests.py
@@ -208,8 +208,8 @@ class AggregatesViewTests(test.BaseAdminViewTests):
208 'availability_zone_list', 208 'availability_zone_list',
209 'tenant_absolute_limits',), 209 'tenant_absolute_limits',),
210 api.cinder: ('tenant_absolute_limits',), 210 api.cinder: ('tenant_absolute_limits',),
211 api.neutron: ('is_extension_supported',), 211 api.neutron: ('is_extension_supported',
212 api.network: ('tenant_floating_ip_list', 212 'tenant_floating_ip_list',
213 'security_group_list'), 213 'security_group_list'),
214 api.keystone: ('tenant_list',)}) 214 api.keystone: ('tenant_list',)})
215 def test_panel_not_available(self): 215 def test_panel_not_available(self):
@@ -220,9 +220,9 @@ class AggregatesViewTests(test.BaseAdminViewTests):
220 api.neutron.\ 220 api.neutron.\
221 is_extension_supported(IsA(http.HttpRequest), 'security-group'). \ 221 is_extension_supported(IsA(http.HttpRequest), 'security-group'). \
222 MultipleTimes().AndReturn(True) 222 MultipleTimes().AndReturn(True)
223 api.network.tenant_floating_ip_list(IsA(http.HttpRequest)) \ 223 api.neutron.tenant_floating_ip_list(IsA(http.HttpRequest)) \
224 .AndReturn(self.floating_ips.list()) 224 .AndReturn(self.floating_ips.list())
225 api.network.security_group_list(IsA(http.HttpRequest)) \ 225 api.neutron.security_group_list(IsA(http.HttpRequest)) \
226 .AndReturn(self.security_groups.list()) 226 .AndReturn(self.security_groups.list())
227 api.keystone.tenant_list(IsA(http.HttpRequest)) \ 227 api.keystone.tenant_list(IsA(http.HttpRequest)) \
228 .AndReturn(self.tenants.list()) 228 .AndReturn(self.tenants.list())
diff --git a/openstack_dashboard/dashboards/admin/floating_ips/forms.py b/openstack_dashboard/dashboards/admin/floating_ips/forms.py
index fe528ec..42ad353 100644
--- a/openstack_dashboard/dashboards/admin/floating_ips/forms.py
+++ b/openstack_dashboard/dashboards/admin/floating_ips/forms.py
@@ -50,7 +50,7 @@ class AdminFloatingIpAllocate(forms.SelfHandlingForm):
50 param['floating_ip_address'] = data['floating_ip_address'] 50 param['floating_ip_address'] = data['floating_ip_address']
51 subnet = api.neutron.subnet_get(request, data['pool']) 51 subnet = api.neutron.subnet_get(request, data['pool'])
52 param['subnet_id'] = subnet.id 52 param['subnet_id'] = subnet.id
53 fip = api.network.tenant_floating_ip_allocate( 53 fip = api.neutron.tenant_floating_ip_allocate(
54 request, 54 request,
55 pool=subnet.network_id, 55 pool=subnet.network_id,
56 tenant_id=data['tenant'], 56 tenant_id=data['tenant'],
diff --git a/openstack_dashboard/dashboards/admin/floating_ips/tables.py b/openstack_dashboard/dashboards/admin/floating_ips/tables.py
index 9d7c9ce..5216a61 100644
--- a/openstack_dashboard/dashboards/admin/floating_ips/tables.py
+++ b/openstack_dashboard/dashboards/admin/floating_ips/tables.py
@@ -61,7 +61,7 @@ class AdminSimpleDisassociateIP(project_tables.DisassociateIP):
61 def single(self, table, request, obj_id): 61 def single(self, table, request, obj_id):
62 try: 62 try:
63 fip = table.get_object_by_id(filters.get_int_or_uuid(obj_id)) 63 fip = table.get_object_by_id(filters.get_int_or_uuid(obj_id))
64 api.network.floating_ip_disassociate(request, fip.id) 64 api.neutron.floating_ip_disassociate(request, fip.id)
65 LOG.info('Disassociating Floating IP "%s".', obj_id) 65 LOG.info('Disassociating Floating IP "%s".', obj_id)
66 messages.success(request, 66 messages.success(request,
67 _('Successfully disassociated Floating IP: %s') 67 _('Successfully disassociated Floating IP: %s')
diff --git a/openstack_dashboard/dashboards/admin/floating_ips/tests.py b/openstack_dashboard/dashboards/admin/floating_ips/tests.py
index 5be9753..fb6961e 100644
--- a/openstack_dashboard/dashboards/admin/floating_ips/tests.py
+++ b/openstack_dashboard/dashboards/admin/floating_ips/tests.py
@@ -25,16 +25,16 @@ INDEX_TEMPLATE = 'horizon/common/_data_table_view.html'
25 25
26 26
27class AdminFloatingIpViewTest(test.BaseAdminViewTests): 27class AdminFloatingIpViewTest(test.BaseAdminViewTests):
28 @test.create_stubs({api.network: ('tenant_floating_ip_list', ), 28 @test.create_stubs({api.nova: ('server_list', ),
29 api.nova: ('server_list', ),
30 api.keystone: ('tenant_list', ), 29 api.keystone: ('tenant_list', ),
31 api.neutron: ('network_list', )}) 30 api.neutron: ('network_list',
31 'tenant_floating_ip_list',)})
32 def test_index(self): 32 def test_index(self):
33 # Use neutron test data 33 # Use neutron test data
34 fips = self.floating_ips.list() 34 fips = self.floating_ips.list()
35 servers = self.servers.list() 35 servers = self.servers.list()
36 tenants = self.tenants.list() 36 tenants = self.tenants.list()
37 api.network.tenant_floating_ip_list(IsA(http.HttpRequest), 37 api.neutron.tenant_floating_ip_list(IsA(http.HttpRequest),
38 all_tenants=True).AndReturn(fips) 38 all_tenants=True).AndReturn(fips)
39 api.nova.server_list(IsA(http.HttpRequest), all_tenants=True) \ 39 api.nova.server_list(IsA(http.HttpRequest), all_tenants=True) \
40 .AndReturn([servers, False]) 40 .AndReturn([servers, False])
@@ -58,12 +58,12 @@ class AdminFloatingIpViewTest(test.BaseAdminViewTests):
58 row_actions = floating_ips_table.get_row_actions(floating_ips[1]) 58 row_actions = floating_ips_table.get_row_actions(floating_ips[1])
59 self.assertEqual(len(row_actions), 2) 59 self.assertEqual(len(row_actions), 2)
60 60
61 @test.create_stubs({api.network: ('tenant_floating_ip_get', ), 61 @test.create_stubs({api.neutron: ('tenant_floating_ip_get',
62 api.neutron: ('network_get', )}) 62 'network_get', )})
63 def test_floating_ip_detail_get(self): 63 def test_floating_ip_detail_get(self):
64 fip = self.floating_ips.first() 64 fip = self.floating_ips.first()
65 network = self.networks.first() 65 network = self.networks.first()
66 api.network.tenant_floating_ip_get( 66 api.neutron.tenant_floating_ip_get(
67 IsA(http.HttpRequest), fip.id).AndReturn(fip) 67 IsA(http.HttpRequest), fip.id).AndReturn(fip)
68 api.neutron.network_get( 68 api.neutron.network_get(
69 IsA(http.HttpRequest), fip.pool).AndReturn(network) 69 IsA(http.HttpRequest), fip.pool).AndReturn(network)
@@ -75,11 +75,11 @@ class AdminFloatingIpViewTest(test.BaseAdminViewTests):
75 'admin/floating_ips/detail.html') 75 'admin/floating_ips/detail.html')
76 self.assertEqual(res.context['floating_ip'].ip, fip.ip) 76 self.assertEqual(res.context['floating_ip'].ip, fip.ip)
77 77
78 @test.create_stubs({api.network: ('tenant_floating_ip_get',)}) 78 @test.create_stubs({api.neutron: ('tenant_floating_ip_get',)})
79 def test_floating_ip_detail_exception(self): 79 def test_floating_ip_detail_exception(self):
80 fip = self.floating_ips.first() 80 fip = self.floating_ips.first()
81 # Only supported by neutron, so raise a neutron exception 81 # Only supported by neutron, so raise a neutron exception
82 api.network.tenant_floating_ip_get( 82 api.neutron.tenant_floating_ip_get(
83 IsA(http.HttpRequest), 83 IsA(http.HttpRequest),
84 fip.id).AndRaise(self.exceptions.neutron) 84 fip.id).AndRaise(self.exceptions.neutron)
85 85
@@ -90,18 +90,18 @@ class AdminFloatingIpViewTest(test.BaseAdminViewTests):
90 90
91 self.assertRedirectsNoFollow(res, INDEX_URL) 91 self.assertRedirectsNoFollow(res, INDEX_URL)
92 92
93 @test.create_stubs({api.network: ('tenant_floating_ip_list', )}) 93 @test.create_stubs({api.neutron: ('tenant_floating_ip_list', )})
94 def test_index_no_floating_ips(self): 94 def test_index_no_floating_ips(self):
95 api.network.tenant_floating_ip_list(IsA(http.HttpRequest), 95 api.neutron.tenant_floating_ip_list(IsA(http.HttpRequest),
96 all_tenants=True).AndReturn([]) 96 all_tenants=True).AndReturn([])
97 self.mox.ReplayAll() 97 self.mox.ReplayAll()
98 98
99 res = self.client.get(INDEX_URL) 99 res = self.client.get(INDEX_URL)
100 self.assertTemplateUsed(res, INDEX_TEMPLATE) 100 self.assertTemplateUsed(res, INDEX_TEMPLATE)
101 101
102 @test.create_stubs({api.network: ('tenant_floating_ip_list', )}) 102 @test.create_stubs({api.neutron: ('tenant_floating_ip_list', )})
103 def test_index_error(self): 103 def test_index_error(self):
104 api.network.tenant_floating_ip_list(IsA(http.HttpRequest), 104 api.neutron.tenant_floating_ip_list(IsA(http.HttpRequest),
105 all_tenants=True) \ 105 all_tenants=True) \
106 .AndRaise(self.exceptions.neutron) 106 .AndRaise(self.exceptions.neutron)
107 self.mox.ReplayAll() 107 self.mox.ReplayAll()
@@ -154,8 +154,8 @@ class AdminFloatingIpViewTest(test.BaseAdminViewTests):
154 res = self.client.post(url, form_data) 154 res = self.client.post(url, form_data)
155 self.assertContains(res, "Invalid version for IP address") 155 self.assertContains(res, "Invalid version for IP address")
156 156
157 @test.create_stubs({api.network: ('tenant_floating_ip_allocate',), 157 @test.create_stubs({api.neutron: ('tenant_floating_ip_allocate',
158 api.neutron: ('network_list', 'subnet_get'), 158 'network_list', 'subnet_get'),
159 api.keystone: ('tenant_list',)}) 159 api.keystone: ('tenant_list',)})
160 def test_admin_allocate_post(self): 160 def test_admin_allocate_post(self):
161 tenant = self.tenants.first() 161 tenant = self.tenants.first()
@@ -171,7 +171,7 @@ class AdminFloatingIpViewTest(test.BaseAdminViewTests):
171 search_opts = {'router:external': True} 171 search_opts = {'router:external': True}
172 api.neutron.network_list(IsA(http.HttpRequest), **search_opts) \ 172 api.neutron.network_list(IsA(http.HttpRequest), **search_opts) \
173 .AndReturn([pool]) 173 .AndReturn([pool])
174 api.network.tenant_floating_ip_allocate( 174 api.neutron.tenant_floating_ip_allocate(
175 IsA(http.HttpRequest), 175 IsA(http.HttpRequest),
176 pool=pool.id, 176 pool=pool.id,
177 tenant_id=tenant.id).AndReturn(floating_ip) 177 tenant_id=tenant.id).AndReturn(floating_ip)
@@ -183,18 +183,18 @@ class AdminFloatingIpViewTest(test.BaseAdminViewTests):
183 res = self.client.post(url, form_data) 183 res = self.client.post(url, form_data)
184 self.assertRedirectsNoFollow(res, INDEX_URL) 184 self.assertRedirectsNoFollow(res, INDEX_URL)
185 185
186 @test.create_stubs({api.network: ('tenant_floating_ip_list', 186 @test.create_stubs({api.neutron: ('tenant_floating_ip_list',
187 'floating_ip_disassociate'), 187 'floating_ip_disassociate',
188 'network_list'),
188 api.nova: ('server_list', ), 189 api.nova: ('server_list', ),
189 api.keystone: ('tenant_list', ), 190 api.keystone: ('tenant_list', )})
190 api.neutron: ('network_list', )})
191 def test_admin_disassociate_floatingip(self): 191 def test_admin_disassociate_floatingip(self):
192 # Use neutron test data 192 # Use neutron test data
193 fips = self.floating_ips.list() 193 fips = self.floating_ips.list()
194 floating_ip = self.floating_ips.list()[1] 194 floating_ip = self.floating_ips.list()[1]
195 servers = self.servers.list() 195 servers = self.servers.list()
196 tenants = self.tenants.list() 196 tenants = self.tenants.list()
197 api.network.tenant_floating_ip_list(IsA(http.HttpRequest), 197 api.neutron.tenant_floating_ip_list(IsA(http.HttpRequest),
198 all_tenants=True).AndReturn(fips) 198 all_tenants=True).AndReturn(fips)
199 api.nova.server_list(IsA(http.HttpRequest), all_tenants=True) \ 199 api.nova.server_list(IsA(http.HttpRequest), all_tenants=True) \
200 .AndReturn([servers, False]) 200 .AndReturn([servers, False])
@@ -203,7 +203,7 @@ class AdminFloatingIpViewTest(test.BaseAdminViewTests):
203 params = {"router:external": True} 203 params = {"router:external": True}
204 api.neutron.network_list(IsA(http.HttpRequest), **params) \ 204 api.neutron.network_list(IsA(http.HttpRequest), **params) \
205 .AndReturn(self.networks.list()) 205 .AndReturn(self.networks.list())
206 api.network.floating_ip_disassociate(IsA(http.HttpRequest), 206 api.neutron.floating_ip_disassociate(IsA(http.HttpRequest),
207 floating_ip.id) 207 floating_ip.id)
208 self.mox.ReplayAll() 208 self.mox.ReplayAll()
209 209
@@ -214,17 +214,17 @@ class AdminFloatingIpViewTest(test.BaseAdminViewTests):
214 214
215 self.assertNoFormErrors(res) 215 self.assertNoFormErrors(res)
216 216
217 @test.create_stubs({api.network: ('tenant_floating_ip_list', ), 217 @test.create_stubs({api.neutron: ('tenant_floating_ip_list',
218 'network_list'),
218 api.nova: ('server_list', ), 219 api.nova: ('server_list', ),
219 api.keystone: ('tenant_list', ), 220 api.keystone: ('tenant_list', )})
220 api.neutron: ('network_list', )})
221 def test_admin_delete_floatingip(self): 221 def test_admin_delete_floatingip(self):
222 # Use neutron test data 222 # Use neutron test data
223 fips = self.floating_ips.list() 223 fips = self.floating_ips.list()
224 floating_ip = self.floating_ips.list()[1] 224 floating_ip = self.floating_ips.list()[1]
225 servers = self.servers.list() 225 servers = self.servers.list()
226 tenants = self.tenants.list() 226 tenants = self.tenants.list()
227 api.network.tenant_floating_ip_list(IsA(http.HttpRequest), 227 api.neutron.tenant_floating_ip_list(IsA(http.HttpRequest),
228 all_tenants=True).AndReturn(fips) 228 all_tenants=True).AndReturn(fips)
229 api.nova.server_list(IsA(http.HttpRequest), all_tenants=True) \ 229 api.nova.server_list(IsA(http.HttpRequest), all_tenants=True) \
230 .AndReturn([servers, False]) 230 .AndReturn([servers, False])
@@ -243,16 +243,16 @@ class AdminFloatingIpViewTest(test.BaseAdminViewTests):
243 243
244 self.assertNoFormErrors(res) 244 self.assertNoFormErrors(res)
245 245
246 @test.create_stubs({api.network: ('tenant_floating_ip_list', ), 246 @test.create_stubs({api.neutron: ('tenant_floating_ip_list',
247 'network_list'),
247 api.nova: ('server_list', ), 248 api.nova: ('server_list', ),
248 api.keystone: ('tenant_list', ), 249 api.keystone: ('tenant_list', )})
249 api.neutron: ('network_list', )})
250 def test_floating_ip_table_actions(self): 250 def test_floating_ip_table_actions(self):
251 # Use neutron test data 251 # Use neutron test data
252 fips = self.floating_ips.list() 252 fips = self.floating_ips.list()
253 servers = self.servers.list() 253 servers = self.servers.list()
254 tenants = self.tenants.list() 254 tenants = self.tenants.list()
255 api.network.tenant_floating_ip_list(IsA(http.HttpRequest), 255 api.neutron.tenant_floating_ip_list(IsA(http.HttpRequest),
256 all_tenants=True).AndReturn(fips) 256 all_tenants=True).AndReturn(fips)
257 api.nova.server_list(IsA(http.HttpRequest), all_tenants=True) \ 257 api.nova.server_list(IsA(http.HttpRequest), all_tenants=True) \
258 .AndReturn([servers, False]) 258 .AndReturn([servers, False])
diff --git a/openstack_dashboard/dashboards/admin/floating_ips/views.py b/openstack_dashboard/dashboards/admin/floating_ips/views.py
index 5036641..53df696 100644
--- a/openstack_dashboard/dashboards/admin/floating_ips/views.py
+++ b/openstack_dashboard/dashboards/admin/floating_ips/views.py
@@ -65,7 +65,7 @@ class IndexView(tables.DataTableView):
65 def get_data(self): 65 def get_data(self):
66 floating_ips = [] 66 floating_ips = []
67 try: 67 try:
68 floating_ips = api.network.tenant_floating_ip_list( 68 floating_ips = api.neutron.tenant_floating_ip_list(
69 self.request, 69 self.request,
70 all_tenants=True) 70 all_tenants=True)
71 except Exception: 71 except Exception:
@@ -104,7 +104,7 @@ class DetailView(views.HorizonTemplateView):
104 page_title = _("Floating IP Details") 104 page_title = _("Floating IP Details")
105 105
106 def _get_corresponding_data(self, resource, resource_id): 106 def _get_corresponding_data(self, resource, resource_id):
107 function_dict = {"floating IP": api.network.tenant_floating_ip_get, 107 function_dict = {"floating IP": api.neutron.tenant_floating_ip_get,
108 "instance": api.nova.server_get, 108 "instance": api.nova.server_get,
109 "network": api.neutron.network_get, 109 "network": api.neutron.network_get,
110 "router": api.neutron.router_get} 110 "router": api.neutron.router_get}
diff --git a/openstack_dashboard/dashboards/admin/overview/tests.py b/openstack_dashboard/dashboards/admin/overview/tests.py
index 6183971..70957e3 100644
--- a/openstack_dashboard/dashboards/admin/overview/tests.py
+++ b/openstack_dashboard/dashboards/admin/overview/tests.py
@@ -44,9 +44,9 @@ class UsageViewTests(test.BaseAdminViewTests):
44 self.mox.StubOutWithMock(api.nova, 'extension_supported') 44 self.mox.StubOutWithMock(api.nova, 'extension_supported')
45 self.mox.StubOutWithMock(api.keystone, 'tenant_list') 45 self.mox.StubOutWithMock(api.keystone, 'tenant_list')
46 self.mox.StubOutWithMock(api.neutron, 'is_extension_supported') 46 self.mox.StubOutWithMock(api.neutron, 'is_extension_supported')
47 self.mox.StubOutWithMock(api.network, 'floating_ip_supported') 47 self.mox.StubOutWithMock(api.neutron, 'floating_ip_supported')
48 self.mox.StubOutWithMock(api.network, 'tenant_floating_ip_list') 48 self.mox.StubOutWithMock(api.neutron, 'tenant_floating_ip_list')
49 self.mox.StubOutWithMock(api.network, 'security_group_list') 49 self.mox.StubOutWithMock(api.neutron, 'security_group_list')
50 self.mox.StubOutWithMock(api.cinder, 'tenant_absolute_limits') 50 self.mox.StubOutWithMock(api.cinder, 'tenant_absolute_limits')
51 51
52 api.nova.extension_supported( 52 api.nova.extension_supported(
@@ -103,11 +103,11 @@ class UsageViewTests(test.BaseAdminViewTests):
103 .AndReturn(self.limits['absolute']) 103 .AndReturn(self.limits['absolute'])
104 api.neutron.is_extension_supported(IsA(http.HttpRequest), 104 api.neutron.is_extension_supported(IsA(http.HttpRequest),
105 'security-group').AndReturn(True) 105 'security-group').AndReturn(True)
106 api.network.floating_ip_supported(IsA(http.HttpRequest)) \ 106 api.neutron.floating_ip_supported(IsA(http.HttpRequest)) \
107 .AndReturn(True) 107 .AndReturn(True)
108 api.network.tenant_floating_ip_list(IsA(http.HttpRequest)) \ 108 api.neutron.tenant_floating_ip_list(IsA(http.HttpRequest)) \
109 .AndReturn(self.floating_ips.list()) 109 .AndReturn(self.floating_ips.list())
110 api.network.security_group_list(IsA(http.HttpRequest)) \ 110 api.neutron.security_group_list(IsA(http.HttpRequest)) \
111 .AndReturn(self.security_groups.list()) 111 .AndReturn(self.security_groups.list())
112 api.cinder.tenant_absolute_limits(IsA(http.HttpRequest)) \ 112 api.cinder.tenant_absolute_limits(IsA(http.HttpRequest)) \
113 .AndReturn(self.cinder_limits['absolute']) 113 .AndReturn(self.cinder_limits['absolute'])
@@ -199,11 +199,11 @@ class UsageViewTests(test.BaseAdminViewTests):
199 .AndReturn(self.limits['absolute']) 199 .AndReturn(self.limits['absolute'])
200 api.neutron.is_extension_supported(IsA(http.HttpRequest), 200 api.neutron.is_extension_supported(IsA(http.HttpRequest),
201 'security-group').AndReturn(True) 201 'security-group').AndReturn(True)
202 api.network.floating_ip_supported(IsA(http.HttpRequest)) \ 202 api.neutron.floating_ip_supported(IsA(http.HttpRequest)) \
203 .AndReturn(True) 203 .AndReturn(True)
204 api.network.tenant_floating_ip_list(IsA(http.HttpRequest)) \ 204 api.neutron.tenant_floating_ip_list(IsA(http.HttpRequest)) \
205 .AndReturn(self.floating_ips.list()) 205 .AndReturn(self.floating_ips.list())
206 api.network.security_group_list(IsA(http.HttpRequest)) \ 206 api.neutron.security_group_list(IsA(http.HttpRequest)) \
207 .AndReturn(self.security_groups.list()) 207 .AndReturn(self.security_groups.list())
208 api.cinder.tenant_absolute_limits(IsA(http.HttpRequest)) \ 208 api.cinder.tenant_absolute_limits(IsA(http.HttpRequest)) \
209 .AndReturn(self.cinder_limits['absolute']) 209 .AndReturn(self.cinder_limits['absolute'])
diff --git a/openstack_dashboard/dashboards/identity/projects/tests.py b/openstack_dashboard/dashboards/identity/projects/tests.py
index a91e817..734970b 100644
--- a/openstack_dashboard/dashboards/identity/projects/tests.py
+++ b/openstack_dashboard/dashboards/identity/projects/tests.py
@@ -1566,19 +1566,19 @@ class UsageViewTests(test.BaseAdminViewTests):
1566 1566
1567 def _stub_neutron_api_calls(self, neutron_sg_enabled=True): 1567 def _stub_neutron_api_calls(self, neutron_sg_enabled=True):
1568 self.mox.StubOutWithMock(api.neutron, 'is_extension_supported') 1568 self.mox.StubOutWithMock(api.neutron, 'is_extension_supported')
1569 self.mox.StubOutWithMock(api.network, 'floating_ip_supported') 1569 self.mox.StubOutWithMock(api.neutron, 'floating_ip_supported')
1570 self.mox.StubOutWithMock(api.network, 'tenant_floating_ip_list') 1570 self.mox.StubOutWithMock(api.neutron, 'tenant_floating_ip_list')
1571 if neutron_sg_enabled: 1571 if neutron_sg_enabled:
1572 self.mox.StubOutWithMock(api.network, 'security_group_list') 1572 self.mox.StubOutWithMock(api.neutron, 'security_group_list')
1573 api.neutron.is_extension_supported( 1573 api.neutron.is_extension_supported(
1574 IsA(http.HttpRequest), 1574 IsA(http.HttpRequest),
1575 'security-group').AndReturn(neutron_sg_enabled) 1575 'security-group').AndReturn(neutron_sg_enabled)
1576 api.network.floating_ip_supported(IsA(http.HttpRequest)) \ 1576 api.neutron.floating_ip_supported(IsA(http.HttpRequest)) \
1577 .AndReturn(True) 1577 .AndReturn(True)
1578 api.network.tenant_floating_ip_list(IsA(http.HttpRequest)) \ 1578 api.neutron.tenant_floating_ip_list(IsA(http.HttpRequest)) \
1579 .AndReturn(self.floating_ips.list()) 1579 .AndReturn(self.floating_ips.list())
1580 if neutron_sg_enabled: 1580 if neutron_sg_enabled:
1581 api.network.security_group_list(IsA(http.HttpRequest)) \ 1581 api.neutron.security_group_list(IsA(http.HttpRequest)) \
1582 .AndReturn(self.security_groups.list()) 1582 .AndReturn(self.security_groups.list())
1583 1583
1584 def test_usage_csv(self): 1584 def test_usage_csv(self):
diff --git a/openstack_dashboard/dashboards/project/floating_ips/forms.py b/openstack_dashboard/dashboards/project/floating_ips/forms.py
index d933c7a..6e4daf6 100644
--- a/openstack_dashboard/dashboards/project/floating_ips/forms.py
+++ b/openstack_dashboard/dashboards/project/floating_ips/forms.py
@@ -45,7 +45,7 @@ class FloatingIpAllocate(forms.SelfHandlingForm):
45 self.api_error(error_message) 45 self.api_error(error_message)
46 return False 46 return False
47 47
48 fip = api.network.tenant_floating_ip_allocate(request, 48 fip = api.neutron.tenant_floating_ip_allocate(request,
49 pool=data['pool']) 49 pool=data['pool'])
50 messages.success(request, 50 messages.success(request,
51 _('Allocated Floating IP %(ip)s.') 51 _('Allocated Floating IP %(ip)s.')
diff --git a/openstack_dashboard/dashboards/project/floating_ips/tables.py b/openstack_dashboard/dashboards/project/floating_ips/tables.py
index 600526f..e02475e 100644
--- a/openstack_dashboard/dashboards/project/floating_ips/tables.py
+++ b/openstack_dashboard/dashboards/project/floating_ips/tables.py
@@ -90,7 +90,7 @@ class ReleaseIPs(tables.BatchAction):
90 return policy.check(policy_rules, request) 90 return policy.check(policy_rules, request)
91 91
92 def action(self, request, obj_id): 92 def action(self, request, obj_id):
93 api.network.tenant_floating_ip_release(request, obj_id) 93 api.neutron.tenant_floating_ip_release(request, obj_id)
94 94
95 95
96class AssociateIP(tables.LinkAction): 96class AssociateIP(tables.LinkAction):
@@ -124,7 +124,7 @@ class DisassociateIP(tables.Action):
124 def single(self, table, request, obj_id): 124 def single(self, table, request, obj_id):
125 try: 125 try:
126 fip = table.get_object_by_id(filters.get_int_or_uuid(obj_id)) 126 fip = table.get_object_by_id(filters.get_int_or_uuid(obj_id))
127 api.network.floating_ip_disassociate(request, fip.id) 127 api.neutron.floating_ip_disassociate(request, fip.id)
128 LOG.info('Disassociating Floating IP "%s".', obj_id) 128 LOG.info('Disassociating Floating IP "%s".', obj_id)
129 messages.success(request, 129 messages.success(request,
130 _('Successfully disassociated Floating IP: %s') 130 _('Successfully disassociated Floating IP: %s')
diff --git a/openstack_dashboard/dashboards/project/floating_ips/tests.py b/openstack_dashboard/dashboards/project/floating_ips/tests.py
index 3cfa119..3212589 100644
--- a/openstack_dashboard/dashboards/project/floating_ips/tests.py
+++ b/openstack_dashboard/dashboards/project/floating_ips/tests.py
@@ -37,12 +37,12 @@ NAMESPACE = "horizon:project:floating_ips"
37 37
38class FloatingIpViewTests(test.TestCase): 38class FloatingIpViewTests(test.TestCase):
39 39
40 @test.create_stubs({api.network: ('floating_ip_target_list', 40 @test.create_stubs({api.neutron: ('floating_ip_target_list',
41 'tenant_floating_ip_list',)}) 41 'tenant_floating_ip_list',)})
42 def test_associate(self): 42 def test_associate(self):
43 api.network.floating_ip_target_list(IsA(http.HttpRequest)) \ 43 api.neutron.floating_ip_target_list(IsA(http.HttpRequest)) \
44 .AndReturn(self._get_fip_targets()) 44 .AndReturn(self._get_fip_targets())
45 api.network.tenant_floating_ip_list(IsA(http.HttpRequest)) \ 45 api.neutron.tenant_floating_ip_list(IsA(http.HttpRequest)) \
46 .AndReturn(self.floating_ips.list()) 46 .AndReturn(self.floating_ips.list())
47 self.mox.ReplayAll() 47 self.mox.ReplayAll()
48 48
@@ -54,18 +54,18 @@ class FloatingIpViewTests(test.TestCase):
54 # Verify that our "associated" floating IP isn't in the choices list. 54 # Verify that our "associated" floating IP isn't in the choices list.
55 self.assertNotIn(self.floating_ips.first(), choices) 55 self.assertNotIn(self.floating_ips.first(), choices)
56 56
57 @test.create_stubs({api.network: ('floating_ip_target_list', 57 @test.create_stubs({api.neutron: ('floating_ip_target_list',
58 'floating_ip_target_get_by_instance', 58 'floating_ip_target_get_by_instance',
59 'tenant_floating_ip_list',)}) 59 'tenant_floating_ip_list',)})
60 def test_associate_with_instance_id(self): 60 def test_associate_with_instance_id(self):
61 targets = self._get_fip_targets() 61 targets = self._get_fip_targets()
62 target = targets[0] 62 target = targets[0]
63 api.network.floating_ip_target_list(IsA(http.HttpRequest)) \ 63 api.neutron.floating_ip_target_list(IsA(http.HttpRequest)) \
64 .AndReturn(targets) 64 .AndReturn(targets)
65 api.network.floating_ip_target_get_by_instance( 65 api.neutron.floating_ip_target_get_by_instance(
66 IsA(http.HttpRequest), target.instance_id, targets) \ 66 IsA(http.HttpRequest), target.instance_id, targets) \
67 .AndReturn(target.id) 67 .AndReturn(target.id)
68 api.network.tenant_floating_ip_list(IsA(http.HttpRequest)) \ 68 api.neutron.tenant_floating_ip_list(IsA(http.HttpRequest)) \
69 .AndReturn(self.floating_ips.list()) 69 .AndReturn(self.floating_ips.list())
70 self.mox.ReplayAll() 70 self.mox.ReplayAll()
71 71
@@ -100,16 +100,16 @@ class FloatingIpViewTests(test.TestCase):
100 def _get_target_id(port): 100 def _get_target_id(port):
101 return '%s_%s' % (port.id, port.fixed_ips[0]['ip_address']) 101 return '%s_%s' % (port.id, port.fixed_ips[0]['ip_address'])
102 102
103 @test.create_stubs({api.network: ('floating_ip_target_list', 103 @test.create_stubs({api.neutron: ('floating_ip_target_list',
104 'tenant_floating_ip_list',)}) 104 'tenant_floating_ip_list',)})
105 def test_associate_with_port_id(self): 105 def test_associate_with_port_id(self):
106 compute_port = self._get_compute_ports()[0] 106 compute_port = self._get_compute_ports()[0]
107 associated_fips = [fip.id for fip in self.floating_ips.list() 107 associated_fips = [fip.id for fip in self.floating_ips.list()
108 if fip.port_id] 108 if fip.port_id]
109 109
110 api.network.floating_ip_target_list(IsA(http.HttpRequest)) \ 110 api.neutron.floating_ip_target_list(IsA(http.HttpRequest)) \
111 .AndReturn(self._get_fip_targets()) 111 .AndReturn(self._get_fip_targets())
112 api.network.tenant_floating_ip_list(IsA(http.HttpRequest)) \ 112 api.neutron.tenant_floating_ip_list(IsA(http.HttpRequest)) \
113 .AndReturn(self.floating_ips.list()) 113 .AndReturn(self.floating_ips.list())
114 self.mox.ReplayAll() 114 self.mox.ReplayAll()
115 115
@@ -123,7 +123,7 @@ class FloatingIpViewTests(test.TestCase):
123 # Verify that our "associated" floating IP isn't in the choices list. 123 # Verify that our "associated" floating IP isn't in the choices list.
124 self.assertFalse(set(associated_fips) & set(choices.keys())) 124 self.assertFalse(set(associated_fips) & set(choices.keys()))
125 125
126 @test.create_stubs({api.network: ('floating_ip_associate', 126 @test.create_stubs({api.neutron: ('floating_ip_associate',
127 'floating_ip_target_list', 127 'floating_ip_target_list',
128 'tenant_floating_ip_list',)}) 128 'tenant_floating_ip_list',)})
129 def test_associate_post(self): 129 def test_associate_post(self):
@@ -132,11 +132,11 @@ class FloatingIpViewTests(test.TestCase):
132 compute_port = self._get_compute_ports()[0] 132 compute_port = self._get_compute_ports()[0]
133 port_target_id = self._get_target_id(compute_port) 133 port_target_id = self._get_target_id(compute_port)
134 134
135 api.network.tenant_floating_ip_list(IsA(http.HttpRequest)) \ 135 api.neutron.tenant_floating_ip_list(IsA(http.HttpRequest)) \
136 .AndReturn(self.floating_ips.list()) 136 .AndReturn(self.floating_ips.list())
137 api.network.floating_ip_target_list(IsA(http.HttpRequest)) \ 137 api.neutron.floating_ip_target_list(IsA(http.HttpRequest)) \
138 .AndReturn(self._get_fip_targets()) 138 .AndReturn(self._get_fip_targets())
139 api.network.floating_ip_associate(IsA(http.HttpRequest), 139 api.neutron.floating_ip_associate(IsA(http.HttpRequest),
140 floating_ip.id, 140 floating_ip.id,
141 port_target_id) 141 port_target_id)
142 self.mox.ReplayAll() 142 self.mox.ReplayAll()
@@ -147,7 +147,7 @@ class FloatingIpViewTests(test.TestCase):
147 res = self.client.post(url, form_data) 147 res = self.client.post(url, form_data)
148 self.assertRedirectsNoFollow(res, INDEX_URL) 148 self.assertRedirectsNoFollow(res, INDEX_URL)
149 149
150 @test.create_stubs({api.network: ('floating_ip_associate', 150 @test.create_stubs({api.neutron: ('floating_ip_associate',
151 'floating_ip_target_list', 151 'floating_ip_target_list',
152 'tenant_floating_ip_list',)}) 152 'tenant_floating_ip_list',)})
153 def test_associate_post_with_redirect(self): 153 def test_associate_post_with_redirect(self):
@@ -156,11 +156,11 @@ class FloatingIpViewTests(test.TestCase):
156 compute_port = self._get_compute_ports()[0] 156 compute_port = self._get_compute_ports()[0]
157 port_target_id = self._get_target_id(compute_port) 157 port_target_id = self._get_target_id(compute_port)
158 158
159 api.network.tenant_floating_ip_list(IsA(http.HttpRequest)) \ 159 api.neutron.tenant_floating_ip_list(IsA(http.HttpRequest)) \
160 .AndReturn(self.floating_ips.list()) 160 .AndReturn(self.floating_ips.list())
161 api.network.floating_ip_target_list(IsA(http.HttpRequest)) \ 161 api.neutron.floating_ip_target_list(IsA(http.HttpRequest)) \
162 .AndReturn(self._get_fip_targets()) 162 .AndReturn(self._get_fip_targets())
163 api.network.floating_ip_associate(IsA(http.HttpRequest), 163 api.neutron.floating_ip_associate(IsA(http.HttpRequest),
164 floating_ip.id, 164 floating_ip.id,
165 port_target_id) 165 port_target_id)
166 self.mox.ReplayAll() 166 self.mox.ReplayAll()
@@ -172,7 +172,7 @@ class FloatingIpViewTests(test.TestCase):
172 res = self.client.post(url, form_data) 172 res = self.client.post(url, form_data)
173 self.assertRedirectsNoFollow(res, next) 173 self.assertRedirectsNoFollow(res, next)
174 174
175 @test.create_stubs({api.network: ('floating_ip_associate', 175 @test.create_stubs({api.neutron: ('floating_ip_associate',
176 'floating_ip_target_list', 176 'floating_ip_target_list',
177 'tenant_floating_ip_list',)}) 177 'tenant_floating_ip_list',)})
178 def test_associate_post_with_exception(self): 178 def test_associate_post_with_exception(self):
@@ -181,11 +181,11 @@ class FloatingIpViewTests(test.TestCase):
181 compute_port = self._get_compute_ports()[0] 181 compute_port = self._get_compute_ports()[0]
182 port_target_id = self._get_target_id(compute_port) 182 port_target_id = self._get_target_id(compute_port)
183 183
184 api.network.tenant_floating_ip_list(IsA(http.HttpRequest)) \ 184 api.neutron.tenant_floating_ip_list(IsA(http.HttpRequest)) \
185 .AndReturn(self.floating_ips.list()) 185 .AndReturn(self.floating_ips.list())
186 api.network.floating_ip_target_list(IsA(http.HttpRequest)) \ 186 api.neutron.floating_ip_target_list(IsA(http.HttpRequest)) \
187 .AndReturn(self._get_fip_targets()) 187 .AndReturn(self._get_fip_targets())
188 api.network.floating_ip_associate(IsA(http.HttpRequest), 188 api.neutron.floating_ip_associate(IsA(http.HttpRequest),
189 floating_ip.id, 189 floating_ip.id,
190 port_target_id) \ 190 port_target_id) \
191 .AndRaise(self.exceptions.nova) 191 .AndRaise(self.exceptions.nova)
@@ -198,21 +198,21 @@ class FloatingIpViewTests(test.TestCase):
198 self.assertRedirectsNoFollow(res, INDEX_URL) 198 self.assertRedirectsNoFollow(res, INDEX_URL)
199 199
200 @test.create_stubs({api.nova: ('server_list',), 200 @test.create_stubs({api.nova: ('server_list',),
201 api.network: ('floating_ip_disassociate', 201 api.neutron: ('floating_ip_disassociate',
202 'floating_ip_pools_list',
202 'tenant_floating_ip_get', 203 'tenant_floating_ip_get',
203 'tenant_floating_ip_list',), 204 'tenant_floating_ip_list',
204 api.neutron: ('is_extension_supported',)}) 205 'is_extension_supported',)})
205 def test_disassociate_post(self): 206 def test_disassociate_post(self):
206 floating_ip = self.floating_ips.first() 207 floating_ip = self.floating_ips.first()
207 208
208 api.nova.server_list(IsA(http.HttpRequest), detailed=False) \ 209 api.nova.server_list(IsA(http.HttpRequest), detailed=False) \
209 .AndReturn([self.servers.list(), False]) 210 .AndReturn([self.servers.list(), False])
210 api.network.tenant_floating_ip_list(IsA(http.HttpRequest)) \ 211 api.neutron.tenant_floating_ip_list(IsA(http.HttpRequest)) \
211 .AndReturn(self.floating_ips.list()) 212 .AndReturn(self.floating_ips.list())
212 api.neutron.is_extension_supported(IsA(http.HttpRequest), 213 api.neutron.floating_ip_pools_list(IsA(http.HttpRequest)) \
213 'subnet_allocation')\ 214 .AndReturn(self.pools.list())
214 .AndReturn(True) 215 api.neutron.floating_ip_disassociate(IsA(http.HttpRequest),
215 api.network.floating_ip_disassociate(IsA(http.HttpRequest),
216 floating_ip.id) 216 floating_ip.id)
217 self.mox.ReplayAll() 217 self.mox.ReplayAll()
218 218
@@ -222,22 +222,21 @@ class FloatingIpViewTests(test.TestCase):
222 self.assertRedirectsNoFollow(res, INDEX_URL) 222 self.assertRedirectsNoFollow(res, INDEX_URL)
223 223
224 @test.create_stubs({api.nova: ('server_list',), 224 @test.create_stubs({api.nova: ('server_list',),
225 api.network: ('floating_ip_disassociate', 225 api.neutron: ('floating_ip_disassociate',
226 'floating_ip_pools_list',
226 'tenant_floating_ip_get', 227 'tenant_floating_ip_get',
227 'tenant_floating_ip_list',), 228 'tenant_floating_ip_list',
228 api.neutron: ('is_extension_supported',)}) 229 'is_extension_supported',)})
229 def test_disassociate_post_with_exception(self): 230 def test_disassociate_post_with_exception(self):
230 floating_ip = self.floating_ips.first() 231 floating_ip = self.floating_ips.first()
231 232
232 api.nova.server_list(IsA(http.HttpRequest), detailed=False) \ 233 api.nova.server_list(IsA(http.HttpRequest), detailed=False) \
233 .AndReturn([self.servers.list(), False]) 234 .AndReturn([self.servers.list(), False])
234 api.network.tenant_floating_ip_list(IsA(http.HttpRequest)) \ 235 api.neutron.tenant_floating_ip_list(IsA(http.HttpRequest)) \
235 .AndReturn(self.floating_ips.list()) 236 .AndReturn(self.floating_ips.list())
236 api.neutron.is_extension_supported(IsA(http.HttpRequest), 237 api.neutron.floating_ip_pools_list(IsA(http.HttpRequest)) \
237 'subnet_allocation')\ 238 .AndReturn(self.pools.list())
238 .AndReturn(True) 239 api.neutron.floating_ip_disassociate(IsA(http.HttpRequest),
239
240 api.network.floating_ip_disassociate(IsA(http.HttpRequest),
241 floating_ip.id) \ 240 floating_ip.id) \
242 .AndRaise(self.exceptions.nova) 241 .AndRaise(self.exceptions.nova)
243 self.mox.ReplayAll() 242 self.mox.ReplayAll()
@@ -246,7 +245,7 @@ class FloatingIpViewTests(test.TestCase):
246 res = self.client.post(INDEX_URL, {"action": action}) 245 res = self.client.post(INDEX_URL, {"action": action})
247 self.assertRedirectsNoFollow(res, INDEX_URL) 246 self.assertRedirectsNoFollow(res, INDEX_URL)
248 247
249 @test.create_stubs({api.network: ('tenant_floating_ip_list', 248 @test.create_stubs({api.neutron: ('tenant_floating_ip_list',
250 'floating_ip_pools_list',), 249 'floating_ip_pools_list',),
251 api.nova: ('server_list',), 250 api.nova: ('server_list',),
252 quotas: ('tenant_quota_usages',), 251 quotas: ('tenant_quota_usages',),
@@ -257,10 +256,10 @@ class FloatingIpViewTests(test.TestCase):
257 quota_data = self.quota_usages.first() 256 quota_data = self.quota_usages.first()
258 quota_data['floating_ips']['available'] = 10 257 quota_data['floating_ips']['available'] = 10
259 258
260 api.network.tenant_floating_ip_list( 259 api.neutron.tenant_floating_ip_list(
261 IsA(http.HttpRequest)) \ 260 IsA(http.HttpRequest)) \
262 .AndReturn(floating_ips) 261 .AndReturn(floating_ips)
263 api.network.floating_ip_pools_list( 262 api.neutron.floating_ip_pools_list(
264 IsA(http.HttpRequest)) \ 263 IsA(http.HttpRequest)) \
265 .AndReturn(floating_pools) 264 .AndReturn(floating_pools)
266 api.nova.server_list( 265 api.nova.server_list(
@@ -284,7 +283,7 @@ class FloatingIpViewTests(test.TestCase):
284 url = 'horizon:project:floating_ips:allocate' 283 url = 'horizon:project:floating_ips:allocate'
285 self.assertEqual(url, allocate_action.url) 284 self.assertEqual(url, allocate_action.url)
286 285
287 @test.create_stubs({api.network: ('tenant_floating_ip_list', 286 @test.create_stubs({api.neutron: ('tenant_floating_ip_list',
288 'floating_ip_pools_list',), 287 'floating_ip_pools_list',),
289 api.nova: ('server_list',), 288 api.nova: ('server_list',),
290 quotas: ('tenant_quota_usages',), 289 quotas: ('tenant_quota_usages',),
@@ -295,10 +294,10 @@ class FloatingIpViewTests(test.TestCase):
295 quota_data = self.quota_usages.first() 294 quota_data = self.quota_usages.first()
296 quota_data['floating_ips']['available'] = 0 295 quota_data['floating_ips']['available'] = 0
297 296
298 api.network.tenant_floating_ip_list( 297 api.neutron.tenant_floating_ip_list(
299 IsA(http.HttpRequest)) \ 298 IsA(http.HttpRequest)) \
300 .AndReturn(floating_ips) 299 .AndReturn(floating_ips)
301 api.network.floating_ip_pools_list( 300 api.neutron.floating_ip_pools_list(
302 IsA(http.HttpRequest)) \ 301 IsA(http.HttpRequest)) \
303 .AndReturn(floating_pools) 302 .AndReturn(floating_pools)
304 api.nova.server_list( 303 api.nova.server_list(
@@ -321,11 +320,11 @@ class FloatingIpViewTests(test.TestCase):
321 320
322 @test.create_stubs({api.nova: ('tenant_quota_get', 'flavor_list', 321 @test.create_stubs({api.nova: ('tenant_quota_get', 'flavor_list',
323 'server_list'), 322 'server_list'),
324 api.network: ('floating_ip_pools_list', 323 api.neutron: ('floating_ip_pools_list',
325 'floating_ip_supported', 324 'floating_ip_supported',
326 'security_group_list', 325 'security_group_list',
327 'tenant_floating_ip_list'), 326 'tenant_floating_ip_list',
328 api.neutron: ('is_extension_supported', 327 'is_extension_supported',
329 'is_router_enabled', 328 'is_router_enabled',
330 'tenant_quota_get', 329 'tenant_quota_get',
331 'network_list', 330 'network_list',
@@ -368,13 +367,13 @@ class FloatingIpViewTests(test.TestCase):
368 api.neutron.network_list(IsA(http.HttpRequest), 367 api.neutron.network_list(IsA(http.HttpRequest),
369 tenant_id=self.tenant.id) \ 368 tenant_id=self.tenant.id) \
370 .AndReturn(self.networks.list()) 369 .AndReturn(self.networks.list())
371 api.network.floating_ip_supported(IsA(http.HttpRequest)) \ 370 api.neutron.floating_ip_supported(IsA(http.HttpRequest)) \
372 .AndReturn(True) 371 .AndReturn(True)
373 api.network.tenant_floating_ip_list(IsA(http.HttpRequest)) \ 372 api.neutron.tenant_floating_ip_list(IsA(http.HttpRequest)) \
374 .MultipleTimes().AndReturn(self.floating_ips.list()) 373 .MultipleTimes().AndReturn(self.floating_ips.list())
375 api.network.floating_ip_pools_list(IsA(http.HttpRequest)) \ 374 api.neutron.floating_ip_pools_list(IsA(http.HttpRequest)) \
376 .AndReturn(self.pools.list()) 375 .AndReturn(self.pools.list())
377 api.network.security_group_list(IsA(http.HttpRequest)) \ 376 api.neutron.security_group_list(IsA(http.HttpRequest)) \
378 .AndReturn(self.security_groups.list()) 377 .AndReturn(self.security_groups.list())
379 self.mox.ReplayAll() 378 self.mox.ReplayAll()
380 379
diff --git a/openstack_dashboard/dashboards/project/floating_ips/views.py b/openstack_dashboard/dashboards/project/floating_ips/views.py
index bb8625f..dfd2a52 100644
--- a/openstack_dashboard/dashboards/project/floating_ips/views.py
+++ b/openstack_dashboard/dashboards/project/floating_ips/views.py
@@ -68,7 +68,7 @@ class AllocateView(forms.ModalFormView):
68 68
69 def get_initial(self): 69 def get_initial(self):
70 try: 70 try:
71 pools = api.network.floating_ip_pools_list(self.request) 71 pools = api.neutron.floating_ip_pools_list(self.request)
72 except neutron_exc.ConnectionFailed: 72 except neutron_exc.ConnectionFailed:
73 pools = [] 73 pools = []
74 exceptions.handle(self.request) 74 exceptions.handle(self.request)
@@ -88,7 +88,7 @@ class IndexView(tables.DataTableView):
88 88
89 def get_data(self): 89 def get_data(self):
90 try: 90 try:
91 floating_ips = api.network.tenant_floating_ip_list(self.request) 91 floating_ips = api.neutron.tenant_floating_ip_list(self.request)
92 except neutron_exc.ConnectionFailed: 92 except neutron_exc.ConnectionFailed:
93 floating_ips = [] 93 floating_ips = []
94 exceptions.handle(self.request) 94 exceptions.handle(self.request)
@@ -99,7 +99,7 @@ class IndexView(tables.DataTableView):
99 99
100 try: 100 try:
101 floating_ip_pools = \ 101 floating_ip_pools = \
102 api.network.floating_ip_pools_list(self.request) 102 api.neutron.floating_ip_pools_list(self.request)
103 except neutron_exc.ConnectionFailed: 103 except neutron_exc.ConnectionFailed:
104 floating_ip_pools = [] 104 floating_ip_pools = []
105 exceptions.handle(self.request) 105 exceptions.handle(self.request)
diff --git a/openstack_dashboard/dashboards/project/floating_ips/workflows.py b/openstack_dashboard/dashboards/project/floating_ips/workflows.py
index 093c95b..faadc42 100644
--- a/openstack_dashboard/dashboards/project/floating_ips/workflows.py
+++ b/openstack_dashboard/dashboards/project/floating_ips/workflows.py
@@ -54,7 +54,7 @@ class AssociateIPAction(workflows.Action):
54 q_port_id = self.request.GET.get('port_id') 54 q_port_id = self.request.GET.get('port_id')
55 if q_instance_id: 55 if q_instance_id:
56 targets = self._get_target_list() 56 targets = self._get_target_list()
57 target_id = api.network.floating_ip_target_get_by_instance( 57 target_id = api.neutron.floating_ip_target_get_by_instance(
58 self.request, q_instance_id, targets) 58 self.request, q_instance_id, targets)
59 self.initial['instance_id'] = target_id 59 self.initial['instance_id'] = target_id
60 elif q_port_id: 60 elif q_port_id:
@@ -69,7 +69,7 @@ class AssociateIPAction(workflows.Action):
69 ips = [] 69 ips = []
70 redirect = reverse('horizon:project:floating_ips:index') 70 redirect = reverse('horizon:project:floating_ips:index')
71 try: 71 try:
72 ips = api.network.tenant_floating_ip_list(self.request) 72 ips = api.neutron.tenant_floating_ip_list(self.request)
73 except neutron_exc.ConnectionFailed: 73 except neutron_exc.ConnectionFailed:
74 exceptions.handle(self.request, redirect=redirect) 74 exceptions.handle(self.request, redirect=redirect)
75 except Exception: 75 except Exception:
@@ -88,7 +88,7 @@ class AssociateIPAction(workflows.Action):
88 def _get_target_list(self): 88 def _get_target_list(self):
89 targets = [] 89 targets = []
90 try: 90 try:
91 targets = api.network.floating_ip_target_list(self.request) 91 targets = api.neutron.floating_ip_target_list(self.request)
92 except Exception: 92 except Exception:
93 redirect = reverse('horizon:project:floating_ips:index') 93 redirect = reverse('horizon:project:floating_ips:index')
94 exceptions.handle(self.request, 94 exceptions.handle(self.request,
@@ -145,7 +145,7 @@ class IPAssociationWorkflow(workflows.Workflow):
145 145
146 def handle(self, request, data): 146 def handle(self, request, data):
147 try: 147 try:
148 api.network.floating_ip_associate(request, 148 api.neutron.floating_ip_associate(request,
149 data['ip_id'], 149 data['ip_id'],
150 data['instance_id']) 150 data['instance_id'])
151 except neutron_exc.Conflict: 151 except neutron_exc.Conflict:
diff --git a/openstack_dashboard/dashboards/project/instances/tables.py b/openstack_dashboard/dashboards/project/instances/tables.py
index 76eec68..4ed1170 100644
--- a/openstack_dashboard/dashboards/project/instances/tables.py
+++ b/openstack_dashboard/dashboards/project/instances/tables.py
@@ -633,9 +633,9 @@ class AssociateIP(policy.PolicyTargetMixin, tables.LinkAction):
633 def allowed(self, request, instance): 633 def allowed(self, request, instance):
634 if not api.base.is_service_enabled(request, 'network'): 634 if not api.base.is_service_enabled(request, 'network'):
635 return False 635 return False
636 if not api.network.floating_ip_supported(request): 636 if not api.neutron.floating_ip_supported(request):
637 return False 637 return False
638 if api.network.floating_ip_simple_associate_supported(request): 638 if api.neutron.floating_ip_simple_associate_supported(request):
639 return False 639 return False
640 if instance.status == "ERROR": 640 if instance.status == "ERROR":
641 return False 641 return False
@@ -669,7 +669,7 @@ class SimpleDisassociateIP(policy.PolicyTargetMixin, tables.Action):
669 def allowed(self, request, instance): 669 def allowed(self, request, instance):
670 if not api.base.is_service_enabled(request, 'network'): 670 if not api.base.is_service_enabled(request, 'network'):
671 return False 671 return False
672 if not api.network.floating_ip_supported(request): 672 if not api.neutron.floating_ip_supported(request):
673 return False 673 return False
674 if not conf.HORIZON_CONFIG["simple_ip_management"]: 674 if not conf.HORIZON_CONFIG["simple_ip_management"]:
675 return False 675 return False
@@ -683,18 +683,18 @@ class SimpleDisassociateIP(policy.PolicyTargetMixin, tables.Action):
683 try: 683 try:
684 # target_id is port_id for Neutron and instance_id for Nova Network 684 # target_id is port_id for Neutron and instance_id for Nova Network
685 # (Neutron API wrapper returns a 'portid_fixedip' string) 685 # (Neutron API wrapper returns a 'portid_fixedip' string)
686 targets = api.network.floating_ip_target_list_by_instance( 686 targets = api.neutron.floating_ip_target_list_by_instance(
687 request, instance_id) 687 request, instance_id)
688 688
689 target_ids = [t.split('_')[0] for t in targets] 689 target_ids = [t.split('_')[0] for t in targets]
690 690
691 fips = [fip for fip in api.network.tenant_floating_ip_list(request) 691 fips = [fip for fip in api.neutron.tenant_floating_ip_list(request)
692 if fip.port_id in target_ids] 692 if fip.port_id in target_ids]
693 # Removing multiple floating IPs at once doesn't work, so this pops 693 # Removing multiple floating IPs at once doesn't work, so this pops
694 # off the first one. 694 # off the first one.
695 if fips: 695 if fips:
696 fip = fips.pop() 696 fip = fips.pop()
697 api.network.floating_ip_disassociate(request, fip.id) 697 api.neutron.floating_ip_disassociate(request, fip.id)
698 messages.success(request, 698 messages.success(request,
699 _("Successfully disassociated " 699 _("Successfully disassociated "
700 "floating IP: %s") % fip.ip) 700 "floating IP: %s") % fip.ip)
diff --git a/openstack_dashboard/dashboards/project/instances/tests.py b/openstack_dashboard/dashboards/project/instances/tests.py
index afef5cf..9c46324 100644
--- a/openstack_dashboard/dashboards/project/instances/tests.py
+++ b/openstack_dashboard/dashboards/project/instances/tests.py
@@ -100,7 +100,7 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
100 .AndReturn(self.flavors.list()) 100 .AndReturn(self.flavors.list())
101 api.nova.keypair_list(IsA(http.HttpRequest)) \ 101 api.nova.keypair_list(IsA(http.HttpRequest)) \
102 .AndReturn(self.keypairs.list()) 102 .AndReturn(self.keypairs.list())
103 api.network.security_group_list(IsA(http.HttpRequest)) \ 103 api.neutron.security_group_list(IsA(http.HttpRequest)) \
104 .AndReturn(self.security_groups.list()) 104 .AndReturn(self.security_groups.list())
105 api.nova.availability_zone_list(IsA(http.HttpRequest)) \ 105 api.nova.availability_zone_list(IsA(http.HttpRequest)) \
106 .AndReturn(self.availability_zones.list()) 106 .AndReturn(self.availability_zones.list())
@@ -123,9 +123,11 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
123 'is_feature_available', 123 'is_feature_available',
124 ), 124 ),
125 api.glance: ('image_list_detailed',), 125 api.glance: ('image_list_detailed',),
126 api.network: ( 126 api.neutron: (
127 'floating_ip_simple_associate_supported', 127 'floating_ip_simple_associate_supported',
128 'floating_ip_supported', 128 'floating_ip_supported',
129 ),
130 api.network: (
129 'servers_update_addresses', 131 'servers_update_addresses',
130 ), 132 ),
131 }) 133 })
@@ -148,9 +150,9 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
148 api.network.servers_update_addresses(IsA(http.HttpRequest), servers) 150 api.network.servers_update_addresses(IsA(http.HttpRequest), servers)
149 api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \ 151 api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \
150 .MultipleTimes().AndReturn(self.limits['absolute']) 152 .MultipleTimes().AndReturn(self.limits['absolute'])
151 api.network.floating_ip_supported(IsA(http.HttpRequest)) \ 153 api.neutron.floating_ip_supported(IsA(http.HttpRequest)) \
152 .MultipleTimes().AndReturn(True) 154 .MultipleTimes().AndReturn(True)
153 api.network.floating_ip_simple_associate_supported( 155 api.neutron.floating_ip_simple_associate_supported(
154 IsA(http.HttpRequest)).MultipleTimes().AndReturn(True) 156 IsA(http.HttpRequest)).MultipleTimes().AndReturn(True)
155 157
156 self.mox.ReplayAll() 158 self.mox.ReplayAll()
@@ -197,9 +199,9 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
197 'tenant_absolute_limits', 'extension_supported', 199 'tenant_absolute_limits', 'extension_supported',
198 'is_feature_available',), 200 'is_feature_available',),
199 api.glance: ('image_list_detailed',), 201 api.glance: ('image_list_detailed',),
200 api.network: ('floating_ip_simple_associate_supported', 202 api.neutron: ('floating_ip_simple_associate_supported',
201 'floating_ip_supported', 203 'floating_ip_supported',),
202 'servers_update_addresses',), 204 api.network: ('servers_update_addresses',),
203 }) 205 })
204 def test_index_flavor_list_exception(self): 206 def test_index_flavor_list_exception(self):
205 servers = self.servers.list() 207 servers = self.servers.list()
@@ -225,9 +227,9 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
225 AndReturn(full_flavors[server.flavor["id"]]) 227 AndReturn(full_flavors[server.flavor["id"]])
226 api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \ 228 api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \
227 .MultipleTimes().AndReturn(self.limits['absolute']) 229 .MultipleTimes().AndReturn(self.limits['absolute'])
228 api.network.floating_ip_supported(IsA(http.HttpRequest)) \ 230 api.neutron.floating_ip_supported(IsA(http.HttpRequest)) \
229 .MultipleTimes().AndReturn(True) 231 .MultipleTimes().AndReturn(True)
230 api.network.floating_ip_simple_associate_supported( 232 api.neutron.floating_ip_simple_associate_supported(
231 IsA(http.HttpRequest)).MultipleTimes().AndReturn(True) 233 IsA(http.HttpRequest)).MultipleTimes().AndReturn(True)
232 234
233 self.mox.ReplayAll() 235 self.mox.ReplayAll()
@@ -243,9 +245,9 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
243 api.nova: ('flavor_list', 'server_list', 'tenant_absolute_limits', 245 api.nova: ('flavor_list', 'server_list', 'tenant_absolute_limits',
244 'extension_supported', 'is_feature_available',), 246 'extension_supported', 'is_feature_available',),
245 api.glance: ('image_list_detailed',), 247 api.glance: ('image_list_detailed',),
246 api.network: ('floating_ip_simple_associate_supported', 248 api.neutron: ('floating_ip_simple_associate_supported',
247 'floating_ip_supported', 249 'floating_ip_supported',),
248 'servers_update_addresses',), 250 api.network: ('servers_update_addresses',),
249 }) 251 })
250 def test_index_with_instance_booted_from_volume(self): 252 def test_index_with_instance_booted_from_volume(self):
251 volume_server = self.servers.first() 253 volume_server = self.servers.first()
@@ -271,9 +273,9 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
271 api.network.servers_update_addresses(IsA(http.HttpRequest), servers) 273 api.network.servers_update_addresses(IsA(http.HttpRequest), servers)
272 api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \ 274 api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \
273 .MultipleTimes().AndReturn(self.limits['absolute']) 275 .MultipleTimes().AndReturn(self.limits['absolute'])
274 api.network.floating_ip_supported(IsA(http.HttpRequest)) \ 276 api.neutron.floating_ip_supported(IsA(http.HttpRequest)) \
275 .MultipleTimes().AndReturn(True) 277 .MultipleTimes().AndReturn(True)
276 api.network.floating_ip_simple_associate_supported( 278 api.neutron.floating_ip_simple_associate_supported(
277 IsA(http.HttpRequest)).MultipleTimes().AndReturn(True) 279 IsA(http.HttpRequest)).MultipleTimes().AndReturn(True)
278 280
279 self.mox.ReplayAll() 281 self.mox.ReplayAll()
@@ -988,12 +990,12 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
988 "extension_supported", 990 "extension_supported",
989 'is_feature_available', 991 'is_feature_available',
990 ), 992 ),
991 api.network: ( 993 api.neutron: (
992 "server_security_groups", 994 "server_security_groups",
993 "servers_update_addresses",
994 "floating_ip_simple_associate_supported", 995 "floating_ip_simple_associate_supported",
995 "floating_ip_supported" 996 "floating_ip_supported"
996 ) 997 ),
998 api.network: ('servers_update_addresses',),
997 }) 999 })
998 def _get_instance_details(self, server, qs=None, 1000 def _get_instance_details(self, server, qs=None,
999 flavor_return=None, volumes_return=None, 1001 flavor_return=None, volumes_return=None,
@@ -1024,11 +1026,11 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
1024 else: 1026 else:
1025 api.nova.flavor_get(IsA(http.HttpRequest), server.flavor['id']) \ 1027 api.nova.flavor_get(IsA(http.HttpRequest), server.flavor['id']) \
1026 .AndReturn(flavor_return) 1028 .AndReturn(flavor_return)
1027 api.network.server_security_groups(IsA(http.HttpRequest), server.id) \ 1029 api.neutron.server_security_groups(IsA(http.HttpRequest), server.id) \
1028 .AndReturn(security_groups_return) 1030 .AndReturn(security_groups_return)
1029 api.network.floating_ip_simple_associate_supported( 1031 api.neutron.floating_ip_simple_associate_supported(
1030 IsA(http.HttpRequest)).MultipleTimes().AndReturn(True) 1032 IsA(http.HttpRequest)).MultipleTimes().AndReturn(True)
1031 api.network.floating_ip_supported(IsA(http.HttpRequest)) \ 1033 api.neutron.floating_ip_supported(IsA(http.HttpRequest)) \
1032 .MultipleTimes().AndReturn(True) 1034 .MultipleTimes().AndReturn(True)
1033 api.nova.extension_supported('AdminActions', IsA(http.HttpRequest)) \ 1035 api.nova.extension_supported('AdminActions', IsA(http.HttpRequest)) \
1034 .MultipleTimes().AndReturn(True) 1036 .MultipleTimes().AndReturn(True)
@@ -1400,9 +1402,9 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
1400 api.nova: ('flavor_list', 'server_list', 'tenant_absolute_limits', 1402 api.nova: ('flavor_list', 'server_list', 'tenant_absolute_limits',
1401 'extension_supported', 'is_feature_available',), 1403 'extension_supported', 'is_feature_available',),
1402 api.glance: ('image_list_detailed',), 1404 api.glance: ('image_list_detailed',),
1403 api.network: ('floating_ip_simple_associate_supported', 1405 api.neutron: ('floating_ip_simple_associate_supported',
1404 'floating_ip_supported', 1406 'floating_ip_supported',),
1405 'servers_update_addresses',), 1407 api.network: ('servers_update_addresses',),
1406 }) 1408 })
1407 def _test_instances_index_retrieve_password_action(self): 1409 def _test_instances_index_retrieve_password_action(self):
1408 servers = self.servers.list() 1410 servers = self.servers.list()
@@ -1423,9 +1425,9 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
1423 api.network.servers_update_addresses(IsA(http.HttpRequest), servers) 1425 api.network.servers_update_addresses(IsA(http.HttpRequest), servers)
1424 api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \ 1426 api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \
1425 .MultipleTimes().AndReturn(self.limits['absolute']) 1427 .MultipleTimes().AndReturn(self.limits['absolute'])
1426 api.network.floating_ip_supported(IsA(http.HttpRequest)) \ 1428 api.neutron.floating_ip_supported(IsA(http.HttpRequest)) \
1427 .MultipleTimes().AndReturn(True) 1429 .MultipleTimes().AndReturn(True)
1428 api.network.floating_ip_simple_associate_supported( 1430 api.neutron.floating_ip_simple_associate_supported(
1429 IsA(http.HttpRequest)).MultipleTimes().AndReturn(True) 1431 IsA(http.HttpRequest)).MultipleTimes().AndReturn(True)
1430 1432
1431 self.mox.ReplayAll() 1433 self.mox.ReplayAll()
@@ -1470,7 +1472,7 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
1470 1472
1471 instance_update_get_stubs = { 1473 instance_update_get_stubs = {
1472 api.nova: ('server_get',), 1474 api.nova: ('server_get',),
1473 api.network: ('security_group_list', 1475 api.neutron: ('security_group_list',
1474 'server_security_groups',)} 1476 'server_security_groups',)}
1475 1477
1476 @helpers.create_stubs(instance_update_get_stubs) 1478 @helpers.create_stubs(instance_update_get_stubs)
@@ -1478,9 +1480,9 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
1478 server = self.servers.first() 1480 server = self.servers.first()
1479 1481
1480 api.nova.server_get(IsA(http.HttpRequest), server.id).AndReturn(server) 1482 api.nova.server_get(IsA(http.HttpRequest), server.id).AndReturn(server)
1481 api.network.security_group_list(IsA(http.HttpRequest)) \ 1483 api.neutron.security_group_list(IsA(http.HttpRequest)) \
1482 .AndReturn([]) 1484 .AndReturn([])
1483 api.network.server_security_groups(IsA(http.HttpRequest), 1485 api.neutron.server_security_groups(IsA(http.HttpRequest),
1484 server.id).AndReturn([]) 1486 server.id).AndReturn([])
1485 1487
1486 self.mox.ReplayAll() 1488 self.mox.ReplayAll()
@@ -1517,7 +1519,7 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
1517 1519
1518 instance_update_post_stubs = { 1520 instance_update_post_stubs = {
1519 api.nova: ('server_get', 'server_update'), 1521 api.nova: ('server_get', 'server_update'),
1520 api.network: ('security_group_list', 1522 api.neutron: ('security_group_list',
1521 'server_security_groups', 1523 'server_security_groups',
1522 'server_update_security_groups')} 1524 'server_update_security_groups')}
1523 1525
@@ -1530,15 +1532,15 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
1530 wanted_groups = [secgroups[1].id, secgroups[2].id] 1532 wanted_groups = [secgroups[1].id, secgroups[2].id]
1531 1533
1532 api.nova.server_get(IsA(http.HttpRequest), server.id).AndReturn(server) 1534 api.nova.server_get(IsA(http.HttpRequest), server.id).AndReturn(server)
1533 api.network.security_group_list(IsA(http.HttpRequest)) \ 1535 api.neutron.security_group_list(IsA(http.HttpRequest)) \
1534 .AndReturn(secgroups) 1536 .AndReturn(secgroups)
1535 api.network.server_security_groups(IsA(http.HttpRequest), 1537 api.neutron.server_security_groups(IsA(http.HttpRequest),
1536 server.id).AndReturn(server_groups) 1538 server.id).AndReturn(server_groups)
1537 1539
1538 api.nova.server_update(IsA(http.HttpRequest), 1540 api.nova.server_update(IsA(http.HttpRequest),
1539 server.id, 1541 server.id,
1540 server.name).AndReturn(server) 1542 server.name).AndReturn(server)
1541 api.network.server_update_security_groups(IsA(http.HttpRequest), 1543 api.neutron.server_update_security_groups(IsA(http.HttpRequest),
1542 server.id, 1544 server.id,
1543 wanted_groups) 1545 wanted_groups)
1544 1546
@@ -1553,14 +1555,14 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
1553 server = self.servers.first() 1555 server = self.servers.first()
1554 1556
1555 api.nova.server_get(IsA(http.HttpRequest), server.id).AndReturn(server) 1557 api.nova.server_get(IsA(http.HttpRequest), server.id).AndReturn(server)
1556 api.network.security_group_list(IsA(http.HttpRequest)) \ 1558 api.neutron.security_group_list(IsA(http.HttpRequest)) \
1557 .AndReturn([]) 1559 .AndReturn([])
1558 api.network.server_security_groups(IsA(http.HttpRequest), 1560 api.neutron.server_security_groups(IsA(http.HttpRequest),
1559 server.id).AndReturn([]) 1561 server.id).AndReturn([])
1560 1562
1561 api.nova.server_update(IsA(http.HttpRequest), server.id, server.name) \ 1563 api.nova.server_update(IsA(http.HttpRequest), server.id, server.name) \
1562 .AndRaise(self.exceptions.nova) 1564 .AndRaise(self.exceptions.nova)
1563 api.network.server_update_security_groups( 1565 api.neutron.server_update_security_groups(
1564 IsA(http.HttpRequest), server.id, []) 1566 IsA(http.HttpRequest), server.id, [])
1565 1567
1566 self.mox.ReplayAll() 1568 self.mox.ReplayAll()
@@ -1573,15 +1575,15 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
1573 server = self.servers.first() 1575 server = self.servers.first()
1574 1576
1575 api.nova.server_get(IsA(http.HttpRequest), server.id).AndReturn(server) 1577 api.nova.server_get(IsA(http.HttpRequest), server.id).AndReturn(server)
1576 api.network.security_group_list(IsA(http.HttpRequest)) \ 1578 api.neutron.security_group_list(IsA(http.HttpRequest)) \
1577 .AndReturn([]) 1579 .AndReturn([])
1578 api.network.server_security_groups(IsA(http.HttpRequest), 1580 api.neutron.server_security_groups(IsA(http.HttpRequest),
1579 server.id).AndReturn([]) 1581 server.id).AndReturn([])
1580 1582
1581 api.nova.server_update(IsA(http.HttpRequest), 1583 api.nova.server_update(IsA(http.HttpRequest),
1582 server.id, 1584 server.id,
1583 server.name).AndReturn(server) 1585 server.name).AndReturn(server)
1584 api.network.server_update_security_groups( 1586 api.neutron.server_update_security_groups(
1585 IsA(http.HttpRequest), 1587 IsA(http.HttpRequest),
1586 server.id, []).AndRaise(self.exceptions.nova) 1588 server.id, []).AndRaise(self.exceptions.nova)
1587 1589
@@ -1596,11 +1598,11 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
1596 'keypair_list', 1598 'keypair_list',
1597 'server_group_list', 1599 'server_group_list',
1598 'availability_zone_list',), 1600 'availability_zone_list',),
1599 api.network: ('security_group_list',),
1600 cinder: ('volume_snapshot_list', 1601 cinder: ('volume_snapshot_list',
1601 'volume_list',), 1602 'volume_list',),
1602 api.neutron: ('network_list', 1603 api.neutron: ('network_list',
1603 'port_list'), 1604 'port_list',
1605 'security_group_list',),
1604 api.glance: ('image_list_detailed',), 1606 api.glance: ('image_list_detailed',),
1605 quotas: ('tenant_limit_usages',)}) 1607 quotas: ('tenant_limit_usages',)})
1606 def test_launch_instance_get(self, 1608 def test_launch_instance_get(self,
@@ -1832,11 +1834,11 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
1832 'keypair_list', 1834 'keypair_list',
1833 'server_group_list', 1835 'server_group_list',
1834 'availability_zone_list',), 1836 'availability_zone_list',),
1835 api.network: ('security_group_list',),
1836 cinder: ('volume_snapshot_list', 1837 cinder: ('volume_snapshot_list',
1837 'volume_list',), 1838 'volume_list',),
1838 api.neutron: ('network_list', 1839 api.neutron: ('network_list',
1839 'port_list'), 1840 'port_list',
1841 'security_group_list',),
1840 api.glance: ('image_list_detailed',), 1842 api.glance: ('image_list_detailed',),
1841 quotas: ('tenant_limit_usages',)}) 1843 quotas: ('tenant_limit_usages',)})
1842 def test_launch_instance_get_bootable_volumes(self, 1844 def test_launch_instance_get_bootable_volumes(self,
@@ -1925,7 +1927,8 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
1925 @helpers.create_stubs({api.glance: ('image_list_detailed',), 1927 @helpers.create_stubs({api.glance: ('image_list_detailed',),
1926 api.neutron: ('network_list', 1928 api.neutron: ('network_list',
1927 'port_create', 1929 'port_create',
1928 'port_list'), 1930 'port_list',
1931 'security_group_list',),
1929 api.nova: ('extension_supported', 1932 api.nova: ('extension_supported',
1930 'is_feature_available', 1933 'is_feature_available',
1931 'flavor_list', 1934 'flavor_list',
@@ -1933,7 +1936,6 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
1933 'availability_zone_list', 1936 'availability_zone_list',
1934 'server_group_list', 1937 'server_group_list',
1935 'server_create',), 1938 'server_create',),
1936 api.network: ('security_group_list',),
1937 cinder: ('volume_list', 1939 cinder: ('volume_list',
1938 'volume_snapshot_list',), 1940 'volume_snapshot_list',),
1939 quotas: ('tenant_quota_usages',)}) 1941 quotas: ('tenant_quota_usages',)})
@@ -2037,14 +2039,14 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
2037 @helpers.create_stubs({api.glance: ('image_list_detailed',), 2039 @helpers.create_stubs({api.glance: ('image_list_detailed',),
2038 api.neutron: ('network_list', 2040 api.neutron: ('network_list',
2039 'port_create', 2041 'port_create',
2040 'port_list'), 2042 'port_list',
2043 'security_group_list',),
2041 api.nova: ('extension_supported', 2044 api.nova: ('extension_supported',
2042 'is_feature_available', 2045 'is_feature_available',
2043 'flavor_list', 2046 'flavor_list',
2044 'keypair_list', 2047 'keypair_list',
2045 'availability_zone_list', 2048 'availability_zone_list',
2046 'server_create',), 2049 'server_create',),
2047 api.network: ('security_group_list',),
2048 cinder: ('volume_list', 2050 cinder: ('volume_list',
2049 'volume_snapshot_list',), 2051 'volume_snapshot_list',),
2050 quotas: ('tenant_quota_usages',)}) 2052 quotas: ('tenant_quota_usages',)})
@@ -2159,7 +2161,8 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
2159 @helpers.create_stubs({api.glance: ('image_list_detailed',), 2161 @helpers.create_stubs({api.glance: ('image_list_detailed',),
2160 api.neutron: ('network_list', 2162 api.neutron: ('network_list',
2161 'port_create', 2163 'port_create',
2162 'port_list'), 2164 'port_list',
2165 'security_group_list',),
2163 api.nova: ('server_create', 2166 api.nova: ('server_create',
2164 'extension_supported', 2167 'extension_supported',
2165 'is_feature_available', 2168 'is_feature_available',
@@ -2167,7 +2170,6 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
2167 'keypair_list', 2170 'keypair_list',
2168 'availability_zone_list', 2171 'availability_zone_list',
2169 'server_group_list',), 2172 'server_group_list',),
2170 api.network: ('security_group_list',),
2171 cinder: ('volume_list', 2173 cinder: ('volume_list',
2172 'volume_snapshot_list',), 2174 'volume_snapshot_list',),
2173 quotas: ('tenant_quota_usages',)}) 2175 quotas: ('tenant_quota_usages',)})
@@ -2260,13 +2262,13 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
2260 2262
2261 @helpers.create_stubs({api.glance: ('image_list_detailed',), 2263 @helpers.create_stubs({api.glance: ('image_list_detailed',),
2262 api.neutron: ('network_list', 2264 api.neutron: ('network_list',
2263 'port_list'), 2265 'port_list',
2266 'security_group_list',),
2264 api.nova: ('extension_supported', 2267 api.nova: ('extension_supported',
2265 'is_feature_available', 2268 'is_feature_available',
2266 'flavor_list', 2269 'flavor_list',
2267 'keypair_list', 2270 'keypair_list',
2268 'availability_zone_list'), 2271 'availability_zone_list'),
2269 api.network: ('security_group_list',),
2270 cinder: ('volume_list', 2272 cinder: ('volume_list',
2271 'volume_snapshot_list',), 2273 'volume_snapshot_list',),
2272 quotas: ('tenant_quota_usages', 2274 quotas: ('tenant_quota_usages',
@@ -2337,7 +2339,8 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
2337 api.glance: ('image_list_detailed',), 2339 api.glance: ('image_list_detailed',),
2338 api.neutron: ('network_list', 2340 api.neutron: ('network_list',
2339 'port_create', 2341 'port_create',
2340 'port_list'), 2342 'port_list',
2343 'security_group_list',),
2341 api.nova: ('extension_supported', 2344 api.nova: ('extension_supported',
2342 'is_feature_available', 2345 'is_feature_available',
2343 'flavor_list', 2346 'flavor_list',
@@ -2345,7 +2348,6 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
2345 'availability_zone_list', 2348 'availability_zone_list',
2346 'server_group_list', 2349 'server_group_list',
2347 'server_create',), 2350 'server_create',),
2348 api.network: ('security_group_list',),
2349 cinder: ('volume_list', 2351 cinder: ('volume_list',
2350 'volume_snapshot_list',), 2352 'volume_snapshot_list',),
2351 quotas: ('tenant_quota_usages',)}) 2353 quotas: ('tenant_quota_usages',)})
@@ -2463,7 +2465,8 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
2463 api.glance: ('image_list_detailed',), 2465 api.glance: ('image_list_detailed',),
2464 api.neutron: ('network_list', 2466 api.neutron: ('network_list',
2465 'port_create', 2467 'port_create',
2466 'port_list'), 2468 'port_list',
2469 'security_group_list',),
2467 api.nova: ('extension_supported', 2470 api.nova: ('extension_supported',
2468 'is_feature_available', 2471 'is_feature_available',
2469 'flavor_list', 2472 'flavor_list',
@@ -2471,7 +2474,6 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
2471 'availability_zone_list', 2474 'availability_zone_list',
2472 'server_create', 2475 'server_create',
2473 'tenant_absolute_limits'), 2476 'tenant_absolute_limits'),
2474 api.network: ('security_group_list',),
2475 cinder: ('volume_list', 2477 cinder: ('volume_list',
2476 'volume_snapshot_list', 2478 'volume_snapshot_list',
2477 'tenant_absolute_limits'), 2479 'tenant_absolute_limits'),
@@ -2532,10 +2534,10 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
2532 2534
2533 @helpers.create_stubs({api.glance: ('image_list_detailed',), 2535 @helpers.create_stubs({api.glance: ('image_list_detailed',),
2534 api.neutron: ('network_list', 2536 api.neutron: ('network_list',
2535 'port_list'), 2537 'port_list',
2538 'security_group_list',),
2536 cinder: ('volume_list', 2539 cinder: ('volume_list',
2537 'volume_snapshot_list',), 2540 'volume_snapshot_list',),
2538 api.network: ('security_group_list',),
2539 api.nova: ('extension_supported', 2541 api.nova: ('extension_supported',
2540 'is_feature_available', 2542 'is_feature_available',
2541 'flavor_list', 2543 'flavor_list',
@@ -2571,7 +2573,7 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
2571 .AndRaise(self.exceptions.nova) 2573 .AndRaise(self.exceptions.nova)
2572 api.nova.keypair_list(IsA(http.HttpRequest)) \ 2574 api.nova.keypair_list(IsA(http.HttpRequest)) \
2573 .AndReturn(self.keypairs.list()) 2575 .AndReturn(self.keypairs.list())
2574 api.network.security_group_list(IsA(http.HttpRequest)) \ 2576 api.neutron.security_group_list(IsA(http.HttpRequest)) \
2575 .AndReturn(self.security_groups.list()) 2577 .AndReturn(self.security_groups.list())
2576 api.nova.availability_zone_list(IsA(http.HttpRequest)) \ 2578 api.nova.availability_zone_list(IsA(http.HttpRequest)) \
2577 .AndReturn(self.availability_zones.list()) 2579 .AndReturn(self.availability_zones.list())
@@ -2591,7 +2593,8 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
2591 api.neutron: ('network_list', 2593 api.neutron: ('network_list',
2592 'port_create', 2594 'port_create',
2593 'port_delete', 2595 'port_delete',
2594 'port_list'), 2596 'port_list',
2597 'security_group_list',),
2595 api.nova: ('extension_supported', 2598 api.nova: ('extension_supported',
2596 'is_feature_available', 2599 'is_feature_available',
2597 'flavor_list', 2600 'flavor_list',
@@ -2599,7 +2602,6 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
2599 'availability_zone_list', 2602 'availability_zone_list',
2600 'server_group_list', 2603 'server_group_list',
2601 'server_create',), 2604 'server_create',),
2602 api.network: ('security_group_list',),
2603 cinder: ('volume_list', 2605 cinder: ('volume_list',
2604 'volume_snapshot_list',), 2606 'volume_snapshot_list',),
2605 quotas: ('tenant_quota_usages',)}) 2607 quotas: ('tenant_quota_usages',)})
@@ -2629,7 +2631,7 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
2629 .AndReturn(volumes) 2631 .AndReturn(volumes)
2630 api.nova.flavor_list(IgnoreArg()).AndReturn(self.flavors.list()) 2632 api.nova.flavor_list(IgnoreArg()).AndReturn(self.flavors.list())
2631 api.nova.keypair_list(IgnoreArg()).AndReturn(self.keypairs.list()) 2633 api.nova.keypair_list(IgnoreArg()).AndReturn(self.keypairs.list())
2632 api.network.security_group_list(IsA(http.HttpRequest)) \ 2634 api.neutron.security_group_list(IsA(http.HttpRequest)) \
2633 .AndReturn(self.security_groups.list()) 2635 .AndReturn(self.security_groups.list())
2634 api.nova.availability_zone_list(IsA(http.HttpRequest)) \ 2636 api.nova.availability_zone_list(IsA(http.HttpRequest)) \
2635 .AndReturn(self.availability_zones.list()) 2637 .AndReturn(self.availability_zones.list())
@@ -2699,13 +2701,13 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
2699 2701
2700 @helpers.create_stubs({api.glance: ('image_list_detailed',), 2702 @helpers.create_stubs({api.glance: ('image_list_detailed',),
2701 api.neutron: ('network_list', 2703 api.neutron: ('network_list',
2702 'port_list'), 2704 'port_list',
2705 'security_group_list',),
2703 api.nova: ('extension_supported', 2706 api.nova: ('extension_supported',
2704 'is_feature_available', 2707 'is_feature_available',
2705 'flavor_list', 2708 'flavor_list',
2706 'keypair_list', 2709 'keypair_list',
2707 'availability_zone_list',), 2710 'availability_zone_list',),
2708 api.network: ('security_group_list',),
2709 cinder: ('volume_list', 2711 cinder: ('volume_list',
2710 'volume_snapshot_list',), 2712 'volume_snapshot_list',),
2711 quotas: ('tenant_limit_usages', 2713 quotas: ('tenant_limit_usages',
@@ -2778,14 +2780,14 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
2778 2780
2779 @helpers.create_stubs({api.glance: ('image_list_detailed',), 2781 @helpers.create_stubs({api.glance: ('image_list_detailed',),
2780 api.neutron: ('network_list', 2782 api.neutron: ('network_list',
2781 'port_list'), 2783 'port_list',
2784 'security_group_list',),
2782 api.nova: ('extension_supported', 2785 api.nova: ('extension_supported',
2783 'is_feature_available', 2786 'is_feature_available',
2784 'flavor_list', 2787 'flavor_list',
2785 'keypair_list', 2788 'keypair_list',
2786 'server_group_list', 2789 'server_group_list',
2787 'availability_zone_list',), 2790 'availability_zone_list',),
2788 api.network: ('security_group_list',),
2789 cinder: ('volume_list', 2791 cinder: ('volume_list',
2790 'volume_snapshot_list',), 2792 'volume_snapshot_list',),
2791 quotas: ('tenant_quota_usages', 2793 quotas: ('tenant_quota_usages',
@@ -2884,13 +2886,13 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
2884 2886
2885 @helpers.create_stubs({api.glance: ('image_list_detailed',), 2887 @helpers.create_stubs({api.glance: ('image_list_detailed',),
2886 api.neutron: ('network_list', 2888 api.neutron: ('network_list',
2887 'port_list'), 2889 'port_list',
2890 'security_group_list',),
2888 api.nova: ('extension_supported', 2891 api.nova: ('extension_supported',
2889 'is_feature_available', 2892 'is_feature_available',
2890 'flavor_list', 2893 'flavor_list',
2891 'keypair_list', 2894 'keypair_list',
2892 'availability_zone_list',), 2895 'availability_zone_list',),
2893 api.network: ('security_group_list',),
2894 cinder: ('volume_list', 2896 cinder: ('volume_list',
2895 'volume_snapshot_list',), 2897 'volume_snapshot_list',),
2896 quotas: ('tenant_quota_usages', 2898 quotas: ('tenant_quota_usages',
@@ -2982,13 +2984,13 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
2982 2984
2983 @helpers.create_stubs({api.glance: ('image_list_detailed',), 2985 @helpers.create_stubs({api.glance: ('image_list_detailed',),
2984 api.neutron: ('network_list', 2986 api.neutron: ('network_list',
2985 'port_list'), 2987 'port_list',
2988 'security_group_list',),
2986 api.nova: ('extension_supported', 2989 api.nova: ('extension_supported',
2987 'is_feature_available', 2990 'is_feature_available',
2988 'flavor_list', 2991 'flavor_list',
2989 'keypair_list', 2992 'keypair_list',
2990 'availability_zone_list',), 2993 'availability_zone_list',),
2991 api.network: ('security_group_list',),
2992 cinder: ('volume_list', 2994 cinder: ('volume_list',
2993 'volume_snapshot_list',), 2995 'volume_snapshot_list',),
2994 quotas: ('tenant_quota_usages', 2996 quotas: ('tenant_quota_usages',
@@ -3013,7 +3015,7 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
3013 IsA(http.HttpRequest)).AndReturn(self.flavors.list()) 3015 IsA(http.HttpRequest)).AndReturn(self.flavors.list())
3014 api.nova.keypair_list( 3016 api.nova.keypair_list(
3015 IsA(http.HttpRequest)).AndReturn(self.keypairs.list()) 3017 IsA(http.HttpRequest)).AndReturn(self.keypairs.list())
3016 api.network.security_group_list( 3018 api.neutron.security_group_list(
3017 IsA(http.HttpRequest)).AndReturn(self.security_groups.list()) 3019 IsA(http.HttpRequest)).AndReturn(self.security_groups.list())
3018 api.nova.availability_zone_list( 3020 api.nova.availability_zone_list(
3019 IsA(http.HttpRequest)).AndReturn(self.availability_zones.list()) 3021 IsA(http.HttpRequest)).AndReturn(self.availability_zones.list())
@@ -3126,14 +3128,14 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
3126 3128
3127 @helpers.create_stubs({api.glance: ('image_list_detailed',), 3129 @helpers.create_stubs({api.glance: ('image_list_detailed',),
3128 api.neutron: ('network_list', 3130 api.neutron: ('network_list',
3129 'port_list'), 3131 'port_list',
3132 'security_group_list',),
3130 api.nova: ('extension_supported', 3133 api.nova: ('extension_supported',
3131 'is_feature_available', 3134 'is_feature_available',
3132 'flavor_list', 3135 'flavor_list',
3133 'keypair_list', 3136 'keypair_list',
3134 'server_group_list', 3137 'server_group_list',
3135 'availability_zone_list',), 3138 'availability_zone_list',),
3136 api.network: ('security_group_list',),
3137 cinder: ('volume_list', 3139 cinder: ('volume_list',
3138 'volume_snapshot_list',), 3140 'volume_snapshot_list',),
3139 quotas: ('tenant_quota_usages', 3141 quotas: ('tenant_quota_usages',
@@ -3160,7 +3162,7 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
3160 .AndReturn(True) 3162 .AndReturn(True)
3161 api.nova.keypair_list(IsA(http.HttpRequest)) \ 3163 api.nova.keypair_list(IsA(http.HttpRequest)) \
3162 .AndReturn(self.keypairs.list()) 3164 .AndReturn(self.keypairs.list())
3163 api.network.security_group_list(IsA(http.HttpRequest)) \ 3165 api.neutron.security_group_list(IsA(http.HttpRequest)) \
3164 .AndReturn(self.security_groups.list()) 3166 .AndReturn(self.security_groups.list())
3165 api.nova.availability_zone_list(IsA(http.HttpRequest)) \ 3167 api.nova.availability_zone_list(IsA(http.HttpRequest)) \
3166 .AndReturn(self.availability_zones.list()) 3168 .AndReturn(self.availability_zones.list())
@@ -3244,9 +3246,9 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
3244 api.nova: ('flavor_list', 'server_list', 'tenant_absolute_limits', 3246 api.nova: ('flavor_list', 'server_list', 'tenant_absolute_limits',
3245 'extension_supported', 'is_feature_available',), 3247 'extension_supported', 'is_feature_available',),
3246 api.glance: ('image_list_detailed',), 3248 api.glance: ('image_list_detailed',),
3247 api.network: ('floating_ip_simple_associate_supported', 3249 api.neutron: ('floating_ip_simple_associate_supported',
3248 'floating_ip_supported', 3250 'floating_ip_supported',),
3249 'servers_update_addresses',), 3251 api.network: ('servers_update_addresses',),
3250 }) 3252 })
3251 def test_launch_button_attributes(self): 3253 def test_launch_button_attributes(self):
3252 servers = self.servers.list() 3254 servers = self.servers.list()
@@ -3270,9 +3272,9 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
3270 api.network.servers_update_addresses(IsA(http.HttpRequest), servers) 3272 api.network.servers_update_addresses(IsA(http.HttpRequest), servers)
3271 api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \ 3273 api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \
3272 .MultipleTimes().AndReturn(limits) 3274 .MultipleTimes().AndReturn(limits)
3273 api.network.floating_ip_supported(IsA(http.HttpRequest)) \ 3275 api.neutron.floating_ip_supported(IsA(http.HttpRequest)) \
3274 .MultipleTimes().AndReturn(True) 3276 .MultipleTimes().AndReturn(True)
3275 api.network.floating_ip_simple_associate_supported( 3277 api.neutron.floating_ip_simple_associate_supported(
3276 IsA(http.HttpRequest)).MultipleTimes().AndReturn(True) 3278 IsA(http.HttpRequest)).MultipleTimes().AndReturn(True)
3277 3279
3278 self.mox.ReplayAll() 3280 self.mox.ReplayAll()
@@ -3293,9 +3295,9 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
3293 api.nova: ('flavor_list', 'server_list', 'tenant_absolute_limits', 3295 api.nova: ('flavor_list', 'server_list', 'tenant_absolute_limits',
3294 'extension_supported', 'is_feature_available',), 3296 'extension_supported', 'is_feature_available',),
3295 api.glance: ('image_list_detailed',), 3297 api.glance: ('image_list_detailed',),
3296 api.network: ('floating_ip_simple_associate_supported', 3298 api.neutron: ('floating_ip_simple_associate_supported',
3297 'floating_ip_supported', 3299 'floating_ip_supported',),
3298 'servers_update_addresses',), 3300 api.network: ('servers_update_addresses',),
3299 }) 3301 })
3300 def test_launch_button_disabled_when_quota_exceeded(self): 3302 def test_launch_button_disabled_when_quota_exceeded(self):
3301 servers = self.servers.list() 3303 servers = self.servers.list()
@@ -3319,9 +3321,9 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
3319 api.network.servers_update_addresses(IsA(http.HttpRequest), servers) 3321 api.network.servers_update_addresses(IsA(http.HttpRequest), servers)
3320 api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \ 3322 api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \
3321 .MultipleTimes().AndReturn(limits) 3323 .MultipleTimes().AndReturn(limits)
3322 api.network.floating_ip_supported(IsA(http.HttpRequest)) \ 3324 api.neutron.floating_ip_supported(IsA(http.HttpRequest)) \
3323 .MultipleTimes().AndReturn(True) 3325 .MultipleTimes().AndReturn(True)
3324 api.network.floating_ip_simple_associate_supported( 3326 api.neutron.floating_ip_simple_associate_supported(
3325 IsA(http.HttpRequest)).MultipleTimes().AndReturn(True) 3327 IsA(http.HttpRequest)).MultipleTimes().AndReturn(True)
3326 3328
3327 self.mox.ReplayAll() 3329 self.mox.ReplayAll()
@@ -3339,7 +3341,8 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
3339 3341
3340 @helpers.create_stubs({api.glance: ('image_list_detailed',), 3342 @helpers.create_stubs({api.glance: ('image_list_detailed',),
3341 api.neutron: ('network_list', 3343 api.neutron: ('network_list',
3342 'port_list'), 3344 'port_list',
3345 'security_group_list',),
3343 api.nova: ('extension_supported', 3346 api.nova: ('extension_supported',
3344 'is_feature_available', 3347 'is_feature_available',
3345 'flavor_list', 3348 'flavor_list',
@@ -3348,7 +3351,6 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
3348 'server_group_list', 3351 'server_group_list',
3349 'tenant_absolute_limits', 3352 'tenant_absolute_limits',
3350 'server_create',), 3353 'server_create',),
3351 api.network: ('security_group_list',),
3352 cinder: ('volume_list', 3354 cinder: ('volume_list',
3353 'volume_snapshot_list',), 3355 'volume_snapshot_list',),
3354 quotas: ('tenant_quota_usages',)}) 3356 quotas: ('tenant_quota_usages',)})
@@ -3445,9 +3447,9 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
3445 api.nova: ('flavor_list', 'server_list', 'tenant_absolute_limits', 3447 api.nova: ('flavor_list', 'server_list', 'tenant_absolute_limits',
3446 'extension_supported', 'is_feature_available',), 3448 'extension_supported', 'is_feature_available',),
3447 api.glance: ('image_list_detailed',), 3449 api.glance: ('image_list_detailed',),
3448 api.network: ('floating_ip_simple_associate_supported', 3450 api.neutron: ('floating_ip_simple_associate_supported',
3449 'floating_ip_supported', 3451 'floating_ip_supported',),
3450 'servers_update_addresses',), 3452 api.network: ('servers_update_addresses',),
3451 }) 3453 })
3452 def test_index_options_after_migrate(self): 3454 def test_index_options_after_migrate(self):
3453 servers = self.servers.list() 3455 servers = self.servers.list()
@@ -3471,9 +3473,9 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
3471 api.network.servers_update_addresses(IsA(http.HttpRequest), servers) 3473 api.network.servers_update_addresses(IsA(http.HttpRequest), servers)
3472 api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \ 3474 api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \
3473 .MultipleTimes().AndReturn(self.limits['absolute']) 3475 .MultipleTimes().AndReturn(self.limits['absolute'])
3474 api.network.floating_ip_supported(IsA(http.HttpRequest)) \ 3476 api.neutron.floating_ip_supported(IsA(http.HttpRequest)) \
3475 .MultipleTimes().AndReturn(True) 3477 .MultipleTimes().AndReturn(True)
3476 api.network.floating_ip_simple_associate_supported( 3478 api.neutron.floating_ip_simple_associate_supported(
3477 IsA(http.HttpRequest)).MultipleTimes().AndReturn(True) 3479 IsA(http.HttpRequest)).MultipleTimes().AndReturn(True)
3478 3480
3479 self.mox.ReplayAll() 3481 self.mox.ReplayAll()
@@ -3487,11 +3489,11 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
3487 'flavor_list', 3489 'flavor_list',
3488 'keypair_list', 3490 'keypair_list',
3489 'availability_zone_list'), 3491 'availability_zone_list'),
3490 api.network: ('security_group_list',),
3491 cinder: ('volume_snapshot_list', 3492 cinder: ('volume_snapshot_list',
3492 'volume_list',), 3493 'volume_list',),
3493 api.neutron: ('network_list', 3494 api.neutron: ('network_list',
3494 'port_list'), 3495 'port_list',
3496 'security_group_list',),
3495 api.glance: ('image_list_detailed',), 3497 api.glance: ('image_list_detailed',),
3496 quotas: ('tenant_limit_usages',)}) 3498 quotas: ('tenant_limit_usages',)})
3497 def test_select_default_keypair_if_only_one(self): 3499 def test_select_default_keypair_if_only_one(self):
@@ -3537,13 +3539,15 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
3537 def test_select_default_keypair_if_only_one_glance_v1(self): 3539 def test_select_default_keypair_if_only_one_glance_v1(self):
3538 self.test_select_default_keypair_if_only_one() 3540 self.test_select_default_keypair_if_only_one()
3539 3541
3540 @helpers.create_stubs({api.network: ('floating_ip_target_list_by_instance', 3542 @helpers.create_stubs({
3541 'tenant_floating_ip_list', 3543 api.neutron: ('floating_ip_target_list_by_instance',
3542 'floating_ip_disassociate', 3544 'tenant_floating_ip_list',
3543 'servers_update_addresses',), 3545 'floating_ip_disassociate',),
3544 api.glance: ('image_list_detailed',), 3546 api.network: ('servers_update_addresses',),
3545 api.nova: ('server_list', 3547 api.glance: ('image_list_detailed',),
3546 'flavor_list')}) 3548 api.nova: ('server_list',
3549 'flavor_list'),
3550 })
3547 def test_disassociate_floating_ip(self): 3551 def test_disassociate_floating_ip(self):
3548 servers = self.servers.list() 3552 servers = self.servers.list()
3549 server = servers[0] 3553 server = servers[0]
@@ -3557,12 +3561,12 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
3557 api.nova.flavor_list(IgnoreArg()).AndReturn(self.flavors.list()) 3561 api.nova.flavor_list(IgnoreArg()).AndReturn(self.flavors.list())
3558 api.glance.image_list_detailed(IgnoreArg()) \ 3562 api.glance.image_list_detailed(IgnoreArg()) \
3559 .AndReturn((self.images.list(), False, False)) 3563 .AndReturn((self.images.list(), False, False))
3560 api.network.floating_ip_target_list_by_instance( 3564 api.neutron.floating_ip_target_list_by_instance(
3561 IsA(http.HttpRequest), 3565 IsA(http.HttpRequest),
3562 server.id).AndReturn([server.id, ]) 3566 server.id).AndReturn([server.id, ])
3563 api.network.tenant_floating_ip_list( 3567 api.neutron.tenant_floating_ip_list(
3564 IsA(http.HttpRequest)).AndReturn([fip]) 3568 IsA(http.HttpRequest)).AndReturn([fip])
3565 api.network.floating_ip_disassociate( 3569 api.neutron.floating_ip_disassociate(
3566 IsA(http.HttpRequest), fip.id) 3570 IsA(http.HttpRequest), fip.id)
3567 3571
3568 self.mox.ReplayAll() 3572 self.mox.ReplayAll()
@@ -3911,9 +3915,9 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
3911 api.nova: ('flavor_list', 'server_list', 'tenant_absolute_limits', 3915 api.nova: ('flavor_list', 'server_list', 'tenant_absolute_limits',
3912 'extension_supported', 'is_feature_available',), 3916 'extension_supported', 'is_feature_available',),
3913 api.glance: ('image_list_detailed',), 3917 api.glance: ('image_list_detailed',),
3914 api.network: ('floating_ip_simple_associate_supported', 3918 api.neutron: ('floating_ip_simple_associate_supported',
3915 'floating_ip_supported', 3919 'floating_ip_supported',),
3916 'servers_update_addresses',), 3920 api.network: ('servers_update_addresses',),
3917 }) 3921 })
3918 def test_index_form_action_with_pagination(self): 3922 def test_index_form_action_with_pagination(self):
3919 """The form action on the next page should have marker 3923 """The form action on the next page should have marker
@@ -3948,9 +3952,9 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
3948 3952
3949 api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \ 3953 api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \
3950 .MultipleTimes().AndReturn(self.limits['absolute']) 3954 .MultipleTimes().AndReturn(self.limits['absolute'])
3951 api.network.floating_ip_supported(IsA(http.HttpRequest)) \ 3955 api.neutron.floating_ip_supported(IsA(http.HttpRequest)) \
3952 .MultipleTimes().AndReturn(True) 3956 .MultipleTimes().AndReturn(True)
3953 api.network.floating_ip_simple_associate_supported( 3957 api.neutron.floating_ip_simple_associate_supported(
3954 IsA(http.HttpRequest)).MultipleTimes().AndReturn(True) 3958 IsA(http.HttpRequest)).MultipleTimes().AndReturn(True)
3955 3959
3956 self.mox.ReplayAll() 3960 self.mox.ReplayAll()
@@ -4067,8 +4071,7 @@ class InstanceAjaxTests(helpers.TestCase):
4067 "flavor_get", 4071 "flavor_get",
4068 "extension_supported", 4072 "extension_supported",
4069 "is_feature_available"), 4073 "is_feature_available"),
4070 api.network: ('servers_update_addresses',), 4074 api.network: ('servers_update_addresses',)})
4071 api.neutron: ("is_extension_supported",)})
4072 def test_row_update(self): 4075 def test_row_update(self):
4073 server = self.servers.first() 4076 server = self.servers.first()
4074 instance_id = server.id 4077 instance_id = server.id
@@ -4083,13 +4086,12 @@ class InstanceAjaxTests(helpers.TestCase):
4083 ).MultipleTimes().AndReturn(True) 4086 ).MultipleTimes().AndReturn(True)
4084 api.nova.extension_supported('Shelve', IsA(http.HttpRequest)) \ 4087 api.nova.extension_supported('Shelve', IsA(http.HttpRequest)) \
4085 .MultipleTimes().AndReturn(True) 4088 .MultipleTimes().AndReturn(True)
4086 api.neutron.is_extension_supported(IsA(http.HttpRequest),
4087 'security-group')\
4088 .MultipleTimes().AndReturn(True)
4089 api.nova.server_get(IsA(http.HttpRequest), instance_id)\ 4089 api.nova.server_get(IsA(http.HttpRequest), instance_id)\
4090 .AndReturn(server) 4090 .AndReturn(server)
4091 api.nova.flavor_get(IsA(http.HttpRequest), flavor_id)\ 4091 api.nova.flavor_get(IsA(http.HttpRequest), flavor_id)\
4092 .AndReturn(full_flavors[flavor_id]) 4092 .AndReturn(full_flavors[flavor_id])
4093 api.network.servers_update_addresses(IsA(http.HttpRequest), server) \
4094 .AndReturn(None)
4093 4095
4094 self.mox.ReplayAll() 4096 self.mox.ReplayAll()
4095 4097
@@ -4105,7 +4107,6 @@ class InstanceAjaxTests(helpers.TestCase):
4105 "flavor_get", 4107 "flavor_get",
4106 'is_feature_available', 4108 'is_feature_available',
4107 "extension_supported"), 4109 "extension_supported"),
4108 api.neutron: ("is_extension_supported",),
4109 api.network: ('servers_update_addresses',)}) 4110 api.network: ('servers_update_addresses',)})
4110 def test_row_update_instance_error(self): 4111 def test_row_update_instance_error(self):
4111 server = self.servers.first() 4112 server = self.servers.first()
@@ -4132,13 +4133,12 @@ class InstanceAjaxTests(helpers.TestCase):
4132 ).MultipleTimes().AndReturn(True) 4133 ).MultipleTimes().AndReturn(True)
4133 api.nova.extension_supported('Shelve', IsA(http.HttpRequest)) \ 4134 api.nova.extension_supported('Shelve', IsA(http.HttpRequest)) \
4134 .MultipleTimes().AndReturn(True) 4135 .MultipleTimes().AndReturn(True)
4135 api.neutron.is_extension_supported(IsA(http.HttpRequest),
4136 'security-group')\
4137 .MultipleTimes().AndReturn(True)
4138 api.nova.server_get(IsA(http.HttpRequest), instance_id)\ 4136 api.nova.server_get(IsA(http.HttpRequest), instance_id)\
4139 .AndReturn(server) 4137 .AndReturn(server)
4140 api.nova.flavor_get(IsA(http.HttpRequest), flavor_id)\ 4138 api.nova.flavor_get(IsA(http.HttpRequest), flavor_id)\
4141 .AndReturn(full_flavors[flavor_id]) 4139 .AndReturn(full_flavors[flavor_id])
4140 api.network.servers_update_addresses(IsA(http.HttpRequest), server) \
4141 .AndReturn(None)
4142 4142
4143 self.mox.ReplayAll() 4143 self.mox.ReplayAll()
4144 4144
@@ -4164,8 +4164,7 @@ class InstanceAjaxTests(helpers.TestCase):
4164 "flavor_get", 4164 "flavor_get",
4165 'is_feature_available', 4165 'is_feature_available',
4166 "extension_supported"), 4166 "extension_supported"),
4167 api.neutron: ("is_extension_supported", 4167 api.network: ('servers_update_addresses',)})
4168 "servers_update_addresses",)})
4169 def test_row_update_flavor_not_found(self): 4168 def test_row_update_flavor_not_found(self):
4170 server = self.servers.first() 4169 server = self.servers.first()
4171 instance_id = server.id 4170 instance_id = server.id
@@ -4178,13 +4177,12 @@ class InstanceAjaxTests(helpers.TestCase):
4178 ).MultipleTimes().AndReturn(True) 4177 ).MultipleTimes().AndReturn(True)
4179 api.nova.extension_supported('Shelve', IsA(http.HttpRequest)) \ 4178 api.nova.extension_supported('Shelve', IsA(http.HttpRequest)) \
4180 .MultipleTimes().AndReturn(True) 4179 .MultipleTimes().AndReturn(True)
4181 api.neutron.is_extension_supported(IsA(http.HttpRequest),
4182 'security-group')\
4183 .MultipleTimes().AndReturn(True)
4184 api.nova.server_get(IsA(http.HttpRequest), instance_id)\ 4180 api.nova.server_get(IsA(http.HttpRequest), instance_id)\
4185 .AndReturn(server) 4181 .AndReturn(server)
4186 api.nova.flavor_get(IsA(http.HttpRequest), server.flavor["id"])\ 4182 api.nova.flavor_get(IsA(http.HttpRequest), server.flavor["id"])\
4187 .AndRaise(self.exceptions.nova) 4183 .AndRaise(self.exceptions.nova)
4184 api.network.servers_update_addresses(IsA(http.HttpRequest), server) \
4185 .AndReturn(None)
4188 4186
4189 self.mox.ReplayAll() 4187 self.mox.ReplayAll()
4190 4188
diff --git a/openstack_dashboard/dashboards/project/instances/views.py b/openstack_dashboard/dashboards/project/instances/views.py
index 7dd195e..904271e 100644
--- a/openstack_dashboard/dashboards/project/instances/views.py
+++ b/openstack_dashboard/dashboards/project/instances/views.py
@@ -375,7 +375,7 @@ class DetailView(tabs.TabView):
375 exceptions.handle(self.request, msg, ignore=True) 375 exceptions.handle(self.request, msg, ignore=True)
376 376
377 try: 377 try:
378 instance.security_groups = api.network.server_security_groups( 378 instance.security_groups = api.neutron.server_security_groups(
379 self.request, instance_id) 379 self.request, instance_id)
380 except Exception: 380 except Exception:
381 msg = _('Unable to retrieve security groups for instance ' 381 msg = _('Unable to retrieve security groups for instance '
diff --git a/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py b/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py
index 5dd3c79..24d8fc9 100644
--- a/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py
+++ b/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py
@@ -580,7 +580,7 @@ class SetAccessControlsAction(workflows.Action):
580 580
581 def populate_groups_choices(self, request, context): 581 def populate_groups_choices(self, request, context):
582 try: 582 try:
583 groups = api.network.security_group_list(request) 583 groups = api.neutron.security_group_list(request)
584 security_group_list = [(sg.id, sg.name) for sg in groups] 584 security_group_list = [(sg.id, sg.name) for sg in groups]
585 except Exception: 585 except Exception:
586 exceptions.handle(request, 586 exceptions.handle(request,
diff --git a/openstack_dashboard/dashboards/project/instances/workflows/update_instance.py b/openstack_dashboard/dashboards/project/instances/workflows/update_instance.py
index a1bd250..7e748b9 100644
--- a/openstack_dashboard/dashboards/project/instances/workflows/update_instance.py
+++ b/openstack_dashboard/dashboards/project/instances/workflows/update_instance.py
@@ -48,14 +48,14 @@ class UpdateInstanceSecurityGroupsAction(workflows.MembershipAction):
48 # Get list of available security groups 48 # Get list of available security groups
49 all_groups = [] 49 all_groups = []
50 try: 50 try:
51 all_groups = api.network.security_group_list(request) 51 all_groups = api.neutron.security_group_list(request)
52 except Exception: 52 except Exception:
53 exceptions.handle(request, err_msg) 53 exceptions.handle(request, err_msg)
54 groups_list = [(group.id, group.name) for group in all_groups] 54 groups_list = [(group.id, group.name) for group in all_groups]
55 55
56 instance_groups = [] 56 instance_groups = []
57 try: 57 try:
58 instance_groups = api.network.server_security_groups(request, 58 instance_groups = api.neutron.server_security_groups(request,
59 instance_id) 59 instance_id)
60 except Exception: 60 except Exception:
61 exceptions.handle(request, err_msg) 61 exceptions.handle(request, err_msg)
@@ -69,7 +69,7 @@ class UpdateInstanceSecurityGroupsAction(workflows.MembershipAction):
69 instance_id = data['instance_id'] 69 instance_id = data['instance_id']
70 wanted_groups = map(filters.get_int_or_uuid, data['wanted_groups']) 70 wanted_groups = map(filters.get_int_or_uuid, data['wanted_groups'])
71 try: 71 try:
72 api.network.server_update_security_groups(request, instance_id, 72 api.neutron.server_update_security_groups(request, instance_id,
73 wanted_groups) 73 wanted_groups)
74 except Exception as e: 74 except Exception as e:
75 exceptions.handle(request, str(e)) 75 exceptions.handle(request, str(e))
diff --git a/openstack_dashboard/dashboards/project/overview/tests.py b/openstack_dashboard/dashboards/project/overview/tests.py
index b53b307..ac54792 100644
--- a/openstack_dashboard/dashboards/project/overview/tests.py
+++ b/openstack_dashboard/dashboards/project/overview/tests.py
@@ -67,20 +67,20 @@ class UsageViewTests(test.TestCase):
67 api.cinder.tenant_absolute_limits(IsA(http.HttpRequest)) \ 67 api.cinder.tenant_absolute_limits(IsA(http.HttpRequest)) \
68 .AndReturn(self.cinder_limits['absolute']) 68 .AndReturn(self.cinder_limits['absolute'])
69 69
70 @test.create_stubs({api.neutron: ('is_extension_supported',), 70 @test.create_stubs({api.neutron: ('is_extension_supported',
71 api.network: ('floating_ip_supported', 71 'floating_ip_supported',
72 'tenant_floating_ip_list', 72 'tenant_floating_ip_list',
73 'security_group_list')}) 73 'security_group_list')})
74 def _stub_neutron_api_calls(self, neutron_sg_enabled=True): 74 def _stub_neutron_api_calls(self, neutron_sg_enabled=True):
75 api.neutron.is_extension_supported( 75 api.neutron.is_extension_supported(
76 IsA(http.HttpRequest), 76 IsA(http.HttpRequest),
77 'security-group').AndReturn(neutron_sg_enabled) 77 'security-group').AndReturn(neutron_sg_enabled)
78 api.network.floating_ip_supported(IsA(http.HttpRequest)) \ 78 api.neutron.floating_ip_supported(IsA(http.HttpRequest)) \
79 .AndReturn(True) 79 .AndReturn(True)
80 api.network.tenant_floating_ip_list(IsA(http.HttpRequest)) \ 80 api.neutron.tenant_floating_ip_list(IsA(http.HttpRequest)) \
81 .AndReturn(self.floating_ips.list()) 81 .AndReturn(self.floating_ips.list())
82 if neutron_sg_enabled: 82 if neutron_sg_enabled:
83 api.network.security_group_list(IsA(http.HttpRequest)) \ 83 api.neutron.security_group_list(IsA(http.HttpRequest)) \
84 .AndReturn(self.security_groups.list()) 84 .AndReturn(self.security_groups.list())
85 85
86 def _nova_stu_enabled(self, exception=False, overview_days_range=1): 86 def _nova_stu_enabled(self, exception=False, overview_days_range=1):
@@ -248,8 +248,8 @@ class UsageViewTests(test.TestCase):
248 self._test_usage_with_neutron(neutron_fip_enabled=False) 248 self._test_usage_with_neutron(neutron_fip_enabled=False)
249 249
250 @test.create_stubs({api.neutron: ('tenant_quota_get', 250 @test.create_stubs({api.neutron: ('tenant_quota_get',
251 'is_extension_supported'), 251 'is_extension_supported',
252 api.network: ('floating_ip_supported', 252 'floating_ip_supported',
253 'tenant_floating_ip_list', 253 'tenant_floating_ip_list',
254 'security_group_list')}) 254 'security_group_list')})
255 def _test_usage_with_neutron_prepare(self): 255 def _test_usage_with_neutron_prepare(self):
@@ -264,13 +264,13 @@ class UsageViewTests(test.TestCase):
264 api.neutron.is_extension_supported( 264 api.neutron.is_extension_supported(
265 IsA(http.HttpRequest), 265 IsA(http.HttpRequest),
266 'security-group').AndReturn(neutron_sg_enabled) 266 'security-group').AndReturn(neutron_sg_enabled)
267 api.network.floating_ip_supported(IsA(http.HttpRequest)) \ 267 api.neutron.floating_ip_supported(IsA(http.HttpRequest)) \
268 .AndReturn(neutron_fip_enabled) 268 .AndReturn(neutron_fip_enabled)
269 if neutron_fip_enabled: 269 if neutron_fip_enabled:
270 api.network.tenant_floating_ip_list(IsA(http.HttpRequest)) \ 270 api.neutron.tenant_floating_ip_list(IsA(http.HttpRequest)) \
271 .AndReturn(self.floating_ips.list()) 271 .AndReturn(self.floating_ips.list())
272 if neutron_sg_enabled: 272 if neutron_sg_enabled:
273 api.network.security_group_list(IsA(http.HttpRequest)) \ 273 api.neutron.security_group_list(IsA(http.HttpRequest)) \
274 .AndReturn(self.security_groups.list()) 274 .AndReturn(self.security_groups.list())
275 api.neutron.tenant_quota_get(IsA(http.HttpRequest), self.tenant.id) \ 275 api.neutron.tenant_quota_get(IsA(http.HttpRequest), self.tenant.id) \
276 .AndReturn(self.neutron_quotas.first()) 276 .AndReturn(self.neutron_quotas.first())
diff --git a/openstack_dashboard/dashboards/project/security_groups/forms.py b/openstack_dashboard/dashboards/project/security_groups/forms.py
index 213732d..7fd6c80 100644
--- a/openstack_dashboard/dashboards/project/security_groups/forms.py
+++ b/openstack_dashboard/dashboards/project/security_groups/forms.py
@@ -78,7 +78,7 @@ class CreateGroup(GroupBase):
78 error_message = _('Unable to create security group: %s') 78 error_message = _('Unable to create security group: %s')
79 79
80 def _call_network_api(self, request, data): 80 def _call_network_api(self, request, data):
81 return api.network.security_group_create(request, 81 return api.neutron.security_group_create(request,
82 data['name'], 82 data['name'],
83 data['description']) 83 data['description'])
84 84
@@ -90,7 +90,7 @@ class UpdateGroup(GroupBase):
90 id = forms.CharField(widget=forms.HiddenInput()) 90 id = forms.CharField(widget=forms.HiddenInput())
91 91
92 def _call_network_api(self, request, data): 92 def _call_network_api(self, request, data):
93 return api.network.security_group_update(request, 93 return api.neutron.security_group_update(request,
94 data['id'], 94 data['id'],
95 data['name'], 95 data['name'],
96 data['description']) 96 data['description'])
@@ -415,7 +415,7 @@ class AddRule(forms.SelfHandlingForm):
415 redirect = reverse("horizon:project:security_groups:detail", 415 redirect = reverse("horizon:project:security_groups:detail",
416 args=[data['id']]) 416 args=[data['id']])
417 try: 417 try:
418 rule = api.network.security_group_rule_create( 418 rule = api.neutron.security_group_rule_create(
419 request, 419 request,
420 filters.get_int_or_uuid(data['id']), 420 filters.get_int_or_uuid(data['id']),
421 data['direction'], 421 data['direction'],
diff --git a/openstack_dashboard/dashboards/project/security_groups/tables.py b/openstack_dashboard/dashboards/project/security_groups/tables.py
index 29d265f..2b619d1 100644
--- a/openstack_dashboard/dashboards/project/security_groups/tables.py
+++ b/openstack_dashboard/dashboards/project/security_groups/tables.py
@@ -52,7 +52,7 @@ class DeleteGroup(policy.PolicyTargetMixin, tables.DeleteAction):
52 return security_group.name != 'default' 52 return security_group.name != 'default'
53 53
54 def delete(self, request, obj_id): 54 def delete(self, request, obj_id):
55 api.network.security_group_delete(request, obj_id) 55 api.neutron.security_group_delete(request, obj_id)
56 56
57 57
58class CreateGroup(tables.LinkAction): 58class CreateGroup(tables.LinkAction):
@@ -149,7 +149,7 @@ class DeleteRule(tables.DeleteAction):
149 ) 149 )
150 150
151 def delete(self, request, obj_id): 151 def delete(self, request, obj_id):
152 api.network.security_group_rule_delete(request, obj_id) 152 api.neutron.security_group_rule_delete(request, obj_id)
153 153
154 def get_success_url(self, request): 154 def get_success_url(self, request):
155 sg_id = self.table.kwargs['security_group_id'] 155 sg_id = self.table.kwargs['security_group_id']
diff --git a/openstack_dashboard/dashboards/project/security_groups/tests.py b/openstack_dashboard/dashboards/project/security_groups/tests.py
index 0e40687..35790d3 100644
--- a/openstack_dashboard/dashboards/project/security_groups/tests.py
+++ b/openstack_dashboard/dashboards/project/security_groups/tests.py
@@ -65,14 +65,14 @@ class SecurityGroupsViewTests(test.TestCase):
65 self.edit_url = reverse(SG_ADD_RULE_VIEW, args=[sec_group.id]) 65 self.edit_url = reverse(SG_ADD_RULE_VIEW, args=[sec_group.id])
66 self.update_url = reverse(SG_UPDATE_VIEW, args=[sec_group.id]) 66 self.update_url = reverse(SG_UPDATE_VIEW, args=[sec_group.id])
67 67
68 @test.create_stubs({api.network: ('security_group_list',), 68 @test.create_stubs({api.neutron: ('security_group_list',),
69 quotas: ('tenant_quota_usages',)}) 69 quotas: ('tenant_quota_usages',)})
70 def test_index(self): 70 def test_index(self):
71 sec_groups = self.security_groups.list() 71 sec_groups = self.security_groups.list()
72 quota_data = self.quota_usages.first() 72 quota_data = self.quota_usages.first()
73 quota_data['security_groups']['available'] = 10 73 quota_data['security_groups']['available'] = 10
74 74
75 api.network.security_group_list(IsA(http.HttpRequest)) \ 75 api.neutron.security_group_list(IsA(http.HttpRequest)) \
76 .AndReturn(sec_groups) 76 .AndReturn(sec_groups)
77 quotas.tenant_quota_usages(IsA(http.HttpRequest)).MultipleTimes() \ 77 quotas.tenant_quota_usages(IsA(http.HttpRequest)).MultipleTimes() \
78 .AndReturn(quota_data) 78 .AndReturn(quota_data)
@@ -96,14 +96,14 @@ class SecurityGroupsViewTests(test.TestCase):
96 all([sec_groups_from_ctx[i].name <= sec_groups_from_ctx[i + 1].name 96 all([sec_groups_from_ctx[i].name <= sec_groups_from_ctx[i + 1].name
97 for i in range(len(sec_groups_from_ctx) - 1)])) 97 for i in range(len(sec_groups_from_ctx) - 1)]))
98 98
99 @test.create_stubs({api.network: ('security_group_list',), 99 @test.create_stubs({api.neutron: ('security_group_list',),
100 quotas: ('tenant_quota_usages',)}) 100 quotas: ('tenant_quota_usages',)})
101 def test_create_button_attributes(self): 101 def test_create_button_attributes(self):
102 sec_groups = self.security_groups.list() 102 sec_groups = self.security_groups.list()
103 quota_data = self.quota_usages.first() 103 quota_data = self.quota_usages.first()
104 quota_data['security_groups']['available'] = 10 104 quota_data['security_groups']['available'] = 10
105 105
106 api.network.security_group_list( 106 api.neutron.security_group_list(
107 IsA(http.HttpRequest)) \ 107 IsA(http.HttpRequest)) \
108 .AndReturn(sec_groups) 108 .AndReturn(sec_groups)
109 quotas.tenant_quota_usages( 109 quotas.tenant_quota_usages(
@@ -128,7 +128,7 @@ class SecurityGroupsViewTests(test.TestCase):
128 url = 'horizon:project:security_groups:create' 128 url = 'horizon:project:security_groups:create'
129 self.assertEqual(url, create_action.url) 129 self.assertEqual(url, create_action.url)
130 130
131 @test.create_stubs({api.network: ('security_group_list',), 131 @test.create_stubs({api.neutron: ('security_group_list',),
132 quotas: ('tenant_quota_usages',)}) 132 quotas: ('tenant_quota_usages',)})
133 def _test_create_button_disabled_when_quota_exceeded(self, 133 def _test_create_button_disabled_when_quota_exceeded(self,
134 network_enabled): 134 network_enabled):
@@ -136,7 +136,7 @@ class SecurityGroupsViewTests(test.TestCase):
136 quota_data = self.quota_usages.first() 136 quota_data = self.quota_usages.first()
137 quota_data['security_groups']['available'] = 0 137 quota_data['security_groups']['available'] = 0
138 138
139 api.network.security_group_list( 139 api.neutron.security_group_list(
140 IsA(http.HttpRequest)) \ 140 IsA(http.HttpRequest)) \
141 .AndReturn(sec_groups) 141 .AndReturn(sec_groups)
142 quotas.tenant_quota_usages( 142 quotas.tenant_quota_usages(
@@ -161,14 +161,14 @@ class SecurityGroupsViewTests(test.TestCase):
161 def test_create_button_disabled_when_quota_exceeded_neutron_enabled(self): 161 def test_create_button_disabled_when_quota_exceeded_neutron_enabled(self):
162 self._test_create_button_disabled_when_quota_exceeded(True) 162 self._test_create_button_disabled_when_quota_exceeded(True)
163 163
164 @test.create_stubs({api.network: ('security_group_rule_create', 164 @test.create_stubs({api.neutron: ('security_group_rule_create',
165 'security_group_list')}) 165 'security_group_list')})
166 def _add_security_group_rule_fixture(self, **kwargs): 166 def _add_security_group_rule_fixture(self, **kwargs):
167 sec_group = self.security_groups.first() 167 sec_group = self.security_groups.first()
168 sec_group_list = self.security_groups.list() 168 sec_group_list = self.security_groups.list()
169 rule = self.security_group_rules.first() 169 rule = self.security_group_rules.first()
170 170
171 api.network.security_group_rule_create( 171 api.neutron.security_group_rule_create(
172 IsA(http.HttpRequest), 172 IsA(http.HttpRequest),
173 kwargs.get('sec_group', sec_group.id), 173 kwargs.get('sec_group', sec_group.id),
174 kwargs.get('ingress', 'ingress'), 174 kwargs.get('ingress', 'ingress'),
@@ -178,14 +178,14 @@ class SecurityGroupsViewTests(test.TestCase):
178 kwargs.get('to_port', int(rule.to_port)), 178 kwargs.get('to_port', int(rule.to_port)),
179 kwargs.get('cidr', rule.ip_range['cidr']), 179 kwargs.get('cidr', rule.ip_range['cidr']),
180 kwargs.get('security_group', u'%s' % sec_group.id)).AndReturn(rule) 180 kwargs.get('security_group', u'%s' % sec_group.id)).AndReturn(rule)
181 api.network.security_group_list( 181 api.neutron.security_group_list(
182 IsA(http.HttpRequest)).AndReturn(sec_group_list) 182 IsA(http.HttpRequest)).AndReturn(sec_group_list)
183 return sec_group, rule 183 return sec_group, rule
184 184
185 @test.create_stubs({api.network: ('security_group_get',)}) 185 @test.create_stubs({api.neutron: ('security_group_get',)})
186 def test_update_security_groups_get(self): 186 def test_update_security_groups_get(self):
187 sec_group = self.security_groups.first() 187 sec_group = self.security_groups.first()
188 api.network.security_group_get(IsA(http.HttpRequest), 188 api.neutron.security_group_get(IsA(http.HttpRequest),
189 sec_group.id).AndReturn(sec_group) 189 sec_group.id).AndReturn(sec_group)
190 self.mox.ReplayAll() 190 self.mox.ReplayAll()
191 res = self.client.get(self.update_url) 191 res = self.client.get(self.update_url)
@@ -193,7 +193,7 @@ class SecurityGroupsViewTests(test.TestCase):
193 self.assertEqual(res.context['security_group'].name, 193 self.assertEqual(res.context['security_group'].name,
194 sec_group.name) 194 sec_group.name)
195 195
196 @test.create_stubs({api.network: ('security_group_update', 196 @test.create_stubs({api.neutron: ('security_group_update',
197 'security_group_get')}) 197 'security_group_get')})
198 def test_update_security_groups_post(self): 198 def test_update_security_groups_post(self):
199 """Ensure that we can change a group name. 199 """Ensure that we can change a group name.
@@ -204,12 +204,12 @@ class SecurityGroupsViewTests(test.TestCase):
204 """ 204 """
205 sec_group = self.security_groups.first() 205 sec_group = self.security_groups.first()
206 sec_group.name = "@new name" 206 sec_group.name = "@new name"
207 api.network.security_group_update( 207 api.neutron.security_group_update(
208 IsA(http.HttpRequest), 208 IsA(http.HttpRequest),
209 str(sec_group.id), 209 str(sec_group.id),
210 sec_group.name, 210 sec_group.name,
211 sec_group.description).AndReturn(sec_group) 211 sec_group.description).AndReturn(sec_group)
212 api.network.security_group_get( 212 api.neutron.security_group_get(
213 IsA(http.HttpRequest), sec_group.id).AndReturn(sec_group) 213 IsA(http.HttpRequest), sec_group.id).AndReturn(sec_group)
214 self.mox.ReplayAll() 214 self.mox.ReplayAll()
215 form_data = {'method': 'UpdateGroup', 215 form_data = {'method': 'UpdateGroup',
@@ -238,9 +238,9 @@ class SecurityGroupsViewTests(test.TestCase):
238 sec_group.name = '@group name-\xe3\x82\xb3' 238 sec_group.name = '@group name-\xe3\x82\xb3'
239 self._create_security_group(sec_group) 239 self._create_security_group(sec_group)
240 240
241 @test.create_stubs({api.network: ('security_group_create',)}) 241 @test.create_stubs({api.neutron: ('security_group_create',)})
242 def _create_security_group(self, sec_group): 242 def _create_security_group(self, sec_group):
243 api.network.security_group_create( 243 api.neutron.security_group_create(
244 IsA(http.HttpRequest), 244 IsA(http.HttpRequest),
245 sec_group.name, 245 sec_group.name,
246 sec_group.description).AndReturn(sec_group) 246 sec_group.description).AndReturn(sec_group)
@@ -252,10 +252,10 @@ class SecurityGroupsViewTests(test.TestCase):
252 res = self.client.post(SG_CREATE_URL, form_data) 252 res = self.client.post(SG_CREATE_URL, form_data)
253 self.assertRedirectsNoFollow(res, INDEX_URL) 253 self.assertRedirectsNoFollow(res, INDEX_URL)
254 254
255 @test.create_stubs({api.network: ('security_group_create',)}) 255 @test.create_stubs({api.neutron: ('security_group_create',)})
256 def test_create_security_groups_post_exception(self): 256 def test_create_security_groups_post_exception(self):
257 sec_group = self.security_groups.first() 257 sec_group = self.security_groups.first()
258 api.network.security_group_create( 258 api.neutron.security_group_create(
259 IsA(http.HttpRequest), 259 IsA(http.HttpRequest),
260 sec_group.name, 260 sec_group.name,
261 sec_group.description).AndRaise(self.exceptions.nova) 261 sec_group.description).AndRaise(self.exceptions.nova)
@@ -268,21 +268,21 @@ class SecurityGroupsViewTests(test.TestCase):
268 self.assertMessageCount(error=1) 268 self.assertMessageCount(error=1)
269 self.assertRedirectsNoFollow(res, INDEX_URL) 269 self.assertRedirectsNoFollow(res, INDEX_URL)
270 270
271 @test.create_stubs({api.network: ('security_group_get',)}) 271 @test.create_stubs({api.neutron: ('security_group_get',)})
272 def test_detail_get(self): 272 def test_detail_get(self):
273 sec_group = self.security_groups.first() 273 sec_group = self.security_groups.first()
274 274
275 api.network.security_group_get(IsA(http.HttpRequest), 275 api.neutron.security_group_get(IsA(http.HttpRequest),
276 sec_group.id).AndReturn(sec_group) 276 sec_group.id).AndReturn(sec_group)
277 self.mox.ReplayAll() 277 self.mox.ReplayAll()
278 res = self.client.get(self.detail_url) 278 res = self.client.get(self.detail_url)
279 self.assertTemplateUsed(res, SG_DETAIL_TEMPLATE) 279 self.assertTemplateUsed(res, SG_DETAIL_TEMPLATE)
280 280
281 @test.create_stubs({api.network: ('security_group_get',)}) 281 @test.create_stubs({api.neutron: ('security_group_get',)})
282 def test_detail_get_exception(self): 282 def test_detail_get_exception(self):
283 sec_group = self.security_groups.first() 283 sec_group = self.security_groups.first()
284 284
285 api.network.security_group_get( 285 api.neutron.security_group_get(
286 IsA(http.HttpRequest), 286 IsA(http.HttpRequest),
287 sec_group.id).AndRaise(self.exceptions.nova) 287 sec_group.id).AndRaise(self.exceptions.nova)
288 self.mox.ReplayAll() 288 self.mox.ReplayAll()
@@ -371,14 +371,14 @@ class SecurityGroupsViewTests(test.TestCase):
371 self.assertNoFormErrors(res) 371 self.assertNoFormErrors(res)
372 self.assertRedirectsNoFollow(res, self.detail_url) 372 self.assertRedirectsNoFollow(res, self.detail_url)
373 373
374 @test.create_stubs({api.network: ('security_group_rule_create', 374 @test.create_stubs({api.neutron: ('security_group_rule_create',
375 'security_group_list')}) 375 'security_group_list')})
376 def test_detail_add_rule_cidr_with_template(self): 376 def test_detail_add_rule_cidr_with_template(self):
377 sec_group = self.security_groups.first() 377 sec_group = self.security_groups.first()
378 sec_group_list = self.security_groups.list() 378 sec_group_list = self.security_groups.list()
379 rule = self.security_group_rules.first() 379 rule = self.security_group_rules.first()
380 380
381 api.network.security_group_rule_create(IsA(http.HttpRequest), 381 api.neutron.security_group_rule_create(IsA(http.HttpRequest),
382 sec_group.id, 382 sec_group.id,
383 'ingress', 'IPv4', 383 'ingress', 'IPv4',
384 rule.ip_protocol, 384 rule.ip_protocol,
@@ -386,7 +386,7 @@ class SecurityGroupsViewTests(test.TestCase):
386 int(rule.to_port), 386 int(rule.to_port),
387 rule.ip_range['cidr'], 387 rule.ip_range['cidr'],
388 None).AndReturn(rule) 388 None).AndReturn(rule)
389 api.network.security_group_list( 389 api.neutron.security_group_list(
390 IsA(http.HttpRequest)).AndReturn(sec_group_list) 390 IsA(http.HttpRequest)).AndReturn(sec_group_list)
391 self.mox.ReplayAll() 391 self.mox.ReplayAll()
392 392
@@ -405,14 +405,14 @@ class SecurityGroupsViewTests(test.TestCase):
405 return rule 405 return rule
406 raise Exception("No matches found.") 406 raise Exception("No matches found.")
407 407
408 @test.create_stubs({api.network: ('security_group_rule_create', 408 @test.create_stubs({api.neutron: ('security_group_rule_create',
409 'security_group_list',)}) 409 'security_group_list',)})
410 def test_detail_add_rule_self_as_source_group(self): 410 def test_detail_add_rule_self_as_source_group(self):
411 sec_group = self.security_groups.first() 411 sec_group = self.security_groups.first()
412 sec_group_list = self.security_groups.list() 412 sec_group_list = self.security_groups.list()
413 rule = self._get_source_group_rule() 413 rule = self._get_source_group_rule()
414 414
415 api.network.security_group_rule_create( 415 api.neutron.security_group_rule_create(
416 IsA(http.HttpRequest), 416 IsA(http.HttpRequest),
417 sec_group.id, 417 sec_group.id,
418 'ingress', 418 'ingress',
@@ -423,7 +423,7 @@ class SecurityGroupsViewTests(test.TestCase):
423 int(rule.to_port), 423 int(rule.to_port),
424 None, 424 None,
425 u'%s' % sec_group.id).AndReturn(rule) 425 u'%s' % sec_group.id).AndReturn(rule)
426 api.network.security_group_list( 426 api.neutron.security_group_list(
427 IsA(http.HttpRequest)).AndReturn(sec_group_list) 427 IsA(http.HttpRequest)).AndReturn(sec_group_list)
428 self.mox.ReplayAll() 428 self.mox.ReplayAll()
429 429
@@ -438,14 +438,14 @@ class SecurityGroupsViewTests(test.TestCase):
438 res = self.client.post(self.edit_url, formData) 438 res = self.client.post(self.edit_url, formData)
439 self.assertRedirectsNoFollow(res, self.detail_url) 439 self.assertRedirectsNoFollow(res, self.detail_url)
440 440
441 @test.create_stubs({api.network: ('security_group_rule_create', 441 @test.create_stubs({api.neutron: ('security_group_rule_create',
442 'security_group_list',)}) 442 'security_group_list',)})
443 def test_detail_add_rule_self_as_source_group_with_template(self): 443 def test_detail_add_rule_self_as_source_group_with_template(self):
444 sec_group = self.security_groups.first() 444 sec_group = self.security_groups.first()
445 sec_group_list = self.security_groups.list() 445 sec_group_list = self.security_groups.list()
446 rule = self._get_source_group_rule() 446 rule = self._get_source_group_rule()
447 447
448 api.network.security_group_rule_create( 448 api.neutron.security_group_rule_create(
449 IsA(http.HttpRequest), 449 IsA(http.HttpRequest),
450 sec_group.id, 450 sec_group.id,
451 'ingress', 451 'ingress',
@@ -456,7 +456,7 @@ class SecurityGroupsViewTests(test.TestCase):
456 int(rule.to_port), 456 int(rule.to_port),
457 None, 457 None,
458 u'%s' % sec_group.id).AndReturn(rule) 458 u'%s' % sec_group.id).AndReturn(rule)
459 api.network.security_group_list( 459 api.neutron.security_group_list(
460 IsA(http.HttpRequest)).AndReturn(sec_group_list) 460 IsA(http.HttpRequest)).AndReturn(sec_group_list)
461 self.mox.ReplayAll() 461 self.mox.ReplayAll()
462 462
@@ -470,16 +470,16 @@ class SecurityGroupsViewTests(test.TestCase):
470 res = self.client.post(self.edit_url, formData) 470 res = self.client.post(self.edit_url, formData)
471 self.assertRedirectsNoFollow(res, self.detail_url) 471 self.assertRedirectsNoFollow(res, self.detail_url)
472 472
473 @test.create_stubs({api.network: ('security_group_list',)}) 473 @test.create_stubs({api.neutron: ('security_group_list',)})
474 def test_detail_invalid_port(self): 474 def test_detail_invalid_port(self):
475 sec_group = self.security_groups.first() 475 sec_group = self.security_groups.first()
476 sec_group_list = self.security_groups.list() 476 sec_group_list = self.security_groups.list()
477 rule = self.security_group_rules.first() 477 rule = self.security_group_rules.first()
478 478
479 api.network.security_group_list( 479 api.neutron.security_group_list(
480 IsA(http.HttpRequest)).AndReturn(sec_group_list) 480 IsA(http.HttpRequest)).AndReturn(sec_group_list)
481 if django.VERSION >= (1, 9): 481 if django.VERSION >= (1, 9):
482 api.network.security_group_list( 482 api.neutron.security_group_list(
483 IsA(http.HttpRequest)).AndReturn(sec_group_list) 483 IsA(http.HttpRequest)).AndReturn(sec_group_list)
484 484
485 self.mox.ReplayAll() 485 self.mox.ReplayAll()
@@ -495,18 +495,18 @@ class SecurityGroupsViewTests(test.TestCase):
495 self.assertNoMessages() 495 self.assertNoMessages()
496 self.assertContains(res, "The specified port is invalid") 496 self.assertContains(res, "The specified port is invalid")
497 497
498 @test.create_stubs({api.network: ('security_group_list',)}) 498 @test.create_stubs({api.neutron: ('security_group_list',)})
499 def test_detail_invalid_port_range(self): 499 def test_detail_invalid_port_range(self):
500 sec_group = self.security_groups.first() 500 sec_group = self.security_groups.first()
501 sec_group_list = self.security_groups.list() 501 sec_group_list = self.security_groups.list()
502 rule = self.security_group_rules.first() 502 rule = self.security_group_rules.first()
503 503
504 for i in range(3): 504 for i in range(3):
505 api.network.security_group_list( 505 api.neutron.security_group_list(
506 IsA(http.HttpRequest)).AndReturn(sec_group_list) 506 IsA(http.HttpRequest)).AndReturn(sec_group_list)
507 if django.VERSION >= (1, 9): 507 if django.VERSION >= (1, 9):
508 for i in range(3): 508 for i in range(3):
509 api.network.security_group_list( 509 api.neutron.security_group_list(
510 IsA(http.HttpRequest)).AndReturn(sec_group_list) 510 IsA(http.HttpRequest)).AndReturn(sec_group_list)
511 511
512 self.mox.ReplayAll() 512 self.mox.ReplayAll()
@@ -549,7 +549,7 @@ class SecurityGroupsViewTests(test.TestCase):
549 self.assertContains(res, cgi.escape('"to" port number is invalid', 549 self.assertContains(res, cgi.escape('"to" port number is invalid',
550 quote=True)) 550 quote=True))
551 551
552 @test.create_stubs({api.network: ('security_group_get', 552 @test.create_stubs({api.neutron: ('security_group_get',
553 'security_group_list')}) 553 'security_group_list')})
554 def test_detail_invalid_icmp_rule(self): 554 def test_detail_invalid_icmp_rule(self):
555 sec_group = self.security_groups.first() 555 sec_group = self.security_groups.first()
@@ -562,7 +562,7 @@ class SecurityGroupsViewTests(test.TestCase):
562 call_post *= 2 562 call_post *= 2
563 563
564 for i in range(call_post): 564 for i in range(call_post):
565 api.network.security_group_list( 565 api.neutron.security_group_list(
566 IsA(http.HttpRequest)).AndReturn(sec_group_list) 566 IsA(http.HttpRequest)).AndReturn(sec_group_list)
567 567
568 self.mox.ReplayAll() 568 self.mox.ReplayAll()
@@ -628,14 +628,14 @@ class SecurityGroupsViewTests(test.TestCase):
628 self.assertContains( 628 self.assertContains(
629 res, "ICMP code is provided but ICMP type is missing.") 629 res, "ICMP code is provided but ICMP type is missing.")
630 630
631 @test.create_stubs({api.network: ('security_group_rule_create', 631 @test.create_stubs({api.neutron: ('security_group_rule_create',
632 'security_group_list')}) 632 'security_group_list')})
633 def test_detail_add_rule_exception(self): 633 def test_detail_add_rule_exception(self):
634 sec_group = self.security_groups.first() 634 sec_group = self.security_groups.first()
635 sec_group_list = self.security_groups.list() 635 sec_group_list = self.security_groups.list()
636 rule = self.security_group_rules.first() 636 rule = self.security_group_rules.first()
637 637
638 api.network.security_group_rule_create( 638 api.neutron.security_group_rule_create(
639 IsA(http.HttpRequest), 639 IsA(http.HttpRequest),
640 sec_group.id, 'ingress', 'IPv4', 640 sec_group.id, 'ingress', 'IPv4',
641 rule.ip_protocol, 641 rule.ip_protocol,
@@ -643,7 +643,7 @@ class SecurityGroupsViewTests(test.TestCase):
643 int(rule.to_port), 643 int(rule.to_port),
644 rule.ip_range['cidr'], 644 rule.ip_range['cidr'],
645 None).AndRaise(self.exceptions.nova) 645 None).AndRaise(self.exceptions.nova)
646 api.network.security_group_list( 646 api.neutron.security_group_list(
647 IsA(http.HttpRequest)).AndReturn(sec_group_list) 647 IsA(http.HttpRequest)).AndReturn(sec_group_list)
648 self.mox.ReplayAll() 648 self.mox.ReplayAll()
649 649
@@ -657,14 +657,14 @@ class SecurityGroupsViewTests(test.TestCase):
657 res = self.client.post(self.edit_url, formData) 657 res = self.client.post(self.edit_url, formData)
658 self.assertRedirectsNoFollow(res, self.detail_url) 658 self.assertRedirectsNoFollow(res, self.detail_url)
659 659
660 @test.create_stubs({api.network: ('security_group_rule_create', 660 @test.create_stubs({api.neutron: ('security_group_rule_create',
661 'security_group_list')}) 661 'security_group_list')})
662 def test_detail_add_rule_duplicated(self): 662 def test_detail_add_rule_duplicated(self):
663 sec_group = self.security_groups.first() 663 sec_group = self.security_groups.first()
664 sec_group_list = self.security_groups.list() 664 sec_group_list = self.security_groups.list()
665 rule = self.security_group_rules.first() 665 rule = self.security_group_rules.first()
666 666
667 api.network.security_group_rule_create( 667 api.neutron.security_group_rule_create(
668 IsA(http.HttpRequest), 668 IsA(http.HttpRequest),
669 sec_group.id, 'ingress', 'IPv4', 669 sec_group.id, 'ingress', 'IPv4',
670 rule.ip_protocol, 670 rule.ip_protocol,
@@ -672,7 +672,7 @@ class SecurityGroupsViewTests(test.TestCase):
672 int(rule.to_port), 672 int(rule.to_port),
673 rule.ip_range['cidr'], 673 rule.ip_range['cidr'],
674 None).AndRaise(exceptions.Conflict) 674 None).AndRaise(exceptions.Conflict)
675 api.network.security_group_list( 675 api.neutron.security_group_list(
676 IsA(http.HttpRequest)).AndReturn(sec_group_list) 676 IsA(http.HttpRequest)).AndReturn(sec_group_list)
677 self.mox.ReplayAll() 677 self.mox.ReplayAll()
678 678
@@ -687,12 +687,12 @@ class SecurityGroupsViewTests(test.TestCase):
687 self.assertNoFormErrors(res) 687 self.assertNoFormErrors(res)
688 self.assertRedirectsNoFollow(res, self.detail_url) 688 self.assertRedirectsNoFollow(res, self.detail_url)
689 689
690 @test.create_stubs({api.network: ('security_group_rule_delete',)}) 690 @test.create_stubs({api.neutron: ('security_group_rule_delete',)})
691 def test_detail_delete_rule(self): 691 def test_detail_delete_rule(self):
692 sec_group = self.security_groups.first() 692 sec_group = self.security_groups.first()
693 rule = self.security_group_rules.first() 693 rule = self.security_group_rules.first()
694 694
695 api.network.security_group_rule_delete(IsA(http.HttpRequest), rule.id) 695 api.neutron.security_group_rule_delete(IsA(http.HttpRequest), rule.id)
696 self.mox.ReplayAll() 696 self.mox.ReplayAll()
697 697
698 form_data = {"action": "rules__delete__%s" % rule.id} 698 form_data = {"action": "rules__delete__%s" % rule.id}
@@ -703,12 +703,12 @@ class SecurityGroupsViewTests(test.TestCase):
703 self.assertEqual(strip_absolute_base(handled['location']), 703 self.assertEqual(strip_absolute_base(handled['location']),
704 self.detail_url) 704 self.detail_url)
705 705
706 @test.create_stubs({api.network: ('security_group_rule_delete',)}) 706 @test.create_stubs({api.neutron: ('security_group_rule_delete',)})
707 def test_detail_delete_rule_exception(self): 707 def test_detail_delete_rule_exception(self):
708 sec_group = self.security_groups.first() 708 sec_group = self.security_groups.first()
709 rule = self.security_group_rules.first() 709 rule = self.security_group_rules.first()
710 710
711 api.network.security_group_rule_delete( 711 api.neutron.security_group_rule_delete(
712 IsA(http.HttpRequest), 712 IsA(http.HttpRequest),
713 rule.id).AndRaise(self.exceptions.nova) 713 rule.id).AndRaise(self.exceptions.nova)
714 self.mox.ReplayAll() 714 self.mox.ReplayAll()
@@ -722,11 +722,11 @@ class SecurityGroupsViewTests(test.TestCase):
722 self.assertEqual(strip_absolute_base(handled['location']), 722 self.assertEqual(strip_absolute_base(handled['location']),
723 self.detail_url) 723 self.detail_url)
724 724
725 @test.create_stubs({api.network: ('security_group_delete',)}) 725 @test.create_stubs({api.neutron: ('security_group_delete',)})
726 def test_delete_group(self): 726 def test_delete_group(self):
727 sec_group = self.security_groups.get(name="other_group") 727 sec_group = self.security_groups.get(name="other_group")
728 728
729 api.network.security_group_delete(IsA(http.HttpRequest), sec_group.id) 729 api.neutron.security_group_delete(IsA(http.HttpRequest), sec_group.id)
730 self.mox.ReplayAll() 730 self.mox.ReplayAll()
731 731
732 form_data = {"action": "security_groups__delete__%s" % sec_group.id} 732 form_data = {"action": "security_groups__delete__%s" % sec_group.id}
@@ -736,11 +736,11 @@ class SecurityGroupsViewTests(test.TestCase):
736 self.assertEqual(strip_absolute_base(handled['location']), 736 self.assertEqual(strip_absolute_base(handled['location']),
737 INDEX_URL) 737 INDEX_URL)
738 738
739 @test.create_stubs({api.network: ('security_group_delete',)}) 739 @test.create_stubs({api.neutron: ('security_group_delete',)})
740 def test_delete_group_exception(self): 740 def test_delete_group_exception(self):
741 sec_group = self.security_groups.get(name="other_group") 741 sec_group = self.security_groups.get(name="other_group")
742 742
743 api.network.security_group_delete( 743 api.neutron.security_group_delete(
744 IsA(http.HttpRequest), 744 IsA(http.HttpRequest),
745 sec_group.id).AndRaise(self.exceptions.nova) 745 sec_group.id).AndRaise(self.exceptions.nova)
746 746
@@ -754,18 +754,18 @@ class SecurityGroupsViewTests(test.TestCase):
754 self.assertEqual(strip_absolute_base(handled['location']), 754 self.assertEqual(strip_absolute_base(handled['location']),
755 INDEX_URL) 755 INDEX_URL)
756 756
757 @test.create_stubs({api.network: ('security_group_rule_create', 757 @test.create_stubs({api.neutron: ('security_group_rule_create',
758 'security_group_list')}) 758 'security_group_list')})
759 def test_detail_add_rule_custom_protocol(self): 759 def test_detail_add_rule_custom_protocol(self):
760 sec_group = self.security_groups.first() 760 sec_group = self.security_groups.first()
761 sec_group_list = self.security_groups.list() 761 sec_group_list = self.security_groups.list()
762 rule = self.security_group_rules.first() 762 rule = self.security_group_rules.first()
763 763
764 api.network.security_group_rule_create(IsA(http.HttpRequest), 764 api.neutron.security_group_rule_create(IsA(http.HttpRequest),
765 sec_group.id, 'ingress', 'IPv6', 765 sec_group.id, 'ingress', 'IPv6',
766 37, None, None, 'fe80::/48', 766 37, None, None, 'fe80::/48',
767 None).AndReturn(rule) 767 None).AndReturn(rule)
768 api.network.security_group_list( 768 api.neutron.security_group_list(
769 IsA(http.HttpRequest)).AndReturn(sec_group_list) 769 IsA(http.HttpRequest)).AndReturn(sec_group_list)
770 self.mox.ReplayAll() 770 self.mox.ReplayAll()
771 771
@@ -780,18 +780,18 @@ class SecurityGroupsViewTests(test.TestCase):
780 res = self.client.post(self.edit_url, formData) 780 res = self.client.post(self.edit_url, formData)
781 self.assertRedirectsNoFollow(res, self.detail_url) 781 self.assertRedirectsNoFollow(res, self.detail_url)
782 782
783 @test.create_stubs({api.network: ('security_group_rule_create', 783 @test.create_stubs({api.neutron: ('security_group_rule_create',
784 'security_group_list')}) 784 'security_group_list')})
785 def test_detail_add_rule_egress(self): 785 def test_detail_add_rule_egress(self):
786 sec_group = self.security_groups.first() 786 sec_group = self.security_groups.first()
787 sec_group_list = self.security_groups.list() 787 sec_group_list = self.security_groups.list()
788 rule = self.security_group_rules.first() 788 rule = self.security_group_rules.first()
789 789
790 api.network.security_group_rule_create(IsA(http.HttpRequest), 790 api.neutron.security_group_rule_create(IsA(http.HttpRequest),
791 sec_group.id, 'egress', 'IPv4', 791 sec_group.id, 'egress', 'IPv4',
792 'udp', 80, 80, '10.1.1.0/24', 792 'udp', 80, 80, '10.1.1.0/24',
793 None).AndReturn(rule) 793 None).AndReturn(rule)
794 api.network.security_group_list( 794 api.neutron.security_group_list(
795 IsA(http.HttpRequest)).AndReturn(sec_group_list) 795 IsA(http.HttpRequest)).AndReturn(sec_group_list)
796 self.mox.ReplayAll() 796 self.mox.ReplayAll()
797 797
@@ -806,21 +806,21 @@ class SecurityGroupsViewTests(test.TestCase):
806 res = self.client.post(self.edit_url, formData) 806 res = self.client.post(self.edit_url, formData)
807 self.assertRedirectsNoFollow(res, self.detail_url) 807 self.assertRedirectsNoFollow(res, self.detail_url)
808 808
809 @test.create_stubs({api.network: ('security_group_rule_create', 809 @test.create_stubs({api.neutron: ('security_group_rule_create',
810 'security_group_list')}) 810 'security_group_list')})
811 def test_detail_add_rule_egress_with_all_tcp(self): 811 def test_detail_add_rule_egress_with_all_tcp(self):
812 sec_group = self.security_groups.first() 812 sec_group = self.security_groups.first()
813 sec_group_list = self.security_groups.list() 813 sec_group_list = self.security_groups.list()
814 rule = self.security_group_rules.list()[3] 814 rule = self.security_group_rules.list()[3]
815 815
816 api.network.security_group_rule_create(IsA(http.HttpRequest), 816 api.neutron.security_group_rule_create(IsA(http.HttpRequest),
817 sec_group.id, 'egress', 'IPv4', 817 sec_group.id, 'egress', 'IPv4',
818 rule.ip_protocol, 818 rule.ip_protocol,
819 int(rule.from_port), 819 int(rule.from_port),
820 int(rule.to_port), 820 int(rule.to_port),
821 rule.ip_range['cidr'], 821 rule.ip_range['cidr'],
822 None).AndReturn(rule) 822 None).AndReturn(rule)
823 api.network.security_group_list( 823 api.neutron.security_group_list(
824 IsA(http.HttpRequest)).AndReturn(sec_group_list) 824 IsA(http.HttpRequest)).AndReturn(sec_group_list)
825 self.mox.ReplayAll() 825 self.mox.ReplayAll()
826 826
@@ -834,14 +834,14 @@ class SecurityGroupsViewTests(test.TestCase):
834 res = self.client.post(self.edit_url, formData) 834 res = self.client.post(self.edit_url, formData)
835 self.assertRedirectsNoFollow(res, self.detail_url) 835 self.assertRedirectsNoFollow(res, self.detail_url)
836 836
837 @test.create_stubs({api.network: ('security_group_rule_create', 837 @test.create_stubs({api.neutron: ('security_group_rule_create',
838 'security_group_list')}) 838 'security_group_list')})
839 def test_detail_add_rule_source_group_with_direction_ethertype(self): 839 def test_detail_add_rule_source_group_with_direction_ethertype(self):
840 sec_group = self.security_groups.first() 840 sec_group = self.security_groups.first()
841 sec_group_list = self.security_groups.list() 841 sec_group_list = self.security_groups.list()
842 rule = self._get_source_group_rule() 842 rule = self._get_source_group_rule()
843 843
844 api.network.security_group_rule_create( 844 api.neutron.security_group_rule_create(
845 IsA(http.HttpRequest), 845 IsA(http.HttpRequest),
846 sec_group.id, 846 sec_group.id,
847 'egress', 847 'egress',
@@ -852,7 +852,7 @@ class SecurityGroupsViewTests(test.TestCase):
852 int(rule.to_port), 852 int(rule.to_port),
853 None, 853 None,
854 u'%s' % sec_group.id).AndReturn(rule) 854 u'%s' % sec_group.id).AndReturn(rule)
855 api.network.security_group_list( 855 api.neutron.security_group_list(
856 IsA(http.HttpRequest)).AndReturn(sec_group_list) 856 IsA(http.HttpRequest)).AndReturn(sec_group_list)
857 self.mox.ReplayAll() 857 self.mox.ReplayAll()
858 858
@@ -871,7 +871,7 @@ class SecurityGroupsViewTests(test.TestCase):
871 871
872 @test.update_settings( 872 @test.update_settings(
873 OPENSTACK_NEUTRON_NETWORK={'enable_ipv6': False}) 873 OPENSTACK_NEUTRON_NETWORK={'enable_ipv6': False})
874 @test.create_stubs({api.network: ('security_group_rule_create', 874 @test.create_stubs({api.neutron: ('security_group_rule_create',
875 'security_group_list')}) 875 'security_group_list')})
876 def test_add_rule_ethertype_with_ipv6_disabled(self): 876 def test_add_rule_ethertype_with_ipv6_disabled(self):
877 877
@@ -894,7 +894,7 @@ class SecurityGroupsViewTests(test.TestCase):
894 894
895 @test.update_settings( 895 @test.update_settings(
896 OPENSTACK_NEUTRON_NETWORK={'enable_ipv6': False}) 896 OPENSTACK_NEUTRON_NETWORK={'enable_ipv6': False})
897 @test.create_stubs({api.network: ('security_group_list',)}) 897 @test.create_stubs({api.neutron: ('security_group_list',)})
898 def test_add_rule_cidr_with_ipv6_disabled(self): 898 def test_add_rule_cidr_with_ipv6_disabled(self):
899 sec_group = self.security_groups.first() 899 sec_group = self.security_groups.first()
900 900
@@ -913,16 +913,16 @@ class SecurityGroupsViewTests(test.TestCase):
913 self.assertFormError(res, 'form', 'cidr', 913 self.assertFormError(res, 'form', 'cidr',
914 'Invalid version for IP address') 914 'Invalid version for IP address')
915 915
916 @test.create_stubs({api.network: ('security_group_list',)}) 916 @test.create_stubs({api.neutron: ('security_group_list',)})
917 def test_detail_add_rule_invalid_port(self): 917 def test_detail_add_rule_invalid_port(self):
918 sec_group = self.security_groups.first() 918 sec_group = self.security_groups.first()
919 sec_group_list = self.security_groups.list() 919 sec_group_list = self.security_groups.list()
920 rule = self.security_group_rules.first() 920 rule = self.security_group_rules.first()
921 921
922 api.network.security_group_list( 922 api.neutron.security_group_list(
923 IsA(http.HttpRequest)).AndReturn(sec_group_list) 923 IsA(http.HttpRequest)).AndReturn(sec_group_list)
924 if django.VERSION >= (1, 9): 924 if django.VERSION >= (1, 9):
925 api.network.security_group_list( 925 api.neutron.security_group_list(
926 IsA(http.HttpRequest)).AndReturn(sec_group_list) 926 IsA(http.HttpRequest)).AndReturn(sec_group_list)
927 927
928 self.mox.ReplayAll() 928 self.mox.ReplayAll()
@@ -938,21 +938,21 @@ class SecurityGroupsViewTests(test.TestCase):
938 self.assertNoMessages() 938 self.assertNoMessages()
939 self.assertContains(res, "Not a valid port number") 939 self.assertContains(res, "Not a valid port number")
940 940
941 @test.create_stubs({api.network: ('security_group_rule_create', 941 @test.create_stubs({api.neutron: ('security_group_rule_create',
942 'security_group_list')}) 942 'security_group_list')})