Revision fc627daa

b/docs/design/cyclades-networking.rst
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 an 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
interner)
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 represeting the UUID for the network.
31
* name: A human readable name
32
* status: String represetng 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
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 can not 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 it assign addresses to virtual machines. A subnet is associated with
120
a network when created.
121

  
122

  
123
The attributes for subnet objects are the following:
124

  
125
* id: A string represeting 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.
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 this
139
                  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 used must specify the network_id and the cidr for the
154
subnet. If the CIDR is 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 1 subnet of each ip_version, meaning that
159
a network can have no subnets, or one IPv4 subnet or one IPv6 subnet, or one
160
IPv4 and one IPv6 subnet. Also the user can not create a subnet for a network
161
that has or had a port connected to it.
162

  
163
List user subnets
164
^^^^^^^^^^^^^^^^^
165

  
166
METHOD: GET
167

  
168
URI:  /subnets/
169

  
170
Get details about a subnet
171
^^^^^^^^^^^^^^^^^^^^^^^^^^^
172

  
173
METHOD: GET
174

  
175
URI:  /subnets/$(subnet_id)
176

  
177
Example response:
178

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

  
207

  
208
Delete a subnet
209
^^^^^^^^^^^^^^^^
210

  
211
METHOD: DELETE
212

  
213
URI:  /subnets/$(subnet_id)
214

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

  
218

  
219
Update a subnet
220
^^^^^^^^^^^^^^^^
221

  
222
METHOD: PUT
223

  
224
URI:  /subnets/$(subnet_id)
225

  
226

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

  
230

  
231
Ports
232
=====
233

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

  
239
The attributes for port objects are the following:
240

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

  
256

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

  
260
Create a new Port
261
^^^^^^^^^^^^^^^^^^^^
262

  
263
Method: POST
264

  
265
URI: /ports
266

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

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

  
279
List ports
280
^^^^^^^^^^^^^
281

  
282
Method: GET
283

  
284
URI: /ports
285

  
286
Get details about a port
287
^^^^^^^^^^^^^^^^^^^^^^^^^^^
288

  
289
METHOD: GET
290

  
291
URI:  /ports/$(port_id)
292

  
293
Example response:
294

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

  
323
Delete a port
324
^^^^^^^^^^^^^^^^
325

  
326
METHOD: DELETE
327

  
328
URI:  /ports/$(port_id)
329

  
330
Update a port
331
^^^^^^^^^^^^^^^^
332

  
333
METHOD: PUT
334

  
335
URI:  /ports/$(port_id)
336

  
337
Only the name of the port can be updated.
338

  
339
General Implementation Details
340
==============================
341

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

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

Also available in: Unified diff