Change nexus values to properties
[appc.git] / appc-adapters / appc-iaas-adapter / appc-iaas-adapter-bundle / src / main / java / org / openecomp / appc / adapter / iaas / ProviderAdapter.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * openECOMP : APP-C
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights
6  *                                              reserved.
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  */
21
22 package org.openecomp.appc.adapter.iaas;
23
24 import java.util.Map;
25
26 import org.openecomp.appc.exceptions.APPCException;
27 import org.openecomp.appc.exceptions.UnknownProviderException;
28 import com.att.cdp.zones.model.Image;
29 import com.att.cdp.zones.model.Server;
30 import com.att.cdp.zones.model.Stack;
31 import org.openecomp.sdnc.sli.SvcLogicContext;
32 import org.openecomp.sdnc.sli.SvcLogicJavaPlugin;
33
34 /**
35  * This interface defines the operations that the provider adapter exposes.
36  * <p>
37  * This interface defines static constant property values that can be used to configure the adapter. These constants are
38  * prefixed with the name PROPERTY_ to indicate that they are configuration properties. These properties are read from
39  * the configuration file for the adapter and are used to define the providers, identity service URLs, and other
40  * information needed by the adapter to interface with an IaaS provider.
41  * </p>
42  */
43 public interface ProviderAdapter extends SvcLogicJavaPlugin {
44
45     /**
46      * The type of provider to be accessed to locate and operate on a virtual machine instance. This is used to load the
47      * correct provider support through the CDP IaaS abstraction layer and can be OpenStackProvider, BareMetalProvider,
48      * or any other supported provider type.
49      */
50     static final String PROPERTY_PROVIDER_TYPE = "org.openecomp.appc.provider.type";
51
52     /**
53      * The adapter maintains a cache of providers organized by the name of the provider, not its type. This is
54      * equivalent to the system or installation name. All regions within the same installation are assumed to be the
55      * same type.
56      */
57     static final String PROPERTY_PROVIDER_NAME = "org.openecomp.appc.provider.name";
58
59     /**
60      * The fully-qualified URL of the instance to be manipulated as it is known to the provider.
61      */
62     static final String PROPERTY_INSTANCE_URL = "org.openecomp.appc.instance.url";
63
64     /**
65      * The fully-qualified URL of the instance to be manipulated as it is known to the provider.
66      */
67     static final String PROPERTY_IDENTITY_URL = "org.openecomp.appc.identity.url";
68     /**
69      * heat stack id to perform operation on stack
70      */
71     static final String PROPERTY_STACK_ID = "org.openecomp.appc.stack.id";
72
73     static final String PROPERTY_SNAPSHOT_ID = "snapshot.id";
74
75     static final String PROPERTY_INPUT_SNAPSHOT_ID = "org.openecomp.appc.snapshot.id";
76
77     static final String DG_OUTPUT_PARAM_NAMESPACE = "output.";
78
79     /**
80      * This method is used to restart an existing virtual machine given the fully qualified URL of the machine.
81      * <p>
82      * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
83      * passed to the method are passed as properties in a map. This method expects the following properties to be
84      * defined:
85      * <dl>
86      * <dt>org.openecomp.appc.provider.type</dt>
87      * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
88      * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
89      * provider types are legal.</dd>
90      * <dt>org.openecomp.appc.instance.url</dt>
91      * <dd>The fully qualified URL of the instance to be restarted, as it is known to the provider (i.e., the self-link
92      * URL of the server)</dd>
93      * </dl>
94      * </p>
95      *
96      * @param properties
97      *            A map of name-value pairs that supply the parameters needed by this method. The properties needed are
98      *            defined above.
99      * @param context
100      *            The service logic context of the graph being executed.
101      * @return The <code>Server</code> object that represents the VM being restarted. The returned server object can be
102      *         inspected for the final state of the server once the restart has been completed. The method does not
103      *         return until the restart has either completed or has failed.
104      * @throws APPCException
105      *             If the server cannot be restarted for some reason
106      */
107     Server restartServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
108
109     /**
110      * This method is used to stop the indicated server
111      * <p>
112      * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
113      * passed to the method are passed as properties in a map. This method expects the following properties to be
114      * defined:
115      * <dl>
116      * <dt>org.openecomp.appc.provider.type</dt>
117      * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
118      * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
119      * provider types are legal.</dd>
120      * <dt>org.openecomp.appc.instance.url</dt>
121      * <dd>The fully qualified URL of the instance to be stopped, as it is known to the provider (i.e., the self-link
122      * URL of the server)</dd>
123      * </dl>
124      * </p>
125      *
126      * @param properties
127      *            A map of name-value pairs that supply the parameters needed by this method. The properties needed are
128      *            defined above.
129      * @param context
130      *            The service logic context of the graph being executed.
131      * @return The <code>Server</code> object that represents the VM being stopped. The returned server object can be
132      *         inspected for the final state of the server once the stop has been completed. The method does not return
133      *         until the stop has either completed or has failed.
134      * @throws APPCException
135      *             If the server cannot be stopped for some reason
136      */
137     Server stopServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
138
139     /**
140      * This method is used to start the indicated server
141      * <p>
142      * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
143      * passed to the method are passed as properties in a map. This method expects the following properties to be
144      * defined:
145      * <dl>
146      * <dt>org.openecomp.appc.provider.type</dt>
147      * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
148      * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
149      * provider types are legal.</dd>
150      * <dt>org.openecomp.appc.instance.url</dt>
151      * <dd>The fully qualified URL of the instance to be started, as it is known to the provider (i.e., the self-link
152      * URL of the server)</dd>
153      * </dl>
154      * </p>
155      *
156      * @param properties
157      *            A map of name-value pairs that supply the parameters needed by this method. The properties needed are
158      *            defined above.
159      * @param context
160      *            The service logic context of the graph being executed.
161      * @return The <code>Server</code> object that represents the VM being started. The returned server object can be
162      *         inspected for the final state of the server once the start has been completed. The method does not return
163      *         until the start has either completed or has failed.
164      * @throws APPCException
165      *             If the server cannot be started for some reason
166      */
167     Server startServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
168
169     /**
170      * This method is used to rebuild the indicated server
171      * <p>
172      * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
173      * passed to the method are passed as properties in a map. This method expects the following properties to be
174      * defined:
175      * <dl>
176      * <dt>org.openecomp.appc.provider.type</dt>
177      * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
178      * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
179      * provider types are legal.</dd>
180      * <dt>org.openecomp.appc.instance.url</dt>
181      * <dd>The fully qualified URL of the instance to be rebuilt, as it is known to the provider (i.e., the self-link
182      * URL of the server)</dd>
183      * </dl>
184      * </p>
185      *
186      * @param properties
187      *            A map of name-value pairs that supply the parameters needed by this method. The properties needed are
188      *            defined above.
189      * @param context
190      *            The service logic context of the graph being executed.
191      * @return The <code>Server</code> object that represents the VM being rebuilt. The returned server object can be
192      *         inspected for the final state of the server once the rebuild has been completed. The method does not
193      *         return until the rebuild has either completed or has failed.
194      * @throws APPCException
195      *             If the server cannot be rebuilt for some reason
196      */
197     Server rebuildServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
198
199     /**
200      * This method is used to terminate the indicated server
201      * <p>
202      * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
203      * passed to the method are passed as properties in a map. This method expects the following properties to be
204      * defined:
205      * <dl>
206      * <dt>org.openecomp.appc.provider.type</dt>
207      * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
208      * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
209      * provider types are legal.</dd>
210      * <dt>org.openecomp.appc.instance.url</dt>
211      * <dd>The fully qualified URL of the instance to be terminate, as it is known to the provider (i.e., the self-link
212      * URL of the server)</dd>
213      * </dl>
214      * </p>
215      *
216      * @param properties
217      *            A map of name-value pairs that supply the parameters needed by this method. The properties needed are
218      *            defined above.
219      * @param context
220      *            The service logic context of the graph being executed.
221      * @return The <code>Server</code> object that represents the VM being rebuilt. The returned server object can be
222      *         inspected for the final state of the server once the rebuild has been completed. The method does not
223      *         return until the rebuild has either completed or has failed.
224      * @throws APPCException
225      *             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.openecomp.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.openecomp.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
266      *            A map of name-value pairs that supply the parameters needed by this method. The properties needed are
267      *            defined above.
268      * @param context
269      *            The service logic context of the graph being executed.
270      * @return The <code>Server</code> object that represents the VM being rebuilt. The returned server object can be
271      *         inspected for the final state of the server once the rebuild has been completed. The method does not
272      *         return until the rebuild has either completed or has failed.
273      * @throws APPCException
274      *             If the server cannot be found for some reason
275      */
276     Server lookupServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
277
278     /**
279      * The
280      *
281      * @param params
282      *            A map of name-value pairs that supply the parameters needed by this method. The properties needed are
283      *            defined above.
284      * @param ctx
285      *            The service logic context of the graph being executed.
286      * @return The <code>Image</code> object that represents the VM being restarted. The returned server object can be
287      *         inspected for the final state of the server once the restart has been completed. The method does not
288      *         return until the restart has either completed or has failed.
289      * @throws APPCException
290      *             If the server cannot be restarted for some reason
291      */
292     Image createSnapshot(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
293
294 }