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