2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
22 package org.openecomp.appc.adapter.iaas;
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;
35 * This interface defines the operations that the provider adapter exposes.
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.
43 public interface ProviderAdapter extends SvcLogicJavaPlugin {
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.
50 static final String PROPERTY_PROVIDER_TYPE = "org.openecomp.appc.provider.type";
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
57 static final String PROPERTY_PROVIDER_NAME = "org.openecomp.appc.provider.name";
60 * The fully-qualified URL of the instance to be manipulated as it is known to the provider.
62 static final String PROPERTY_INSTANCE_URL = "org.openecomp.appc.instance.url";
65 * The fully-qualified URL of the instance to be manipulated as it is known to the provider.
67 static final String PROPERTY_IDENTITY_URL = "org.openecomp.appc.identity.url";
70 * The Rebuild VM flag is an optional payload parameter for the Evacuate API.
72 static final String PROPERTY_REBUILD_VM = "org.openecomp.appc.rebuildvm";
75 * The target host id is an optional payload parameter for the Evacuate API.
77 static final String PROPERTY_TARGETHOST_ID = "org.openecomp.appc.targethost.id";
80 * heat stack id to perform operation on stack
82 static final String PROPERTY_STACK_ID = "org.openecomp.appc.stack.id";
84 static final String PROPERTY_SNAPSHOT_ID = "snapshot.id";
86 static final String PROPERTY_INPUT_SNAPSHOT_ID = "org.openecomp.appc.snapshot.id";
88 static final String DG_OUTPUT_PARAM_NAMESPACE = "output.";
90 static final String SKIP_HYPERVISOR_CHECK = "org.openecomp.appc.skiphypervisorcheck";
93 * This method is used to restart an existing virtual machine given the fully qualified URL of the machine.
95 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
96 * passed to the method are passed as properties in a map. This method expects the following properties to be
99 * <dt>org.openecomp.appc.provider.type</dt>
100 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
101 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
102 * provider types are legal.</dd>
103 * <dt>org.openecomp.appc.instance.url</dt>
104 * <dd>The fully qualified URL of the instance to be restarted, as it is known to the provider (i.e., the self-link
105 * URL of the server)</dd>
110 * A map of name-value pairs that supply the parameters needed by this method. The properties needed are
113 * 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
118 * If the server cannot be restarted for some reason
120 Server restartServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
123 * This method is used to stop the indicated server
125 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
126 * passed to the method are passed as properties in a map. This method expects the following properties to be
129 * <dt>org.openecomp.appc.provider.type</dt>
130 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
131 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
132 * provider types are legal.</dd>
133 * <dt>org.openecomp.appc.instance.url</dt>
134 * <dd>The fully qualified URL of the instance to be stopped, as it is known to the provider (i.e., the self-link
135 * URL of the server)</dd>
140 * A map of name-value pairs that supply the parameters needed by this method. The properties needed are
143 * The service logic context of the graph being executed.
144 * @return The <code>Server</code> object that represents the VM being stopped. The returned server object can be
145 * inspected for the final state of the server once the stop has been completed. The method does not return
146 * until the stop has either completed or has failed.
147 * @throws APPCException
148 * If the server cannot be stopped for some reason
150 Server stopServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
153 * This method is used to start the indicated server
155 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
156 * passed to the method are passed as properties in a map. This method expects the following properties to be
159 * <dt>org.openecomp.appc.provider.type</dt>
160 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
161 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
162 * provider types are legal.</dd>
163 * <dt>org.openecomp.appc.instance.url</dt>
164 * <dd>The fully qualified URL of the instance to be started, as it is known to the provider (i.e., the self-link
165 * URL of the server)</dd>
170 * A map of name-value pairs that supply the parameters needed by this method. The properties needed are
173 * The service logic context of the graph being executed.
174 * @return The <code>Server</code> object that represents the VM being started. The returned server object can be
175 * inspected for the final state of the server once the start has been completed. The method does not return
176 * until the start has either completed or has failed.
177 * @throws APPCException
178 * If the server cannot be started for some reason
180 Server startServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
183 * This method is used to rebuild the indicated server
185 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
186 * passed to the method are passed as properties in a map. This method expects the following properties to be
189 * <dt>org.openecomp.appc.provider.type</dt>
190 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
191 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
192 * provider types are legal.</dd>
193 * <dt>org.openecomp.appc.instance.url</dt>
194 * <dd>The fully qualified URL of the instance to be rebuilt, as it is known to the provider (i.e., the self-link
195 * URL of the server)</dd>
200 * A map of name-value pairs that supply the parameters needed by this method. The properties needed are
203 * The service logic context of the graph being executed.
204 * @return The <code>Server</code> object that represents the VM being rebuilt. The returned server object can be
205 * inspected for the final state of the server once the rebuild has been completed. The method does not
206 * return until the rebuild has either completed or has failed.
207 * @throws APPCException
208 * If the server cannot be rebuilt for some reason
210 Server rebuildServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
213 * This method is used to terminate the indicated server
215 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
216 * passed to the method are passed as properties in a map. This method expects the following properties to be
219 * <dt>org.openecomp.appc.provider.type</dt>
220 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
221 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
222 * provider types are legal.</dd>
223 * <dt>org.openecomp.appc.instance.url</dt>
224 * <dd>The fully qualified URL of the instance to be terminate, as it is known to the provider (i.e., the self-link
225 * URL of the server)</dd>
230 * A map of name-value pairs that supply the parameters needed by this method. The properties needed are
233 * The service logic context of the graph being executed.
234 * @return The <code>Server</code> object that represents the VM being rebuilt. The returned server object can be
235 * inspected for the final state of the server once the rebuild has been completed. The method does not
236 * return until the rebuild has either completed or has failed.
237 * @throws APPCException
238 * If the server cannot be terminate for some reason
240 Server terminateServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
243 * Returns the symbolic name of the adapter
245 * @return The adapter name
247 String getAdapterName();
249 Server evacuateServer(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
251 Server migrateServer(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
253 Server vmStatuschecker(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
255 Stack terminateStack(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
257 Stack snapshotStack(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
259 Stack restoreStack(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
262 * This method is used to do the lookup of the indicated server
264 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
265 * passed to the method are passed as properties in a map. This method expects the following properties to be
268 * <dt>org.openecomp.appc.provider.type</dt>
269 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
270 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
271 * provider types are legal.</dd>
272 * <dt>org.openecomp.appc.instance.url</dt>
273 * <dd>The fully qualified URL of the instance to be lookup, as it is known to the provider (i.e., the self-link URL
274 * of the server)</dd>
279 * A map of name-value pairs that supply the parameters needed by this method. The properties needed are
282 * The service logic context of the graph being executed.
283 * @return The <code>Server</code> object that represents the VM being rebuilt. The returned server object can be
284 * inspected for the final state of the server once the rebuild has been completed. The method does not
285 * return until the rebuild has either completed or has failed.
286 * @throws APPCException
287 * If the server cannot be found for some reason
289 Server lookupServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
295 * A map of name-value pairs that supply the parameters needed by this method. The properties needed are
298 * The service logic context of the graph being executed.
299 * @return The <code>Image</code> object that represents the VM being restarted. The returned server object can be
300 * inspected for the final state of the server once the restart has been completed. The method does not
301 * return until the restart has either completed or has failed.
302 * @throws APPCException
303 * If the server cannot be restarted for some reason
305 Image createSnapshot(Map<String, String> params, SvcLogicContext ctx) throws APPCException;