First part of onap rename
[appc.git] / appc-adapters / appc-iaas-adapter / appc-iaas-adapter-bundle / src / main / java / org / onap / appc / adapter / iaas / ProviderAdapter.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP : APPC
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Copyright (C) 2017 Amdocs
8  * =============================================================================
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  * 
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  * 
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  * 
21  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22  * ============LICENSE_END=========================================================
23  */
24
25 package org.onap.appc.adapter.iaas;
26
27 import java.util.Map;
28 import org.onap.appc.exceptions.APPCException;
29 import org.onap.appc.exceptions.UnknownProviderException;
30 import com.att.cdp.zones.model.Image;
31 import com.att.cdp.zones.model.Server;
32 import com.att.cdp.zones.model.Stack;
33 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
34 import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
35
36 /**
37  * This interface defines the operations that the provider adapter exposes.
38  * <p>
39  * This interface defines static constant property values that can be used to configure the adapter. These constants are
40  * prefixed with the name PROPERTY_ to indicate that they are configuration properties. These properties are read from
41  * the configuration file for the adapter and are used to define the providers, identity service URLs, and other
42  * information needed by the adapter to interface with an IaaS provider.
43  * </p>
44  */
45 public interface ProviderAdapter extends SvcLogicJavaPlugin {
46
47     /**
48      * The type of provider to be accessed to locate and operate on a virtual machine instance. This is used to load the
49      * correct provider support through the CDP IaaS abstraction layer and can be OpenStackProvider, BareMetalProvider,
50      * or any other supported provider type.
51      */
52     static final String PROPERTY_PROVIDER_TYPE = "org.onap.appc.provider.type";
53
54     /**
55      * The adapter maintains a cache of providers organized by the name of the provider, not its type. This is
56      * equivalent to the system or installation name. All regions within the same installation are assumed to be the
57      * same type.
58      */
59     static final String PROPERTY_PROVIDER_NAME = "org.onap.appc.provider.name";
60
61     /**
62      * The fully-qualified URL of the instance to be manipulated as it is known to the provider.
63      */
64     static final String PROPERTY_INSTANCE_URL = "org.onap.appc.instance.url";
65
66     /**
67      * The fully-qualified URL of the instance to be manipulated as it is known to the provider.
68      */
69     static final String PROPERTY_IDENTITY_URL = "org.onap.appc.identity.url";
70
71     /**
72      * The Rebuild VM flag is an optional payload parameter for the Evacuate API.
73      */
74     static final String PROPERTY_REBUILD_VM = "org.onap.appc.rebuildvm";
75
76     /**
77      * The target host id is an optional payload parameter for the Evacuate API.
78      */
79     static final String PROPERTY_TARGETHOST_ID = "org.onap.appc.targethost.id";
80
81     /**
82      * heat stack id to perform operation on stack
83      */
84     static final String PROPERTY_STACK_ID = "org.onap.appc.stack.id";
85
86     static final String PROPERTY_SNAPSHOT_ID = "snapshot.id";
87
88     static final String PROPERTY_INPUT_SNAPSHOT_ID = "org.onap.appc.snapshot.id";
89
90     static final String DG_OUTPUT_PARAM_NAMESPACE = "output.";
91
92     static final String SKIP_HYPERVISOR_CHECK = "org.onap.appc.skiphypervisorcheck";
93
94     /**
95      * This method is used to restart an existing virtual machine given the fully qualified URL of the machine.
96      * <p>
97      * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
98      * passed to the method are passed as properties in a map. This method expects the following properties to be
99      * defined:
100      * <dl>
101      * <dt>org.onap.appc.provider.type</dt>
102      * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
103      * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
104      * provider types are legal.</dd>
105      * <dt>org.onap.appc.instance.url</dt>
106      * <dd>The fully qualified URL of the instance to be restarted, as it is known to the provider (i.e., the self-link
107      * URL of the server)</dd>
108      * </dl>
109      * </p>
110      *
111      * @param properties A map of name-value pairs that supply the parameters needed by this method. The properties
112      *        needed are defined above.
113      * @param context The service logic context of the graph being executed.
114      * @return The <code>Server</code> object that represents the VM being restarted. The returned server object can be
115      *         inspected for the final state of the server once the restart has been completed. The method does not
116      *         return until the restart has either completed or has failed.
117      * @throws APPCException If the server cannot be restarted for some reason
118      */
119     Server restartServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
120
121     /**
122      * This method is used to stop the indicated server
123      * <p>
124      * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
125      * passed to the method are passed as properties in a map. This method expects the following properties to be
126      * defined:
127      * <dl>
128      * <dt>org.onap.appc.provider.type</dt>
129      * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
130      * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
131      * provider types are legal.</dd>
132      * <dt>org.onap.appc.instance.url</dt>
133      * <dd>The fully qualified URL of the instance to be stopped, as it is known to the provider (i.e., the self-link
134      * URL of the server)</dd>
135      * </dl>
136      * </p>
137      *
138      * @param properties A map of name-value pairs that supply the parameters needed by this method. The properties
139      *        needed are defined above.
140      * @param context The service logic context of the graph being executed.
141      * @return The <code>Server</code> object that represents the VM being stopped. The returned server object can be
142      *         inspected for the final state of the server once the stop has been completed. The method does not return
143      *         until the stop has either completed or has failed.
144      * @throws APPCException If the server cannot be stopped for some reason
145      */
146     Server stopServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
147
148     /**
149      * This method is used to start the indicated server
150      * <p>
151      * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
152      * passed to the method are passed as properties in a map. This method expects the following properties to be
153      * defined:
154      * <dl>
155      * <dt>org.onap.appc.provider.type</dt>
156      * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
157      * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
158      * provider types are legal.</dd>
159      * <dt>org.onap.appc.instance.url</dt>
160      * <dd>The fully qualified URL of the instance to be started, as it is known to the provider (i.e., the self-link
161      * URL of the server)</dd>
162      * </dl>
163      * </p>
164      *
165      * @param properties A map of name-value pairs that supply the parameters needed by this method. The properties
166      *        needed are defined above.
167      * @param context The service logic context of the graph being executed.
168      * @return The <code>Server</code> object that represents the VM being started. The returned server object can be
169      *         inspected for the final state of the server once the start has been completed. The method does not return
170      *         until the start has either completed or has failed.
171      * @throws APPCException If the server cannot be started for some reason
172      */
173     Server startServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
174
175     /**
176      * This method is used to rebuild the indicated server
177      * <p>
178      * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
179      * passed to the method are passed as properties in a map. This method expects the following properties to be
180      * defined:
181      * <dl>
182      * <dt>org.onap.appc.provider.type</dt>
183      * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
184      * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
185      * provider types are legal.</dd>
186      * <dt>org.onap.appc.instance.url</dt>
187      * <dd>The fully qualified URL of the instance to be rebuilt, as it is known to the provider (i.e., the self-link
188      * URL of the server)</dd>
189      * </dl>
190      * </p>
191      *
192      * @param properties A map of name-value pairs that supply the parameters needed by this method. The properties
193      *        needed are defined above.
194      * @param context The service logic context of the graph being executed.
195      * @return The <code>Server</code> object that represents the VM being rebuilt. The returned server object can be
196      *         inspected for the final state of the server once the rebuild has been completed. The method does not
197      *         return until the rebuild has either completed or has failed.
198      * @throws APPCException If the server cannot be rebuilt for some reason
199      */
200     Server rebuildServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
201
202     /**
203      * This method is used to terminate the indicated server
204      * <p>
205      * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
206      * passed to the method are passed as properties in a map. This method expects the following properties to be
207      * defined:
208      * <dl>
209      * <dt>org.onap.appc.provider.type</dt>
210      * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
211      * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
212      * provider types are legal.</dd>
213      * <dt>org.onap.appc.instance.url</dt>
214      * <dd>The fully qualified URL of the instance to be terminate, as it is known to the provider (i.e., the self-link
215      * URL of the server)</dd>
216      * </dl>
217      * </p>
218      *
219      * @param properties A map of name-value pairs that supply the parameters needed by this method. The properties
220      *        needed are defined above.
221      * @param context The service logic context of the graph being executed.
222      * @return The <code>Server</code> object that represents the VM being rebuilt. The returned server object can be
223      *         inspected for the final state of the server once the rebuild has been completed. The method does not
224      *         return until the rebuild has either completed or has failed.
225      * @throws APPCException If the server cannot be terminate for some reason
226      */
227     Server terminateServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
228
229     /**
230      * Returns the symbolic name of the adapter
231      *
232      * @return The adapter name
233      */
234     String getAdapterName();
235
236     Server evacuateServer(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
237
238     Server migrateServer(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
239
240     Server vmStatuschecker(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
241
242     Stack terminateStack(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
243
244     Stack snapshotStack(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
245
246     Stack restoreStack(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
247
248     /**
249      * This method is used to do the lookup of the indicated server
250      * <p>
251      * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
252      * passed to the method are passed as properties in a map. This method expects the following properties to be
253      * defined:
254      * <dl>
255      * <dt>org.onap.appc.provider.type</dt>
256      * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
257      * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
258      * provider types are legal.</dd>
259      * <dt>org.onap.appc.instance.url</dt>
260      * <dd>The fully qualified URL of the instance to be lookup, as it is known to the provider (i.e., the self-link URL
261      * of the server)</dd>
262      * </dl>
263      * </p>
264      *
265      * @param properties A map of name-value pairs that supply the parameters needed by this method. The properties
266      *        needed are defined above.
267      * @param context The service logic context of the graph being executed.
268      * @return The <code>Server</code> object that represents the VM being rebuilt. The returned server object can be
269      *         inspected for the final state of the server once the rebuild has been completed. The method does not
270      *         return until the rebuild has either completed or has failed.
271      * @throws APPCException If the server cannot be found for some reason
272      */
273     Server lookupServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
274
275     /**
276      * The
277      *
278      * @param params A map of name-value pairs that supply the parameters needed by this method. The properties needed
279      *        are defined above.
280      * @param ctx The service logic context of the graph being executed.
281      * @return The <code>Image</code> object that represents the VM being restarted. The returned server object can be
282      *         inspected for the final state of the server once the restart has been completed. The method does not
283      *         return until the restart has either completed or has failed.
284      * @throws APPCException If the server cannot be restarted for some reason
285      */
286     Image createSnapshot(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
287
288 }