Browse Source

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
tags/12.0.0.0b2
Akihiro Motoki 2 years ago
parent
commit
9067ae8b0f
33 changed files with 906 additions and 1035 deletions
  1. 0
    122
      openstack_dashboard/api/network.py
  2. 95
    0
      openstack_dashboard/api/neutron.py
  3. 6
    6
      openstack_dashboard/api/rest/network.py
  4. 1
    1
      openstack_dashboard/api/rest/nova.py
  5. 4
    4
      openstack_dashboard/dashboards/admin/aggregates/tests.py
  6. 1
    1
      openstack_dashboard/dashboards/admin/floating_ips/forms.py
  7. 1
    1
      openstack_dashboard/dashboards/admin/floating_ips/tables.py
  8. 30
    30
      openstack_dashboard/dashboards/admin/floating_ips/tests.py
  9. 2
    2
      openstack_dashboard/dashboards/admin/floating_ips/views.py
  10. 9
    9
      openstack_dashboard/dashboards/admin/overview/tests.py
  11. 6
    6
      openstack_dashboard/dashboards/identity/projects/tests.py
  12. 1
    1
      openstack_dashboard/dashboards/project/floating_ips/forms.py
  13. 2
    2
      openstack_dashboard/dashboards/project/floating_ips/tables.py
  14. 51
    52
      openstack_dashboard/dashboards/project/floating_ips/tests.py
  15. 3
    3
      openstack_dashboard/dashboards/project/floating_ips/views.py
  16. 4
    4
      openstack_dashboard/dashboards/project/floating_ips/workflows.py
  17. 6
    6
      openstack_dashboard/dashboards/project/instances/tables.py
  18. 118
    120
      openstack_dashboard/dashboards/project/instances/tests.py
  19. 1
    1
      openstack_dashboard/dashboards/project/instances/views.py
  20. 1
    1
      openstack_dashboard/dashboards/project/instances/workflows/create_instance.py
  21. 3
    3
      openstack_dashboard/dashboards/project/instances/workflows/update_instance.py
  22. 10
    10
      openstack_dashboard/dashboards/project/overview/tests.py
  23. 3
    3
      openstack_dashboard/dashboards/project/security_groups/forms.py
  24. 2
    2
      openstack_dashboard/dashboards/project/security_groups/tables.py
  25. 76
    76
      openstack_dashboard/dashboards/project/security_groups/tests.py
  26. 4
    4
      openstack_dashboard/dashboards/project/security_groups/views.py
  27. 6
    6
      openstack_dashboard/test/api_tests/network_rest_tests.py
  28. 0
    533
      openstack_dashboard/test/api_tests/network_tests.py
  29. 439
    4
      openstack_dashboard/test/api_tests/neutron_tests.py
  30. 1
    1
      openstack_dashboard/test/api_tests/nova_rest_tests.py
  31. 14
    14
      openstack_dashboard/test/tests/quotas.py
  32. 3
    3
      openstack_dashboard/usage/base.py
  33. 3
    4
      openstack_dashboard/usage/quotas.py

+ 0
- 122
openstack_dashboard/api/network.py View File

@@ -19,132 +19,10 @@ introduced to abstract the differences between them for seamless consumption by
19 19
 different dashboard implementations.
20 20
 """
21 21
 
22
-from horizon.utils.memoized import memoized
23 22
 from openstack_dashboard.api import base
24 23
 from openstack_dashboard.api import neutron
25 24
 
26 25
 
27
-class 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
-
49
-def floating_ip_pools_list(request):
50
-    return NetworkClient(request).floating_ips.list_pools()
51
-
52
-
53
-@memoized
54
-def tenant_floating_ip_list(request, all_tenants=False):
55
-    return NetworkClient(request).floating_ips.list(all_tenants=all_tenants)
56
-
57
-
58
-def tenant_floating_ip_get(request, floating_ip_id):
59
-    return NetworkClient(request).floating_ips.get(floating_ip_id)
60
-
61
-
62
-def 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
-
68
-def tenant_floating_ip_release(request, floating_ip_id):
69
-    return NetworkClient(request).floating_ips.release(floating_ip_id)
70
-
71
-
72
-def floating_ip_associate(request, floating_ip_id, port_id):
73
-    return NetworkClient(request).floating_ips.associate(floating_ip_id,
74
-                                                         port_id)
75
-
76
-
77
-def floating_ip_disassociate(request, floating_ip_id):
78
-    return NetworkClient(request).floating_ips.disassociate(floating_ip_id)
79
-
80
-
81
-def floating_ip_target_list(request):
82
-    return NetworkClient(request).floating_ips.list_targets()
83
-
84
-
85
-def 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
-
90
-def 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
-
95
-def floating_ip_simple_associate_supported(request):
96
-    return NetworkClient(request).floating_ips.is_simple_associate_supported()
97
-
98
-
99
-def floating_ip_supported(request):
100
-    nwc = NetworkClient(request)
101
-    return nwc.enabled and nwc.floating_ips.is_supported()
102
-
103
-
104
-@memoized
105
-def security_group_list(request):
106
-    return NetworkClient(request).secgroups.list()
107
-
108
-
109
-def security_group_get(request, sg_id):
110
-    return NetworkClient(request).secgroups.get(sg_id)
111
-
112
-
113
-def security_group_create(request, name, desc):
114
-    return NetworkClient(request).secgroups.create(name, desc)
115
-
116
-
117
-def security_group_delete(request, sg_id):
118
-    return NetworkClient(request).secgroups.delete(sg_id)
119
-
120
-
121
-def security_group_update(request, sg_id, name, desc):
122
-    return NetworkClient(request).secgroups.update(sg_id, name, desc)
123
-
124
-
125
-def 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
-
134
-def security_group_rule_delete(request, sgr_id):
135
-    return NetworkClient(request).secgroups.rule_delete(sgr_id)
136
-
137
-
138
-def server_security_groups(request, instance_id):
139
-    return NetworkClient(request).secgroups.list_by_instance(instance_id)
140
-
141
-
142
-def 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
-
148 26
 def servers_update_addresses(request, servers, all_tenants=False):
149 27
     """Retrieve servers networking information from Neutron if enabled.
150 28
 

+ 95
- 0
openstack_dashboard/api/neutron.py View File

@@ -1246,6 +1246,101 @@ def provider_list(request):
1246 1246
     return providers['service_providers']
1247 1247
 
1248 1248
 
1249
+def floating_ip_pools_list(request):
1250
+    return FloatingIpManager(request).list_pools()
1251
+
1252
+
1253
+@memoized
1254
+def tenant_floating_ip_list(request, all_tenants=False):
1255
+    return FloatingIpManager(request).list(all_tenants=all_tenants)
1256
+
1257
+
1258
+def tenant_floating_ip_get(request, floating_ip_id):
1259
+    return FloatingIpManager(request).get(floating_ip_id)
1260
+
1261
+
1262
+def tenant_floating_ip_allocate(request, pool=None, tenant_id=None, **params):
1263
+    return FloatingIpManager(request).allocate(pool, tenant_id, **params)
1264
+
1265
+
1266
+def tenant_floating_ip_release(request, floating_ip_id):
1267
+    return FloatingIpManager(request).release(floating_ip_id)
1268
+
1269
+
1270
+def floating_ip_associate(request, floating_ip_id, port_id):
1271
+    return FloatingIpManager(request).associate(floating_ip_id, port_id)
1272
+
1273
+
1274
+def floating_ip_disassociate(request, floating_ip_id):
1275
+    return FloatingIpManager(request).disassociate(floating_ip_id)
1276
+
1277
+
1278
+def floating_ip_target_list(request):
1279
+    return FloatingIpManager(request).list_targets()
1280
+
1281
+
1282
+def 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
+
1287
+def 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
+
1292
+def floating_ip_simple_associate_supported(request):
1293
+    return FloatingIpManager(request).is_simple_associate_supported()
1294
+
1295
+
1296
+def floating_ip_supported(request):
1297
+    return FloatingIpManager(request).is_supported()
1298
+
1299
+
1300
+@memoized
1301
+def security_group_list(request):
1302
+    return SecurityGroupManager(request).list()
1303
+
1304
+
1305
+def security_group_get(request, sg_id):
1306
+    return SecurityGroupManager(request).get(sg_id)
1307
+
1308
+
1309
+def security_group_create(request, name, desc):
1310
+    return SecurityGroupManager(request).create(name, desc)
1311
+
1312
+
1313
+def security_group_delete(request, sg_id):
1314
+    return SecurityGroupManager(request).delete(sg_id)
1315
+
1316
+
1317
+def security_group_update(request, sg_id, name, desc):
1318
+    return SecurityGroupManager(request).update(sg_id, name, desc)
1319
+
1320
+
1321
+def 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
+
1330
+def security_group_rule_delete(request, sgr_id):
1331
+    return SecurityGroupManager(request).rule_delete(sgr_id)
1332
+
1333
+
1334
+def server_security_groups(request, instance_id):
1335
+    return SecurityGroupManager(request).list_by_instance(instance_id)
1336
+
1337
+
1338
+def 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 1344
 # TODO(pkarikh) need to uncomment when osprofiler will have no
1250 1345
 # issues with unicode in:
1251 1346
 # openstack_dashboard/test/test_data/nova_data.py#L470 data

+ 6
- 6
openstack_dashboard/api/rest/network.py View File

@@ -42,7 +42,7 @@ class SecurityGroups(generic.View):
42 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 47
         return {'items': [sg.to_dict() for sg in security_groups]}
48 48
 
@@ -63,7 +63,7 @@ class FloatingIP(generic.View):
63 63
         :return: JSON representation of the new floating IP address
64 64
         """
65 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 67
         return result.to_dict()
68 68
 
69 69
     @rest_utils.ajax(data_required=True)
@@ -77,9 +77,9 @@ class FloatingIP(generic.View):
77 77
         address = request.DATA['address_id']
78 78
         port = request.DATA.get('port_id')
79 79
         if port is None:
80
-            api.network.floating_ip_disassociate(request, address)
80
+            api.neutron.floating_ip_disassociate(request, address)
81 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 85
 @urls.register
@@ -98,7 +98,7 @@ class FloatingIPs(generic.View):
98 98
         Example:
99 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 102
         return {'items': [ip.to_dict() for ip in result]}
103 103
 
104 104
 
@@ -118,5 +118,5 @@ class FloatingIPPools(generic.View):
118 118
         Example:
119 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 122
         return {'items': [p.to_dict() for p in result]}

+ 1
- 1
openstack_dashboard/api/rest/nova.py View File

@@ -233,7 +233,7 @@ class SecurityGroups(generic.View):
233 233
         Example GET:
234 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 237
         return {'items': [s.to_dict() for s in groups]}
238 238
 
239 239
 

+ 4
- 4
openstack_dashboard/dashboards/admin/aggregates/tests.py View File

@@ -208,8 +208,8 @@ class AggregatesViewTests(test.BaseAdminViewTests):
208 208
                                    'availability_zone_list',
209 209
                                    'tenant_absolute_limits',),
210 210
                         api.cinder: ('tenant_absolute_limits',),
211
-                        api.neutron: ('is_extension_supported',),
212
-                        api.network: ('tenant_floating_ip_list',
211
+                        api.neutron: ('is_extension_supported',
212
+                                      'tenant_floating_ip_list',
213 213
                                       'security_group_list'),
214 214
                         api.keystone: ('tenant_list',)})
215 215
     def test_panel_not_available(self):
@@ -220,9 +220,9 @@ class AggregatesViewTests(test.BaseAdminViewTests):
220 220
         api.neutron.\
221 221
             is_extension_supported(IsA(http.HttpRequest), 'security-group'). \
222 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 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 226
             .AndReturn(self.security_groups.list())
227 227
         api.keystone.tenant_list(IsA(http.HttpRequest)) \
228 228
             .AndReturn(self.tenants.list())

+ 1
- 1
openstack_dashboard/dashboards/admin/floating_ips/forms.py View File

@@ -50,7 +50,7 @@ class AdminFloatingIpAllocate(forms.SelfHandlingForm):
50 50
                 param['floating_ip_address'] = data['floating_ip_address']
51 51
             subnet = api.neutron.subnet_get(request, data['pool'])
52 52
             param['subnet_id'] = subnet.id
53
-            fip = api.network.tenant_floating_ip_allocate(
53
+            fip = api.neutron.tenant_floating_ip_allocate(
54 54
                 request,
55 55
                 pool=subnet.network_id,
56 56
                 tenant_id=data['tenant'],

+ 1
- 1
openstack_dashboard/dashboards/admin/floating_ips/tables.py View File

@@ -61,7 +61,7 @@ class AdminSimpleDisassociateIP(project_tables.DisassociateIP):
61 61
     def single(self, table, request, obj_id):
62 62
         try:
63 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 65
             LOG.info('Disassociating Floating IP "%s".', obj_id)
66 66
             messages.success(request,
67 67
                              _('Successfully disassociated Floating IP: %s')

+ 30
- 30
openstack_dashboard/dashboards/admin/floating_ips/tests.py View File

@@ -25,16 +25,16 @@ INDEX_TEMPLATE = 'horizon/common/_data_table_view.html'
25 25
 
26 26
 
27 27
 class AdminFloatingIpViewTest(test.BaseAdminViewTests):
28
-    @test.create_stubs({api.network: ('tenant_floating_ip_list', ),
29
-                        api.nova: ('server_list', ),
28
+    @test.create_stubs({api.nova: ('server_list', ),
30 29
                         api.keystone: ('tenant_list', ),
31
-                        api.neutron: ('network_list', )})
30
+                        api.neutron: ('network_list',
31
+                                      'tenant_floating_ip_list',)})
32 32
     def test_index(self):
33 33
         # Use neutron test data
34 34
         fips = self.floating_ips.list()
35 35
         servers = self.servers.list()
36 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 38
                                             all_tenants=True).AndReturn(fips)
39 39
         api.nova.server_list(IsA(http.HttpRequest), all_tenants=True) \
40 40
             .AndReturn([servers, False])
@@ -58,12 +58,12 @@ class AdminFloatingIpViewTest(test.BaseAdminViewTests):
58 58
         row_actions = floating_ips_table.get_row_actions(floating_ips[1])
59 59
         self.assertEqual(len(row_actions), 2)
60 60
 
61
-    @test.create_stubs({api.network: ('tenant_floating_ip_get', ),
62
-                        api.neutron: ('network_get', )})
61
+    @test.create_stubs({api.neutron: ('tenant_floating_ip_get',
62
+                                      'network_get', )})
63 63
     def test_floating_ip_detail_get(self):
64 64
         fip = self.floating_ips.first()
65 65
         network = self.networks.first()
66
-        api.network.tenant_floating_ip_get(
66
+        api.neutron.tenant_floating_ip_get(
67 67
             IsA(http.HttpRequest), fip.id).AndReturn(fip)
68 68
         api.neutron.network_get(
69 69
             IsA(http.HttpRequest), fip.pool).AndReturn(network)
@@ -75,11 +75,11 @@ class AdminFloatingIpViewTest(test.BaseAdminViewTests):
75 75
                                 'admin/floating_ips/detail.html')
76 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 79
     def test_floating_ip_detail_exception(self):
80 80
         fip = self.floating_ips.first()
81 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 83
             IsA(http.HttpRequest),
84 84
             fip.id).AndRaise(self.exceptions.neutron)
85 85
 
@@ -90,18 +90,18 @@ class AdminFloatingIpViewTest(test.BaseAdminViewTests):
90 90
 
91 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 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 96
                                             all_tenants=True).AndReturn([])
97 97
         self.mox.ReplayAll()
98 98
 
99 99
         res = self.client.get(INDEX_URL)
100 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 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 105
                                             all_tenants=True) \
106 106
             .AndRaise(self.exceptions.neutron)
107 107
         self.mox.ReplayAll()
@@ -154,8 +154,8 @@ class AdminFloatingIpViewTest(test.BaseAdminViewTests):
154 154
         res = self.client.post(url, form_data)
155 155
         self.assertContains(res, "Invalid version for IP address")
156 156
 
157
-    @test.create_stubs({api.network: ('tenant_floating_ip_allocate',),
158
-                        api.neutron: ('network_list', 'subnet_get'),
157
+    @test.create_stubs({api.neutron: ('tenant_floating_ip_allocate',
158
+                                      'network_list', 'subnet_get'),
159 159
                         api.keystone: ('tenant_list',)})
160 160
     def test_admin_allocate_post(self):
161 161
         tenant = self.tenants.first()
@@ -171,7 +171,7 @@ class AdminFloatingIpViewTest(test.BaseAdminViewTests):
171 171
         search_opts = {'router:external': True}
172 172
         api.neutron.network_list(IsA(http.HttpRequest), **search_opts) \
173 173
             .AndReturn([pool])
174
-        api.network.tenant_floating_ip_allocate(
174
+        api.neutron.tenant_floating_ip_allocate(
175 175
             IsA(http.HttpRequest),
176 176
             pool=pool.id,
177 177
             tenant_id=tenant.id).AndReturn(floating_ip)
@@ -183,18 +183,18 @@ class AdminFloatingIpViewTest(test.BaseAdminViewTests):
183 183
         res = self.client.post(url, form_data)
184 184
         self.assertRedirectsNoFollow(res, INDEX_URL)
185 185
 
186
-    @test.create_stubs({api.network: ('tenant_floating_ip_list',
187
-                                      'floating_ip_disassociate'),
186
+    @test.create_stubs({api.neutron: ('tenant_floating_ip_list',
187
+                                      'floating_ip_disassociate',
188
+                                      'network_list'),
188 189
                         api.nova: ('server_list', ),
189
-                        api.keystone: ('tenant_list', ),
190
-                        api.neutron: ('network_list', )})
190
+                        api.keystone: ('tenant_list', )})
191 191
     def test_admin_disassociate_floatingip(self):
192 192
         # Use neutron test data
193 193
         fips = self.floating_ips.list()
194 194
         floating_ip = self.floating_ips.list()[1]
195 195
         servers = self.servers.list()
196 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 198
                                             all_tenants=True).AndReturn(fips)
199 199
         api.nova.server_list(IsA(http.HttpRequest), all_tenants=True) \
200 200
             .AndReturn([servers, False])
@@ -203,7 +203,7 @@ class AdminFloatingIpViewTest(test.BaseAdminViewTests):
203 203
         params = {"router:external": True}
204 204
         api.neutron.network_list(IsA(http.HttpRequest), **params) \
205 205
             .AndReturn(self.networks.list())
206
-        api.network.floating_ip_disassociate(IsA(http.HttpRequest),
206
+        api.neutron.floating_ip_disassociate(IsA(http.HttpRequest),
207 207
                                              floating_ip.id)
208 208
         self.mox.ReplayAll()
209 209
 
@@ -214,17 +214,17 @@ class AdminFloatingIpViewTest(test.BaseAdminViewTests):
214 214
 
215 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 219
                         api.nova: ('server_list', ),
219
-                        api.keystone: ('tenant_list', ),
220
-                        api.neutron: ('network_list', )})
220
+                        api.keystone: ('tenant_list', )})
221 221
     def test_admin_delete_floatingip(self):
222 222
         # Use neutron test data
223 223
         fips = self.floating_ips.list()
224 224
         floating_ip = self.floating_ips.list()[1]
225 225
         servers = self.servers.list()
226 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 228
                                             all_tenants=True).AndReturn(fips)
229 229
         api.nova.server_list(IsA(http.HttpRequest), all_tenants=True) \
230 230
             .AndReturn([servers, False])
@@ -243,16 +243,16 @@ class AdminFloatingIpViewTest(test.BaseAdminViewTests):
243 243
 
244 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 248
                         api.nova: ('server_list', ),
248
-                        api.keystone: ('tenant_list', ),
249
-                        api.neutron: ('network_list', )})
249
+                        api.keystone: ('tenant_list', )})
250 250
     def test_floating_ip_table_actions(self):
251 251
         # Use neutron test data
252 252
         fips = self.floating_ips.list()
253 253
         servers = self.servers.list()
254 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 256
                                             all_tenants=True).AndReturn(fips)
257 257
         api.nova.server_list(IsA(http.HttpRequest), all_tenants=True) \
258 258
             .AndReturn([servers, False])

+ 2
- 2
openstack_dashboard/dashboards/admin/floating_ips/views.py View File

@@ -65,7 +65,7 @@ class IndexView(tables.DataTableView):
65 65
     def get_data(self):
66 66
         floating_ips = []
67 67
         try:
68
-            floating_ips = api.network.tenant_floating_ip_list(
68
+            floating_ips = api.neutron.tenant_floating_ip_list(
69 69
                 self.request,
70 70
                 all_tenants=True)
71 71
         except Exception:
@@ -104,7 +104,7 @@ class DetailView(views.HorizonTemplateView):
104 104
     page_title = _("Floating IP Details")
105 105
 
106 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 108
                          "instance": api.nova.server_get,
109 109
                          "network": api.neutron.network_get,
110 110
                          "router": api.neutron.router_get}

+ 9
- 9
openstack_dashboard/dashboards/admin/overview/tests.py View File

@@ -44,9 +44,9 @@ class UsageViewTests(test.BaseAdminViewTests):
44 44
         self.mox.StubOutWithMock(api.nova, 'extension_supported')
45 45
         self.mox.StubOutWithMock(api.keystone, 'tenant_list')
46 46
         self.mox.StubOutWithMock(api.neutron, 'is_extension_supported')
47
-        self.mox.StubOutWithMock(api.network, 'floating_ip_supported')
48
-        self.mox.StubOutWithMock(api.network, 'tenant_floating_ip_list')
49
-        self.mox.StubOutWithMock(api.network, 'security_group_list')
47
+        self.mox.StubOutWithMock(api.neutron, 'floating_ip_supported')
48
+        self.mox.StubOutWithMock(api.neutron, 'tenant_floating_ip_list')
49
+        self.mox.StubOutWithMock(api.neutron, 'security_group_list')
50 50
         self.mox.StubOutWithMock(api.cinder, 'tenant_absolute_limits')
51 51
 
52 52
         api.nova.extension_supported(
@@ -103,11 +103,11 @@ class UsageViewTests(test.BaseAdminViewTests):
103 103
             .AndReturn(self.limits['absolute'])
104 104
         api.neutron.is_extension_supported(IsA(http.HttpRequest),
105 105
                                            'security-group').AndReturn(True)
106
-        api.network.floating_ip_supported(IsA(http.HttpRequest)) \
106
+        api.neutron.floating_ip_supported(IsA(http.HttpRequest)) \
107 107
             .AndReturn(True)
108
-        api.network.tenant_floating_ip_list(IsA(http.HttpRequest)) \
108
+        api.neutron.tenant_floating_ip_list(IsA(http.HttpRequest)) \
109 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 111
             .AndReturn(self.security_groups.list())
112 112
         api.cinder.tenant_absolute_limits(IsA(http.HttpRequest)) \
113 113
             .AndReturn(self.cinder_limits['absolute'])
@@ -199,11 +199,11 @@ class UsageViewTests(test.BaseAdminViewTests):
199 199
             .AndReturn(self.limits['absolute'])
200 200
         api.neutron.is_extension_supported(IsA(http.HttpRequest),
201 201
                                            'security-group').AndReturn(True)
202
-        api.network.floating_ip_supported(IsA(http.HttpRequest)) \
202
+        api.neutron.floating_ip_supported(IsA(http.HttpRequest)) \
203 203
             .AndReturn(True)
204
-        api.network.tenant_floating_ip_list(IsA(http.HttpRequest)) \
204
+        api.neutron.tenant_floating_ip_list(IsA(http.HttpRequest)) \
205 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 207
             .AndReturn(self.security_groups.list())
208 208
         api.cinder.tenant_absolute_limits(IsA(http.HttpRequest)) \
209 209
             .AndReturn(self.cinder_limits['absolute'])

+ 6
- 6
openstack_dashboard/dashboards/identity/projects/tests.py View File

@@ -1566,19 +1566,19 @@ class UsageViewTests(test.BaseAdminViewTests):
1566 1566
 
1567 1567
     def _stub_neutron_api_calls(self, neutron_sg_enabled=True):
1568 1568
         self.mox.StubOutWithMock(api.neutron, 'is_extension_supported')
1569
-        self.mox.StubOutWithMock(api.network, 'floating_ip_supported')
1570
-        self.mox.StubOutWithMock(api.network, 'tenant_floating_ip_list')
1569
+        self.mox.StubOutWithMock(api.neutron, 'floating_ip_supported')
1570
+        self.mox.StubOutWithMock(api.neutron, 'tenant_floating_ip_list')
1571 1571
         if neutron_sg_enabled:
1572
-            self.mox.StubOutWithMock(api.network, 'security_group_list')
1572
+            self.mox.StubOutWithMock(api.neutron, 'security_group_list')
1573 1573
         api.neutron.is_extension_supported(
1574 1574
             IsA(http.HttpRequest),
1575 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 1577
             .AndReturn(True)
1578
-        api.network.tenant_floating_ip_list(IsA(http.HttpRequest)) \
1578
+        api.neutron.tenant_floating_ip_list(IsA(http.HttpRequest)) \
1579 1579
             .AndReturn(self.floating_ips.list())
1580 1580
         if neutron_sg_enabled:
1581
-            api.network.security_group_list(IsA(http.HttpRequest)) \
1581
+            api.neutron.security_group_list(IsA(http.HttpRequest)) \
1582 1582
                 .AndReturn(self.security_groups.list())
1583 1583
 
1584 1584
     def test_usage_csv(self):

+ 1
- 1
openstack_dashboard/dashboards/project/floating_ips/forms.py View File

@@ -45,7 +45,7 @@ class FloatingIpAllocate(forms.SelfHandlingForm):
45 45
                 self.api_error(error_message)
46 46
                 return False
47 47
 
48
-            fip = api.network.tenant_floating_ip_allocate(request,
48
+            fip = api.neutron.tenant_floating_ip_allocate(request,
49 49
                                                           pool=data['pool'])
50 50
             messages.success(request,
51 51
                              _('Allocated Floating IP %(ip)s.')

+ 2
- 2
openstack_dashboard/dashboards/project/floating_ips/tables.py View File

@@ -90,7 +90,7 @@ class ReleaseIPs(tables.BatchAction):
90 90
         return policy.check(policy_rules, request)
91 91
 
92 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
 
96 96
 class AssociateIP(tables.LinkAction):
@@ -124,7 +124,7 @@ class DisassociateIP(tables.Action):
124 124
     def single(self, table, request, obj_id):
125 125
         try:
126 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 128
             LOG.info('Disassociating Floating IP "%s".', obj_id)
129 129
             messages.success(request,
130 130
                              _('Successfully disassociated Floating IP: %s')

+ 51
- 52
openstack_dashboard/dashboards/project/floating_ips/tests.py View File

@@ -37,12 +37,12 @@ NAMESPACE = "horizon:project:floating_ips"
37 37
 
38 38
 class 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 41
                                       'tenant_floating_ip_list',)})
42 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 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 46
             .AndReturn(self.floating_ips.list())
47 47
         self.mox.ReplayAll()
48 48
 
@@ -54,18 +54,18 @@ class FloatingIpViewTests(test.TestCase):
54 54
         # Verify that our "associated" floating IP isn't in the choices list.
55 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 58
                                       'floating_ip_target_get_by_instance',
59 59
                                       'tenant_floating_ip_list',)})
60 60
     def test_associate_with_instance_id(self):
61 61
         targets = self._get_fip_targets()
62 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 64
             .AndReturn(targets)
65
-        api.network.floating_ip_target_get_by_instance(
65
+        api.neutron.floating_ip_target_get_by_instance(
66 66
             IsA(http.HttpRequest), target.instance_id, targets) \
67 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 69
             .AndReturn(self.floating_ips.list())
70 70
         self.mox.ReplayAll()
71 71
 
@@ -100,16 +100,16 @@ class FloatingIpViewTests(test.TestCase):
100 100
     def _get_target_id(port):
101 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 104
                                       'tenant_floating_ip_list',)})
105 105
     def test_associate_with_port_id(self):
106 106
         compute_port = self._get_compute_ports()[0]
107 107
         associated_fips = [fip.id for fip in self.floating_ips.list()
108 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 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 113
             .AndReturn(self.floating_ips.list())
114 114
         self.mox.ReplayAll()
115 115
 
@@ -123,7 +123,7 @@ class FloatingIpViewTests(test.TestCase):
123 123
         # Verify that our "associated" floating IP isn't in the choices list.
124 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 127
                                       'floating_ip_target_list',
128 128
                                       'tenant_floating_ip_list',)})
129 129
     def test_associate_post(self):
@@ -132,11 +132,11 @@ class FloatingIpViewTests(test.TestCase):
132 132
         compute_port = self._get_compute_ports()[0]
133 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 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 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 140
                                           floating_ip.id,
141 141
                                           port_target_id)
142 142
         self.mox.ReplayAll()
@@ -147,7 +147,7 @@ class FloatingIpViewTests(test.TestCase):
147 147
         res = self.client.post(url, form_data)
148 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 151
                                       'floating_ip_target_list',
152 152
                                       'tenant_floating_ip_list',)})
153 153
     def test_associate_post_with_redirect(self):
@@ -156,11 +156,11 @@ class FloatingIpViewTests(test.TestCase):
156 156
         compute_port = self._get_compute_ports()[0]
157 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 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 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 164
                                           floating_ip.id,
165 165
                                           port_target_id)
166 166
         self.mox.ReplayAll()
@@ -172,7 +172,7 @@ class FloatingIpViewTests(test.TestCase):
172 172
         res = self.client.post(url, form_data)
173 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 176
                                       'floating_ip_target_list',
177 177
                                       'tenant_floating_ip_list',)})
178 178
     def test_associate_post_with_exception(self):
@@ -181,11 +181,11 @@ class FloatingIpViewTests(test.TestCase):
181 181
         compute_port = self._get_compute_ports()[0]
182 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 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 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 189
                                           floating_ip.id,
190 190
                                           port_target_id) \
191 191
             .AndRaise(self.exceptions.nova)
@@ -198,21 +198,21 @@ class FloatingIpViewTests(test.TestCase):
198 198
         self.assertRedirectsNoFollow(res, INDEX_URL)
199 199
 
200 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 203
                                       'tenant_floating_ip_get',
203
-                                      'tenant_floating_ip_list',),
204
-                        api.neutron: ('is_extension_supported',)})
204
+                                      'tenant_floating_ip_list',
205
+                                      'is_extension_supported',)})
205 206
     def test_disassociate_post(self):
206 207
         floating_ip = self.floating_ips.first()
207 208
 
208 209
         api.nova.server_list(IsA(http.HttpRequest), detailed=False) \
209 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 212
             .AndReturn(self.floating_ips.list())
212
-        api.neutron.is_extension_supported(IsA(http.HttpRequest),
213
-                                           'subnet_allocation')\
214
-            .AndReturn(True)
215
-        api.network.floating_ip_disassociate(IsA(http.HttpRequest),
213
+        api.neutron.floating_ip_pools_list(IsA(http.HttpRequest)) \
214
+            .AndReturn(self.pools.list())
215
+        api.neutron.floating_ip_disassociate(IsA(http.HttpRequest),
216 216
                                              floating_ip.id)
217 217
         self.mox.ReplayAll()
218 218
 
@@ -222,22 +222,21 @@ class FloatingIpViewTests(test.TestCase):
222 222
         self.assertRedirectsNoFollow(res, INDEX_URL)
223 223
 
224 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 227
                                       'tenant_floating_ip_get',
227
-                                      'tenant_floating_ip_list',),
228
-                        api.neutron: ('is_extension_supported',)})
228
+                                      'tenant_floating_ip_list',
229
+                                      'is_extension_supported',)})
229 230
     def test_disassociate_post_with_exception(self):
230 231
         floating_ip = self.floating_ips.first()
231 232
 
232 233
         api.nova.server_list(IsA(http.HttpRequest), detailed=False) \
233 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 236
             .AndReturn(self.floating_ips.list())
236
-        api.neutron.is_extension_supported(IsA(http.HttpRequest),
237
-                                           'subnet_allocation')\
238
-            .AndReturn(True)
239
-
240
-        api.network.floating_ip_disassociate(IsA(http.HttpRequest),
237
+        api.neutron.floating_ip_pools_list(IsA(http.HttpRequest)) \
238
+            .AndReturn(self.pools.list())
239
+        api.neutron.floating_ip_disassociate(IsA(http.HttpRequest),
241 240
                                              floating_ip.id) \
242 241
             .AndRaise(self.exceptions.nova)
243 242
         self.mox.ReplayAll()
@@ -246,7 +245,7 @@ class FloatingIpViewTests(test.TestCase):
246 245
         res = self.client.post(INDEX_URL, {"action": action})
247 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 249
                                       'floating_ip_pools_list',),
251 250
                         api.nova: ('server_list',),
252 251
                         quotas: ('tenant_quota_usages',),
@@ -257,10 +256,10 @@ class FloatingIpViewTests(test.TestCase):
257 256
         quota_data = self.quota_usages.first()
258 257
         quota_data['floating_ips']['available'] = 10
259 258
 
260
-        api.network.tenant_floating_ip_list(
259
+        api.neutron.tenant_floating_ip_list(
261 260
             IsA(http.HttpRequest)) \
262 261
             .AndReturn(floating_ips)
263
-        api.network.floating_ip_pools_list(
262
+        api.neutron.floating_ip_pools_list(
264 263
             IsA(http.HttpRequest)) \
265 264
             .AndReturn(floating_pools)
266 265
         api.nova.server_list(
@@ -284,7 +283,7 @@ class FloatingIpViewTests(test.TestCase):
284 283
         url = 'horizon:project:floating_ips:allocate'
285 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 287
                                       'floating_ip_pools_list',),
289 288
                         api.nova: ('server_list',),
290 289
                         quotas: ('tenant_quota_usages',),
@@ -295,10 +294,10 @@ class FloatingIpViewTests(test.TestCase):
295 294
         quota_data = self.quota_usages.first()
296 295
         quota_data['floating_ips']['available'] = 0
297 296
 
298
-        api.network.tenant_floating_ip_list(
297
+        api.neutron.tenant_floating_ip_list(
299 298
             IsA(http.HttpRequest)) \
300 299
             .AndReturn(floating_ips)
301
-        api.network.floating_ip_pools_list(
300
+        api.neutron.floating_ip_pools_list(
302 301
             IsA(http.HttpRequest)) \
303 302
             .AndReturn(floating_pools)
304 303
         api.nova.server_list(
@@ -321,11 +320,11 @@ class FloatingIpViewTests(test.TestCase):
321 320
 
322 321
     @test.create_stubs({api.nova: ('tenant_quota_get', 'flavor_list',
323 322
                                    'server_list'),
324
-                        api.network: ('floating_ip_pools_list',
323
+                        api.neutron: ('floating_ip_pools_list',
325 324
                                       'floating_ip_supported',
326 325
                                       'security_group_list',
327
-                                      'tenant_floating_ip_list'),
328
-                        api.neutron: ('is_extension_supported',
326
+                                      'tenant_floating_ip_list',
327
+                                      'is_extension_supported',
329 328
                                       'is_router_enabled',
330 329
                                       'tenant_quota_get',
331 330
                                       'network_list',
@@ -368,13 +367,13 @@ class FloatingIpViewTests(test.TestCase):
368 367
         api.neutron.network_list(IsA(http.HttpRequest),
369 368
                                  tenant_id=self.tenant.id) \
370 369
             .AndReturn(self.networks.list())
371
-        api.network.floating_ip_supported(IsA(http.HttpRequest)) \
370
+        api.neutron.floating_ip_supported(IsA(http.HttpRequest)) \
372 371
             .AndReturn(True)
373
-        api.network.tenant_floating_ip_list(IsA(http.HttpRequest)) \
372
+        api.neutron.tenant_floating_ip_list(IsA(http.HttpRequest)) \
374 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 375
             .AndReturn(self.pools.list())
377
-        api.network.security_group_list(IsA(http.HttpRequest)) \
376
+        api.neutron.security_group_list(IsA(http.HttpRequest)) \
378 377
             .AndReturn(self.security_groups.list())
379 378
         self.mox.ReplayAll()
380 379
 

+ 3
- 3
openstack_dashboard/dashboards/project/floating_ips/views.py View File

@@ -68,7 +68,7 @@ class AllocateView(forms.ModalFormView):
68 68
 
69 69
     def get_initial(self):
70 70
         try:
71
-            pools = api.network.floating_ip_pools_list(self.request)
71
+            pools = api.neutron.floating_ip_pools_list(self.request)
72 72
         except neutron_exc.ConnectionFailed:
73 73
             pools = []
74 74
             exceptions.handle(self.request)
@@ -88,7 +88,7 @@ class IndexView(tables.DataTableView):
88 88
 
89 89
     def get_data(self):
90 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 92
         except neutron_exc.ConnectionFailed:
93 93
             floating_ips = []
94 94
             exceptions.handle(self.request)
@@ -99,7 +99,7 @@ class IndexView(tables.DataTableView):
99 99
 
100 100
         try:
101 101
             floating_ip_pools = \
102
-                api.network.floating_ip_pools_list(self.request)
102
+                api.neutron.floating_ip_pools_list(self.request)
103 103
         except neutron_exc.ConnectionFailed:
104 104
             floating_ip_pools = []
105 105
             exceptions.handle(self.request)

+ 4
- 4
openstack_dashboard/dashboards/project/floating_ips/workflows.py View File

@@ -54,7 +54,7 @@ class AssociateIPAction(workflows.Action):
54 54
         q_port_id = self.request.GET.get('port_id')
55 55
         if q_instance_id:
56 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 58
                 self.request, q_instance_id, targets)
59 59
             self.initial['instance_id'] = target_id
60 60
         elif q_port_id:
@@ -69,7 +69,7 @@ class AssociateIPAction(workflows.Action):
69 69
         ips = []
70 70
         redirect = reverse('horizon:project:floating_ips:index')
71 71
         try:
72
-            ips = api.network.tenant_floating_ip_list(self.request)
72
+            ips = api.neutron.tenant_floating_ip_list(self.request)
73 73
         except neutron_exc.ConnectionFailed:
74 74
             exceptions.handle(self.request, redirect=redirect)
75 75
         except Exception:
@@ -88,7 +88,7 @@ class AssociateIPAction(workflows.Action):
88 88
     def _get_target_list(self):
89 89
         targets = []
90 90
         try:
91
-            targets = api.network.floating_ip_target_list(self.request)
91
+            targets = api.neutron.floating_ip_target_list(self.request)
92 92
         except Exception:
93 93
             redirect = reverse('horizon:project:floating_ips:index')
94 94
             exceptions.handle(self.request,
@@ -145,7 +145,7 @@ class IPAssociationWorkflow(workflows.Workflow):
145 145
 
146 146
     def handle(self, request, data):
147 147
         try:
148
-            api.network.floating_ip_associate(request,
148
+            api.neutron.floating_ip_associate(request,
149 149
                                               data['ip_id'],
150 150
                                               data['instance_id'])
151 151
         except neutron_exc.Conflict:

+ 6
- 6
openstack_dashboard/dashboards/project/instances/tables.py View File

@@ -633,9 +633,9 @@ class AssociateIP(policy.PolicyTargetMixin, tables.LinkAction):
633 633
     def allowed(self, request, instance):
634 634
         if not api.base.is_service_enabled(request, 'network'):
635 635
             return False
636
-        if not api.network.floating_ip_supported(request):
636
+        if not api.neutron.floating_ip_supported(request):
637 637
             return False
638
-        if api.network.floating_ip_simple_associate_supported(request):
638
+        if api.neutron.floating_ip_simple_associate_supported(request):
639 639
             return False
640 640
         if instance.status == "ERROR":
641 641
             return False
@@ -669,7 +669,7 @@ class SimpleDisassociateIP(policy.PolicyTargetMixin, tables.Action):
669 669
     def allowed(self, request, instance):
670 670
         if not api.base.is_service_enabled(request, 'network'):
671 671
             return False
672
-        if not api.network.floating_ip_supported(request):
672
+        if not api.neutron.floating_ip_supported(request):
673 673
             return False
674 674
         if not conf.HORIZON_CONFIG["simple_ip_management"]:
675 675
             return False
@@ -683,18 +683,18 @@ class SimpleDisassociateIP(policy.PolicyTargetMixin, tables.Action):
683 683
         try:
684 684
             # target_id is port_id for Neutron and instance_id for Nova Network
685 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 687
                 request, instance_id)
688 688
 
689 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 692
                     if fip.port_id in target_ids]
693 693
             # Removing multiple floating IPs at once doesn't work, so this pops
694 694
             # off the first one.
695 695
             if fips:
696 696
                 fip = fips.pop()
697
-                api.network.floating_ip_disassociate(request, fip.id)
697
+                api.neutron.floating_ip_disassociate(request, fip.id)
698 698
                 messages.success(request,
699 699
                                  _("Successfully disassociated "
700 700
                                    "floating IP: %s") % fip.ip)

+ 118
- 120
openstack_dashboard/dashboards/project/instances/tests.py View File

@@ -100,7 +100,7 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
100 100
             .AndReturn(self.flavors.list())
101 101
         api.nova.keypair_list(IsA(http.HttpRequest)) \
102 102
             .AndReturn(self.keypairs.list())
103
-        api.network.security_group_list(IsA(http.HttpRequest)) \
103
+        api.neutron.security_group_list(IsA(http.HttpRequest)) \
104 104
             .AndReturn(self.security_groups.list())
105 105
         api.nova.availability_zone_list(IsA(http.HttpRequest)) \
106 106
             .AndReturn(self.availability_zones.list())
@@ -123,9 +123,11 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
123 123
             'is_feature_available',
124 124
         ),
125 125
         api.glance: ('image_list_detailed',),
126
-        api.network: (
126
+        api.neutron: (
127 127
             'floating_ip_simple_associate_supported',
128 128
             'floating_ip_supported',
129
+        ),
130
+        api.network: (
129 131
             'servers_update_addresses',
130 132
         ),
131 133
     })
@@ -148,9 +150,9 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
148 150
         api.network.servers_update_addresses(IsA(http.HttpRequest), servers)
149 151
         api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \
150 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 154
             .MultipleTimes().AndReturn(True)
153
-        api.network.floating_ip_simple_associate_supported(
155
+        api.neutron.floating_ip_simple_associate_supported(
154 156
             IsA(http.HttpRequest)).MultipleTimes().AndReturn(True)
155 157
 
156 158
         self.mox.ReplayAll()
@@ -197,9 +199,9 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
197 199
                    'tenant_absolute_limits', 'extension_supported',
198 200
                    'is_feature_available',),
199 201
         api.glance: ('image_list_detailed',),
200
-        api.network: ('floating_ip_simple_associate_supported',
201
-                      'floating_ip_supported',
202
-                      'servers_update_addresses',),
202
+        api.neutron: ('floating_ip_simple_associate_supported',
203
+                      'floating_ip_supported',),
204
+        api.network: ('servers_update_addresses',),
203 205
     })
204 206
     def test_index_flavor_list_exception(self):
205 207
         servers = self.servers.list()
@@ -225,9 +227,9 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
225 227
                 AndReturn(full_flavors[server.flavor["id"]])
226 228
         api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \
227 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 231
             .MultipleTimes().AndReturn(True)
230
-        api.network.floating_ip_simple_associate_supported(
232
+        api.neutron.floating_ip_simple_associate_supported(
231 233
             IsA(http.HttpRequest)).MultipleTimes().AndReturn(True)
232 234
 
233 235
         self.mox.ReplayAll()
@@ -243,9 +245,9 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
243 245
         api.nova: ('flavor_list', 'server_list', 'tenant_absolute_limits',
244 246
                    'extension_supported', 'is_feature_available',),
245 247
         api.glance: ('image_list_detailed',),
246
-        api.network: ('floating_ip_simple_associate_supported',
247
-                      'floating_ip_supported',
248
-                      'servers_update_addresses',),
248
+        api.neutron: ('floating_ip_simple_associate_supported',
249
+                      'floating_ip_supported',),
250
+        api.network: ('servers_update_addresses',),
249 251
     })
250 252
     def test_index_with_instance_booted_from_volume(self):
251 253
         volume_server = self.servers.first()
@@ -271,9 +273,9 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
271 273
         api.network.servers_update_addresses(IsA(http.HttpRequest), servers)
272 274
         api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \
273 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 277
             .MultipleTimes().AndReturn(True)
276
-        api.network.floating_ip_simple_associate_supported(
278
+        api.neutron.floating_ip_simple_associate_supported(
277 279
             IsA(http.HttpRequest)).MultipleTimes().AndReturn(True)
278 280
 
279 281
         self.mox.ReplayAll()
@@ -988,12 +990,12 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
988 990
             "extension_supported",
989 991
             'is_feature_available',
990 992
         ),
991
-        api.network: (
993
+        api.neutron: (
992 994
             "server_security_groups",
993
-            "servers_update_addresses",
994 995
             "floating_ip_simple_associate_supported",
995 996
             "floating_ip_supported"
996
-        )
997
+        ),
998
+        api.network: ('servers_update_addresses',),
997 999
     })
998 1000
     def _get_instance_details(self, server, qs=None,
999 1001
                               flavor_return=None, volumes_return=None,
@@ -1024,11 +1026,11 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
1024 1026
         else:
1025 1027
             api.nova.flavor_get(IsA(http.HttpRequest), server.flavor['id']) \
1026 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 1030
             .AndReturn(security_groups_return)
1029
-        api.network.floating_ip_simple_associate_supported(
1031
+        api.neutron.floating_ip_simple_associate_supported(
1030 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 1034
             .MultipleTimes().AndReturn(True)
1033 1035
         api.nova.extension_supported('AdminActions', IsA(http.HttpRequest)) \
1034 1036
             .MultipleTimes().AndReturn(True)
@@ -1400,9 +1402,9 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
1400 1402
         api.nova: ('flavor_list', 'server_list', 'tenant_absolute_limits',
1401 1403
                    'extension_supported', 'is_feature_available',),
1402 1404
         api.glance: ('image_list_detailed',),
1403
-        api.network: ('floating_ip_simple_associate_supported',
1404
-                      'floating_ip_supported',
1405
-                      'servers_update_addresses',),
1405
+        api.neutron: ('floating_ip_simple_associate_supported',
1406
+                      'floating_ip_supported',),
1407
+        api.network: ('servers_update_addresses',),
1406 1408
     })
1407 1409
     def _test_instances_index_retrieve_password_action(self):
1408 1410
         servers = self.servers.list()
@@ -1423,9 +1425,9 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
1423 1425
         api.network.servers_update_addresses(IsA(http.HttpRequest), servers)
1424 1426
         api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \
1425 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 1429
             .MultipleTimes().AndReturn(True)
1428
-        api.network.floating_ip_simple_associate_supported(
1430
+        api.neutron.floating_ip_simple_associate_supported(
1429 1431
             IsA(http.HttpRequest)).MultipleTimes().AndReturn(True)
1430 1432
 
1431 1433
         self.mox.ReplayAll()
@@ -1470,7 +1472,7 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
1470 1472
 
1471 1473
     instance_update_get_stubs = {
1472 1474
         api.nova: ('server_get',),
1473
-        api.network: ('security_group_list',
1475
+        api.neutron: ('security_group_list',
1474 1476
                       'server_security_groups',)}
1475 1477
 
1476 1478
     @helpers.create_stubs(instance_update_get_stubs)
@@ -1478,9 +1480,9 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
1478 1480
         server = self.servers.first()
1479 1481
 
1480 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 1484
             .AndReturn([])
1483
-        api.network.server_security_groups(IsA(http.HttpRequest),
1485
+        api.neutron.server_security_groups(IsA(http.HttpRequest),
1484 1486
                                            server.id).AndReturn([])
1485 1487
 
1486 1488
         self.mox.ReplayAll()
@@ -1517,7 +1519,7 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
1517 1519
 
1518 1520
     instance_update_post_stubs = {
1519 1521
         api.nova: ('server_get', 'server_update'),
1520
-        api.network: ('security_group_list',
1522
+        api.neutron: ('security_group_list',
1521 1523
                       'server_security_groups',
1522 1524
                       'server_update_security_groups')}
1523 1525
 
@@ -1530,15 +1532,15 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
1530 1532
         wanted_groups = [secgroups[1].id, secgroups[2].id]
1531 1533
 
1532 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 1536
             .AndReturn(secgroups)
1535
-        api.network.server_security_groups(IsA(http.HttpRequest),
1537
+        api.neutron.server_security_groups(IsA(http.HttpRequest),
1536 1538
                                            server.id).AndReturn(server_groups)
1537 1539
 
1538 1540
         api.nova.server_update(IsA(http.HttpRequest),
1539 1541
                                server.id,
1540 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 1544
                                                   server.id,
1543 1545
                                                   wanted_groups)
1544 1546
 
@@ -1553,14 +1555,14 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
1553 1555
         server = self.servers.first()
1554 1556
 
1555 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 1559
             .AndReturn([])
1558
-        api.network.server_security_groups(IsA(http.HttpRequest),
1560
+        api.neutron.server_security_groups(IsA(http.HttpRequest),
1559 1561
                                            server.id).AndReturn([])
1560 1562
 
1561 1563
         api.nova.server_update(IsA(http.HttpRequest), server.id, server.name) \
1562 1564
             .AndRaise(self.exceptions.nova)
1563
-        api.network.server_update_security_groups(
1565
+        api.neutron.server_update_security_groups(
1564 1566
             IsA(http.HttpRequest), server.id, [])
1565 1567
 
1566 1568
         self.mox.ReplayAll()
@@ -1573,15 +1575,15 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
1573 1575
         server = self.servers.first()
1574 1576
 
1575 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 1579
             .AndReturn([])
1578
-        api.network.server_security_groups(IsA(http.HttpRequest),
1580
+        api.neutron.server_security_groups(IsA(http.HttpRequest),
1579 1581
                                            server.id).AndReturn([])
1580 1582
 
1581 1583
         api.nova.server_update(IsA(http.HttpRequest),
1582 1584
                                server.id,
1583 1585
                                server.name).AndReturn(server)
1584
-        api.network.server_update_security_groups(
1586
+        api.neutron.server_update_security_groups(
1585 1587
             IsA(http.HttpRequest),
1586 1588
             server.id, []).AndRaise(self.exceptions.nova)
1587 1589
 
@@ -1596,11 +1598,11 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
1596 1598
                                       'keypair_list',
1597 1599
                                       'server_group_list',
1598 1600
                                       'availability_zone_list',),
1599
-                           api.network: ('security_group_list',),
1600 1601
                            cinder: ('volume_snapshot_list',
1601 1602
                                     'volume_list',),
1602 1603
                            api.neutron: ('network_list',
1603
-                                         'port_list'),
1604
+                                         'port_list',
1605
+                                         'security_group_list',),
1604 1606
                            api.glance: ('image_list_detailed',),
1605 1607
                            quotas: ('tenant_limit_usages',)})
1606 1608
     def test_launch_instance_get(self,
@@ -1832,11 +1834,11 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
1832 1834
                                       'keypair_list',
1833 1835
                                       'server_group_list',
1834 1836
                                       'availability_zone_list',),
1835
-                           api.network: ('security_group_list',),
1836 1837
                            cinder: ('volume_snapshot_list',
1837 1838
                                     'volume_list',),
1838 1839
                            api.neutron: ('network_list',
1839
-                                         'port_list'),
1840
+                                         'port_list',
1841
+                                         'security_group_list',),
1840 1842
                            api.glance: ('image_list_detailed',),
1841 1843
                            quotas: ('tenant_limit_usages',)})
1842 1844
     def test_launch_instance_get_bootable_volumes(self,
@@ -1925,7 +1927,8 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
1925 1927
     @helpers.create_stubs({api.glance: ('image_list_detailed',),
1926 1928
                            api.neutron: ('network_list',
1927 1929
                                          'port_create',
1928
-                                         'port_list'),
1930
+                                         'port_list',
1931
+                                         'security_group_list',),
1929 1932
                            api.nova: ('extension_supported',
1930 1933
                                       'is_feature_available',
1931 1934
                                       'flavor_list',
@@ -1933,7 +1936,6 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
1933 1936
                                       'availability_zone_list',
1934 1937
                                       'server_group_list',
1935 1938
                                       'server_create',),
1936
-                           api.network: ('security_group_list',),
1937 1939
                            cinder: ('volume_list',
1938 1940
                                     'volume_snapshot_list',),
1939 1941
                            quotas: ('tenant_quota_usages',)})
@@ -2037,14 +2039,14 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
2037 2039
     @helpers.create_stubs({api.glance: ('image_list_detailed',),
2038 2040
                            api.neutron: ('network_list',
2039 2041
                                          'port_create',
2040
-                                         'port_list'),
2042
+                                         'port_list',
2043
+                                         'security_group_list',),
2041 2044
                            api.nova: ('extension_supported',
2042 2045
                                       'is_feature_available',
2043 2046
                                       'flavor_list',
2044 2047
                                       'keypair_list',
2045 2048
                                       'availability_zone_list',
2046 2049
                                       'server_create',),
2047
-                           api.network: ('security_group_list',),
2048 2050
                            cinder: ('volume_list',
2049 2051
                                     'volume_snapshot_list',),
2050 2052
                            quotas: ('tenant_quota_usages',)})
@@ -2159,7 +2161,8 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
2159 2161
     @helpers.create_stubs({api.glance: ('image_list_detailed',),
2160 2162
                            api.neutron: ('network_list',
2161 2163
                                          'port_create',
2162
-                                         'port_list'),
2164
+                                         'port_list',
2165
+                                         'security_group_list',),
2163 2166
                            api.nova: ('server_create',
2164 2167
                                       'extension_supported',
2165 2168
                                       'is_feature_available',
@@ -2167,7 +2170,6 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
2167 2170
                                       'keypair_list',
2168 2171
                                       'availability_zone_list',
2169 2172
                                       'server_group_list',),
2170
-                           api.network: ('security_group_list',),
2171 2173
                            cinder: ('volume_list',
2172 2174
                                     'volume_snapshot_list',),
2173 2175
                            quotas: ('tenant_quota_usages',)})
@@ -2260,13 +2262,13 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
2260 2262
 
2261 2263
     @helpers.create_stubs({api.glance: ('image_list_detailed',),
2262 2264
                            api.neutron: ('network_list',
2263
-                                         'port_list'),
2265
+                                         'port_list',
2266
+                                         'security_group_list',),
2264 2267
                            api.nova: ('extension_supported',
2265 2268
                                       'is_feature_available',
2266 2269
                                       'flavor_list',
2267 2270
                                       'keypair_list',
2268 2271
                                       'availability_zone_list'),
2269
-                           api.network: ('security_group_list',),
2270 2272
                            cinder: ('volume_list',
2271 2273
                                     'volume_snapshot_list',),
2272 2274
                            quotas: ('tenant_quota_usages',
@@ -2337,7 +2339,8 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
2337 2339
         api.glance: ('image_list_detailed',),
2338 2340
         api.neutron: ('network_list',
2339 2341
                       'port_create',
2340
-                      'port_list'),
2342
+                      'port_list',
2343
+                      'security_group_list',),
2341 2344
         api.nova: ('extension_supported',
2342 2345
                    'is_feature_available',
2343 2346
                    'flavor_list',
@@ -2345,7 +2348,6 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
2345 2348
                    'availability_zone_list',
2346 2349
                    'server_group_list',
2347 2350
                    'server_create',),
2348
-        api.network: ('security_group_list',),
2349 2351
         cinder: ('volume_list',
2350 2352
                  'volume_snapshot_list',),
2351 2353
         quotas: ('tenant_quota_usages',)})
@@ -2463,7 +2465,8 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
2463 2465
         api.glance: ('image_list_detailed',),
2464 2466
         api.neutron: ('network_list',
2465 2467
                       'port_create',
2466
-                      'port_list'),
2468
+                      'port_list',
2469
+                      'security_group_list',),
2467 2470
         api.nova: ('extension_supported',
2468 2471
                    'is_feature_available',
2469 2472
                    'flavor_list',
@@ -2471,7 +2474,6 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
2471 2474
                    'availability_zone_list',
2472 2475
                    'server_create',
2473 2476
                    'tenant_absolute_limits'),
2474
-        api.network: ('security_group_list',),
2475 2477
         cinder: ('volume_list',
2476 2478
                  'volume_snapshot_list',
2477 2479
                  'tenant_absolute_limits'),
@@ -2532,10 +2534,10 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
2532 2534
 
2533 2535
     @helpers.create_stubs({api.glance: ('image_list_detailed',),
2534 2536
                            api.neutron: ('network_list',
2535
-                                         'port_list'),
2537
+                                         'port_list',
2538
+                                         'security_group_list',),
2536 2539
                            cinder: ('volume_list',
2537 2540
                                     'volume_snapshot_list',),
2538
-                           api.network: ('security_group_list',),
2539 2541
                            api.nova: ('extension_supported',
2540 2542
                                       'is_feature_available',
2541 2543
                                       'flavor_list',
@@ -2571,7 +2573,7 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
2571 2573
             .AndRaise(self.exceptions.nova)
2572 2574
         api.nova.keypair_list(IsA(http.HttpRequest)) \
2573 2575
             .AndReturn(self.keypairs.list())
2574
-        api.network.security_group_list(IsA(http.HttpRequest)) \
2576
+        api.neutron.security_group_list(IsA(http.HttpRequest)) \
2575 2577
             .AndReturn(self.security_groups.list())
2576 2578
         api.nova.availability_zone_list(IsA(http.HttpRequest)) \
2577 2579
             .AndReturn(self.availability_zones.list())
@@ -2591,7 +2593,8 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
2591 2593
                            api.neutron: ('network_list',
2592 2594
                                          'port_create',
2593 2595
                                          'port_delete',
2594
-                                         'port_list'),
2596
+                                         'port_list',
2597
+                                         'security_group_list',),
2595 2598
                            api.nova: ('extension_supported',
2596 2599
                                       'is_feature_available',
2597 2600
                                       'flavor_list',
@@ -2599,7 +2602,6 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
2599 2602
                                       'availability_zone_list',
2600 2603
                                       'server_group_list',
2601 2604
                                       'server_create',),
2602
-                           api.network: ('security_group_list',),
2603 2605
                            cinder: ('volume_list',
2604 2606
                                     'volume_snapshot_list',),
2605 2607
                            quotas: ('tenant_quota_usages',)})
@@ -2629,7 +2631,7 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
2629 2631
             .AndReturn(volumes)
2630 2632
         api.nova.flavor_list(IgnoreArg()).AndReturn(self.flavors.list())
2631 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 2635
             .AndReturn(self.security_groups.list())
2634 2636
         api.nova.availability_zone_list(IsA(http.HttpRequest)) \
2635 2637
             .AndReturn(self.availability_zones.list())
@@ -2699,13 +2701,13 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
2699 2701
 
2700 2702
     @helpers.create_stubs({api.glance: ('image_list_detailed',),
2701 2703
                            api.neutron: ('network_list',
2702
-                                         'port_list'),
2704
+                                         'port_list',
2705
+                                         'security_group_list',),
2703 2706
                            api.nova: ('extension_supported',
2704 2707
                                       'is_feature_available',
2705 2708
                                       'flavor_list',
2706 2709
                                       'keypair_list',
2707 2710
                                       'availability_zone_list',),
2708
-                           api.network: ('security_group_list',),
2709 2711
                            cinder: ('volume_list',
2710 2712
                                     'volume_snapshot_list',),
2711 2713
                            quotas: ('tenant_limit_usages',
@@ -2778,14 +2780,14 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
2778 2780
 
2779 2781
     @helpers.create_stubs({api.glance: ('image_list_detailed',),
2780 2782
                            api.neutron: ('network_list',
2781
-                                         'port_list'),
2783
+                                         'port_list',
2784
+                                         'security_group_list',),
2782 2785
                            api.nova: ('extension_supported',
2783 2786
                                       'is_feature_available',
2784 2787
                                       'flavor_list',
2785 2788
                                       'keypair_list',
2786 2789
                                       'server_group_list',
2787 2790
                                       'availability_zone_list',),
2788
-                           api.network: ('security_group_list',),
2789 2791
                            cinder: ('volume_list',
2790 2792
                                     'volume_snapshot_list',),
2791 2793
                            quotas: ('tenant_quota_usages',
@@ -2884,13 +2886,13 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
2884 2886
 
2885 2887
     @helpers.create_stubs({api.glance: ('image_list_detailed',),
2886 2888
                            api.neutron: ('network_list',
2887
-                                         'port_list'),
2889
+                                         'port_list',
2890
+                                         'security_group_list',),
2888 2891
                            api.nova: ('extension_supported',
2889 2892
                                       'is_feature_available',
2890 2893
                                       'flavor_list',
2891 2894
                                       'keypair_list',
2892 2895
                                       'availability_zone_list',),
2893
-                           api.network: ('security_group_list',),
2894 2896
                            cinder: ('volume_list',
2895 2897
                                     'volume_snapshot_list',),
2896 2898
                            quotas: ('tenant_quota_usages',
@@ -2982,13 +2984,13 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
2982 2984
 
2983 2985
     @helpers.create_stubs({api.glance: ('image_list_detailed',),
2984 2986
                            api.neutron: ('network_list',
2985
-                                         'port_list'),
2987
+                                         'port_list',
2988
+                                         'security_group_list',),
2986 2989
                            api.nova: ('extension_supported',
2987 2990
                                       'is_feature_available',
2988 2991
                                       'flavor_list',
2989 2992
                                       'keypair_list',
2990 2993
                                       'availability_zone_list',),
2991
-                           api.network: ('security_group_list',),
2992 2994
                            cinder: ('volume_list',
2993 2995
                                     'volume_snapshot_list',),
2994 2996
                            quotas: ('tenant_quota_usages',
@@ -3013,7 +3015,7 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
3013 3015
             IsA(http.HttpRequest)).AndReturn(self.flavors.list())
3014 3016
         api.nova.keypair_list(
3015 3017
             IsA(http.HttpRequest)).AndReturn(self.keypairs.list())
3016
-        api.network.security_group_list(
3018
+        api.neutron.security_group_list(
3017 3019
             IsA(http.HttpRequest)).AndReturn(self.security_groups.list())
3018 3020
         api.nova.availability_zone_list(
3019 3021
             IsA(http.HttpRequest)).AndReturn(self.availability_zones.list())
@@ -3126,14 +3128,14 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
3126 3128
 
3127 3129
     @helpers.create_stubs({api.glance: ('image_list_detailed',),
3128 3130
                            api.neutron: ('network_list',
3129
-                                         'port_list'),
3131
+                                         'port_list',
3132
+                                         'security_group_list',),
3130 3133
                            api.nova: ('extension_supported',
3131 3134
                                       'is_feature_available',
3132 3135
                                       'flavor_list',
3133 3136
                                       'keypair_list',
3134 3137
                                       'server_group_list',
3135 3138
                                       'availability_zone_list',),
3136
-                           api.network: ('security_group_list',),
3137 3139
                            cinder: ('volume_list',
3138 3140
                                     'volume_snapshot_list',),
3139 3141
                            quotas: ('tenant_quota_usages',
@@ -3160,7 +3162,7 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
3160 3162
             .AndReturn(True)
3161 3163
         api.nova.keypair_list(IsA(http.HttpRequest)) \
3162 3164
             .AndReturn(self.keypairs.list())
3163
-        api.network.security_group_list(IsA(http.HttpRequest)) \
3165
+        api.neutron.security_group_list(IsA(http.HttpRequest)) \
3164 3166
             .AndReturn(self.security_groups.list())
3165 3167
         api.nova.availability_zone_list(IsA(http.HttpRequest)) \
3166 3168
             .AndReturn(self.availability_zones.list())
@@ -3244,9 +3246,9 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
3244 3246
         api.nova: ('flavor_list', 'server_list', 'tenant_absolute_limits',
3245 3247
                    'extension_supported', 'is_feature_available',),
3246 3248
         api.glance: ('image_list_detailed',),
3247
-        api.network: ('floating_ip_simple_associate_supported',
3248
-                      'floating_ip_supported',
3249
-                      'servers_update_addresses',),
3249
+        api.neutron: ('floating_ip_simple_associate_supported',
3250
+                      'floating_ip_supported',),
3251
+        api.network: ('servers_update_addresses',),
3250 3252
     })
3251 3253
     def test_launch_button_attributes(self):
3252 3254
         servers = self.servers.list()
@@ -3270,9 +3272,9 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
3270 3272
         api.network.servers_update_addresses(IsA(http.HttpRequest), servers)
3271 3273
         api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \
3272 3274
             .MultipleTimes().AndReturn(limits)
3273
-        api.network.floating_ip_supported(IsA(http.HttpRequest)) \
3275
+        api.neutron.floating_ip_supported(IsA(http.HttpRequest)) \
3274 3276
             .MultipleTimes().AndReturn(True)
3275
-        api.network.floating_ip_simple_associate_supported(
3277
+        api.neutron.floating_ip_simple_associate_supported(
3276 3278
             IsA(http.HttpRequest)).MultipleTimes().AndReturn(True)
3277 3279
 
3278 3280
         self.mox.ReplayAll()
@@ -3293,9 +3295,9 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
3293 3295
         api.nova: ('flavor_list', 'server_list', 'tenant_absolute_limits',
3294 3296
                    'extension_supported', 'is_feature_available',),
3295 3297
         api.glance: ('image_list_detailed',),
3296
-        api.network: ('floating_ip_simple_associate_supported',
3297
-                      'floating_ip_supported',
3298
-                      'servers_update_addresses',),
3298
+        api.neutron: ('floating_ip_simple_associate_supported',
3299
+                      'floating_ip_supported',),
3300
+        api.network: ('servers_update_addresses',),
3299 3301
     })
3300 3302
     def test_launch_button_disabled_when_quota_exceeded(self):
3301 3303
         servers = self.servers.list()
@@ -3319,9 +3321,9 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
3319 3321
         api.network.servers_update_addresses(IsA(http.HttpRequest), servers)
3320 3322
         api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \
3321 3323
             .MultipleTimes().AndReturn(limits)
3322
-        api.network.floating_ip_supported(IsA(http.HttpRequest)) \
3324
+        api.neutron.floating_ip_supported(IsA(http.HttpRequest)) \
3323 3325
             .MultipleTimes().AndReturn(True)
3324
-        api.network.floating_ip_simple_associate_supported(
3326
+        api.neutron.floating_ip_simple_associate_supported(
3325 3327
             IsA(http.HttpRequest)).MultipleTimes().AndReturn(True)
3326 3328
 
3327 3329
         self.mox.ReplayAll()
@@ -3339,7 +3341,8 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
3339 3341
 
3340 3342
     @helpers.create_stubs({api.glance: ('image_list_detailed',),
3341 3343
                            api.neutron: ('network_list',
3342
-                                         'port_list'),
3344
+                                         'port_list',
3345
+                                         'security_group_list',),
3343 3346
                            api.nova: ('extension_supported',
3344 3347
                                       'is_feature_available',
3345 3348
                                       'flavor_list',
@@ -3348,7 +3351,6 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
3348 3351
                                       'server_group_list',
3349 3352
                                       'tenant_absolute_limits',
3350 3353
                                       'server_create',),
3351
-                           api.network: ('security_group_list',),
3352 3354
                            cinder: ('volume_list',
3353 3355
                                     'volume_snapshot_list',),
3354 3356
                            quotas: ('tenant_quota_usages',)})
@@ -3445,9 +3447,9 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
3445 3447
         api.nova: ('flavor_list', 'server_list', 'tenant_absolute_limits',
3446 3448
                    'extension_supported', 'is_feature_available',),
3447 3449
         api.glance: ('image_list_detailed',),
3448
-        api.network: ('floating_ip_simple_associate_supported',
3449
-                      'floating_ip_supported',
3450
-                      'servers_update_addresses',),
3450
+        api.neutron: ('floating_ip_simple_associate_supported',
3451
+                      'floating_ip_supported',),
3452
+        api.network: ('servers_update_addresses',),
3451 3453
     })
3452 3454
     def test_index_options_after_migrate(self):
3453 3455
         servers = self.servers.list()
@@ -3471,9 +3473,9 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
3471 3473
         api.network.servers_update_addresses(IsA(http.HttpRequest), servers)
3472 3474
         api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \
3473 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 3477
             .MultipleTimes().AndReturn(True)
3476
-        api.network.floating_ip_simple_associate_supported(
3478
+        api.neutron.floating_ip_simple_associate_supported(
3477 3479
             IsA(http.HttpRequest)).MultipleTimes().AndReturn(True)
3478 3480
 
3479 3481
         self.mox.ReplayAll()
@@ -3487,11 +3489,11 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
3487 3489
                                       'flavor_list',
3488 3490
                                       'keypair_list',
3489 3491
                                       'availability_zone_list'),
3490
-                           api.network: ('security_group_list',),
3491 3492
                            cinder: ('volume_snapshot_list',
3492 3493
                                     'volume_list',),
3493 3494
                            api.neutron: ('network_list',
3494
-                                         'port_list'),
3495
+                                         'port_list',
3496
+                                         'security_group_list',),
3495 3497
                            api.glance: ('image_list_detailed',),
3496 3498
                            quotas: ('tenant_limit_usages',)})
3497 3499
     def test_select_default_keypair_if_only_one(self):
@@ -3537,13 +3539,15 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
3537 3539
     def test_select_default_keypair_if_only_one_glance_v1(self):
3538 3540
         self.test_select_default_keypair_if_only_one()
3539 3541
 
3540
-    @helpers.create_stubs({api.network: ('floating_ip_target_list_by_instance',
3541
-                                         'tenant_floating_ip_list',
3542
-                                         'floating_ip_disassociate',
3543
-                                         'servers_update_addresses',),
3544
-                           api.glance: ('image_list_detailed',),
3545
-                           api.nova: ('server_list',
3546
-                                      'flavor_list')})
3542
+    @helpers.create_stubs({
3543
+        api.neutron: ('floating_ip_target_list_by_instance',
3544
+                      'tenant_floating_ip_list',
3545
+                      'floating_ip_disassociate',),
3546
+        api.network: ('servers_update_addresses',),
3547
+        api.glance: ('image_list_detailed',),
3548
+        api.nova: ('server_list',
3549
+                   'flavor_list'),
3550
+    })
3547 3551
     def test_disassociate_floating_ip(self):
3548 3552
         servers = self.servers.list()
3549 3553
         server = servers[0]
@@ -3557,12 +3561,12 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
3557 3561
         api.nova.flavor_list(IgnoreArg()).AndReturn(self.flavors.list())
3558 3562
         api.glance.image_list_detailed(IgnoreArg()) \
3559 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 3565
             IsA(http.HttpRequest),
3562 3566
             server.id).AndReturn([server.id, ])
3563
-        api.network.tenant_floating_ip_list(
3567
+        api.neutron.tenant_floating_ip_list(
3564 3568
             IsA(http.HttpRequest)).AndReturn([fip])
3565
-        api.network.floating_ip_disassociate(
3569
+        api.neutron.floating_ip_disassociate(
3566 3570
             IsA(http.HttpRequest), fip.id)
3567 3571
 
3568 3572
         self.mox.ReplayAll()
@@ -3911,9 +3915,9 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
3911 3915
         api.nova: ('flavor_list', 'server_list', 'tenant_absolute_limits',
3912 3916
                    'extension_supported', 'is_feature_available',),
3913 3917
         api.glance: ('image_list_detailed',),
3914
-        api.network: ('floating_ip_simple_associate_supported',
3915
-                      'floating_ip_supported',
3916
-                      'servers_update_addresses',),
3918
+        api.neutron: ('floating_ip_simple_associate_supported',
3919
+                      'floating_ip_supported',),
3920
+        api.network: ('servers_update_addresses',),
3917 3921
     })
3918 3922
     def test_index_form_action_with_pagination(self):
3919 3923
         """The form action on the next page should have marker
@@ -3948,9 +3952,9 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
3948 3952
 
3949 3953
         api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \
3950 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 3956
             .MultipleTimes().AndReturn(True)
3953
-        api.network.floating_ip_simple_associate_supported(
3957
+        api.neutron.floating_ip_simple_associate_supported(
3954 3958
             IsA(http.HttpRequest)).MultipleTimes().AndReturn(True)
3955 3959
 
3956 3960
         self.mox.ReplayAll()
@@ -4067,8 +4071,7 @@ class InstanceAjaxTests(helpers.TestCase):
4067 4071
                                       "flavor_get",
4068 4072
                                       "extension_supported",
4069 4073
                                       "is_feature_available"),
4070
-                           api.network: ('servers_update_addresses',),
4071
-                           api.neutron: ("is_extension_supported",)})
4074
+                           api.network: ('servers_update_addresses',)})
4072 4075
     def test_row_update(self):
4073 4076
         server = self.servers.first()
4074 4077
         instance_id = server.id
@@ -4083,13 +4086,12 @@ class InstanceAjaxTests(helpers.TestCase):
4083 4086
         ).MultipleTimes().AndReturn(True)
4084 4087
         api.nova.extension_supported('Shelve', IsA(http.HttpRequest)) \
4085 4088
             .MultipleTimes().AndReturn(True)
4086
-        api.neutron.is_extension_supported(IsA(http.HttpRequest),
4087
-                                           'security-group')\
4088
-            .MultipleTimes().AndReturn(True)
4089 4089
         api.nova.server_get(IsA(http.HttpRequest), instance_id)\
4090 4090
             .AndReturn(server)
4091 4091
         api.nova.flavor_get(IsA(http.HttpRequest), flavor_id)\
4092 4092
             .AndReturn(full_flavors[flavor_id])
4093
+        api.network.servers_update_addresses(IsA(http.HttpRequest), server) \
4094
+            .AndReturn(None)
4093 4095
 
4094 4096
         self.mox.ReplayAll()
4095 4097
 
@@ -4105,7 +4107,6 @@ class InstanceAjaxTests(helpers.TestCase):
4105 4107
                                       "flavor_get",
4106 4108
                                       'is_feature_available',
4107 4109
                                       "extension_supported"),
4108
-                           api.neutron: ("is_extension_supported",),
4109 4110
                            api.network: ('servers_update_addresses',)})
4110 4111
     def test_row_update_instance_error(self):
4111 4112
         server = self.servers.first()
@@ -4132,13 +4133,12 @@ class InstanceAjaxTests(helpers.TestCase):
4132 4133
         ).MultipleTimes().AndReturn(True)
4133 4134
         api.nova.extension_supported('Shelve', IsA(http.HttpRequest)) \
4134 4135
             .MultipleTimes().AndReturn(True)
4135
-        api.neutron.is_extension_supported(IsA(http.HttpRequest),
4136
-                                           'security-group')\
4137
-            .MultipleTimes().AndReturn(True)
4138 4136
         api.nova.server_get(IsA(http.HttpRequest), instance_id)\
4139 4137
             .AndReturn(server)
4140 4138
         api.nova.flavor_get(IsA(http.HttpRequest), flavor_id)\
4141 4139
             .AndReturn(full_flavors[flavor_id])
4140
+        api.network.servers_update_addresses(IsA(http.HttpRequest), server) \
4141
+            .AndReturn(None)
4142 4142
 
4143 4143
         self.mox.ReplayAll()
4144 4144
 
@@ -4164,8 +4164,7 @@ class InstanceAjaxTests(helpers.TestCase):
4164 4164
                                       "flavor_get",
4165 4165
                                       'is_feature_available',
4166 4166
                                       "extension_supported"),
4167
-                           api.neutron: ("is_extension_supported",
4168
-                                         "servers_update_addresses",)})
4167
+                           api.network: ('servers_update_addresses',)})
4169 4168
     def test_row_update_flavor_not_found(self):
4170 4169
         server = self.servers.first()
4171 4170
         instance_id = server.id
@@ -4178,13 +4177,12 @@ class InstanceAjaxTests(helpers.TestCase):
4178 4177
         ).MultipleTimes().AndReturn(True)
4179 4178
         api.nova.extension_supported('Shelve', IsA(http.HttpRequest)) \
4180 4179
             .MultipleTimes().AndReturn(True)
4181
-        api.neutron.is_extension_supported(IsA(http.HttpRequest),
4182
-                                           'security-group')\
4183
-            .MultipleTimes().AndReturn(True)
4184 4180
         api.nova.server_get(IsA(http.HttpRequest), instance_id)\
4185 4181
             .AndReturn(server)
4186 4182
         api.nova.flavor_get(IsA(http.HttpRequest), server.flavor["id"])\
4187 4183
             .AndRaise(self.exceptions.nova)
4184
+        api.network.servers_update_addresses(IsA(http.HttpRequest), server) \
4185
+            .AndReturn(None)
4188 4186
 
4189 4187
         self.mox.ReplayAll()
4190 4188
 

+ 1
- 1
openstack_dashboard/dashboards/project/instances/views.py View File

@@ -375,7 +375,7 @@ class DetailView(tabs.TabView):
375 375
             exceptions.handle(self.request, msg, ignore=True)
376 376
 
377 377
         try:
378
-            instance.security_groups = api.network.server_security_groups(
378
+            instance.security_groups = api.neutron.server_security_groups(
379 379
                 self.request, instance_id)
380 380
         except Exception:
381 381
             msg = _('Unable to retrieve security groups for instance '

+ 1
- 1
openstack_dashboard/dashboards/project/instances/workflows/create_instance.py View File

@@ -580,7 +580,7 @@ class SetAccessControlsAction(workflows.Action):
580 580
 
581 581
     def populate_groups_choices(self, request, context):
582 582
         try:
583
-            groups = api.network.security_group_list(request)
583
+            groups = api.neutron.security_group_list(request)
584 584
             security_group_list = [(sg.id, sg.name) for sg in groups]
585 585
         except Exception:
586 586
             exceptions.handle(request,

+ 3
- 3
openstack_dashboard/dashboards/project/instances/workflows/update_instance.py View File

@@ -48,14 +48,14 @@ class UpdateInstanceSecurityGroupsAction(workflows.MembershipAction):
48 48
         # Get list of available security groups
49 49
         all_groups = []
50 50
         try:
51
-            all_groups = api.network.security_group_list(request)
51
+            all_groups = api.neutron.security_group_list(request)
52 52
         except Exception:
53 53
             exceptions.handle(request, err_msg)
54 54
         groups_list = [(group.id, group.name) for group in all_groups]
55 55
 
56 56
         instance_groups = []
57 57
         try:
58
-            instance_groups = api.network.server_security_groups(request,
58
+            instance_groups = api.neutron.server_security_groups(request,
59 59
                                                                  instance_id)
60 60
         except Exception:
61 61
             exceptions.handle(request, err_msg)
@@ -69,7 +69,7 @@ class UpdateInstanceSecurityGroupsAction(workflows.MembershipAction):
69 69
         instance_id = data['instance_id']
70 70
         wanted_groups = map(filters.get_int_or_uuid, data['wanted_groups'])
71 71
         try:
72
-            api.network.server_update_security_groups(request, instance_id,
72
+            api.neutron.server_update_security_groups(request, instance_id,
73 73
                                                       wanted_groups)
74 74
         except Exception as e:
75 75
             exceptions.handle(request, str(e))

+ 10
- 10
openstack_dashboard/dashboards/project/overview/tests.py View File

@@ -67,20 +67,20 @@ class UsageViewTests(test.TestCase):
67 67
         api.cinder.tenant_absolute_limits(IsA(http.HttpRequest)) \
68 68
             .AndReturn(self.cinder_limits['absolute'])
69 69
 
70
-    @test.create_stubs({api.neutron: ('is_extension_supported',),
71
-                        api.network: ('floating_ip_supported',
70
+    @test.create_stubs({api.neutron: ('is_extension_supported',
71
+                                      'floating_ip_supported',
72 72
                                       'tenant_floating_ip_list',
73 73
                                       'security_group_list')})
74 74
     def _stub_neutron_api_calls(self, neutron_sg_enabled=True):
75 75
         api.neutron.is_extension_supported(
76 76
             IsA(http.HttpRequest),
77 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 79
             .AndReturn(True)
80
-        api.network.tenant_floating_ip_list(IsA(http.HttpRequest)) \
80
+        api.neutron.tenant_floating_ip_list(IsA(http.HttpRequest)) \
81 81
             .AndReturn(self.floating_ips.list())
82 82
         if neutron_sg_enabled:
83
-            api.network.security_group_list(IsA(http.HttpRequest)) \
83
+            api.neutron.security_group_list(IsA(http.HttpRequest)) \
84 84
                 .AndReturn(self.security_groups.list())
85 85
 
86 86
     def _nova_stu_enabled(self, exception=False, overview_days_range=1):
@@ -248,8 +248,8 @@ class UsageViewTests(test.TestCase):
248 248
         self._test_usage_with_neutron(neutron_fip_enabled=False)
249 249
 
250 250
     @test.create_stubs({api.neutron: ('tenant_quota_get',
251
-                                      'is_extension_supported'),
252
-                        api.network: ('floating_ip_supported',
251
+                                      'is_extension_supported',
252
+                                      'floating_ip_supported',
253 253
                                       'tenant_floating_ip_list',
254 254
                                       'security_group_list')})
255 255
     def _test_usage_with_neutron_prepare(self):
@@ -264,13 +264,13 @@ class UsageViewTests(test.TestCase):
264 264
         api.neutron.is_extension_supported(
265 265
             IsA(http.HttpRequest),
266 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 268
             .AndReturn(neutron_fip_enabled)
269 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 271
                 .AndReturn(self.floating_ips.list())
272 272
         if neutron_sg_enabled:
273
-            api.network.security_group_list(IsA(http.HttpRequest)) \
273
+            api.neutron.security_group_list(IsA(http.HttpRequest)) \
274 274
                 .AndReturn(self.security_groups.list())
275 275
         api.neutron.tenant_quota_get(IsA(http.HttpRequest), self.tenant.id) \
276 276
             .AndReturn(self.neutron_quotas.first())

+ 3
- 3
openstack_dashboard/dashboards/project/security_groups/forms.py View File

@@ -78,7 +78,7 @@ class CreateGroup(GroupBase):
78 78
     error_message = _('Unable to create security group: %s')
79 79
 
80 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 82
                                                  data['name'],
83 83
                                                  data['description'])
84 84
 
@@ -90,7 +90,7 @@ class UpdateGroup(GroupBase):
90 90
     id = forms.CharField(widget=forms.HiddenInput())
91 91
 
92 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 94
                                                  data['id'],
95 95
                                                  data['name'],
96 96
                                                  data['description'])
@@ -415,7 +415,7 @@ class AddRule(forms.SelfHandlingForm):
415 415
         redirect = reverse("horizon:project:security_groups:detail",
416 416
                            args=[data['id']])
417 417
         try:
418
-            rule = api.network.security_group_rule_create(
418
+            rule = api.neutron.security_group_rule_create(
419 419
                 request,
420 420
                 filters.get_int_or_uuid(data['id']),
421 421
                 data['direction'],

+ 2
- 2
openstack_dashboard/dashboards/project/security_groups/tables.py View File

@@ -52,7 +52,7 @@ class DeleteGroup(policy.PolicyTargetMixin, tables.DeleteAction):
52 52
         return security_group.name != 'default'
53 53
 
54 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
 
58 58
 class CreateGroup(tables.LinkAction):
@@ -149,7 +149,7 @@ class DeleteRule(tables.DeleteAction):
149 149
         )
150 150
 
151 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 154
     def get_success_url(self, request):
155 155
         sg_id = self.table.kwargs['security_group_id']

+ 76
- 76
openstack_dashboard/dashboards/project/security_groups/tests.py View File

@@ -65,14 +65,14 @@ class SecurityGroupsViewTests(test.TestCase):
65 65
         self.edit_url = reverse(SG_ADD_RULE_VIEW, args=[sec_group.id])
66 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 69
                         quotas: ('tenant_quota_usages',)})
70 70
     def test_index(self):
71 71
         sec_groups = self.security_groups.list()
72 72
         quota_data = self.quota_usages.first()
73 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 76
             .AndReturn(sec_groups)
77 77
         quotas.tenant_quota_usages(IsA(http.HttpRequest)).MultipleTimes() \
78 78
             .AndReturn(quota_data)
@@ -96,14 +96,14 @@ class SecurityGroupsViewTests(test.TestCase):
96 96
             all([sec_groups_from_ctx[i].name <= sec_groups_from_ctx[i + 1].name
97 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 100
                         quotas: ('tenant_quota_usages',)})
101 101
     def test_create_button_attributes(self):
102 102
         sec_groups = self.security_groups.list()
103 103
         quota_data = self.quota_usages.first()
104 104
         quota_data['security_groups']['available'] = 10
105 105
 
106
-        api.network.security_group_list(
106
+        api.neutron.security_group_list(
107 107
             IsA(http.HttpRequest)) \
108 108
             .AndReturn(sec_groups)
109 109
         quotas.tenant_quota_usages(
@@ -128,7 +128,7 @@ class SecurityGroupsViewTests(test.TestCase):
128 128
         url = 'horizon:project:security_groups:create'
129 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 132
                         quotas: ('tenant_quota_usages',)})
133 133
     def _test_create_button_disabled_when_quota_exceeded(self,
134 134
                                                          network_enabled):
@@ -136,7 +136,7 @@ class SecurityGroupsViewTests(test.TestCase):
136 136
         quota_data = self.quota_usages.first()
137 137
         quota_data['security_groups']['available'] = 0
138 138
 
139
-        api.network.security_group_list(
139
+        api.neutron.security_group_list(
140 140
             IsA(http.HttpRequest)) \
141 141
             .AndReturn(sec_groups)
142 142
         quotas.tenant_quota_usages(
@@ -161,14 +161,14 @@ class SecurityGroupsViewTests(test.TestCase):
161 161
     def test_create_button_disabled_when_quota_exceeded_neutron_enabled(self):
162 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 165
                                       'security_group_list')})
166 166
     def _add_security_group_rule_fixture(self, **kwargs):
167 167
         sec_group = self.security_groups.first()
168 168
         sec_group_list = self.security_groups.list()
169 169
         rule = self.security_group_rules.first()
170 170
 
171
-        api.network.security_group_rule_create(
171
+        api.neutron.security_group_rule_create(
172 172
             IsA(http.HttpRequest),
173 173
             kwargs.get('sec_group', sec_group.id),
174 174
             kwargs.get('ingress', 'ingress'),
@@ -178,14 +178,14 @@ class SecurityGroupsViewTests(test.TestCase):
178 178
             kwargs.get('to_port', int(rule.to_port)),
179 179
             kwargs.get('cidr', rule.ip_range['cidr']),
180 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 182
             IsA(http.HttpRequest)).AndReturn(sec_group_list)
183 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 186
     def test_update_security_groups_get(self):
187 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 189
                                        sec_group.id).AndReturn(sec_group)
190 190
         self.mox.ReplayAll()
191 191
         res = self.client.get(self.update_url)
@@ -193,7 +193,7 @@ class SecurityGroupsViewTests(test.TestCase):
193 193
         self.assertEqual(res.context['security_group'].name,
194 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 197
                                       'security_group_get')})
198 198
     def test_update_security_groups_post(self):
199 199
         """Ensure that we can change a group name.
@@ -204,12 +204,12 @@ class SecurityGroupsViewTests(test.TestCase):
204 204
         """
205 205
         sec_group = self.security_groups.first()
206 206
         sec_group.name = "@new name"
207
-        api.network.security_group_update(
207
+        api.neutron.security_group_update(
208 208
             IsA(http.HttpRequest),
209 209
             str(sec_group.id),
210 210
             sec_group.name,
211 211
             sec_group.description).AndReturn(sec_group)
212
-        api.network.security_group_get(
212
+        api.neutron.security_group_get(
213 213
             IsA(http.HttpRequest), sec_group.id).AndReturn(sec_group)
214 214
         self.mox.ReplayAll()
215 215
         form_data = {'method': 'UpdateGroup',
@@ -238,9 +238,9 @@ class SecurityGroupsViewTests(test.TestCase):
238 238
         sec_group.name = '@group name-\xe3\x82\xb3'
239 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 242
     def _create_security_group(self, sec_group):
243
-        api.network.security_group_create(
243
+        api.neutron.security_group_create(
244 244
             IsA(http.HttpRequest),
245 245
             sec_group.name,
246 246
             sec_group.description).AndReturn(sec_group)
@@ -252,10 +252,10 @@ class SecurityGroupsViewTests(test.TestCase):
252 252
         res = self.client.post(SG_CREATE_URL, form_data)
253 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 256
     def test_create_security_groups_post_exception(self):
257 257
         sec_group = self.security_groups.first()
258
-        api.network.security_group_create(
258
+        api.neutron.security_group_create(
259 259
             IsA(http.HttpRequest),
260 260
             sec_group.name,
261 261
             sec_group.description).AndRaise(self.exceptions.nova)
@@ -268,21 +268,21 @@ class SecurityGroupsViewTests(test.TestCase):
268 268
         self.assertMessageCount(error=1)
269 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 272
     def test_detail_get(self):
273 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 276
                                        sec_group.id).AndReturn(sec_group)
277 277
         self.mox.ReplayAll()
278 278
         res = self.client.get(self.detail_url)
279 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 282
     def test_detail_get_exception(self):
283 283
         sec_group = self.security_groups.first()
284 284
 
285
-        api.network.security_group_get(
285
+        api.neutron.security_group_get(
286 286
             IsA(http.HttpRequest),
287 287
             sec_group.id).AndRaise(self.exceptions.nova)
288 288
         self.mox.ReplayAll()
@@ -371,14 +371,14 @@ class SecurityGroupsViewTests(test.TestCase):
371 371
         self.assertNoFormErrors(res)
372 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 375
                                       'security_group_list')})
376 376
     def test_detail_add_rule_cidr_with_template(self):
377 377
         sec_group = self.security_groups.first()
378 378
         sec_group_list = self.security_groups.list()
379 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 382
                                                sec_group.id,
383 383
                                                'ingress', 'IPv4',
384 384
                                                rule.ip_protocol,
@@ -386,7 +386,7 @@ class SecurityGroupsViewTests(test.TestCase):
386 386
                                                int(rule.to_port),
387 387
                                                rule.ip_range['cidr'],
388 388
                                                None).AndReturn(rule)
389
-        api.network.security_group_list(
389
+        api.neutron.security_group_list(
390 390
             IsA(http.HttpRequest)).AndReturn(sec_group_list)
391 391
         self.mox.ReplayAll()
392 392
 
@@ -405,14 +405,14 @@ class SecurityGroupsViewTests(test.TestCase):
405 405
                 return rule
406 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 409
                                       'security_group_list',)})
410 410
     def test_detail_add_rule_self_as_source_group(self):
411 411
         sec_group = self.security_groups.first()
412 412
         sec_group_list = self.security_groups.list()
413 413
         rule = self._get_source_group_rule()
414 414
 
415
-        api.network.security_group_rule_create(
415
+        api.neutron.security_group_rule_create(
416 416
             IsA(http.HttpRequest),
417 417
             sec_group.id,
418 418
             'ingress',
@@ -423,7 +423,7 @@ class SecurityGroupsViewTests(test.TestCase):
423 423
             int(rule.to_port),
424 424
             None,
425 425
             u'%s' % sec_group.id).AndReturn(rule)
426
-        api.network.security_group_list(
426
+        api.neutron.security_group_list(
427 427
             IsA(http.HttpRequest)).AndReturn(sec_group_list)
428 428
         self.mox.ReplayAll()
429 429
 
@@ -438,14 +438,14 @@ class SecurityGroupsViewTests(test.TestCase):
438 438
         res = self.client.post(self.edit_url, formData)
439 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 442
                                       'security_group_list',)})
443 443
     def test_detail_add_rule_self_as_source_group_with_template(self):
444 444
         sec_group = self.security_groups.first()
445 445
         sec_group_list = self.security_groups.list()
446 446
         rule = self._get_source_group_rule()
447 447
 
448
-        api.network.security_group_rule_create(
448
+        api.neutron.security_group_rule_create(
449 449
             IsA(http.HttpRequest),
450 450
             sec_group.id,
451 451
             'ingress',
@@ -456,7 +456,7 @@ class SecurityGroupsViewTests(test.TestCase):
456 456
             int(rule.to_port),
457 457
             None,
458 458
             u'%s' % sec_group.id).AndReturn(rule)
459
-        api.network.security_group_list(
459
+        api.neutron.security_group_list(
460 460
             IsA(http.HttpRequest)).AndReturn(sec_group_list)
461 461
         self.mox.ReplayAll()
462 462
 
@@ -470,16 +470,16 @@ class SecurityGroupsViewTests(test.TestCase):
470 470
         res = self.client.post(self.edit_url, formData)
471 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 474
     def test_detail_invalid_port(self):
475 475
         sec_group = self.security_groups.first()
476 476
         sec_group_list = self.security_groups.list()
477 477
         rule = self.security_group_rules.first()
478 478
 
479
-        api.network.security_group_list(
479
+        api.neutron.security_group_list(
480 480
             IsA(http.HttpRequest)).AndReturn(sec_group_list)
481 481
         if django.VERSION >= (1, 9):
482
-            api.network.security_group_list(
482
+            api.neutron.security_group_list(
483 483
                 IsA(http.HttpRequest)).AndReturn(sec_group_list)
484 484
 
485 485
         self.mox.ReplayAll()
@@ -495,18 +495,18 @@ class SecurityGroupsViewTests(test.TestCase):
495 495
         self.assertNoMessages()
496 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 499
     def test_detail_invalid_port_range(self):
500 500
         sec_group = self.security_groups.first()
501 501
         sec_group_list = self.security_groups.list()
502 502
         rule = self.security_group_rules.first()
503 503
 
504 504
         for i in range(3):
505
-            api.network.security_group_list(
505
+            api.neutron.security_group_list(
506 506
                 IsA(http.HttpRequest)).AndReturn(sec_group_list)
507 507
         if django.VERSION >= (1, 9):
508 508
             for i in range(3):
509
-                api.network.security_group_list(
509
+                api.neutron.security_group_list(
510 510
                     IsA(http.HttpRequest)).AndReturn(sec_group_list)
511 511
 
512 512
         self.mox.ReplayAll()
@@ -549,7 +549,7 @@ class SecurityGroupsViewTests(test.TestCase):
549 549
         self.assertContains(res, cgi.escape('"to" port number is invalid',
550 550
                                             quote=True))
551 551
 
552
-    @test.create_stubs({api.network: ('security_group_get',
552
+    @test.create_stubs({api.neutron: ('security_group_get',
553 553
                                       'security_group_list')})
554 554
     def test_detail_invalid_icmp_rule(self):
555 555
         sec_group = self.security_groups.first()
@@ -562,7 +562,7 @@ class SecurityGroupsViewTests(test.TestCase):
562 562
             call_post *= 2
563 563
 
564 564
         for i in range(call_post):
565
-            api.network.security_group_list(
565
+            api.neutron.security_group_list(
566 566
                 IsA(http.HttpRequest)).AndReturn(sec_group_list)
567 567
 
568 568
         self.mox.ReplayAll()
@@ -628,14 +628,14 @@ class SecurityGroupsViewTests(test.TestCase):
628 628
         self.assertContains(
629 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 632
                                       'security_group_list')})
633 633
     def test_detail_add_rule_exception(self):
634 634
         sec_group = self.security_groups.first()
635 635
         sec_group_list = self.security_groups.list()
636 636
         rule = self.security_group_rules.first()
637 637
 
638
-        api.network.security_group_rule_create(
638
+        api.neutron.security_group_rule_create(
639 639
             IsA(http.HttpRequest),
640 640
             sec_group.id, 'ingress', 'IPv4',
641 641
             rule.ip_protocol,
@@ -643,7 +643,7 @@ class SecurityGroupsViewTests(test.TestCase):
643 643
             int(rule.to_port),
644 644
             rule.ip_range['cidr'],
645 645
             None).AndRaise(self.exceptions.nova)
646
-        api.network.security_group_list(
646
+        api.neutron.security_group_list(
647 647
             IsA(http.HttpRequest)).AndReturn(sec_group_list)
648 648
         self.mox.ReplayAll()
649 649
 
@@ -657,14 +657,14 @@ class SecurityGroupsViewTests(test.TestCase):
657 657
         res = self.client.post(self.edit_url, formData)
658 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 661
                                       'security_group_list')})
662 662
     def test_detail_add_rule_duplicated(self):
663 663
         sec_group = self.security_groups.first()
664 664
         sec_group_list = self.security_groups.list()
665 665
         rule = self.security_group_rules.first()
666 666
 
667
-        api.network.security_group_rule_create(
667
+        api.neutron.security_group_rule_create(
668 668
             IsA(http.HttpRequest),
669 669
             sec_group.id, 'ingress', 'IPv4',
670 670
             rule.ip_protocol,
@@ -672,7 +672,7 @@ class SecurityGroupsViewTests(test.TestCase):
672 672
             int(rule.to_port),
673 673
             rule.ip_range['cidr'],
674 674
             None).AndRaise(exceptions.Conflict)
675
-        api.network.security_group_list(
675
+        api.neutron.security_group_list(
676 676
             IsA(http.HttpRequest)).AndReturn(sec_group_list)
677 677
         self.mox.ReplayAll()
678 678
 
@@ -687,12 +687,12 @@ class SecurityGroupsViewTests(test.TestCase):
687 687
         self.assertNoFormErrors(res)
688 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 691
     def test_detail_delete_rule(self):
692 692
         sec_group = self.security_groups.first()
693 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 696
         self.mox.ReplayAll()
697 697
 
698 698
         form_data = {"action": "rules__delete__%s" % rule.id}
@@ -703,12 +703,12 @@ class SecurityGroupsViewTests(test.TestCase):
703 703
         self.assertEqual(strip_absolute_base(handled['location']),
704 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 707
     def test_detail_delete_rule_exception(self):
708 708
         sec_group = self.security_groups.first()
709 709
         rule = self.security_group_rules.first()
710 710
 
711
-        api.network.security_group_rule_delete(
711
+        api.neutron.security_group_rule_delete(
712 712
             IsA(http.HttpRequest),
713 713
             rule.id).AndRaise(self.exceptions.nova)
714 714
         self.mox.ReplayAll()
@@ -722,11 +722,11 @@ class SecurityGroupsViewTests(test.TestCase):
722 722
         self.assertEqual(strip_absolute_base(handled['location']),
723 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 726
     def test_delete_group(self):
727 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 730
         self.mox.ReplayAll()
731 731
 
732 732
         form_data = {"action": "security_groups__delete__%s" % sec_group.id}
@@ -736,11 +736,11 @@ class SecurityGroupsViewTests(test.TestCase):
736 736
         self.assertEqual(strip_absolute_base(handled['location']),
737 737
                          INDEX_URL)
738 738
 
739
-    @test.create_stubs({api.network: ('security_group_delete',)})
739
+    @test.create_stubs({api.neutron: ('security_group_delete',)})
740 740
     def test_delete_group_exception(self):
741 741
         sec_group = self.security_groups.get(name="other_group")
742 742
 
743
-        api.network.security_group_delete(
743