8ec28b6f9a6617325996406921886d9ae527c6cf
[domino.git] / docs / userguide / api-documentation.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
3
4 .. image:: ../etc/opnfv-logo.png
5   :height: 40
6   :width: 200
7   :alt: OPNFV
8   :align: left
9 .. these two pipes are to seperate the logo from the first title
10 |
11 |
12 Domino API and Usage
13 ====================
14
15 Using domino-cli Client
16 -----------------------
17
18 Prerequisites:
19
20 1. Make sure that domino-cli.py is in +x mode.
21
22 2. Change directory to where domino-cli.py, DominoClient.py and DominoServer.py are located or include file path in the PATH environment variable.
23
24 3. Start the Domino Server:
25
26 .. code-block:: bash
27
28   ./DominoServer.py --log=debug
29
30 4. Start the Domino Client:
31
32 .. code-block:: bash
33
34   ./DominoClient.py -p <portnumber> --cliport <cli-portnumber> --log=debug
35
36 Note1: The default log level is WARNING and omitting --log option will lead to minimal/no logging on the console
37
38 Note2: domino_conf.py file includes most of the default values
39
40 * Registration Command
41
42 Command line input:
43
44 .. code-block:: bash
45
46   ./domino-cli.py <cli-portnumber> register
47
48 This message has the following fields that are automatically filled in.
49
50 .. code-block:: bash
51
52   Message Type (= REGISTER)
53   DESIRED UDID (= if not allocated, this will be assigned as Unique Domino ID)
54   Sequence Number (=incremented after each RPC call)
55   IP ADDR (= IP address of DOMINO Client to be used by DOMINO Server for future RPC Calls to this client)
56   TCP PORT (= TCP port of DOMINO Client to be used by DOMINO Server for future RPC Calls to this client)
57   Supported Templates (= Null, this field not used currently)
58
59 * Heart Beat Command
60
61 Command line input:
62
63 .. code-block:: bash
64
65   ./domino-cli.py <cli-portnumber> heartbeat
66
67 This message has the following fields that are automatically filled in.
68
69 .. code-block:: bash
70
71   Message Type (= HEART_BEAT)
72   UDID (= Unique Domino ID assigned during registration)
73   Sequence Number (=incremented after each RPC call)
74
75 * Label and Template Type Subscription Command
76
77 .. code-block:: bash
78
79   ./domino-cli.py <cli-portnumber> subscribe -l <labelname> -t <templatetype>
80
81 Note that -l can be substituted by --label and -t can be substituted by --ttype.
82
83 More than one label or template type can be subscribed within the same command line as comma separated labels or template types
84
85 .. code-block:: bash
86
87   ./domino-cli.py <cli-portnumber> subscribe -l <label1>,<label2>,<labeln> -t <ttype1>,<ttype2>,<ttypen>
88
89 To subscribe more than one label or template type, one can also repeat the options -l and -t, e.g.:
90
91 .. code-block:: bash
92
93   ./domino-cli.py <cli-portnumber> subscribe -l <label1> -l <label2> -l <labeln> -t <ttype1> -t <ttype2> -t <ttypen>
94
95 It is safe to call subscribe command multiple times with duplicate labels.
96
97 This message has the following fields that are automatically filled in.
98
99 .. code-block:: bash
100
101   Message Type (= SUBSCRIBE)
102   UDID (= Unique Domino ID assigned during registration)
103   Sequence Number (=incremented after each RPC call)
104   Template Operation (= APPEND)
105   Label Operation (= APPEND)
106
107 The following fields are filled in based on arguments passed on via -l/--label and -t/--ttype flags
108
109 Subscribe RPC also supports options for label using
110   --lop=APPEND/DELETE/OVERWRITE
111 and for supported template types using
112   --top=APPEND/DELETE/OVERWRITE.
113 When unspecified, the default is APPEND.
114 DELETE deletes existing labels (template types) specified in the current call via key -l/--label (-t/--ttype).
115 OVERWRITE removes the current set of labels (template types) and sets it to the new set of values passed in the same RPC call.
116
117 .. code-block:: bash
118
119   Supported Template Types
120   Supported Labels
121
122 * Template Publishing Command
123
124 .. code-block:: bash
125
126   ./domino-cli.py <cli-portnumber> publish -t <toscafile>
127
128 Note that -t can be substituted by --tosca-file.
129
130 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.
131
132 This message has the following fields that are automatically filled in.
133
134 .. code-block:: bash
135
136   Message Type (= SUBSCRIBE)
137   UDID (= Unique Domino ID assigned during registration)
138   Sequence Number (=incremented after each RPC call)
139   Template Type (= TOSCA)
140   Template File
141
142
143 Interactive CLI mode
144 --------------------
145
146 To enter this mode, start Domino Client with interactive console option set as true, i.e., --iac=true:
147
148 .. code-block:: bash
149
150   ./DominoClient -p <portnumber> --iax=true --log=DEBUG
151
152 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.,:
153
154 .. code-block:: bash
155
156   >>register
157   >>heartbeat
158   >>subscribe -l <label1> -t <ttype1>
159   >>publish -t <toscafile>
160
161 The interactive CLI mode is mainly supported for manual testing.
162
163 Revision: _sha1_
164
165 Build date: |today|