blob: f471d67143d4ec3d48accb951ec625fad77b715d [file] [log] [blame]
Ralph Knagd2cd31b2018-04-02 16:27:46 -04001.. This work is licensed under a Creative Commons Attribution 4.0 International License.
2.. http://creativecommons.org/licenses/by/4.0
3
4.. _dcae_cli_commands:
5
6dcae_cli Commands
7=================
8
9The dcae_cli tool has four command groups. Each has several
10sub-commands.
11
12``catalog``
13-----------
14
15The ``catalog`` command lists and shows resources (components and
16data_formats) in the ‘onboarding’ catalog (regardless of the owner). A
17resource can have a status of ``staged`` or ``published``. By default,
18only ``published`` resources are displayed. To see ``staged`` resources,
19add the –expanded argument.
20
Lusheng Jieaac78d2018-06-06 00:20:03 -040021+------------------------------+----------------------------------------+
22| Catalog Status | Meaning |
23+==============================+========================================+
24| staged | resource has be added |
25| | (and validated), but |
26| | is under development |
27+------------------------------+----------------------------------------+
28| staged | data_formats can only be referenced in |
29| | their owners component specs |
30+------------------------------+----------------------------------------+
31| staged | components can only be deployed by |
32| | their owners |
33+------------------------------+----------------------------------------+
34| published | resource has been |
35| | tested and can be |
36| | shared |
37+------------------------------+----------------------------------------+
38| | published data_formats can be used in |
39| | anyone's component spec |
40+------------------------------+----------------------------------------+
41| | published components and be deployed by|
42| | anyone |
43+------------------------------+----------------------------------------+
Ralph Knagd2cd31b2018-04-02 16:27:46 -040044
45::
46
47 $ dcae_cli catalog --help
48 Usage: dcae_cli catalog [OPTIONS] COMMAND [ARGS]...
49
50 Options:
51 --help Show this message and exit.
52
53 Commands:
54 list Lists resources in the onboarding catalog
55 show Provides more information about resource
56
57List onboarding catalog contents
58~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
59
60::
61
62 $ dcae_cli catalog list
63 Components:
64 +--------------------------------+---------+--------+---------------------------------------------------------------------+--------+-----------+------------+
65 | Name | Version | Type | Description | Owner | Status | Published |
66 +--------------------------------+---------+--------+---------------------------------------------------------------------+--------+-----------+------------+
67 | DcaeSyslogCollector | 2.0.0 | docker | DCAE Control Plane Syslog Collector | sh1986 | published | 2017-08-04 |
68 | cdap.dmaap.spec.example | 0.2.0 | cdap | dmaap spec example. Not a functioning application, only for showing | tc677g | published | 2017-07-24 |
69 | | | | how to pub/sub dmaap. Pretend this is like MAP with VES in and ou.. | | | |
70 | cdap.event.proc.enrich.app | 1.0.3 | cdap | CDAP Event Processing Enrich application | an4828 | published | 2017-09-20 |
71 | cdap.event.proc.map.app | 1.0.3 | cdap | CDAP Event Processing Map application | an4828 | published | 2017-09-20 |
72
73 ...
74
75 Data formats:
76 +--------------------------------------------+---------+-----------------------------------------------------------------------+--------+-----------+------------+
77 | Name | Version | Description | Owner | Status | Published |
78 +--------------------------------------------+---------+-----------------------------------------------------------------------+--------+-----------+------------+
79 | FOI_PM_VHSS_data_format | 1.0.0 | CSV pipe delimited data format for VHSS PM files | sr229c | published | 2017-09-05 |
80 | Map_input | 1.0.0 | The input format for Mapper, that in 1707 is the UCSNMP Collector | an4828 | published | 2017-07-18 |
81 | | | output format, but will support more formats later | | | |
82 | Syslog Collector Parsed Json Message | 1.0.0 | Post processed/parsed collected syslog message | sh1986 | published | 2017-08-04 |
83 | Syslog Collector Syslog Message Input | 1.0.0 | The input message for the DCAE syslog collector is free/unstructured | sh1986 | published | 2017-08-04 |
84 | | | text | | | |
85 | myapp Alert Definition | 1.0.0 | The format of the output event from myapp | an4828 | published | 2017-08-10 |
86 | VES_specification | 5.28.4 | VES spec for 5.4 | vv770d | published | 2017-09-19 |
87
88 ...
89
90Show the contents of an item in the catalog
91~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
92
93::
94
95 $ dcae_cli catalog show FOI_PM_VHSS_data_format
96
97 Data format
98 -----------
99 {
100 "dataformatversion": "1.0.0",
101 "delimitedschema": {
102 "delimiter": "|",
103 "fields": [
104 {
105 "description": "System ID",
106 "fieldtype": "string",
107 "name": "SYSTEM"
108 },
109 {
110 "description": "Date",
111 "fieldtype": "string",
112 "name": "DATE"
113 },
114 {
115 "description": "Time",
116 "fieldtype": "string",
117 "name": "TIME"
118 },
119
120 ...
121
122.. _dcae_cli_component_commands:
123
124--------------
125
126``component``
127-------------
128
129The ``component`` command is for validating (adding), listing, showing,
130verifying generated configuration, running, undeploying, and publishing
131components that YOU own.
132
133::
134
135 $ dcae_cli component --help
136 Usage: dcae_cli component [OPTIONS] COMMAND [ARGS]...
137
138 Options:
139 --help Show this message and exit.
140
141 Commands:
142 add
143 dev Set up component in development for...
144 list Lists components in the onboarding catalog.
145 publish Pushes COMPONENT to the onboarding catalog
146 run Runs the latest version of COMPONENT.
147 show Provides more information about COMPONENT
148 undeploy Undeploys the latest version of COMPONENT.
149
150--------------
151
152.. _dcae_cli_add_a_component:
153
154Add a Component
155~~~~~~~~~~~~~~~
156
157A component must be added to the onboarding catalog in order to be
158tested by the dcae_cli tool. The process of adding a component also
159validates it’s component specification. In order to add a component, the
160component docker image (or CDAP jar) must exist locally.
161
162Components in the onboarding catalog can be run by others, once they are
163``published.`` ``Published`` components cannot be modified or deleted.
164Rather a new version can be created instead.
165
166Validated component specs are used later to generate Tosca models and
167Cloudify Blueprints for the component, which makes them available for
168use in the SDC Tool for creating services.
169
170::
171
172 $ dcae_cli component add --help
173 Usage: dcae_cli component add [OPTIONS] COMPONENT-SPECIFICATION
174
175 Options:
176 --update Updates a previously added component if it has not been already
177 published
178 --help Show this message and exit.
179
180::
181
182 $ dcae_cli component add component-spec.json
183
184--------------
185
186List Components
187~~~~~~~~~~~~~~~
188
189List components in the onboarding catalog that owned by YOUR userid..
190
191::
192
193 $ dcae_cli component list
194 Active profile: solutioning
195 +-------------------------+---------+--------+---------------------------------------------------------------+--------+----------------------------+-----------+
196 | Name | Version | Type | Description | Status | Modified | #Deployed |
197 +-------------------------+---------+--------+---------------------------------------------------------------+--------+----------------------------+-----------+
198 | cdap.helloworld.endnode | 0.8.0 | cdap | cdap test component | staged | 2017-05-23 04:14:35.588075 | 0 |
199 | sandbox.platform.yourapp| 0.5.0 | docker | Web service used as a stand-alone test DCAE service compone.. | staged | 2017-05-23 04:07:44.065610 | 0 |
200 +-------------------------+---------+--------+---------------------------------------------------------------+--------+----------------------------+-----------+
201
202The fields ``Name``, ``Version``, ``Type``, ``Description`` are
203referenced from the component specification’s ``self`` JSON. Use the
Stanislav Chlebece7933a02018-11-15 10:08:31 +0100204“–deployed” argument to see more details on deployed components
Ralph Knagd2cd31b2018-04-02 16:27:46 -0400205
206--------------
207
208.. _dcae_cli_run_a_component:
209
210Run a Component
211~~~~~~~~~~~~~~~
212
213The ``run`` operation is to be used for running your application in its
214container remotely on the activated environment. Docker containers have
215the additional option to run locally on your development machine. If the
216component uses Dmaap, you can specify the Dmaap Connection Object as
217well. Refer to :doc:`Dmaap Connection Object <../component-specification/dmaap-connection-objects>`.
218
219When you run a component via the dcae_cli Tool, remember the blueprint
220has not been created and is not used for deployment.
221
222In order to run the component, the data formats and component must have
223been added to the onboarding catalog.
224
225**DOCKER NOTE:** Make sure the Docker image has been uploaded to the
226shared registry.
227
228A docker component can be run in either ``attached`` or ``unattached``
229mode. (Default is unattached).
230
231+------------------+---------------------------------------------------+
232| Mode | Description |
233+==================+===================================================+
234| attached | component is run in the ‘foreground’, container |
235| | logs are streamed to stdout. Ctrl-C is used to |
236| | terminate the dcae_cli session. |
237+------------------+---------------------------------------------------+
238| unattached | component is run in the ‘background’, container |
239| | logs are viewed via ``docker logs`` command, |
240| | container runs until undeployed with dcae_cli |
241| | ``undeploy`` command. |
242+------------------+---------------------------------------------------+
243
244Run a component in attached mode:
245^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
246
247::
248
249 $ dcae_cli -v component run --attached sandbox.platform.yourapp:0.5.0
250
251 DCAE.Docker | INFO | Running image 'registry.proto.server.com/dcae-rework/yourapp:0.4.0' as 'user1.b7287639-37f5-4f25-8d54-8a2087f4c8da.0-5-0.sandbox-platform-yourapp'
252 DCAE.Docker.user1.b7287639-37f5-4f25-8d54-8a2087f4c8da.0-5-0.sandbox-platform-yourapp | INFO | Consul host: yourconsulhost.com
253
254 DCAE.Docker.user1.b7287639-37f5-4f25-8d54-8a2087f4c8da.0-5-0.sandbox-platform-yourapp | INFO | service name: mh677g.b7287639-37f5-4f25-8d54-8a2087f4c8da.0-5-0.sandbox-platform-yourapp
255
256 DCAE.Docker.user1.b7287639-37f5-4f25-8d54-8a2087f4c8da.0-5-0.sandbox-platform-yourapp | INFO | Generated config: {'multiplier': 3}
257
258 DCAE.Docker.user1.b7287639-37f5-4f25-8d54-8a2087f4c8da.0-5-0.sandbox-platform-yourapp | INFO | * Running on http://0.0.0.0:8080/ (Press CTRL+C to quit)
259
260 DCAE.Docker.user1.b7287639-37f5-4f25-8d54-8a2087f4c8da.0-5-0.sandbox-platform-yourapp | INFO | 135.205.226.140 - - [24/May/2017 03:37:57] "GET /health HTTP/1.1" 200 -
261
262 DCAE.Docker.user1.b7287639-37f5-4f25-8d54-8a2087f4c8da.0-5-0.sandbox-platform-yourapp | INFO | 135.205.226.140 - - [24/May/2017 03:38:12] "GET /health HTTP/1.1" 200 -
263
264Hit Ctrl-C to terminate session.
265
266::
267
268 ^CDCAE.Docker | INFO | Stopping container 'user1.b7287639-37f5-4f25-8d54-8a2087f4c8da.0-5-0.sandbox-platform-yourapp' and cleaning up...
269
270Run a component in unattached mode:
271^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
272
273::
274
275 $ dcae_cli -v component run sandbox.platform.yourapp:0.5.0
276 DCAE.Docker | INFO | Running image 'registry.proto.server.com/dcae-rework/yourapp:0.4.0' as 'user1.4811da0e-08d5-429f-93bf-bf6814924577.0-5-0.sandbox-platform-yourapp'
277 DCAE.Run | INFO | Deployed /user1.4811da0e-08d5-429f-93bf-bf6814924577.0-5-0.sandbox-platform-yourapp
278
279**NOTE** You must undeploy this component when finished testing. This is
280important to conserve resources in the environment.
281
282Run a component that subscribes to Dmaap MR or DR
283^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
284
285::
286
287 $ dcae_cli -v component run --attached --dmaap-file $dmaap-connection-file sandbox.platform.yourapp:0.5.0
288
289--------------
290
291Undeploy a Component
292~~~~~~~~~~~~~~~~~~~~
293
294The ``undeploy`` command is used to undeploy any instance of a specified
295component/version that you have deployed. This includes cleaning up the
296configuration.
297
298::
299
300 $ dcae_cli component undeploy sandbox.platform.yourapp:0.5.0
301 DCAE.Undeploy | WARNING | Undeploying components: 1
302 DCAE.Undeploy | WARNING | Undeployed components: 1
303
304--------------
305
306Publish a component
307~~~~~~~~~~~~~~~~~~~
308
309| Once a component has been tested, it should be published in the
310 onboarding catalog using the ``publish`` sub-command .
311| Publishing will change the status of the component (from ``staged`` to
312 ``published``), indicating that it has been tested, and making it
313 accessible for other developers to use.
314
315**Note** Before a component can be published, all data_formats that it
316references must be published.
317
318::
319
320 dcae_cli component publish sandbox.platform.yourapp:0.5.0
321
322--------------
323
324Show a Component
325~~~~~~~~~~~~~~~~
326
327This will print out the contents of a component and is useful to copy a
328component spec.
329
330::
331
332 $ dcae_cli component show
333
334--------------
335
336.. _dcae-cli-run-the-dev-command:
337
338Run the ``dev`` command
339~~~~~~~~~~~~~~~~~~~~~~~
340
341The ``dev`` command is used as part of a process to see the platform
342generated configuration. It established the environment variables and is
343best explained
344:any:`here <dcae-cli-view-the-platform>`.
345
346::
347
348 $ dcae_cli component dev component-spec.json
349 Ready for component development
350
351--------------
352
353.. _dcae_cli_data_format:
354
355``data_format``
356---------------
357
358The ``data_format`` command is for validating (adding), listing,
359showing, publishing data_formats that YOU own. data_formats can also be
360generated with this command.
361
362::
363
364 $ dcae_cli data_format --help
365 Usage: dcae_cli data_format [OPTIONS] COMMAND [ARGS]...
366
367 Options:
368 --help Show this message and exit.
369
370 Commands:
371 add Tracks a data format file DATA_FORMAT-SPECIFICATION...
372 generate Create schema from a file or directory...
373 list Lists all your data formats
374 publish Publishes data format to make available to others...
375 show Provides more information about FORMAT
376
377--------------
378
379.. _dcae_cli_add_a_data_format:
380
381Add a Data Format
382~~~~~~~~~~~~~~~~~
383
384A data_format must be in the onboarding catalog in order to be
385referenced in the component specification. The process of adding a
386data_format also validates it. Data_formats in the onboarding catalog
387can be run by others, once they are ``published.`` ``Published``
388data_formats cannot be modified or deleted. Rather a new version can be
389created instead.
390
391::
392
393 $ dcae_cli data_format add --help
394 Usage: dcae_cli data_format add [OPTIONS] DATA_FORMAT-SPECIFICATION
395
396 Options:
397 --update Updates a previously added data_format if it has not been already
398 published
399 --help Show this message and exit.
400
401::
402
403 dcae_cli data_format add health.json
404
405--------------
406
407List Data Formats
408~~~~~~~~~~~~~~~~~
409
410Only data_formats owned by YOUR userid will be shown.
411
412::
413
414 $ dcae_cli data_format list
415
416 Data formats for user1
417 +---------------------------------+---------+-------------------------------------------+--------+----------------------------+
418 | Name | Version | Description | Status | Modified |
419 +---------------------------------+---------+-------------------------------------------+--------+----------------------------+
420 | sandbox.platform.yourapp.health | 0.1.0 | Data format used for the /health endpoint | staged | 2017-05-23 04:02:38.952799 |
421 +---------------------------------+---------+-------------------------------------------+--------+----------------------------+
422
423The fields ``name``, ``version``, ``description`` are referenced from
424the data format specification’s ``self`` JSON. ``Status`` represents the
425status of the data format in the catalog. See `Publish a Data
426Format <#publish-a-data-format>`__ for more info.
427
428--------------
429
430Show a Data Format
431~~~~~~~~~~~~~~~~~~
432
433This will print out the contents of a data_format and is useful for
434copying a data_format.
435
436::
437
438 $ dcae_cli data_format show
439
440--------------
441
442Publish a Data Format
443~~~~~~~~~~~~~~~~~~~~~
444
445| Once a data_format has been tested (by referencing it in a component
446 spec that has been tested), it should be published in the onboarding
447 catalog using the ``publish`` sub-command .
448| Publishing will change the status of the data_format (from ``staged``
449 to ``published``), indicating that it has been tested, and making it
450 accessible for other developers to use.
451
452::
453
454 $ dcae_cli data_format publish data_format.json
455
456--------------
457
458Generate a Data Format
459~~~~~~~~~~~~~~~~~~~~~~
460
461If you already have a valid input or output file, you can use the
462generate command to create the it’s data format specification.
463
464::
465
466 $ dcae_cli data_format generate name:version file-or-dir-path
467
468--------------
469
470``profiles``
471------------
472
473The\ ``profiles`` command is for creating, deleting, listing, showing,
474activating, and updating (set) profiles. The profile contains
475environment variables used to connect to different environments. This is
476used in the running and deployment of a component using the
477``dcae_cli component run`` or ``dev`` command.
478
479::
480
481 $ dcae_cli profiles --help
482 Usage: dcae_cli profiles [OPTIONS] COMMAND [ARGS]...
483
484 Options:
485 --help Show this message and exit.
486
487 Commands:
488 activate Sets profile NAME as the active profile
489 create Creates a new profile NAME initialized with...
490 delete Deletes profile NAME
491 list Lists available profiles
492 set Updates profile NAME such that KEY=VALUE
493 show Prints the profile dictionary
494
495--------------
496
497List the available profiles
498~~~~~~~~~~~~~~~~~~~~~~~~~~~
499
500::
501
502 $ dcae_cli profiles list
503 * solutioning
504 1710
505 1802
506
507The \* identifies the active profile. ``dcae-cli`` is currently
508installed with profiles for the ``solutioning``, ``1710``, and ``1802``
509environments. They are intended for the following:
510
511+-----------------------------------+-----------------------------------+
512| Environment | Description |
513+===================================+===================================+
514| solutioning | default environment; used for |
515| | initial component developer |
516| | testing with the dcae_cli tool. |
517+-----------------------------------+-----------------------------------+
518| 1710 | FTL3 (Functional Testing Lab 3) |
519| | environment, which represents the |
520| | 1710 release. |
521+-----------------------------------+-----------------------------------+
522| 1802 | FTL3a (Functional Testing Lab 3a) |
523| | environment, which represents the |
524| | 1802 release. |
525+-----------------------------------+-----------------------------------+
526
527--------------
528
529Show the details of a profile
530~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
531
532::
533
534 $ dcae_cli profiles show solutioning
535 {
536 "cdap_broker": "cdap_broker",
537 "config_binding_service": "config_binding_service",
538 "consul_host": "yourconsulhost.com",
539 "docker_host": "yourdockerhost.com:2376"
540 }
541
542--------------
543
544.. _dcae_cli_activate_profile:
545
546Activate a profile
547~~~~~~~~~~~~~~~~~~
548
549To switch among profiles, use the activate sub-command. A subsequent
550``list`` will reveal the change made.
551
552::
553
554 $ dcae_cli profiles activate test
555
556--------------
557
558Create a new profile
559~~~~~~~~~~~~~~~~~~~~
560
561If you want to work in a different environment using the dcae_cli tool,
562you can make your own profile. (The environment must be a working DCAE
563Platform environment).
564
565::
566
567 $ dcae_cli profiles create new-profile
568
569After creating you would assign the variables with the ``set``
570sub-command. Then activate it to use.
571
572--------------
573
574Set variables in a profile
575~~~~~~~~~~~~~~~~~~~~~~~~~~
576
577::
578
579 $ dcae_cli profiles set $profile $key $value
580
581--------------
582
583Delete a profile
584~~~~~~~~~~~~~~~~
585
586::
587
588 $ dcae_cli profiles delete new-profile
589
590