Revision e864cd9e
b/kamaki/cli/config/__init__.py | ||
---|---|---|
85 | 85 |
'file_cli': 'pithos', |
86 | 86 |
'server_cli': 'cyclades', |
87 | 87 |
'flavor_cli': 'cyclades', |
88 |
'network_cli': 'networking',
|
|
89 |
'subnet_cli': 'networking',
|
|
90 |
'port_cli': 'networking',
|
|
88 |
'network_cli': 'network', |
|
89 |
'subnet_cli': 'network', |
|
90 |
'port_cli': 'network', |
|
91 | 91 |
'ip_cli': 'cyclades', |
92 | 92 |
'image_cli': 'image', |
93 | 93 |
'config_cli': 'config', |
b/kamaki/clients/cyclades/__init__.py | ||
---|---|---|
34 | 34 |
from time import sleep |
35 | 35 |
|
36 | 36 |
from kamaki.clients.cyclades.rest_api import CycladesRestClient |
37 |
from kamaki.clients.network import NetworkClient |
|
37 | 38 |
from kamaki.clients import ClientError |
38 | 39 |
|
39 | 40 |
|
... | ... | |
502 | 503 |
req = dict(removeFloatingIp=dict(address=address)) |
503 | 504 |
r = self.servers_action_post(server_id, json_data=req) |
504 | 505 |
return r.headers |
506 |
|
|
507 |
|
|
508 |
class CycladesNetworkClient(NetworkClient): |
|
509 |
"""Cyclades Network API extentions""" |
|
510 |
|
|
511 |
network_types = ( |
|
512 |
'CUSTOM', 'MAC_FILTERED', 'IP_LESS_ROUTED', 'PHYSICAL_VLAN') |
|
513 |
|
|
514 |
def create_network(self, type, name=None, shared=None): |
|
515 |
req = dict(network=dict(type=type, admin_state_up=True)) |
|
516 |
if name: |
|
517 |
req['network']['name'] = name |
|
518 |
if shared not in (None, ): |
|
519 |
req['network']['shared'] = bool(shared) |
|
520 |
r = self.networks_post(json_data=req, success=201) |
|
521 |
return r.json['network'] |
b/kamaki/clients/cyclades/test.py | ||
---|---|---|
239 | 239 |
'/os-floating-ips/%s' % fip, success=success, **kwargs)) |
240 | 240 |
|
241 | 241 |
|
242 |
class CycladesNetworkClient(TestCase): |
|
243 |
|
|
244 |
"""Set up a ComputesRest thorough test""" |
|
245 |
def setUp(self): |
|
246 |
self.url = 'http://network.example.com' |
|
247 |
self.token = 'n2tw0rk70k3n' |
|
248 |
self.client = cyclades.CycladesNetworkClient(self.url, self.token) |
|
249 |
|
|
250 |
def tearDown(self): |
|
251 |
FR.json = vm_recv |
|
252 |
del self.client |
|
253 |
|
|
254 |
@patch( |
|
255 |
'kamaki.clients.network.NetworkClient.networks_post', |
|
256 |
return_value=FR()) |
|
257 |
def test_create_network(self, networks_post): |
|
258 |
for name, shared in product((None, 'net name'), (None, True)): |
|
259 |
FR.json = dict(network='ret val') |
|
260 |
type = 'net type' |
|
261 |
self.assertEqual( |
|
262 |
self.client.create_network(type, name=name, shared=shared), |
|
263 |
'ret val') |
|
264 |
req = dict(type=type, admin_state_up=True) |
|
265 |
if name: |
|
266 |
req['name'] = name |
|
267 |
if shared: |
|
268 |
req['shared'] = shared |
|
269 |
expargs = dict(json_data=dict(network=req), success=201) |
|
270 |
self.assertEqual(networks_post.mock_calls[-1], call(**expargs)) |
|
271 |
|
|
272 |
|
|
242 | 273 |
class CycladesClient(TestCase): |
243 | 274 |
|
244 | 275 |
def assert_dicts_are_equal(self, d1, d2): |
... | ... | |
533 | 564 |
not_found = True |
534 | 565 |
if not argv[1:] or argv[1] == 'CycladesClient': |
535 | 566 |
not_found = False |
536 |
runTestCase(CycladesClient, 'Cyclades Client', argv[2:]) |
|
567 |
runTestCase(CycladesNetworkClient, 'Cyclades Client', argv[2:]) |
|
568 |
if not argv[1:] or argv[1] == 'CycladesNetworkClient': |
|
569 |
not_found = False |
|
570 |
runTestCase(CycladesNetworkClient, 'CycladesNetwork Client', argv[2:]) |
|
537 | 571 |
if not argv[1:] or argv[1] == 'CycladesRestClient': |
538 | 572 |
not_found = False |
539 | 573 |
runTestCase(CycladesRestClient, 'CycladesRest Client', argv[2:]) |
b/kamaki/clients/test.py | ||
---|---|---|
42 | 42 |
from kamaki.clients.astakos.test import AstakosClient |
43 | 43 |
from kamaki.clients.compute.test import ComputeClient, ComputeRestClient |
44 | 44 |
from kamaki.clients.network.test import (NetworkClient, NetworkRestClient) |
45 |
from kamaki.clients.cyclades.test import CycladesClient |
|
45 |
from kamaki.clients.cyclades.test import CycladesClient, CycladesNetworkClient
|
|
46 | 46 |
from kamaki.clients.cyclades.test import CycladesRestClient |
47 | 47 |
from kamaki.clients.image.test import ImageClient |
48 | 48 |
from kamaki.clients.storage.test import StorageClient |
b/setup.py | ||
---|---|---|
76 | 76 |
'kamaki.clients.astakos', |
77 | 77 |
'kamaki.clients.compute', |
78 | 78 |
'kamaki.clients.cyclades', |
79 |
'kamaki.clients.networking'
|
|
79 |
'kamaki.clients.network' |
|
80 | 80 |
], |
81 | 81 |
classifiers=[ |
82 | 82 |
'Operating System :: OS Independent', |
Also available in: Unified diff