blob: 37b8716ad931bfd44732992eb3e5505590490328 [file] [log] [blame]
Scott Seaboltd51cafc2017-09-20 10:33:30 -04001.. _appc_client_library:
Scott Seabolt59153e92017-09-08 15:08:33 -04002
Scott Seaboltd51cafc2017-09-20 10:33:30 -04003==================================================
4Application Controller (APPC) Client Library Guide
5==================================================
6
7
8Revision History
Scott Seaboltf7824832017-10-10 11:27:11 -04009================
Scott Seabolt59153e92017-09-08 15:08:33 -040010
11+--------------+------------+---------------+--------------------------------------------------+
12| Date | Revision | Author | Changes |
13+--------------+------------+---------------+--------------------------------------------------+
Scott Seaboltd51cafc2017-09-20 10:33:30 -040014| 2017-08-22 | 1.0.0 | Paul Miller | First draft |
Scott Seabolt59153e92017-09-08 15:08:33 -040015+--------------+------------+---------------+--------------------------------------------------+
Scott Seabolt59153e92017-09-08 15:08:33 -040016
Scott Seaboltd51cafc2017-09-20 10:33:30 -040017Introduction
18============
Scott Seabolt59153e92017-09-08 15:08:33 -040019
Scott Seaboltd51cafc2017-09-20 10:33:30 -040020Target Audience
21---------------
Scott Seabolt59153e92017-09-08 15:08:33 -040022
Scott Seaboltd51cafc2017-09-20 10:33:30 -040023This document is for an advanced technical audience, which includes engineers and technicians. Document revisions occur with the release of new software versions.
Scott Seabolt59153e92017-09-08 15:08:33 -040024
25Related Documentation
26---------------------
27
Scott Seaboltf7824832017-10-10 11:27:11 -040028For additional information, see
29
30 :ref:`appc_api_guide`
Scott Seabolt59153e92017-09-08 15:08:33 -040031
Scott Seabolt59153e92017-09-08 15:08:33 -040032
33Client Library Background
Scott Seaboltd51cafc2017-09-20 10:33:30 -040034=========================
Scott Seabolt59153e92017-09-08 15:08:33 -040035
Scott Seaboltd51cafc2017-09-20 10:33:30 -040036This guide discusses the Application Controller (APPC) Client Library and how to use it.
Scott Seabolt59153e92017-09-08 15:08:33 -040037
38About the Client Library
39------------------------
40
Scott Seaboltd51cafc2017-09-20 10:33:30 -040041The APPC client library provides consumers of APPC capabilities with a strongly-typed Java interface and encapsulates the actual interaction with the APPC component over an asynchronous messaging channel such as UEB.
Scott Seabolt59153e92017-09-08 15:08:33 -040042
43Consumer Logic
44--------------
45
Scott Seaboltd51cafc2017-09-20 10:33:30 -040046The client application that consumes APPCs capability for VNF lifecycle management (the APPC client library) can be implemented against the lightweight and strongly-typed Java API exposed by the APPC client library. The library does not try to impose architectural constraints upon clients, but instead provides support for different options and styles of API. It is the responsibility of the client application to select the most suitable paradigm to use; for example, a client may choose to use blocking calls as opposed to asynchronous notifications.
Scott Seabolt59153e92017-09-08 15:08:33 -040047
48VNF Lifecycle Management API
49----------------------------
50
Scott Seaboltd51cafc2017-09-20 10:33:30 -040051The API represents a relatively thin layer that consists mainly of business interfaces with strongly-typed APIs and a data object model created for the convenience of the consumer applicationThe original YANG schema used by the APPC component and the underlying MD-SAL layer on the server-side generates these artifacts.
Scott Seabolt59153e92017-09-08 15:08:33 -040052
53APP-C Client Library Flow
54-------------------------
55
56 |image0|
57
Scott Seaboltf7824832017-10-10 11:27:11 -040058Asynchronous Flow
59^^^^^^^^^^^^^^^^^
Scott Seabolt59153e92017-09-08 15:08:33 -040060
Scott Seaboltd51cafc2017-09-20 10:33:30 -040061- The APPC Client Library is called using an asynchronous API using a full command object, which is mapped to a JSON representation.
62- The APPC client calls the UEB client and sends the JSON command to a configured topic.
Scott Seabolt59153e92017-09-08 15:08:33 -040063- The APPC client pulls response messages from the configured topic.
Scott Seaboltd51cafc2017-09-20 10:33:30 -040064- On receiving the response for the command, the APPC client runs the relevant callback method of the consumer ResponseHandler.
Scott Seabolt59153e92017-09-08 15:08:33 -040065
Scott Seaboltf7824832017-10-10 11:27:11 -040066Synchronous Flow
67^^^^^^^^^^^^^^^^
Scott Seabolt59153e92017-09-08 15:08:33 -040068
Scott Seaboltd51cafc2017-09-20 10:33:30 -040069- The APPC Client Library is called using a synchronous API using a full command object, which is mapped to a JSON representation.
70- The APPC client calls the UEB client and sends the JSON command to a configured topic.
Scott Seabolt59153e92017-09-08 15:08:33 -040071- The APPC client pulls response messages from the configured topic.
Scott Seaboltd51cafc2017-09-20 10:33:30 -040072- On receiving the **final** response for the command, the APPC client returns the response object with a final status.
Scott Seabolt59153e92017-09-08 15:08:33 -040073
Scott Seaboltd51cafc2017-09-20 10:33:30 -040074Client Library Usage
75====================
76
77Jar Files
78---------
Scott Seabolt59153e92017-09-08 15:08:33 -040079
Scott Seaboltd51cafc2017-09-20 10:33:30 -040080The Java application that runs the APPC client kit uses the following jar files:
Scott Seabolt59153e92017-09-08 15:08:33 -040081
Scott Seaboltd51cafc2017-09-20 10:33:30 -040082 - com.att.appc.client.client-kit
83 - com.att.appc.client.client-lib
Scott Seabolt59153e92017-09-08 15:08:33 -040084
Scott Seaboltd51cafc2017-09-20 10:33:30 -040085The client library JAR files are located in the repository under ``com\\att\\appc\\client``.
Scott Seabolt59153e92017-09-08 15:08:33 -040086
Scott Seaboltd51cafc2017-09-20 10:33:30 -040087Initialization
Scott Seabolt2406a972017-09-13 17:31:44 -040088--------------
Scott Seabolt59153e92017-09-08 15:08:33 -040089
Scott Seaboltd51cafc2017-09-20 10:33:30 -040090Initialize the client by calling the following method:
Scott Seabolt59153e92017-09-08 15:08:33 -040091
Scott Seaboltd51cafc2017-09-20 10:33:30 -040092``AppcClientServiceFactoryProvider.getFactory(AppcLifeCycleManagerServiceFactory.class).createLifeCycleManagerStateful()``
Scott Seabolt59153e92017-09-08 15:08:33 -040093
Scott Seaboltd51cafc2017-09-20 10:33:30 -040094Specify the following configuration properties as method parameters:
Scott Seabolt59153e92017-09-08 15:08:33 -040095
Scott Seaboltd51cafc2017-09-20 10:33:30 -040096 - "topic.read"
97 - "topic.read.timeout"
98 - "topic.write"
99 - "client.key"
100 - "client.secret"
101 - "client.name"
102 - "client.name.id"
103 - "poolMembers"
104 - client.response.timeout
105 - client.graceful.shutdown.timeout
Scott Seabolt59153e92017-09-08 15:08:33 -0400106
107Shutdown
Scott Seabolt2406a972017-09-13 17:31:44 -0400108--------
Scott Seabolt59153e92017-09-08 15:08:33 -0400109
110Shutdown the client by calling the following method:
111
Scott Seaboltd51cafc2017-09-20 10:33:30 -0400112``void shutdownLifeCycleManager(boolean isForceShutdown)``
Scott Seabolt59153e92017-09-08 15:08:33 -0400113
Scott Seaboltd51cafc2017-09-20 10:33:30 -0400114If the ``isForceShutdown`` flag is set to false, the client shuts down as soon as all responses for pending requests are received, or upon configurable timeout. (``client.graceful.shutdown.timeout``).
Scott Seabolt59153e92017-09-08 15:08:33 -0400115
Scott Seaboltd51cafc2017-09-20 10:33:30 -0400116If the ``isForceShutdown`` flag is set to true, the client shuts down immediately.
Scott Seabolt59153e92017-09-08 15:08:33 -0400117
118Invoking LCM Commands
Scott Seabolt2406a972017-09-13 17:31:44 -0400119---------------------
Scott Seabolt59153e92017-09-08 15:08:33 -0400120
121Invoke the LCM commands by:
122
Scott Seaboltd51cafc2017-09-20 10:33:30 -0400123 - Creating input objects, such as AuditInput, LiveUpgradeInput, with relevant command information.
124 - Executing commands asynchronously, for example:
Scott Seabolt59153e92017-09-08 15:08:33 -0400125
Scott Seaboltd51cafc2017-09-20 10:33:30 -0400126``void liveUpgrade(LiveUpgradeInput liveUpgradeInput, ResponseHandler<LiveUpgradeOutput> listener) throws AppcClientException;)``
Scott Seabolt59153e92017-09-08 15:08:33 -0400127
128In this case, client should implement the ResponseHandler<T> interface.
129
Scott Seaboltd51cafc2017-09-20 10:33:30 -0400130 - Executing commands synchronously, for example:
Scott Seabolt59153e92017-09-08 15:08:33 -0400131
Scott Seaboltd51cafc2017-09-20 10:33:30 -0400132``LiveUpgradeOutput liveUpgrade(LiveUpgradeInput liveUpgradeInput) throws AppcClientException;)``
133
Scott Seabolt59153e92017-09-08 15:08:33 -0400134
135Client API
Scott Seaboltd51cafc2017-09-20 10:33:30 -0400136==========
Scott Seabolt59153e92017-09-08 15:08:33 -0400137
Scott Seaboltd51cafc2017-09-20 10:33:30 -0400138After initializing the client, a returned Object of type LifeCycleManagerStateful defines all the Life Cycle Management APIs
139 supported by APPC.
Scott Seabolt59153e92017-09-08 15:08:33 -0400140
Scott Seaboltd51cafc2017-09-20 10:33:30 -0400141The interface contains two definitions for each RPC: one for Asynchronous call mode, and one for Synchronous.
Scott Seabolt59153e92017-09-08 15:08:33 -0400142
Scott Seaboltd51cafc2017-09-20 10:33:30 -0400143In Asynchronous mode, client consumer should provide a callback function of type:
Scott Seabolt59153e92017-09-08 15:08:33 -0400144
Scott Seaboltd51cafc2017-09-20 10:33:30 -0400145 ``ResponseHandler<RPC-NAMEOutput>``
Scott Seabolt59153e92017-09-08 15:08:33 -0400146
Scott Seaboltd51cafc2017-09-20 10:33:30 -0400147where ``RPC-NAME`` is the command name, such as Audit or Snapshot.
Scott Seabolt59153e92017-09-08 15:08:33 -0400148
Scott Seaboltd51cafc2017-09-20 10:33:30 -0400149There may be multiple calls to the ResponseHandler for each response returned by APPC. For example, first 100 accept is returned, then 400 success’.
Scott Seabolt59153e92017-09-08 15:08:33 -0400150
151LifeCycleManagerStateful Interface
152----------------------------------
153
Scott Seaboltd51cafc2017-09-20 10:33:30 -0400154Generated from the APPC Yang model, this interface defines the services and request/response requirements for the ECOMP APPC component. For example, for LCM Command Audit, the following is defined:
Scott Seabolt59153e92017-09-08 15:08:33 -0400155
Scott Seaboltd51cafc2017-09-20 10:33:30 -0400156``@RPC(name="audit", outputType=AuditOutput.class)``
Scott Seabolt59153e92017-09-08 15:08:33 -0400157
Scott Seaboltd51cafc2017-09-20 10:33:30 -0400158``AuditOutput audit(AuditInput auditInput) throws AppcClientException;``
Scott Seabolt59153e92017-09-08 15:08:33 -0400159
Scott Seaboltd51cafc2017-09-20 10:33:30 -0400160For a Synchronous call to Audit, the consumer thread is blocked until a response is received or a timeout exception is thrown.
Scott Seabolt59153e92017-09-08 15:08:33 -0400161
Scott Seaboltd51cafc2017-09-20 10:33:30 -0400162``@RPC(name="audit", outputType=AuditOutput.class)``
Scott Seabolt59153e92017-09-08 15:08:33 -0400163
Scott Seaboltd51cafc2017-09-20 10:33:30 -0400164``void audit(AuditInput auditInput, ResponseHandler<AuditOutput> listener) throws AppcClientException;``
Scott Seabolt59153e92017-09-08 15:08:33 -0400165
Scott Seaboltd51cafc2017-09-20 10:33:30 -0400166For an Asynchronous call to Audit, a callback should be provided so that when a response is received the listener is called.
Scott Seabolt59153e92017-09-08 15:08:33 -0400167
168API documentation
169-----------------
170
Scott Seaboltd51cafc2017-09-20 10:33:30 -0400171The API documentation is also available as a swagger page generated from files at /client-kit/target/resources.
Scott Seabolt59153e92017-09-08 15:08:33 -0400172
173appc-provider-lcm
174-----------------
175
Scott Seaboltd51cafc2017-09-20 10:33:30 -0400176This defines the services and request/response requirements for the APPC component.
Scott Seabolt59153e92017-09-08 15:08:33 -0400177
Scott Seaboltd51cafc2017-09-20 10:33:30 -0400178Methods
Scott Seabolt59153e92017-09-08 15:08:33 -0400179--------
180
Scott Seaboltd51cafc2017-09-20 10:33:30 -0400181The methods should match the actions described in the LCM API Guide. For each method:
Scott Seabolt59153e92017-09-08 15:08:33 -0400182
183**Consumes**
184
Scott Seaboltd51cafc2017-09-20 10:33:30 -0400185This API call consumes the following media types using the**Content-Type** request header:
Scott Seabolt59153e92017-09-08 15:08:33 -0400186
Scott Seaboltd51cafc2017-09-20 10:33:30 -0400187 - ``application/json``
Scott Seabolt59153e92017-09-08 15:08:33 -0400188
189**Request body**
190
191The request body is the action name followed by Input (e.g., AuditInput)
192
193**Return type**
194
Scott Seaboltd51cafc2017-09-20 10:33:30 -0400195The return type is the action name followed by Output (e.g., OutputInput)
Scott Seabolt59153e92017-09-08 15:08:33 -0400196
197**Produces**
198
Scott Seaboltd51cafc2017-09-20 10:33:30 -0400199This API call produces the following media types according to the **Accept** request header; the **Content-Type** response header conveys the media type.
Scott Seabolt59153e92017-09-08 15:08:33 -0400200
Scott Seaboltd51cafc2017-09-20 10:33:30 -0400201 - ``application/json``
Scott Seabolt59153e92017-09-08 15:08:33 -0400202
203**Responses**
204
205200 Successful operation
206
207401 Unauthorized
208
209500 Internal server error
210
211.. |image0| image:: image2.png
212 :width: 5.60495in
213 :height: 4.55272in