InventoryNames in ansible-adapter DG
[appc/deployment.git] / docs / APPC Chef Adapter / APPC Chef Adapter.rst
1 .. ============LICENSE_START==========================================
2 .. ===================================================================
3 .. Copyright © 2017 AT&T Intellectual Property. All rights reserved.
4 .. ===================================================================
5 .. Licensed under the Creative Commons License, Attribution 4.0 Intl.  (the "License");
6 .. you may not use this documentation except in compliance with the License.
7 .. You may obtain a copy of the License at
8 .. 
9 ..  https://creativecommons.org/licenses/by/4.0/
10 .. 
11 .. Unless required by applicable law or agreed to in writing, software
12 .. distributed under the License is distributed on an "AS IS" BASIS,
13 .. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 .. See the License for the specific language governing permissions and
15 .. limitations under the License.
16 .. ============LICENSE_END============================================
17 .. ECOMP is a trademark and service mark of AT&T Intellectual Property.
18
19 =================
20 APPC Chef Adapter
21 =================
22
23 This wiki provides  documentation regarding the design, capabilities and usage of the Chef Extension for APPC.
24
25 The Chef Extension for APPC allows management of VNFs that support Chef through the following two additions:
26
27 1. An APPC Chef Adapter 
28 2. Chef Directed Graph (DG)
29
30 Details of each of these two aspects are listed below:
31
32 1. **Chef Directed Graph (DG)**:
33
34 +------------+--------+
35 | Field      | Value  |
36 +============+========+ 
37 | module     | APPC   |
38 +------------+--------+
39 | rpc        | chef   | 
40 +------------+--------+
41 | version    | 3.0.0  | 
42 +------------+--------+
43
44 The inputs that the Chef DG expects are listed  below:
45
46 Table 1: Input Parameters to the Chef Directed Graph
47
48 +---------------------+-----------------------------------------------------------+------------+-------------------------------------------+
49 | Variable Name       |  Description                                              | Type       | Comments                                  |
50 +=====================+===========================================================+============+===========================================+
51 | chef-server-address |  The FQDN of the chef server                              | Mandatory  | Should be provided by APPC.               |
52 +---------------------+-----------------------------------------------------------+------------+-------------------------------------------+
53 | chef-organization   |  The chef organization name                               | Mandatory  | Should be provided by APPC.               |
54 +---------------------+-----------------------------------------------------------+------------+-------------------------------------------+
55 | chef-username       |  The username of the chef organization                    | Mandatory  | Should be provided by APPC.               |
56 +---------------------+-----------------------------------------------------------+------------+-------------------------------------------+
57 | Environment         |  A JSON dictionary representing a Chef Environmentobject. | Optional   | To be provided in template by VNF owner.  |
58 |                     |  If the VNF action requires loading or modifying Chef     |            |                                           |
59 |                     |  environment attributes associated with the VNF, all the  |            |                                           |
60 |                     |  relevant information must be provided in this JSON       |            |                                           |
61 |                     |  dictionary in a structure that conforms to a Chef        |            |                                           |
62 |                     |  Environment Object.                                      |            |                                           |
63 +---------------------+-----------------------------------------------------------+------------+-------------------------------------------+
64 | Node                |  A JSON dictionary representing  a Chef Node Object. The  | Mandatory  | To be provided in template by VNF owner.  |
65 |                     |  Node JSON dictionary must include the run list to be     |            |                                           |
66 |                     |  triggered for the desired VNF action by the push job.    |            |                                           |
67 |                     |  It should also include any attributes that need to be    |            |                                           |
68 |                     |  configured on the Node Object as part of the VNF action. |            |                                           |
69 +---------------------+-----------------------------------------------------------+------------+-------------------------------------------+
70 | NodeList            |  Array of FQDNs that correspond to the endpoints (VMs) of | Mandatory  | To be provided in template.               |
71 |                     |  a VNF registered with the Chef Server that need to       |            |                                           |  
72 |                     |  trigger a chef-client run as part of the desired         |            |                                           | 
73 |                     |  VNF action.                                              |            |                                           | 
74 +---------------------+-----------------------------------------------------------+------------+-------------------------------------------+    
75 | CallbackCapable     |  This field indicates if the chef-client run invoked by   | Optional   | To be provided in template by VNF owner.  |
76 |                     |  push job corresponding to the VNF action is  capable of  |            |                                           |
77 |                     |  posting results on a callback URL.                       |            |                                           |
78 +---------------------+-----------------------------------------------------------+------------+-------------------------------------------+
79 | RequestId           |  A unique string associated with the original request     | Optional   | To be provided by APPC.                   |
80 |                     |  by ONAP. This key-value pair will be provided by ONAP in |            |                                           |
81 |                     |  the environment of the push job request and must be      |            |                                           |
82 |                     |  returned as part of the POST message.                    |            |                                           |
83 +---------------------+-----------------------------------------------------------+------------+-------------------------------------------+
84 | CallbackUrl         |  Currently not used.                                      | Optional   |                                           |
85 +---------------------+-----------------------------------------------------------+------------+-------------------------------------------+    
86 | retryTimes          |  The retry times to query the result of chef push job.    | Mandatory  | To be provided in template by VNF owner.  |
87 +---------------------+-----------------------------------------------------------+------------+-------------------------------------------+
88 | retryInterval       |  The estimate duration to finish the push job. Measure    | Mandatory  | To be provided in template by VNF owner.  |
89 |                     |  by milliseconds.                                         |            |                                           |
90 +---------------------+-----------------------------------------------------------+------------+-------------------------------------------+
91 | GetOutputFlag       |  Flag which indicates whether ONAP should retrieve output | Mandatory  | To be provided in template by VNF owner.  |
92 |                     |  generated in a chef-client run  from Node object         |            |                                           |
93 |                     |  attribute node[‘PushJobOutput’] for this VNF action      |            |                                           |
94 |                     |  (e.g in Audit).                                          |            |                                           |
95 +---------------------+-----------------------------------------------------------+------------+-------------------------------------------+
96 | PushJobFlag         |  Flag which indicates whether ONAP should trigger         | Mandatory  | To be provided in template by VNF owner.  |
97 |                     |  the push job.                                            |            |                                           |
98 +---------------------+-----------------------------------------------------------+------------+-------------------------------------------+
99
100
101 Table 2: Output Variables set by chef DG
102
103 +-----------------------+-----------------------------------------------------------------+
104 | Variable Name         |  Description                                                    |
105 +=======================+=================================================================+
106 | output.status.code    |  Result of the request : 400 if SUCCESS , 200 if FAILURE.       |
107 +-----------------------+-----------------------------------------------------------------+
108 | output.status.message |  If Cookbook finished, set to corresponding message.            |
109 |                       |  If abnormal error, reported in message.                        |
110 +-----------------------+-----------------------------------------------------------------+
111 | output.status.results |  A JSON dictionary with results corresponding to PushJobOutput. |
112 +-----------------------+-----------------------------------------------------------------+
113
114
115 Example:
116
117 |image0|
118
119
120 2. **APPC Chef Adapter**:
121
122 a. Environment set:
123
124   - To connect to the chef server, APPC should load the chef server credentials.
125
126   - The Chef server uses role-based access control to restrict access to objects—nodes, environments, roles, data bags, cookbooks, and so on. So we need load the user's private key to authenticate the permission.
127
128 APPC needs to pre-load the SSL certificate and user private key.
129  
130 The file structure is shown below:
131
132 |image1|
133
134 *chefServerSSL.jks* file saves all the SSL certificates of chef server. In the chef server, please check the chef server setting file at */etc/opscode/chef-server.rb*. The *chef-server.rb* declares where is the SSL certificate. Find the SSL crt file and use keytool to import certificate to the key store. The password of the *chefServerSSL.jks* is "*adminadmin*"
135
136 The user private key file should be saved under */opt/appc/bvc/chef/{{CHEF SERVER FQDN}}/{{ORGANIZATION NAME}}* director and the file name should be *{{username}}.pem*.  Please make sure this user have enough permission on the chef server.
137
138 .. |image0| image:: images/image0.png
139 .. |image1| image:: images/image1.png