2 * ============LICENSE_START=======================================================
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
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=========================================================
20 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
23 package org.openecomp.appc.adapter.iaas;
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;
36 * This interface defines the operations that the provider adapter exposes.
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.
44 public interface ProviderAdapter extends SvcLogicJavaPlugin {
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.
51 static final String PROPERTY_PROVIDER_TYPE = "org.openecomp.appc.provider.type";
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
58 static final String PROPERTY_PROVIDER_NAME = "org.openecomp.appc.provider.name";
61 * The fully-qualified URL of the instance to be manipulated as it is known to the provider.
63 static final String PROPERTY_INSTANCE_URL = "org.openecomp.appc.instance.url";
66 * The fully-qualified URL of the instance to be manipulated as it is known to the provider.
68 static final String PROPERTY_IDENTITY_URL = "org.openecomp.appc.identity.url";
71 * The Rebuild VM flag is an optional payload parameter for the Evacuate API.
73 static final String PROPERTY_REBUILD_VM = "org.openecomp.appc.rebuildvm";
76 * The target host id is an optional payload parameter for the Evacuate API.
78 static final String PROPERTY_TARGETHOST_ID = "org.openecomp.appc.targethost.id";
81 * heat stack id to perform operation on stack
83 static final String PROPERTY_STACK_ID = "org.openecomp.appc.stack.id";
85 static final String PROPERTY_SNAPSHOT_ID = "snapshot.id";
87 static final String PROPERTY_INPUT_SNAPSHOT_ID = "org.openecomp.appc.snapshot.id";
89 static final String DG_OUTPUT_PARAM_NAMESPACE = "output.";
91 static final String SKIP_HYPERVISOR_CHECK = "org.openecomp.appc.skiphypervisorcheck";
94 * This method is used to restart an existing virtual machine given the fully qualified URL of the machine.
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
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>
111 * A map of name-value pairs that supply the parameters needed by this method. The properties needed are
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
121 Server restartServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
124 * This method is used to stop the indicated server
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
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>
141 * A map of name-value pairs that supply the parameters needed by this method. The properties needed are
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
151 Server stopServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
154 * This method is used to start the indicated server
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
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>
171 * A map of name-value pairs that supply the parameters needed by this method. The properties needed are
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
181 Server startServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
184 * This method is used to rebuild the indicated server
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
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>
201 * A map of name-value pairs that supply the parameters needed by this method. The properties needed are
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
211 Server rebuildServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
214 * This method is used to terminate the indicated server
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
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>
231 * A map of name-value pairs that supply the parameters needed by this method. The properties needed are
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
241 Server terminateServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
244 * Returns the symbolic name of the adapter
246 * @return The adapter name
248 String getAdapterName();
250 Server evacuateServer(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
252 Server migrateServer(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
254 Server vmStatuschecker(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
256 Stack terminateStack(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
258 Stack snapshotStack(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
260 Stack restoreStack(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
263 * This method is used to do the lookup of the indicated server
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
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>
280 * A map of name-value pairs that supply the parameters needed by this method. The properties needed are
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
290 Server lookupServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
296 * A map of name-value pairs that supply the parameters needed by this method. The properties needed are
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
306 Image createSnapshot(Map<String, String> params, SvcLogicContext ctx) throws APPCException;