Merge "fixed oclip.sh execption on ubuntu"
[cli.git] / docs / cookbook.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
3 .. Copyright 2018 Huawei Technologies Co., Ltd.
4
5 .. _cli_cookbook:
6
7 CLI cook-book
8 =============
9
10 To Run OCLIP on local docker machine
11 ---------------------------------------
12
13 1. Login to docker repository::
14
15     docker login -u docker -p docker nexus3.onap.org:10001
16
17 2. Pull cli docker image and run locally::
18
19     docker run -d --name oclip -e OPEN_CLI_MODE=daemon -p 9090:8080 -p 8080:80 nexus3.onap.org:10001/onap/cli:2.0-STAGING-latest
20
21 Access the CLI console
22 ~~~~~~~~~~~~~~~~~~~~~~
23
24 1. Web command console::
25
26     http://localhost:9090
27
28 2. Linux console::
29
30     docker exec -it oclip oclip
31
32 How to run OCLIP on ubuntu server
33 ---------------------------------
34
35 1. Download install script::
36
37     wget -O ~/oclip-install.sh https://gerrit.onap.org/r/gitweb?p=cli.git;a=blob_plain;f=deployment/zip/installer/install-latest.sh;h=71488dae78a3ecbb27711c95475b4568883f799f;hb=refs/heads/master
38
39 2. Set execution mode and run installer::
40
41     cd ~
42
43     chmod +x oclip-install.sh
44
45     ./oclip-install.sh
46
47 3. verify the installation, by running::
48
49     oclip --version
50
51     NOTE: Make sure OPEN_CLI_HOME is set to /opt/oclip, type
52
53     echo $OPEN_CLI_HOME
54
55 Setup profile
56 -------------
57
58 1. Run oclip console::
59
60     oclip
61
62 2. Create a profile::
63
64     profile <name>
65
66 3. Add basic parameters in to profile::
67
68     set <service-name>:<parameter-name>
69
70     Example: To set the host url for service AAI in ONAP, type 'set AAI:host-url=https://192.168.17.35:30233'
71
72 4. For ONAP beijing version, OCLIP provides default profile named onap-beijing. To use this profile, type::
73
74     profile onap-beijing
75
76     set aai:host-url=<AAI service URL>
77
78     set msb:host-url=<MSB service URL>
79
80     set sdc:host-url=<SDC service URL>
81
82     set so:host-url=<SO service URL>
83
84     NOTE: This step is not applicable for other products, so it could be skipped.
85
86 4. Exit console::
87
88     exit
89
90 Use the existing profile
91 ------------------------
92
93 1. In console mode, type::
94
95     profile <profile-name>
96
97
98 2. In scripting mode, type::
99
100     oclip -c <profile-name> <command name>
101
102     Example: To list the VNF cloud registered in the ONAP, type 'oclip -c onap-beijing cloud-list'.
103
104
105 How to configure OCLIP to use for given product version
106 -------------------------------------------------------
107
108 In console mode
109 ~~~~~~~~~~~~~~~
110
111 1. Identify the available and current product version, type::
112
113     version
114
115     It will report as below:
116
117     CLI version       : 2.0.0 [2018-03-21 11:04 UTC]
118     Available products: [open-cli, onap-beijing, onap-amsterdam, sample-helloworld]
119     Enabled product   : open-cli
120
121 2. To enable a product say onap-beijing, type::
122
123     use onap-beijing
124
125 3. List available commands, type::
126
127     help
128
129 In scripting mode
130 ~~~~~~~~~~~~~~~~~
131
132 1. Identify the available and current product version, type::
133
134     oclip --version
135
136     It will report as below:
137
138     CLI version       : 2.0.0 [2018-03-21 11:04 UTC]
139     Available products: [open-cli, onap-beijing, onap-amsterdam, sample-helloworld]
140     Enabled product   : open-cli
141
142 2. To enable a product say onap-beijing, set environment variable OPEN_CLI_PRODUCT_IN_USE::
143
144     export OPEN_CLI_PRODUCT_IN_USE=onap-beijing
145
146 3. List available commands, type::
147
148     oclip --help