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;
28 import org.openecomp.appc.exceptions.APPCException;
29 import org.openecomp.appc.exceptions.UnknownProviderException;
30 import com.att.cdp.zones.model.Image;
31 import com.att.cdp.zones.model.Server;
32 import com.att.cdp.zones.model.Stack;
33 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
34 import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
37 * This interface defines the operations that the provider adapter exposes.
39 * This interface defines static constant property values that can be used to configure the adapter. These constants are
40 * prefixed with the name PROPERTY_ to indicate that they are configuration properties. These properties are read from
41 * the configuration file for the adapter and are used to define the providers, identity service URLs, and other
42 * information needed by the adapter to interface with an IaaS provider.
45 public interface ProviderAdapter extends SvcLogicJavaPlugin {
48 * The type of provider to be accessed to locate and operate on a virtual machine instance. This is used to load the
49 * correct provider support through the CDP IaaS abstraction layer and can be OpenStackProvider, BareMetalProvider,
50 * or any other supported provider type.
52 static final String PROPERTY_PROVIDER_TYPE = "org.openecomp.appc.provider.type";
55 * The adapter maintains a cache of providers organized by the name of the provider, not its type. This is
56 * equivalent to the system or installation name. All regions within the same installation are assumed to be the
59 static final String PROPERTY_PROVIDER_NAME = "org.openecomp.appc.provider.name";
62 * The fully-qualified URL of the instance to be manipulated as it is known to the provider.
64 static final String PROPERTY_INSTANCE_URL = "org.openecomp.appc.instance.url";
67 * The fully-qualified URL of the instance to be manipulated as it is known to the provider.
69 static final String PROPERTY_IDENTITY_URL = "org.openecomp.appc.identity.url";
72 * The Rebuild VM flag is an optional payload parameter for the Evacuate API.
74 static final String PROPERTY_REBUILD_VM = "org.openecomp.appc.rebuildvm";
77 * The target host id is an optional payload parameter for the Evacuate API.
79 static final String PROPERTY_TARGETHOST_ID = "org.openecomp.appc.targethost.id";
82 * heat stack id to perform operation on stack
84 static final String PROPERTY_STACK_ID = "org.openecomp.appc.stack.id";
86 static final String PROPERTY_SNAPSHOT_ID = "snapshot.id";
88 static final String PROPERTY_INPUT_SNAPSHOT_ID = "org.openecomp.appc.snapshot.id";
90 static final String DG_OUTPUT_PARAM_NAMESPACE = "output.";
92 static final String SKIP_HYPERVISOR_CHECK = "org.openecomp.appc.skiphypervisorcheck";
95 * This method is used to restart an existing virtual machine given the fully qualified URL of the machine.
97 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
98 * passed to the method are passed as properties in a map. This method expects the following properties to be
101 * <dt>org.openecomp.appc.provider.type</dt>
102 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
103 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
104 * provider types are legal.</dd>
105 * <dt>org.openecomp.appc.instance.url</dt>
106 * <dd>The fully qualified URL of the instance to be restarted, as it is known to the provider (i.e., the self-link
107 * URL of the server)</dd>
111 * @param properties A map of name-value pairs that supply the parameters needed by this method. The properties
112 * needed are defined above.
113 * @param context 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 If the server cannot be restarted for some reason
119 Server restartServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
122 * This method is used to stop the indicated server
124 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
125 * passed to the method are passed as properties in a map. This method expects the following properties to be
128 * <dt>org.openecomp.appc.provider.type</dt>
129 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
130 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
131 * provider types are legal.</dd>
132 * <dt>org.openecomp.appc.instance.url</dt>
133 * <dd>The fully qualified URL of the instance to be stopped, as it is known to the provider (i.e., the self-link
134 * URL of the server)</dd>
138 * @param properties A map of name-value pairs that supply the parameters needed by this method. The properties
139 * needed are defined above.
140 * @param context The service logic context of the graph being executed.
141 * @return The <code>Server</code> object that represents the VM being stopped. The returned server object can be
142 * inspected for the final state of the server once the stop has been completed. The method does not return
143 * until the stop has either completed or has failed.
144 * @throws APPCException If the server cannot be stopped for some reason
146 Server stopServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
149 * This method is used to start the indicated server
151 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
152 * passed to the method are passed as properties in a map. This method expects the following properties to be
155 * <dt>org.openecomp.appc.provider.type</dt>
156 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
157 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
158 * provider types are legal.</dd>
159 * <dt>org.openecomp.appc.instance.url</dt>
160 * <dd>The fully qualified URL of the instance to be started, as it is known to the provider (i.e., the self-link
161 * URL of the server)</dd>
165 * @param properties A map of name-value pairs that supply the parameters needed by this method. The properties
166 * needed are defined above.
167 * @param context The service logic context of the graph being executed.
168 * @return The <code>Server</code> object that represents the VM being started. The returned server object can be
169 * inspected for the final state of the server once the start has been completed. The method does not return
170 * until the start has either completed or has failed.
171 * @throws APPCException If the server cannot be started for some reason
173 Server startServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
176 * This method is used to rebuild the indicated server
178 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
179 * passed to the method are passed as properties in a map. This method expects the following properties to be
182 * <dt>org.openecomp.appc.provider.type</dt>
183 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
184 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
185 * provider types are legal.</dd>
186 * <dt>org.openecomp.appc.instance.url</dt>
187 * <dd>The fully qualified URL of the instance to be rebuilt, as it is known to the provider (i.e., the self-link
188 * URL of the server)</dd>
192 * @param properties A map of name-value pairs that supply the parameters needed by this method. The properties
193 * needed are defined above.
194 * @param context The service logic context of the graph being executed.
195 * @return The <code>Server</code> object that represents the VM being rebuilt. The returned server object can be
196 * inspected for the final state of the server once the rebuild has been completed. The method does not
197 * return until the rebuild has either completed or has failed.
198 * @throws APPCException If the server cannot be rebuilt for some reason
200 Server rebuildServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
203 * This method is used to terminate the indicated server
205 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
206 * passed to the method are passed as properties in a map. This method expects the following properties to be
209 * <dt>org.openecomp.appc.provider.type</dt>
210 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
211 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
212 * provider types are legal.</dd>
213 * <dt>org.openecomp.appc.instance.url</dt>
214 * <dd>The fully qualified URL of the instance to be terminate, as it is known to the provider (i.e., the self-link
215 * URL of the server)</dd>
219 * @param properties A map of name-value pairs that supply the parameters needed by this method. The properties
220 * needed are defined above.
221 * @param context The service logic context of the graph being executed.
222 * @return The <code>Server</code> object that represents the VM being rebuilt. The returned server object can be
223 * inspected for the final state of the server once the rebuild has been completed. The method does not
224 * return until the rebuild has either completed or has failed.
225 * @throws APPCException If the server cannot be terminate for some reason
227 Server terminateServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
230 * Returns the symbolic name of the adapter
232 * @return The adapter name
234 String getAdapterName();
236 Server evacuateServer(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
238 Server migrateServer(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
240 Server vmStatuschecker(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
242 Stack terminateStack(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
244 Stack snapshotStack(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
246 Stack restoreStack(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
249 * This method is used to do the lookup of the indicated server
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
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>
265 * @param properties A map of name-value pairs that supply the parameters needed by this method. The properties
266 * needed are defined above.
267 * @param context The service logic context of the graph being executed.
268 * @return The <code>Server</code> object that represents the VM being rebuilt. The returned server object can be
269 * inspected for the final state of the server once the rebuild has been completed. The method does not
270 * return until the rebuild has either completed or has failed.
271 * @throws APPCException If the server cannot be found for some reason
273 Server lookupServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
278 * @param params A map of name-value pairs that supply the parameters needed by this method. The properties needed
280 * @param ctx The service logic context of the graph being executed.
281 * @return The <code>Image</code> object that represents the VM being restarted. The returned server object can be
282 * inspected for the final state of the server once the restart has been completed. The method does not
283 * return until the restart has either completed or has failed.
284 * @throws APPCException If the server cannot be restarted for some reason
286 Image createSnapshot(Map<String, String> params, SvcLogicContext ctx) throws APPCException;