Statistics
| Branch: | Tag: | Revision:

root / docs / design / cyclades-networking.rst @ 9fad003b

History | View | Annotate | Download (21.1 kB)

1
===================
2
Cyclades Networking
3
===================
4

    
5
Networks
6
========
7

    
8
A Cyclades network is a virtual network that can be, depending on it's Network
9
Flavor, either an isolated Layer-2 broadcast domain or a Layer-3 network.
10
Networks can either be private or public. Private networks are reserved for the
11
user who created it, while public networks are created by the administrator and
12
are visible to all users. Also, networks can be marked with the
13
`--router:external` attribute to indicate that are external networks (public
14
internet)
15

    
16
Currently there are four available Networks Flavors:
17

    
18
* IP_ONLY: A Layer-3 network where host routes traffic to the external network.
19
* PHYSICAL_VLAN: A Layer-2 network where a physical VLAN is assigned to the
20
  network.
21
* MAC_FILTERED: A Layer-2 network. All networks of this type share the same
22
  physical VLAN, but isolation is achieved by filtering rules based on a
23
  unique MAC prefix that is assigned to each network.
24

    
25
The administrator can limit which networks can be created via API with the
26
`API_ENABLED_NETOWRK_FLAVORS` setting.
27

    
28
The attributes for network objects are the following:
29

    
30
* id: A string representing the UUID for the network.
31
* name: A human readable name.
32
* status: String representing the state of the network. Possible values for the
33
  state include: ACTIVE, DOWN, BUILD, ERROR.
34
* subnets: List of subnet UUIDs that are associated with this network.
35
* public: Whether network is visible to other users or not.
36
* user_id/tenant_id: The UUID of the owner of the network.
37
* admin_state_up: Boolean value indicating the administrative state of the
38
  network. If 'down' the network does not forward packets.
39

    
40
Note: The 'admin_state_up' value is used only for compatibility with Neutron
41
API. It will be read-only, and will always be True.
42

    
43
Create a new network
44
^^^^^^^^^^^^^^^^^^^^
45

    
46
Method: POST
47

    
48
URI: /networks
49

    
50
The body of the request must contain the 'type' of the network. Also it can
51
contain a 'name' attribute.
52

    
53
List Networks
54
^^^^^^^^^^^^^
55

    
56
Method: GET
57

    
58
URI: /networks
59

    
60
Get details about a network
61
^^^^^^^^^^^^^^^^^^^^^^^^^^^
62

    
63
METHOD: GET
64

    
65
URI: /networks/$(network_id)
66

    
67
Example response:
68

    
69
+-----------------+-----------------------------------+
70
| Field           | Value                             |
71
+=================+===================================+
72
| admin_state_up  | True                              |
73
+-----------------+-----------------------------------+
74
| id              | 42                                |
75
+-----------------+-----------------------------------+
76
| name            | Test_network                      |
77
+-----------------+-----------------------------------+
78
| network_type    | MAC_FILTERED                      |
79
+-----------------+-----------------------------------+
80
| router:external | False                             |
81
+-----------------+-----------------------------------+
82
| public          | False                             |
83
+-----------------+-----------------------------------+
84
| status          | ACTIVE                            |
85
+-----------------+-----------------------------------+
86
| subnets         | []                                |
87
+-----------------+-----------------------------------+
88
| user_id         | 1012fd8c72284c00b133832cd179f896  |
89
+-----------------+-----------------------------------+
90
| tenant_id       | 1012fd8c72284c00b133832cd179f896  |
91
+-----------------+-----------------------------------+
92

    
93
Delete a network
94
^^^^^^^^^^^^^^^^
95

    
96
METHOD: DELETE
97

    
98
URI:  /networks/$(network_id)
99

    
100
The network cannot be deleted if there are any Ports connected to it or
101
any FloatingIPs reserved from this network. The subnets that are connected
102
to this network are automatically deleted upon network deletion.
103

    
104
Update a network
105
^^^^^^^^^^^^^^^^
106

    
107
METHOD: PUT
108

    
109
URI:  /networks/$(network_id)
110

    
111
Only the name of the network can be updated.
112

    
113

    
114
Subnets
115
=======
116

    
117
A subnet represents L3-Layer characteristics of the network that is
118
associated with. Specifically, it represents an IP address block that is
119
used in order to assign addresses to virtual machines. A subnet is associated
120
with a network when created.
121

    
122

    
123
The attributes for subnet objects are the following:
124

    
125
* id: A string representing the UUID for the subnet.
126
* name: A human readable name.
127
* network_id: The UUID of the network that the subnet is associated with.
128
* ip_version: The IP version of the subnet. Can either be 4 or 6, default is 4.
129
* cidr: cidr representing IP range for this subnet, based on the IP version.
130
* gateway: Default gateway used by devices in this subnet. If not specified
131
  the gateway will be the first available IP address. Set to None in order to
132
  get no gateway.
133
* enable_dhcp(CR): Boolean value indicating whether nfdhcpd is enabled for this
134
  subnet or not.
135
* allocation_pools(CR): Subranges of cidr available for dynamic allocation.
136
  A list of dictionaries of the form {"start": "192.168.2.0", "end": 192.168.2.10"}
137
* user_id/tenant_id: The UUID of the owner of the network.
138
* host_routes(R): List of routes that should be used by devices with IPs from
139
  this subnet.
140
* dns_nameservers(R): List of DNS name servers used by hosts in this subnet.
141

    
142
Note: 'host_routes' and 'dns_nameservers' is used only for compatibility with
143
Neutron. These values will be read-only and always be [].
144

    
145

    
146
Create a Subnet
147
^^^^^^^^^^^^^^^
148

    
149
METHOD: POST
150

    
151
URI:  /subnets/
152

    
153
To create a subnet the user must specify the network_id and the cidr for the
154
subnet. If the CIDR is an IPv6 subnet, the user must set the ip_version to 6.
155
If allocation pools overlap, or gateway overlaps with allocation_pools then 409
156
conflict is returned.
157

    
158
Finally, the user can create maximum one subnet of each ip_version, meaning
159
that a network can have no subnets, or one IPv4 subnet or one IPv6 subnet, or
160
one IPv4 and one IPv6 subnet. Also the user cannot create a subnet for a
161
network that has or had a port connected to it.
162

    
163
Note: Bulk creation of subnets, is not supported.
164

    
165
List user subnets
166
^^^^^^^^^^^^^^^^^
167

    
168
METHOD: GET
169

    
170
URI:  /subnets/
171

    
172
Get details about a subnet
173
^^^^^^^^^^^^^^^^^^^^^^^^^^^
174

    
175
METHOD: GET
176

    
177
URI:  /subnets/$(subnet_id)
178

    
179
Example response:
180

    
181
+------------------+--------------------------------------------------+
182
| Field            | Value                                            |
183
+==================+==================================================+
184
| allocation_pools | {"start": "192.168.2.2", "end": "192.168.2.254"} |
185
+------------------+--------------------------------------------------+
186
| cidr             | 192.168.2.0/24                                   |
187
+------------------+--------------------------------------------------+
188
| dns_nameservers  | []                                               |
189
+------------------+--------------------------------------------------+
190
| enable_dhcp      | False                                            |
191
+------------------+--------------------------------------------------+
192
| gateway_ip       | 192.168.2.1                                      |
193
+------------------+--------------------------------------------------+
194
| host_routes      | []                                               |
195
+------------------+--------------------------------------------------+
196
| id               | 49ce3872-446c-43e9-aa22-68dbc2bac0b5             |
197
+------------------+--------------------------------------------------+
198
| ip_version       | 4                                                |
199
+------------------+--------------------------------------------------+
200
| name             | test1                                            |
201
+------------------+--------------------------------------------------+
202
| network_id       | 8fc5e2bf-9c1b-4458-8f71-e38177ed23a5             |
203
+------------------+--------------------------------------------------+
204
| tenant_id        | 11a65261147d462b998eafb7f696f0ba                 |
205
+------------------+--------------------------------------------------+
206
| user_id          | 11a65261147d462b998eafb7f696f0ba                 |
207
+------------------+--------------------------------------------------+
208

    
209

    
210
Delete a subnet
211
^^^^^^^^^^^^^^^^
212

    
213
METHOD: DELETE
214

    
215
URI:  /subnets/$(subnet_id)
216

    
217
We will not allow deletion of subnets. Subnets will be deleted when network
218
is deleted. This call will return 400 (badRequest).
219

    
220

    
221
Update a subnet
222
^^^^^^^^^^^^^^^^
223

    
224
METHOD: PUT
225

    
226
URI:  /subnets/$(subnet_id)
227

    
228

    
229
Only the name of the subnet can be updated. This call will return 400 (badRequest)
230
if the user tries to update any other field.
231

    
232

    
233
Ports
234
=====
235

    
236
A port represents a virtual switch port on a network switch. Virtual machines
237
attach their interfaces to ports. A port that is connected to a network
238
gets an IP address for each subnet that is associated with the network. If the
239
network has no subnets, then the port will have no IP.
240

    
241
The attributes for port objects are the following:
242

    
243
* id: A string representing the UUID for the port.
244
* network_id: The UUID of the network that this port is associated with.
245
* name: A human readable name.
246
* status: String representing the state of the port. Possible values for the
247
  state include: ACTIVE, DOWN, BUILD, ERROR.
248
* mac_address: MAC address.
249
* fixed_ips(R): List of dictionaries subnet_id->ip_address.
250
* device_id(CR): Device using this port (VM id or Router id).
251
* device_owner(CR): Entity using this port. e.g., network:router,
252
  network:router_gateway.
253
* user_id/tenant_id: The UUID of the owner of the port.
254
* security_groups(CRUD): List of security groups IDs associated with this port.
255
* admin_state_up: Boolean value indicating the administrative state of the
256
  port. If 'down' the port does not forward packets.
257

    
258

    
259
Note: The 'admin_state_up' value is used only for compatibility with Neutron
260
API. It will be read-only, and will always be True.
261

    
262
Create a new Port
263
^^^^^^^^^^^^^^^^^^^^
264

    
265
Method: POST
266

    
267
URI: /ports
268

    
269
The body of the request must contain the 'network_id' of the network that
270
this port will be associated with and the 'device_id' that the port will
271
be connected to. Also it can contain the following optional
272
attributes:
273
* security_groups
274
* name
275

    
276
The port will not have a MAC address and an IPv6 address until the
277
corresponding NIC goes to ACTIVE state. This will be fixed when Cyclades
278
will do MAC allocation. If MAC allocation is implemented, we will also
279
be able to create a Port without specifying a device_id.
280

    
281
List ports
282
^^^^^^^^^^^^^
283

    
284
Method: GET
285

    
286
URI: /ports
287

    
288
Get details about a port
289
^^^^^^^^^^^^^^^^^^^^^^^^^^^
290

    
291
METHOD: GET
292

    
293
URI:  /ports/$(port_id)
294

    
295
Example response:
296

    
297
+-----------------------+---------------------------------------------------------------------------------+
298
| Field                 | Value                                                                           |
299
+=======================+=================================================================================+
300
| admin_state_up        | True                                                                            |
301
+-----------------------+---------------------------------------------------------------------------------+
302
| device_id             | 39a02a66-33be-478a-8e9f-012141258678                                            |
303
+-----------------------+---------------------------------------------------------------------------------+
304
| device_owner          | network:router_interface                                                        |
305
+-----------------------+---------------------------------------------------------------------------------+
306
| fixed_ips             | {"subnet_id": "2313705f-68c1-4e16-80e3-c9fd8c0a5170", "ip_address": "10.0.2.1"} |
307
+-----------------------+---------------------------------------------------------------------------------+
308
| id                    | ff15e3fe-7b39-4adc-ae98-a7e29588977e                                            |
309
+-----------------------+---------------------------------------------------------------------------------+
310
| mac_address           | fa:16:3e:c1:63:06                                                               |
311
+-----------------------+---------------------------------------------------------------------------------+
312
| name                  | "test_port"                                                                     |
313
+-----------------------+---------------------------------------------------------------------------------+
314
| network_id            | 2f04b49f-ca49-4b93-9139-11a4eca35fdd                                            |
315
+-----------------------+---------------------------------------------------------------------------------+
316
| security_groups       | []                                                                              |
317
+-----------------------+---------------------------------------------------------------------------------+
318
| status                | DOWN                                                                            |
319
+-----------------------+---------------------------------------------------------------------------------+
320
| tenant_id             | 1012fd8c72284c00b133832cd179f896                                                |
321
+-----------------------+---------------------------------------------------------------------------------+
322
| user_id               | 1012fd8c72284c00b133832cd179f896                                                |
323
+-----------------------+---------------------------------------------------------------------------------+
324

    
325
Delete a port
326
^^^^^^^^^^^^^^^^
327

    
328
METHOD: DELETE
329

    
330
URI:  /ports/$(port_id)
331

    
332
Update a port
333
^^^^^^^^^^^^^^^^
334

    
335
METHOD: PUT
336

    
337
URI:  /ports/$(port_id)
338

    
339
Only the name of the port can be updated.
340

    
341
General Implementation Details
342
==============================
343

    
344
Creation of a network corresponds to only creating a Network object in the
345
Cyclades DB. Also, creation of a subnet corresponds to creation of a Subnet in
346
the Cyclades DB and the of the corresponding allocation pools. The Ganeti
347
network will only be created in the Ganeti backend when a port is connected to
348
this network.  Updating fields of Ganeti networks is really hard (e.g.,
349
changing the dhcp option) or impossible (e.g., changing the subnet). For this
350
reason, if the network has been created in a Ganeti backend, then it will be
351
marked as read-only!
352

    
353
A port is mapped to a Ganeti NIC directly. The port will be created in DB in
354
the "BUILD" state and an OP_INSTANCE_MODIFY will be issued to Ganeti to create
355
the NIC in the specified VM. When the job successfully completes, the NIC will
356
be updated to state "ACTIVE" in the DB. Also the MAC address that was allocated
357
from Ganeti will be stored in the updated NIC.
358

    
359

    
360
Routers
361
=======
362

    
363
A router is a logical entity that can be used to:
364

    
365
* interconnect subnets and forward traffic among them, and
366
* NAT internal traffic to external networks.
367

    
368
A router is associated with subnets through interfaces. The router gets an
369
interface with each subnet that is associated with. By default, the IP address
370
of such interface is the gateway of the subnet. Besides the interfaces, the
371
router also gets a Port for each network that is associated with (through
372
the corresponding subnets). These ports are created automatically when
373
interfaces are added to the router, have as device_owner the router, and
374
can not be managed with the Port API.
375

    
376
Besides the internal subnets, the router, can also be associated with an
377
external network in order to NAT traffic from internal networks to the external
378
one. The id of the external network is specified in the `external_gateway_info`
379
attribute of the network, and a port will be created for the router with an
380
IP address from the range of the public network. Besides the network id, the
381
user can also specify a floating IP from this network, to use as the router IP.
382
This port can also not be managed with the Port API.
383

    
384
The attributes for Router objects are the following:
385

    
386
* id: A string representing the UUID for the router.
387
* name: A human readable name.
388
* status: String representing the state of the network. Possible values for the
389
  state include: ACTIVE, DOWN, BUILD, ERROR.
390
* user_id/tenant_id: The UUID of the owner of the router.
391
* admin_state_up: Boolean value indicating the administrative state of the
392
  router. If 'down' the router does not forward packets.
393
* external_gateway_info: Dictionary with the information about the external
394
  gateway for the router.
395

    
396
Create a new router
397
^^^^^^^^^^^^^^^^^^^^
398

    
399
Method: POST
400

    
401
URI: /routers
402

    
403
The body of the request contains the name of the router. The new router that
404
is created does not have any internal interface and so it is not associated
405
with any subnet.
406

    
407
Also, the used can specify an external gateway for the router at create time.
408
This is done by specifying the network_id in the `external_gateway_info`
409
attribute. This network must have the attribute `router:external` set to
410
`True`. Besides the id of the network, the used can also specify one of his
411
floating IPs to use. An example request is the following
412

    
413

    
414
.. code-block:: console
415

    
416
  {
417
    "router":
418
    {
419
      "name": "example_router",
420
      "external_gateway_info":
421
      {
422
        "network_id": "42",
423
        "floating_ip_id": "142"
424
      }
425
    }
426
  }
427

    
428
List routers
429
^^^^^^^^^^^^^
430

    
431
Method: GET
432

    
433
URI: /routers
434

    
435
Get details about a router
436
^^^^^^^^^^^^^^^^^^^^^^^^^^^
437

    
438
METHOD: GET
439

    
440
URI: /routers/$(router_id)
441

    
442
Example response:
443

    
444
.. code-block:: console
445

    
446
  {
447
    "id": "5",
448
    "name": "example_router",
449
    "status": "ACTIVE",
450
    "user_id": "1012fd8c72284c00b133832cd179f896",
451
    "tenant_id": "1012fd8c72284c00b133832cd179f896",
452
    "external_gateway_info": {
453
      "network_id": "42",
454
      "floating_ip_id": "142"
455
    }
456
  }
457

    
458
Delete a router
459
^^^^^^^^^^^^^^^^
460

    
461
METHOD: DELETE
462

    
463
URI:  /routers/$(router_id)
464

    
465
This operation removes a logical router;
466
the operation will fail if the router still has some internal interfaces.
467

    
468
Update a router
469
^^^^^^^^^^^^^^^^
470

    
471
METHOD: PUT
472

    
473
URI:  /routers/$(router_id)
474

    
475
Only the `name` of the router and the `external_gateway_info` can be updated.
476

    
477
Add interface to router
478
^^^^^^^^^^^^^^^^^^^^^^^
479

    
480
METHOD: PUT
481

    
482
URI: /routers/$(router_id)/add_router_interface
483

    
484
The body of the request contains only the id of the subnet that the router
485
will be associated to.
486

    
487
Remove interface from router
488
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
489

    
490
METHOD: PUT
491

    
492
URI: /routers/$(router_id)/remove_router_interface
493

    
494
The body of the request contains only the id of the subnet that the router
495
will be detached from.
496

    
497

    
498
Floating IPs
499
============
500

    
501
Floating IPs are addresses on external networks (and so can be defined only
502
on networks on which the attribute `router:external` has been set to True). In
503
the Neutron API, floating IPs are associated with specific ports and IP
504
addresses on private networks and are used to allow an instance from a private
505
network to access the external network. Cyclades are able to associate a
506
floating IP with an instance without the restriction that the instance must
507
already have a port and a private IP from a private network. In order to avoid
508
this limitation of Neutron API, Cyclades are using a slightly modified and
509
extended API.
510

    
511
The attributes of floating IP objects are the following:
512

    
513
* id: A string representing the UUID for the floating IP.
514
* floating_network_id: The UUID of the external network with which the floating
515
  IP is associated.
516
* floating_ip_address: The IPv4 address of the floating IP.
517
* device_id: The UUID of the device that is associated with the floating IP.
518
* router_id: The UUID of the router that is associated with this floating IP.
519
* user_id/tenant_id: The UUID of the owner of the floating IP.
520

    
521
Note: The `device_id` is not part of Neutron API. Instead the Neutron API uses
522
the `port_id` and `fixed_ip_address` to associate the floating IP with a
523
specific port and private address.
524

    
525
Floating IPs are associated/de-associated with instances, using the
526
'addfloatingip', and 'removefloatingip' server actions that are defined in the
527
extensions of the OpenStack Compute API. When a floating IP is associated with
528
a server the corresponding Port is automatically created, with device owner the
529
floating IP. However these ports, exactly as with Router Ports, can not be
530
managed with the Ports API.
531

    
532
Create(reserve) a floating IP
533
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
534

    
535
METHOD: POST
536

    
537
URI: /floatingips
538

    
539
The body of the request contains the id of the external network
540
(`floating_network_id`). If no address is specified (`floating_ip_address`),
541
an address will automatically be allocated from the pool addresses of the
542
external network.
543

    
544
List floating IPs
545
^^^^^^^^^^^^^^^^^
546

    
547
METHOD: GET
548

    
549
URI: /floatingips
550

    
551
Show a floating IP
552
^^^^^^^^^^^^^^^^^^
553

    
554
METHOD: GET
555

    
556
URI: /floatingips/$(floatingip_id)
557

    
558
Example response:
559

    
560
.. code-block:: console
561

    
562
 {
563
   "floatingip": {
564
     "id": "5923c02a-a162-4044-a432-9e52d6d819ce",
565
     "floating_ip_address": 192.168.1.227,
566
     "floating_network_id": 00983314-2f3c-43e9-acb0-9fd7cdb32231,
567
     "router_id": null,
568
     "device_id": 42,
569
     "tenant_id: "1012fd8c72284c00b133832cd179f896",
570
     "user_id": "1012fd8c72284c00b133832cd179f896"
571
   }
572
 }
573

    
574

    
575
Delete a Floating IP
576
^^^^^^^^^^^^^^^^^^^^
577

    
578
METHOD: DELETE
579

    
580
URI: /floatingips/$(floatingip_id)
581

    
582
This operation removes(releases) the floating IP. If it associated with a
583
device(port), the port is automatically removed.
584

    
585
Add Floating IP to server
586
^^^^^^^^^^^^^^^^^^^^^^^^^
587

    
588
METHOD: POST
589

    
590
URI: server/$(server_id)/action
591

    
592
Request:
593

    
594
.. code-block:: console
595
 {
596
   "addFloatingIp": {
597
     "address": "192.168.1.277"
598
   }
599
 }
600

    
601

    
602
Remove Floating IP from server
603
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
604

    
605
METHOD: POST
606

    
607
URI: servers/$(server_id)/action
608

    
609
.. code-block:: console
610
 {
611
   "removeFloatingIp": {
612
     "address": "192.168.1.277"
613
   }
614
 }