Revision fe980c71

b/docs/developers/clients-api.rst
314 314
    #! /user/bin/python
315 315

  
316 316
    from kamaki.clients.astakos import AstakosClient
317
    from kamaki.clients.cyclades import CycladesClient
317
    from kamaki.clients.cyclades import CycladesClient, CycladesNetworkClient
318 318

  
319 319
    AUTHENTICATION_URL = 'https://accounts.example.com/identity/v2.0'
320 320
    TOKEN = 'replace this with your token'
321 321

  
322 322
    astakos = AstakosClient(AUTHENTICATION_URL, TOKEN)
323 323

  
324
    network_endpoints = user.get_service_endpoints('network')
325
    NETWORK_URL = network_endpoints['publicURL']
326

  
327
    network = CycladesNetworkClient(NETWORK_URL, TOKEN)
328
    net = cyclades.create_network('My private network')
329

  
324 330
    cyclades_endpoints = user.get_service_endpoints('compute')
325 331
    CYCLADES_URL = cyclades_endpoints['publicURL']
326 332

  
327 333
    FLAVOR_ID = 'put your flavor id here'
328 334
    IMAGE_ID = 'put your image id here'
329

  
330 335
    cyclades = CycladesClient(CYCLADES_URL, TOKEN)
331 336

  
332
    srv1 = cyclades.create_server('server 1', FLAVOR_ID, IMAGE_ID)
333
    srv2 = cyclades.create_server('server 2', FLAVOR_ID, IMAGE_ID)
337
    srv1 = cyclades.create_server(
338
        'server 1', FLAVOR_ID, IMAGE_ID,
339
        networks=[{'uuid': net['id']}])
340
    srv2 = cyclades.create_server(
341
        'server 2', FLAVOR_ID, IMAGE_ID,
342
        networks=[{'uuid': net['id']}])
334 343

  
335 344
    srv_state1 = cyclades.wait_server(srv1['id'])
336 345
    assert srv_state1 in ('ACTIVE'), 'Server 1 built failure'
337 346

  
338 347
    srv_state2 = cyclades.wait_server(srv2['id'])
339 348
    assert srv_state2 in ('ACTIVE'), 'Server 2 built failure'
340

  
341
    net = cyclades.create_network('My private network')
342
    net_state = cyclades.wait_network(net['id'])
343
    assert net_state in ('ACTIVE', ), 'Network built failure'
344

  
345
    cyclades.connect_server(srv1['id'], net['id'])
346
    cyclades.connect_server(srv2['id'], net['id'])

Also available in: Unified diff