1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
\r
2 .. http://creativecommons.org/licenses/by/4.0
\r
9 The goal of this quickstart is to provide an overview of the
\r
10 functionalities of the ``dcae-cli`` and walk you through the
\r
13 - `Adding data formats <#adding-data-formats>`__
\r
14 - `Adding component <#adding-component>`__
\r
15 - `Setting profile <#setting-profile>`__
\r
16 - `Development and testing <#development-and-testing>`__
\r
17 - `Publishing component <#publishing-component>`__
\r
18 - `Shared catalog <#shared-catalog>`__
\r
20 .. This walk-through uses example projects: COMMENTED OUT FOR NOW TBD
\r
22 .. - `laika <ONAP%20URL%20TBD>`__
\r
23 .. - `CDAP examples <ONAP%20URL%20TBD>`__
\r
25 .. _adding-data-formats:
\r
30 ``data_format`` is the sub-command that is used to execute operations
\r
31 that manage `data formats <../data-formats.md>`__.
\r
35 $ dcae_cli data_format --help
\r
36 Usage: dcae_cli data_format [OPTIONS] COMMAND [ARGS]...
\r
39 --help Show this message and exit.
\r
42 add Tracks a data format file SPECIFICATION...
\r
43 generate Generates a data format file from JSON input examples
\r
44 list Lists all your data formats
\r
45 publish Publishes data format to make publicly...
\r
46 show Provides more information about FORMAT
\r
48 Your data format must be in the catalog in order to use in the component
\r
49 specification. Check the catalog using the ``data_format list``
\r
54 $ dcae_cli data_format list
\r
56 Data formats for mh677g
\r
57 +------+---------+-------------+--------+----------+
\r
58 | Name | Version | Description | Status | Modified |
\r
59 +------+---------+-------------+--------+----------+
\r
61 +------+---------+-------------+--------+----------+
\r
63 The fields ``name``, ``version``, ``description`` are referenced from
\r
64 the data format JSON from the ``self`` JSON.
\r
66 There are no data formats so you must add the data formats that your
\r
67 component specification references. Use the ``data_format add``
\r
70 Here’s an example command:
\r
74 dcae_cli data_format add health.json
\r
76 Verify that it was added:
\r
80 $ dcae_cli data_format list
\r
82 Data formats for mh677g
\r
83 +-------------------------------+---------+-------------------------------------------+--------+----------------------------+
\r
84 | Name | Version | Description | Status | Modified |
\r
85 +-------------------------------+---------+-------------------------------------------+--------+----------------------------+
\r
86 | sandbox.platform.laika.health | 0.1.0 | Data format used for the /health endpoint | staged | 2017-05-23 04:02:38.952799 |
\r
87 +-------------------------------+---------+-------------------------------------------+--------+----------------------------+
\r
89 Go ahead and add other referenced data formats.
\r
91 If you have JSON input you can generate a data format like this:
\r
95 $ dcae_cli data_format --keywords generate myname:1.0.0 myjsoninputfile
\r
97 where ``myname`` is the name of your data format, ``1.0.0`` is an
\r
98 example version, and ``myjsoninputfile`` is an example JSON input file
\r
99 (a directory of input JSON files can also be provided). The
\r
100 ``--keywords`` option adds additional data attributes that can be
\r
101 completed to provide a more detailed data characterization. In any event
\r
102 the output should be reviewed for accuracy. The data format is written
\r
105 .. _adding-component:
\r
110 ``component`` is the sub-command that is used to work with operations
\r
115 $ dcae_cli component --help
\r
116 Usage: dcae_cli component [OPTIONS] COMMAND [ARGS]...
\r
119 --help Show this message and exit.
\r
123 dev Set up component in development for...
\r
124 list Lists components in the public catalog.
\r
125 publish Pushes COMPONENT to the public catalog
\r
126 run Runs the latest version of COMPONENT.
\r
127 show Provides more information about COMPONENT
\r
128 undeploy Undeploys the latest version of COMPONENT.
\r
130 Your component must be accessible from the catalog in order for it to be
\r
131 used. Check the catalog using the ``component list`` sub-command:
\r
135 $ dcae_cli component list
\r
136 Active profile: solutioning
\r
138 +------+---------+------+-------------+--------+----------+-----------+
\r
139 | Name | Version | Type | Description | Status | Modified | #Deployed |
\r
140 +------+---------+------+-------------+--------+----------+-----------+
\r
142 +------+---------+------+-------------+--------+----------+-----------+
\r
144 Use the "--deployed" option to see more details on deployments
\r
146 The fields ``name``, ``version``, ``type``, ``description`` are
\r
147 referenced from the component specification’s ``self`` JSON.
\r
149 There are no components so you must add your component. Use the
\r
150 ``component add`` sub-command. The command is the same for docker and
\r
155 $ dcae_cli component add --help
\r
156 Usage: dcae_cli component add [OPTIONS] SPECIFICATION
\r
159 --update Updates a locally added component if it has not been already
\r
161 --help Show this message and exit.
\r
163 *Note* use the ``--update`` flag to replace existing staged instances.
\r
165 The ``component dev`` sub-command can be useful in validating and
\r
166 experimenting when crafting your component specification. See details
\r
167 about ``dev`` under `Development and
\r
168 testing <#development-and-testing>`__.
\r
170 Once we add the components laika and helloworld, let’s verify that they
\r
175 $ dcae_cli component list
\r
176 Active profile: solutioning
\r
178 +-------------------------+---------+--------+---------------------------------------------------------------+--------+----------------------------+-----------+
\r
179 | Name | Version | Type | Description | Status | Modified | #Deployed |
\r
180 +-------------------------+---------+--------+---------------------------------------------------------------+--------+----------------------------+-----------+
\r
181 | cdap.helloworld.endnode | 0.8.0 | cdap | cdap test component | staged | 2017-05-23 04:14:35.588075 | 0 |
\r
182 | sandbox.platform.laika | 0.5.0 | docker | Web service used as a stand-alone test DCAE service compone.. | staged | 2017-05-23 04:07:44.065610 | 0 |
\r
183 +-------------------------+---------+--------+---------------------------------------------------------------+--------+----------------------------+-----------+
\r
185 Use the "--deployed" option to see more details on deployments
\r
187 .. _setting-profile:
\r
192 ``profile`` is the sub-command that is used to manage profiles. These
\r
193 profiles contain environment variables used to connect to different
\r
194 environments. This is used in the running and deployment of your
\r
195 component using the ``dcae_cli component run`` command. The ``dcae-cli``
\r
196 ships with profiles for ``solutioning`` and ``rework``.
\r
200 $ dcae_cli profiles --help
\r
201 Usage: dcae_cli profiles [OPTIONS] COMMAND [ARGS]...
\r
204 --help Show this message and exit.
\r
207 activate Sets profile NAME as the active profile
\r
208 create Creates a new profile NAME initialized with...
\r
209 delete Deletes profile NAME
\r
210 list Lists available profiles
\r
211 set Updates profile NAME such that KEY=VALUE
\r
212 show Prints the profile dictionary
\r
214 To see what variables a profile contains, you can use the ``show``
\r
215 command, as in ``dcae_cli profiles show PROFILE_NAME``
\r
217 Use the ``create`` sub-command to create your own profile and assign new
\r
218 values using the ``set`` command. Afterwards you will need to
\r
219 ``activate`` the profile you wish to use. First take a look at which
\r
224 $ dcae_cli profiles list
\r
228 The active profile is ``solutioning`` so to activate *rework* to use
\r
233 $ dcae_cli profiles activate rework
\r
239 $ dcae_cli profiles list
\r
243 .. _development-and-testing:
\r
245 Development and testing
\r
246 -----------------------
\r
248 The following operations under the sub-command ``component`` are aimed
\r
249 to help developers with testing:
\r
258 The ``run`` operation is to be used for running your application in its
\r
259 container remotely on the activated environment. Docker containers have
\r
260 the additional option to run locally on your development machine.
\r
262 In order to run your application, you must have added your data formats
\r
263 and your component to your catalog.
\r
265 Let’s verify that your component is in the catalog:
\r
269 $ dcae_cli component list
\r
270 Active profile: solutioning
\r
272 +-------------------------+---------+--------+---------------------------------------------------------------+--------+----------------------------+-----------+
\r
273 | Name | Version | Type | Description | Status | Modified | #Deployed |
\r
274 +-------------------------+---------+--------+---------------------------------------------------------------+--------+----------------------------+-----------+
\r
275 | cdap.helloworld.endnode | 0.8.0 | cdap | cdap test component | staged | 2017-05-23 04:14:35.588075 | 0 |
\r
276 | sandbox.platform.laika | 0.5.0 | docker | Web service used as a stand-alone test DCAE service compone.. | staged | 2017-05-23 04:07:44.065610 | 0 |
\r
277 +-------------------------+---------+--------+---------------------------------------------------------------+--------+----------------------------+-----------+
\r
279 Use the "--deployed" option to see more details on deployments
\r
284 **NOTE** Make sure your Docker image has been uploaded to the shared
\r
287 For Docker containers, you can run either attached or unattached.
\r
288 Attached means that the dcae-cli tool will launch the container and not
\r
289 terminate. The dcae-cli while attached will stream in the logs of the
\r
290 Docker container. Doing a Ctrl-C will terminate the run session which
\r
291 means undeploy your container and force a clean up automatically.
\r
293 Running unattached means simply deploy your container. You will need to
\r
294 execute ``undeploy`` when you are done testing. #### CDAP
\r
296 **NOTE** Make sure your CDAP jar has been uploaded to Nexus.
\r
303 The ``undeploy`` operation is to be used to undeploy any instances of a
\r
304 specified component, version that you have deployed. This includes
\r
305 cleaning up of configuration.
\r
307 Let’s undeploy ``sandbox.platform.laika`` that was deployed from the
\r
312 $ dcae_cli component undeploy sandbox.platform.laika:0.5.0
\r
313 DCAE.Undeploy | WARNING | Undeploying components: 1
\r
314 DCAE.Undeploy | WARNING | Undeployed components: 1
\r
316 .. _walkthrough-dev:
\r
321 The ``dev`` operation is a convenient operation that can be useful for
\r
322 the development and testing of your component. It can be used to:
\r
324 - Help validate your experimental component specification before
\r
325 uploading to the catalog
\r
326 - Generate the application configuration from the component
\r
327 specification and make it available in a test environment. This
\r
328 allows you to view your resulting configuration for local development
\r
329 and to help debug potential related issues.
\r
331 Let’s say you have a component specification called
\r
332 ``component-spec.json``:
\r
336 $ dcae_cli component dev component-spec.json
\r
337 Ready for component development
\r
339 Setup these environment varibles. Run "source env_solutioning":
\r
341 export DOCKER_HOST=SOME_DOCKER_HOST:2376
\r
342 export SERVICE_CHECK_INTERVAL=15s
\r
343 export CONFIG_BINDING_SERVICE=config_binding_service
\r
344 export HOSTNAME=mh677g.95740959-63d2-492a-b964-62a6dce2591d.0-6-0.sandbox-platform-laika
\r
345 export CONSUL_HOST=SOME_CONSUL_HOST
\r
346 export CDAP_BROKER=cdap_broker
\r
347 export SERVICE_NAME=mh677g.95740959-63d2-492a-b964-62a6dce2591d.0-6-0.sandbox-platform-laika
\r
348 export SERVICE_CHECK_TIMEOUT=1s
\r
349 export SERVICE_CHECK_HTTP=/health
\r
351 Press any key to stop and to clean up
\r
353 Your application configuration is now available under the name
\r
354 ``mh677g.95740959-63d2-492a-b964-62a6dce2591d.0-6-0.sandbox-platform-laika``.
\r
356 To view the resulting configuration, you can ``curl`` a request to the
\r
357 config binding service or programmatically fetch your configuration
\r
358 within your application.
\r
360 You need to first query Consul to get the ip and port of config binding
\r
365 curl http://$CONSUL_HOST:8500/v1/catalog/service/$CONFIG_BINDING_SERVICE
\r
368 "ID": "983d5c94-c508-4a8a-9be3-5912bd09786b",
\r
369 "Node": "realsolcnsl00",
\r
370 "Address": "10.226.1.22",
\r
371 "TaggedAddresses": {
\r
372 "lan": "10.226.1.22",
\r
373 "wan": "10.226.1.22"
\r
376 "ServiceID": "5f371f295c90:config_binding_service:10000",
\r
377 "ServiceName": "config_binding_service",
\r
379 "ServiceAddress": "XXXX",
\r
380 "ServicePort": 32770,
\r
381 "ServiceEnableTagOverride": false,
\r
382 "CreateIndex": 487,
\r
392 Currently, the dcae-cli does not have the capability of provisioning
\r
393 topics. In order to do testing with message router topics or with data
\r
394 router feeds, the developer must provision the topic or the feed
\r
395 manually and provide the connection details in the form of a JSON in a
\r
396 file to the dcae-cli. This file is to be passed in when using the
\r
397 ``run`` and ``dev`` commands with the option ``--dmaap-file``.
\r
399 The structure of the DMaaP JSON is an object of config keys to matching
\r
400 topic or feed connection details. Config keys are the ``config_key``
\r
401 values specified in your component specification streams section where
\r
402 the streams must be type message router or data router. Information
\r
403 about the associated connection details can be found on `this
\r
404 page <dmaap-connection-objects.md>`__. Please check it out.
\r
406 For example, if you have a component specification that has the
\r
407 following streams entry:
\r
414 "version": "1.0.0",
\r
415 "type": "message router",
\r
416 "config_key": "ves_connection"
\r
420 Then to deploy and to run your component, you must use the
\r
421 ``--dmaap-file`` command and pass in a JSON that looks like:
\r
426 "ves_connection": {
\r
427 "type": "message_router",
\r
429 "topic_url": "https://we-are-message-router.us:3905/events/some-topic"
\r
434 The provided DMaaP JSON is used to simulate the output of provisioning
\r
435 and will be used to merge with the generated application configuration
\r
438 Your final application config will look like:
\r
443 "streams_publishes": {
\r
444 "ves_connection": {
\r
445 "type": "message_router",
\r
447 "topic_url": "https://we-are-message-router.us:3905/events/some-topic"
\r
453 Data router subscribers
\r
454 ^^^^^^^^^^^^^^^^^^^^^^^
\r
456 Note for data router subscriber testing, you will need the delivery url
\r
457 in order to provision the subscriber to the feed. This is constructed at
\r
458 deployment time and will be provided by the dcae-cli after you deploy
\r
459 your component. The delivery urls will be displayed to the screen:
\r
463 DCAE.Run | WARNING | Your component is a data router subscriber. Here are the delivery urls:
\r
465 some-sub-dr: http://SOME_IP:32838/identity
\r
467 *Sourced at deployment* testing
\r
468 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\r
470 Components may have configuration parameters whose values are to be
\r
471 sourced at deployment time. For example, there are components whose
\r
472 configuration parameters are to come from DTI events which are only
\r
473 available when the component is getting deployed. These configuration
\r
474 parameters must be setup correctly in the `component
\r
475 specification <http://localhost:8000/components/component-specification/docker-specification/#configuration-parameters>`__
\r
476 by setting the property ``sourced_at_deployment`` to ``true`` for each
\r
477 and every parameter that is expected to come in at deployment time.
\r
479 Once your component specification has been updated correctly, you must
\r
480 use the ``--inputs-file`` command-line argument when running the
\r
481 commands ``dev`` or ``run`` with your component. This is to simulate
\r
482 providing the dynamic, deployment time values for those parameters
\r
483 marked as ``sourced_at_deployment``.
\r
485 For example, if your component specification has the following
\r
486 configuration parameters:
\r
493 "sourced_at_deployment": true
\r
496 "name": "static-param",
\r
500 You would have to pass in an inputs file that looks like:
\r
505 "vnf-ip": "10.100.1.100"
\r
508 Your application configuration would look like:
\r
513 "vnf-ip": "10.100.1.100",
\r
517 Publishing component
\r
518 --------------------
\r
520 Once components have their component specifications crafted and
\r
521 validated and have been tested, components should be published in the
\r
522 shared onboarding catalog using the ``publish`` sub-command for both
\r
523 data formats and components. You must publish all data formats of a
\r
524 component before publishing a component.
\r
526 Publishing will change the status of a component, be made accessible for
\r
527 other developers to use, and will generate the associated TOSCA models
\r
528 for use in designing of compositions.
\r
532 dcae_cli component publish sandbox.platform.laika:0.5.0
\r
537 ``catalog`` is the sub-command used to access and to browse the shared
\r
538 onboarding catalog to view components and data formats that have been
\r
539 published and that are being worked on. Components and data formats have
\r
540 two statuses ``staged`` and ``published``.
\r
542 Staged means that the resource has been simply added and is under
\r
543 development. It is to be used only by the owner. Published means that
\r
544 the resource has been fully developed and tested and is ready to be
\r
547 Published components can be deployed by non-owners and published data
\r
548 formats can be used in component specifications of non-owners.
\r
550 There are two available operations:
\r
554 $ dcae_cli catalog --help
\r
555 Usage: dcae_cli catalog [OPTIONS] COMMAND [ARGS]...
\r
558 --help Show this message and exit.
\r
564 Staged components can be viewed under the ``list`` operation using the
\r
565 ``--expanded`` flag.
\r