1 .. _appc_client_library:
3 ==================================================
4 Application Controller (APPC) Client Library Guide
5 ==================================================
11 +--------------+------------+---------------+--------------------------------------------------+
12 | Date | Revision | Author | Changes |
13 +--------------+------------+---------------+--------------------------------------------------+
14 | 2017-08-22 | 1.0.0 | Paul Miller | First draft |
15 +--------------+------------+---------------+--------------------------------------------------+
16 +--------------+------------+---------------+--------------------------------------------------+
24 This document is for an advanced technical audience, which includes engineers and technicians. Document revisions occur with the release of new software versions.
29 For additional information, see the ONAP Application Controller (APPC) API Guide.
32 Client Library Background
33 =========================
35 This guide discusses the Application Controller (APPC) Client Library and how to use it.
37 About the Client Library
38 ------------------------
40 The 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.
45 The client application that consumes APPC’s 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.
47 VNF Lifecycle Management API
48 ----------------------------
50 The 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 application. The original YANG schema used by the APPC component and the underlying MD-SAL layer on the server-side generates these artifacts.
52 APP-C Client Library Flow
53 -------------------------
59 - The APPC Client Library is called using an asynchronous API using a full command object, which is mapped to a JSON representation.
60 - The APPC client calls the UEB client and sends the JSON command to a configured topic.
61 - The APPC client pulls response messages from the configured topic.
62 - On receiving the response for the command, the APPC client runs the relevant callback method of the consumer ResponseHandler.
66 - The APPC Client Library is called using a synchronous API using a full command object, which is mapped to a JSON representation.
67 - The APPC client calls the UEB client and sends the JSON command to a configured topic.
68 - The APPC client pulls response messages from the configured topic.
69 - On receiving the **final** response for the command, the APPC client returns the response object with a final status.
77 The Java application that runs the APPC client kit uses the following jar files:
79 - com.att.appc.client.client-kit
80 - com.att.appc.client.client-lib
82 The client library JAR files are located in the repository under ``com\\att\\appc\\client``.
87 Initialize the client by calling the following method:
89 ``AppcClientServiceFactoryProvider.getFactory(AppcLifeCycleManagerServiceFactory.class).createLifeCycleManagerStateful()``
91 Specify the following configuration properties as method parameters:
94 - "topic.read.timeout"
101 - “client.response.timeout”
102 - “client.graceful.shutdown.timeout”
107 Shutdown the client by calling the following method:
109 ``void shutdownLifeCycleManager(boolean isForceShutdown)``
111 If 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``).
113 If the ``isForceShutdown`` flag is set to true, the client shuts down immediately.
115 Invoking LCM Commands
116 ---------------------
118 Invoke the LCM commands by:
120 - Creating input objects, such as AuditInput, LiveUpgradeInput, with relevant command information.
121 - Executing commands asynchronously, for example:
123 ``void liveUpgrade(LiveUpgradeInput liveUpgradeInput, ResponseHandler<LiveUpgradeOutput> listener) throws AppcClientException;)``
125 In this case, client should implement the ResponseHandler<T> interface.
127 - Executing commands synchronously, for example:
129 ``LiveUpgradeOutput liveUpgrade(LiveUpgradeInput liveUpgradeInput) throws AppcClientException;)``
135 After initializing the client, a returned Object of type LifeCycleManagerStateful defines all the Life Cycle Management APIs
138 The interface contains two definitions for each RPC: one for Asynchronous call mode, and one for Synchronous.
140 In Asynchronous mode, client consumer should provide a callback function of type:
142 ``ResponseHandler<RPC-NAMEOutput>``
144 where ``RPC-NAME`` is the command name, such as Audit or Snapshot.
146 There may be multiple calls to the ResponseHandler for each response returned by APPC. For example, first 100 ‘accept’ is returned, then 400 ‘success’.
148 LifeCycleManagerStateful Interface
149 ----------------------------------
151 Generated 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:
153 ``@RPC(name="audit", outputType=AuditOutput.class)``
155 ``AuditOutput audit(AuditInput auditInput) throws AppcClientException;``
157 For a Synchronous call to Audit, the consumer thread is blocked until a response is received or a timeout exception is thrown.
159 ``@RPC(name="audit", outputType=AuditOutput.class)``
161 ``void audit(AuditInput auditInput, ResponseHandler<AuditOutput> listener) throws AppcClientException;``
163 For an Asynchronous call to Audit, a callback should be provided so that when a response is received the listener is called.
168 The API documentation is also available as a swagger page generated from files at /client-kit/target/resources.
173 This defines the services and request/response requirements for the APPC component.
178 The methods should match the actions described in the LCM API Guide. For each method:
182 This API call consumes the following media types using the**Content-Type** request header:
184 - ``application/json``
188 The request body is the action name followed by Input (e.g., AuditInput)
192 The return type is the action name followed by Output (e.g., OutputInput)
196 This API call produces the following media types according to the **Accept** request header; the **Content-Type** response header conveys the media type.
198 - ``application/json``
202 200 Successful operation
206 500 Internal server error
208 .. |image0| image:: image2.png