JIRA Issue DOMINO-20
[domino.git] / docs / userguide / feature.userguide.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
3 .. (c) Ulas C. Kozat Huawei R&D USA
4
5 ==================
6 Domino Description
7 ==================
8
9 Domino provides a distribution service for Network Service Descriptors (NSDs) and
10 Virtual Network Function Descriptors (VNFDs) that are composed using Tosca Simple
11 Profile for Network Functions Virtualization
12 (http://docs.oasis-open.org/tosca/tosca-nfv/v1.0/tosca-nfv-v1.0.html).
13 Domino service is targeted towards supporting many SDN controllers, service orchestrators,
14 VNF Managers (VNFMs), Virtual Infastructure Managers (VIMs), Operation and Business Support
15 Systems that produce and/or consume NSDs and VNFDs.
16
17 Producers of NSDs and VNFDs use Domino Service as an entry point to publish these
18 descriptors. Consumers of NSDs and VNFDs subscribe with the Domino Service and declare
19 their resource capabilities to onboard and perform Life Cycle Management (LCM) for Network
20 Services (NSs) and Virtual Network Functions (VNFs). Thus, Domino acts as a broker for
21 NSs and VNFs described in a Tosca template.
22
23 =============================
24 Domino Capabilities and Usage
25 =============================
26
27 Labels in Domino
28 ================
29
30 Domino's pub/sub architecture is based on labels (see Fig. 1 below).
31 Each Template Producer and Template Consumer is expected to run a local Domino Client
32 to publish templates and subscribe for labels.
33
34 .. _fig-label:
35
36 .. figure:: ../etc/domino_pubsub_system.jpeg
37     :width: 350px
38     :align: center
39     :height: 300px
40     :alt: alternate text
41     :figclass: align-center
42
43     Domino provides a pub/sub server for NSDs and VNFDs
44
45 Domino Service does not interpret what the labels mean. Domino derives labels directly from
46 the normative definitions in TOSCA Simple YAML Profile for NFV. Domino parses the policy
47 rules included in the NSD/VNFD, form "policy" labels, and determine which resources are
48 associated with which set of labels. Domino identifies which Domino Clients can host
49 which resource based on the label subscriptions by these clients. Once mapping of resources
50 to the clients are done, new NSDs/VNFDs are created based on the mapping. These new
51 NSDs/VNFDs are translated and delivered to the clients.
52
53 Label Format and Examples
54 =========================
55
56 Domino supports policy labels in the following form:
57
58 .. code-block:: bash
59
60   <policytype>:properties:<key:value>
61
62 Orchestrators, controllers, and managers use Domino service to announce their
63 capabilities by defining labels in this form and subscribing for these labels with
64 the Domino Server.
65
66 For instance a particular VIM that is capable of performing an
67 affinity based VNF or VDU placement at host machine granularity can specify a label
68 in the form:
69
70 .. code-block:: bash
71
72   tosca.policies.Placement.affinity:properties:granularity:hostlevel
73
74 When the VIM registers with the Domino Service and subscribed for that label, Domino views
75 this VIM as a candidate location that can host a VNF or VDU requesting affinity based
76 placement policy at host machine granularity.
77
78 Another use case is the announcement of lifecycle management capabilities for VNFs and
79 VNF Forwarding Graphs (VNFFG) by different SDN Controllers (SDN-Cs), VNFMs, or VIMs.
80 For instance
81
82 .. code-block:: bash
83
84   tosca.policies.Scaling.VNFFG:properties:session_continuity:true
85
86 can be used as a label to indicate that when a scaling operation on a VNFFG (e.g., add
87 more VNFs into the graph) is requested, existing session can still be enforced to go
88 through the same chain of VNF instances.
89
90 To utilize Domino's domain mapping services for virtual network resources (e.g., VNF, VDU,
91 VNFFG, CP, VL, etc.), a network service or network function request must include
92 policy rules that are composed of policy types and property values that match to the
93 label announcements of these domains. For instance, when a TOSCA template includes a
94 policy rule with type "tosca.policies.Scaling.VNFFG" and property field
95 "session_continuity" set as "true" targeting one or more VNFFGs, this serves as the hint
96 for the Domino Server to identify all the Domain Clients that subscribed the label
97 "tosca.policies.Scaling.VNFFG:properties:session_continuity:true".
98
99 Template Example for Label Extraction
100 =====================================
101
102 Consider the following NSD TOSCA template:
103
104 .. code-block:: bash
105
106   tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
107   description: Template for deploying a single server with predefined properties.
108   metadata:
109     template_name: TOSCA NFV Sample Template
110   policy_types:
111     tosca.policies.Placement.Geolocation:
112       description: Geolocation policy
113       derived_from: tosca.policies.Placement
114   topology_template:
115     node_templates:
116       VNF1:
117         type: tosca.nodes.nfv.VNF
118         properties:
119           id: vnf1
120           vendor: acmetelco
121           version: 1.0
122       VNF2:
123         type: tosca.nodes.nfv.VNF
124         properties:
125           id: vnf2
126           vendor: ericsson
127           version: 1.0
128       VNF3:
129         type: tosca.nodes.nfv.VNF
130         properties:
131           id: vnf3
132           vendor: huawei
133           version: 1.0
134     policies:
135       - rule1:
136           type: tosca.policies.Placement.Geolocation
137           targets: [ VNF1 ]
138           properties:
139             region: [ us-west-1 ]
140       - rule2:
141           type: tosca.policies.Placement.Geolocation
142           targets: [ VNF2, VNF3 ]
143           properties:
144             region: [ us-west-1 , us-west-2 ]
145
146 Domino Server extracts all possible policy labels by exhaustively concatenating key-value
147 pairs under the properties section of the policy rules to the policy type of these rules:
148
149 .. code-block:: bash
150
151   tosca.policies.Placement.Geolocation:properties:region:us-west-1
152   tosca.policies.Placement.Geolocation:properties:region:us-west-2
153
154 Furthermore, Domino Server iterates over the targets specified under policy rules to generate a set of labels for each target node:
155
156 .. code-block:: bash
157
158   required_labels['VNF1'] = { tosca.policies.Placement.Geolocation:properties:region:us-west-1 }
159   required_labels['VNF2'] = { tosca.policies.Placement.Geolocation:properties:region:us-west-1 , tosca.policies.Placement.Geolocation:properties:region:us-west-2}
160   required_labels['VNF3'] = { tosca.policies.Placement.Geolocation:properties:region:us-west-1 , tosca.policies.Placement.Geolocation:properties:region:us-west-2}
161
162 When a Template Consuming site (e.g., VNFM or VIM) registers with the Domino Server using
163 Domino Client, it becomes an eligible candidate for template distribution with an initially
164 empty set of label subscriptions. Suppose three different Domino Clients register with the
165 Domino Server and subscribe for some or none of the policy labels such that the Domino Server
166 has the current subscription state as follows:
167
168 .. code-block:: bash
169
170   subscribed_labels[site-1] = { } #this is empty set
171   subscribed_labels[site-2] = { tosca.policies.Placement.Geolocation:properties:region:us-west-1 }
172   subscribed_labels[site-3] = { tosca.policies.Placement.Geolocation:properties:region:us-west-1 ,  tosca.policies.Placement.Geolocation:properties:region:us-west-2}
173
174
175 Based on the TOSCA example and hypothetical label subscriptions above, Domino Server identifies
176 all the VNFs can be hosted by Site-3, while VNF1 can be hosted by both Site-2 and Site-3.
177 Note that Site-1 cannot host any of the VNFs listed in the TOSCA file. When a VNF can be hosted
178 by multiple sites, Domino Server picks the site that can host the most number of VNFs. When not
179 all VNFs can be hosted on the same site, the TOSCA file is partitioned into multiple files, one
180 for each site. These files share a common part (e.g, meta-data, policy-types, version,
181 description, virtual resources that are not targeted by any policy rule, etc.). Each site
182 specific file has also a non-common part that only appears in that file (i.e., virtual
183 resources explicitly assigned to that site and the policy rules that accompany those virtual
184 resources.
185
186 In the current Domino convention, if a VNF (or any virtual resource) does not have a policy
187 rule (i.e., it is not specified as a target in any of the policy rules) and it also is not
188 dependent on any VNF (or any virtual resource) that is assigned to another site, that resource
189 is wild carded by default and treated as part of the "common part". Also note that currently
190 Domino does not support all or nothing semantics: if some of the virtual resources are not
191 mappable to any domain because they are targets of policy rules that are not supported by any
192 site, these portions will be excluded while the remaining virtual resources will be still be
193 part of one or more template files to be distributed to hosting sites. When NSDs and VNFDs are
194 prepared, these conventions must be kept in mind. In the future releases, these conventions can
195 change based on the new use cases.
196
197 For the example above, no partitioning would occur as all VNFs are mapped onto site-3;
198 Domino Server simply delivers the Tosca file to Domino Client hosted on site-3. When TOSCA
199 cannot be consumed by a particular site directly, Domino Server can utilize
200 existing translators (e.g., heat-translator) to first translate the template before delivery.
201
202 Internal Processing Pipeline at Domino Server
203 =============================================
204
205 Fig. 2 shows the block diagram for the processing stages of a published TOSCA template.
206 Domino Client issues an RPC call publish(tosca file). Domino Server passes the received tosca
207 file to Label Extractor that outputs resource labels. Domain Mapper uses the extracted labels
208 and tosca file to find mappings from resources to domains as well as the resource dependencies.
209 Resource to domain mappings and resource dependencies are utilized to partition the
210 orchestration template into individual resource orchestration templates (one for each domain).
211 If a translation is required (e.g., TOSCA to HOT), individual resource orchestration templates
212 are first translated and then placed on a template distribution workflow based on resource
213 dependencies. Message Sender block in the server takes one distribution task at a time from the
214 workflow generator and pushes the orchestration template to the corresponding Domino Client.
215
216 .. _fig-pipe:
217
218 .. figure:: ../etc/domino_server_processing.png
219     :width: 400px
220     :align: center
221     :height: 350px
222     :alt: alternate text
223     :figclass: align-center
224
225     Domino Service Processing Pipeline
226
227 Resource Scheduling
228 ===================
229
230 Domino Service currently supports maximum packing strategy when a  virtual resource type can
231 be hosted on multiple candidate sites. Initially, Domino Scheduler identifies virtual resources
232 that has only one feasible site for hosting. Each such virtual resource is trivially assigned
233 to its only feasible site. The remaining virtual resources with multiple candidate locations
234 are sequentially allocated to one of their candidate locations that has the most virtual
235 resource assignments so far. Note that wildcarded resources are assigned to all sites. To
236 prevent wildcarding within the current release, (i) all sites must subscribed to a base policy
237 with a dummy key-value pair defined under the properties tab and (ii) all the independent
238 resources must be specified as target of that policy in NSD or VNFD file.
239
240 ============================================
241 Domino and API Usage Guidelines and Examples
242 ============================================
243
244 Using domino-cli Client
245 =======================
246
247 Prerequisites:
248
249 1. Make sure that domino-cli.py is in +x mode.
250
251 2. Change directory to where domino-cli.py, DominoClient.py and DominoServer.py are located or include file path in the PATH environment variable.
252
253 3. Start the Domino Server:
254
255 .. code-block:: bash
256
257   ./DominoServer.py --log=debug
258
259 4. Start the Domino Client:
260
261 .. code-block:: bash
262
263   ./DominoClient.py -p <portnumber> --cliport <cli-portnumber> --log=debug
264
265 Note1: The default log level is WARNING and omitting --log option will lead to minimal/no logging on the console
266
267 Note2: domino_conf.py file includes most of the default values
268
269 * Registration Command
270
271 Command line input:
272
273 .. code-block:: bash
274
275   ./domino-cli.py <cli-portnumber> register
276
277 This message has the following fields that are automatically filled in.
278
279 .. code-block:: bash
280
281   Message Type (= REGISTER)
282   DESIRED UDID (= if not allocated, this will be assigned as Unique Domino ID)
283   Sequence Number (=incremented after each RPC call)
284   IP ADDR (= IP address of DOMINO Client to be used by DOMINO Server for future RPC Calls to this client)
285   TCP PORT (= TCP port of DOMINO Client to be used by DOMINO Server for future RPC Calls to this client)
286   Supported Templates (= Null, this field not used currently)
287
288 * Heart Beat Command
289
290 Command line input:
291
292 .. code-block:: bash
293
294   ./domino-cli.py <cli-portnumber> heartbeat
295
296 This message has the following fields that are automatically filled in.
297
298 .. code-block:: bash
299
300   Message Type (= HEART_BEAT)
301   UDID (= Unique Domino ID assigned during registration)
302   Sequence Number (=incremented after each RPC call)
303
304 * Label and Template Type Subscription Command
305
306 .. code-block:: bash
307
308   ./domino-cli.py <cli-portnumber> subscribe -l <labelname> -t <templatetype>
309
310 Note that -l can be substituted by --label and -t can be substituted by --ttype.
311
312 More than one label or template type can be subscribed within the same command line as comma separated labels or template types
313
314 .. code-block:: bash
315
316   ./domino-cli.py <cli-portnumber> subscribe -l <label1>,<label2>,<labeln> -t <ttype1>,<ttype2>,<ttypen>
317
318 To subscribe more than one label or template type, one can also repeat the options -l and -t, e.g.:
319
320 .. code-block:: bash
321
322   ./domino-cli.py <cli-portnumber> subscribe -l <label1> -l <label2> -l <labeln> -t <ttype1> -t <ttype2> -t <ttypen>
323
324 It is safe to call subscribe command multiple times with duplicate labels.
325
326 This message has the following fields that are automatically filled in.
327
328 .. code-block:: bash
329
330   Message Type (= SUBSCRIBE)
331   UDID (= Unique Domino ID assigned during registration)
332   Sequence Number (=incremented after each RPC call)
333   Template Operation (= APPEND)
334   Label Operation (= APPEND)
335
336 The following fields are filled in based on arguments passed on via -l/--label and -t/--ttype flags
337
338 Subscribe RPC also supports options for label using
339   --lop=APPEND/DELETE/OVERWRITE
340 and for supported template types using
341   --top=APPEND/DELETE/OVERWRITE.
342 When unspecified, the default is APPEND.
343 DELETE deletes existing labels (template types) specified in the current call via key -l/--label (-t/--ttype).
344 OVERWRITE removes the current set of labels (template types) and sets it to the new set of values passed in the same RPC call.
345
346 By default, no translation service is provided. Currently, only TOSCA to Heat
347 Orchestration Template (HOT) translation is supported using OpenStack
348 heat-translator library. A domain that requires HOT files must subscribe HOT
349 template type using
350
351 .. code-block:: bash
352
353   ./domino-cli.py <cli-portnumber> subscribe -t hot
354
355 * Template Publishing Command
356
357 .. code-block:: bash
358
359   ./domino-cli.py <cli-portnumber> publish -t <toscafile>
360
361 Note that -t can be substituted by --tosca-file.
362
363 If -t or --tosca-file flag is used multiple times, the last tosca file passed as input will be used. This usage is not recommended as undefined/unintended results may emerge as the Domino client will continue to publish.
364
365 This message has the following fields that are automatically filled in.
366
367 .. code-block:: bash
368
369   Message Type (= SUBSCRIBE)
370   UDID (= Unique Domino ID assigned during registration)
371   Sequence Number (=incremented after each RPC call)
372   Template Type (= TOSCA)
373   Template File
374
375 Interactive CLI mode
376 --------------------
377
378 To enter this mode, start Domino Client with interactive console option set as true, i.e., --iac=true:
379
380 .. code-block:: bash
381
382   ./DominoClient -p <portnumber> --iax=true --log=DEBUG
383
384 The rest of the API calls are the same as in the case of using domino-cli.py except that at the prompt there is no need to write "domino-cli.py <cli-portnumber>, e.g.,:
385
386 .. code-block:: bash
387
388   >>register
389   >>heartbeat
390   >>subscribe -l <label1> -t <ttype1>
391   >>publish -t <toscafile>
392
393 The interactive CLI mode is mainly supported for manual testing.