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