2 * ============LICENSE_START=======================================================
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
13 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22 * ============LICENSE_END=========================================================
25 package org.openecomp.appc.adapter.iaas;
29 import org.openecomp.appc.exceptions.APPCException;
30 import org.openecomp.appc.exceptions.UnknownProviderException;
31 import com.att.cdp.zones.model.Image;
32 import com.att.cdp.zones.model.Server;
33 import com.att.cdp.zones.model.Stack;
34 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
35 import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
38 * This interface defines the operations that the provider adapter exposes.
40 * This interface defines static constant property values that can be used to configure the adapter. These constants are
41 * prefixed with the name PROPERTY_ to indicate that they are configuration properties. These properties are read from
42 * the configuration file for the adapter and are used to define the providers, identity service URLs, and other
43 * information needed by the adapter to interface with an IaaS provider.
46 public interface ProviderAdapter extends SvcLogicJavaPlugin {
49 * The type of provider to be accessed to locate and operate on a virtual machine instance. This is used to load the
50 * correct provider support through the CDP IaaS abstraction layer and can be OpenStackProvider, BareMetalProvider,
51 * or any other supported provider type.
53 static final String PROPERTY_PROVIDER_TYPE = "org.openecomp.appc.provider.type";
56 * The adapter maintains a cache of providers organized by the name of the provider, not its type. This is
57 * equivalent to the system or installation name. All regions within the same installation are assumed to be the
60 static final String PROPERTY_PROVIDER_NAME = "org.openecomp.appc.provider.name";
63 * The fully-qualified URL of the instance to be manipulated as it is known to the provider.
65 static final String PROPERTY_INSTANCE_URL = "org.openecomp.appc.instance.url";
68 * The fully-qualified URL of the instance to be manipulated as it is known to the provider.
70 static final String PROPERTY_IDENTITY_URL = "org.openecomp.appc.identity.url";
73 * The Rebuild VM flag is an optional payload parameter for the Evacuate API.
75 static final String PROPERTY_REBUILD_VM = "org.openecomp.appc.rebuildvm";
78 * The target host id is an optional payload parameter for the Evacuate API.
80 static final String PROPERTY_TARGETHOST_ID = "org.openecomp.appc.targethost.id";
83 * heat stack id to perform operation on stack
85 static final String PROPERTY_STACK_ID = "org.openecomp.appc.stack.id";
87 static final String PROPERTY_SNAPSHOT_ID = "snapshot.id";
89 static final String PROPERTY_INPUT_SNAPSHOT_ID = "org.openecomp.appc.snapshot.id";
91 static final String DG_OUTPUT_PARAM_NAMESPACE = "output.";
93 static final String SKIP_HYPERVISOR_CHECK = "org.openecomp.appc.skiphypervisorcheck";
96 * This method is used to restart an existing virtual machine given the fully qualified URL of the machine.
98 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
99 * passed to the method are passed as properties in a map. This method expects the following properties to be
102 * <dt>org.openecomp.appc.provider.type</dt>
103 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
104 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
105 * provider types are legal.</dd>
106 * <dt>org.openecomp.appc.instance.url</dt>
107 * <dd>The fully qualified URL of the instance to be restarted, as it is known to the provider (i.e., the self-link
108 * URL of the server)</dd>
113 * A map of name-value pairs that supply the parameters needed by this method. The properties needed are
116 * The service logic context of the graph being executed.
117 * @return The <code>Server</code> object that represents the VM being restarted. The returned server object can be
118 * inspected for the final state of the server once the restart has been completed. The method does not
119 * return until the restart has either completed or has failed.
120 * @throws APPCException
121 * If the server cannot be restarted for some reason
123 Server restartServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
126 * This method is used to stop the indicated server
128 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
129 * passed to the method are passed as properties in a map. This method expects the following properties to be
132 * <dt>org.openecomp.appc.provider.type</dt>
133 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
134 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
135 * provider types are legal.</dd>
136 * <dt>org.openecomp.appc.instance.url</dt>
137 * <dd>The fully qualified URL of the instance to be stopped, as it is known to the provider (i.e., the self-link
138 * URL of the server)</dd>
143 * A map of name-value pairs that supply the parameters needed by this method. The properties needed are
146 * The service logic context of the graph being executed.
147 * @return The <code>Server</code> object that represents the VM being stopped. The returned server object can be
148 * inspected for the final state of the server once the stop has been completed. The method does not return
149 * until the stop has either completed or has failed.
150 * @throws APPCException
151 * If the server cannot be stopped for some reason
153 Server stopServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
156 * This method is used to start the indicated server
158 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
159 * passed to the method are passed as properties in a map. This method expects the following properties to be
162 * <dt>org.openecomp.appc.provider.type</dt>
163 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
164 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
165 * provider types are legal.</dd>
166 * <dt>org.openecomp.appc.instance.url</dt>
167 * <dd>The fully qualified URL of the instance to be started, as it is known to the provider (i.e., the self-link
168 * URL of the server)</dd>
173 * A map of name-value pairs that supply the parameters needed by this method. The properties needed are
176 * The service logic context of the graph being executed.
177 * @return The <code>Server</code> object that represents the VM being started. The returned server object can be
178 * inspected for the final state of the server once the start has been completed. The method does not return
179 * until the start has either completed or has failed.
180 * @throws APPCException
181 * If the server cannot be started for some reason
183 Server startServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
186 * This method is used to rebuild the indicated server
188 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
189 * passed to the method are passed as properties in a map. This method expects the following properties to be
192 * <dt>org.openecomp.appc.provider.type</dt>
193 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
194 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
195 * provider types are legal.</dd>
196 * <dt>org.openecomp.appc.instance.url</dt>
197 * <dd>The fully qualified URL of the instance to be rebuilt, as it is known to the provider (i.e., the self-link
198 * URL of the server)</dd>
203 * A map of name-value pairs that supply the parameters needed by this method. The properties needed are
206 * The service logic context of the graph being executed.
207 * @return The <code>Server</code> object that represents the VM being rebuilt. The returned server object can be
208 * inspected for the final state of the server once the rebuild has been completed. The method does not
209 * return until the rebuild has either completed or has failed.
210 * @throws APPCException
211 * If the server cannot be rebuilt for some reason
213 Server rebuildServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
216 * This method is used to terminate the indicated server
218 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
219 * passed to the method are passed as properties in a map. This method expects the following properties to be
222 * <dt>org.openecomp.appc.provider.type</dt>
223 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
224 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
225 * provider types are legal.</dd>
226 * <dt>org.openecomp.appc.instance.url</dt>
227 * <dd>The fully qualified URL of the instance to be terminate, as it is known to the provider (i.e., the self-link
228 * URL of the server)</dd>
233 * A map of name-value pairs that supply the parameters needed by this method. The properties needed are
236 * The service logic context of the graph being executed.
237 * @return The <code>Server</code> object that represents the VM being rebuilt. The returned server object can be
238 * inspected for the final state of the server once the rebuild has been completed. The method does not
239 * return until the rebuild has either completed or has failed.
240 * @throws APPCException
241 * If the server cannot be terminate for some reason
243 Server terminateServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
246 * Returns the symbolic name of the adapter
248 * @return The adapter name
250 String getAdapterName();
252 Server evacuateServer(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
254 Server migrateServer(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
256 Server vmStatuschecker(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
258 Stack terminateStack(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
260 Stack snapshotStack(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
262 Stack restoreStack(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
265 * This method is used to do the lookup of the indicated server
267 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
268 * passed to the method are passed as properties in a map. This method expects the following properties to be
271 * <dt>org.openecomp.appc.provider.type</dt>
272 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
273 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
274 * provider types are legal.</dd>
275 * <dt>org.openecomp.appc.instance.url</dt>
276 * <dd>The fully qualified URL of the instance to be lookup, as it is known to the provider (i.e., the self-link URL
277 * of the server)</dd>
282 * A map of name-value pairs that supply the parameters needed by this method. The properties needed are
285 * The service logic context of the graph being executed.
286 * @return The <code>Server</code> object that represents the VM being rebuilt. The returned server object can be
287 * inspected for the final state of the server once the rebuild has been completed. The method does not
288 * return until the rebuild has either completed or has failed.
289 * @throws APPCException
290 * If the server cannot be found for some reason
292 Server lookupServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
298 * A map of name-value pairs that supply the parameters needed by this method. The properties needed are
301 * The service logic context of the graph being executed.
302 * @return The <code>Image</code> object that represents the VM being restarted. The returned server object can be
303 * inspected for the final state of the server once the restart has been completed. The method does not
304 * return until the restart has either completed or has failed.
305 * @throws APPCException
306 * If the server cannot be restarted for some reason
308 Image createSnapshot(Map<String, String> params, SvcLogicContext ctx) throws APPCException;