2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Copyright (C) 2017 Amdocs
8 * =============================================================================
9 * Modifications Copyright © 2018 IBM.
10 * =============================================================================
11 * Licensed under the Apache License, Version 2.0 (the "License");
12 * you may not use this file except in compliance with the License.
13 * You may obtain a copy of the License at
15 * http://www.apache.org/licenses/LICENSE-2.0
17 * Unless required by applicable law or agreed to in writing, software
18 * distributed under the License is distributed on an "AS IS" BASIS,
19 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 * See the License for the specific language governing permissions and
21 * limitations under the License.
23 * ============LICENSE_END=========================================================
26 package org.onap.appc.adapter.iaas;
29 import org.onap.appc.exceptions.APPCException;
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 {
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.onap.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.onap.appc.provider.name";
59 * The fully-qualified URL of the instance to be manipulated as it is known to the provider.
61 static final String PROPERTY_INSTANCE_URL = "org.onap.appc.instance.url";
63 * The fully-qualified URL of the instance to be manipulated as it is known to the provider.
65 static final String PROPERTY_IDENTITY_URL = "org.onap.appc.identity.url";
67 * The Rebuild VM flag is an optional payload parameter for the Evacuate API.
69 static final String PROPERTY_REBUILD_VM = "org.onap.appc.rebuildvm";
71 * The target host id is an optional payload parameter for the Evacuate API.
73 static final String PROPERTY_TARGETHOST_ID = "org.onap.appc.targethost.id";
75 * heat stack id to perform operation on stack
77 static final String PROPERTY_STACK_ID = "org.onap.appc.stack.id";
78 static final String PROPERTY_SNAPSHOT_ID = "snapshot.id";
79 static final String PROPERTY_INPUT_SNAPSHOT_ID = "org.onap.appc.snapshot.id";
80 static final String DG_OUTPUT_PARAM_NAMESPACE = "output.";
81 static final String SKIP_HYPERVISOR_CHECK = "org.onap.appc.skiphypervisorcheck";
82 static final String PAYLOAD = "payload";
83 static final String VOLUME_ID = "org.onap.appc.volumeid";
84 static final String DEVICE = "org.onap.appc.device";
85 static final String REBOOT_TYPE = "org.onap.appc.reboot.type";
86 static final String PROPERTY_REQUEST_SNAPSHOT_ID = "snapshot-id";
88 * This method is used to restart an existing virtual machine given the fully qualified URL of the machine.
90 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
91 * passed to the method are passed as properties in a map. This method expects the following properties to be
94 * <dt>org.onap.appc.provider.type</dt>
95 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
96 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
97 * provider types are legal.</dd>
98 * <dt>org.onap.appc.instance.url</dt>
99 * <dd>The fully qualified URL of the instance to be restarted, as it is known to the provider (i.e., the self-link
100 * URL of the server)</dd>
104 * @param properties A map of name-value pairs that supply the parameters needed by this method. The properties
105 * needed are defined above.
106 * @param context The service logic context of the graph being executed.
107 * @return The <code>Server</code> object that represents the VM being restarted. The returned server object can be
108 * inspected for the final state of the server once the restart has been completed. The method does not
109 * return until the restart has either completed or has failed.
110 * @throws APPCException If the server cannot be restarted for some reason
112 Server restartServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
114 * This method is used to stop the indicated server
116 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
117 * passed to the method are passed as properties in a map. This method expects the following properties to be
120 * <dt>org.onap.appc.provider.type</dt>
121 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
122 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
123 * provider types are legal.</dd>
124 * <dt>org.onap.appc.instance.url</dt>
125 * <dd>The fully qualified URL of the instance to be stopped, as it is known to the provider (i.e., the self-link
126 * URL of the server)</dd>
130 * @param properties A map of name-value pairs that supply the parameters needed by this method. The properties
131 * needed are defined above.
132 * @param context The service logic context of the graph being executed.
133 * @return The <code>Server</code> object that represents the VM being stopped. The returned server object can be
134 * inspected for the final state of the server once the stop has been completed. The method does not return
135 * until the stop has either completed or has failed.
136 * @throws APPCException If the server cannot be stopped for some reason
138 Server stopServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
140 * This method is used to start the indicated server
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
146 * <dt>org.onap.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.onap.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>
156 * @param properties A map of name-value pairs that supply the parameters needed by this method. The properties
157 * needed are defined above.
158 * @param context The service logic context of the graph being executed.
159 * @return The <code>Server</code> object that represents the VM being started. The returned server object can be
160 * inspected for the final state of the server once the start has been completed. The method does not return
161 * until the start has either completed or has failed.
162 * @throws APPCException If the server cannot be started for some reason
164 Server startServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
166 * This method is used to rebuild the indicated server
168 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
169 * passed to the method are passed as properties in a map. This method expects the following properties to be
172 * <dt>org.onap.appc.provider.type</dt>
173 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
174 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
175 * provider types are legal.</dd>
176 * <dt>org.onap.appc.instance.url</dt>
177 * <dd>The fully qualified URL of the instance to be rebuilt, as it is known to the provider (i.e., the self-link
178 * URL of the server)</dd>
182 * @param properties A map of name-value pairs that supply the parameters needed by this method. The properties
183 * needed are defined above.
184 * @param context The service logic context of the graph being executed.
185 * @return The <code>Server</code> object that represents the VM being rebuilt. The returned server object can be
186 * inspected for the final state of the server once the rebuild has been completed. The method does not
187 * return until the rebuild has either completed or has failed.
188 * @throws APPCException If the server cannot be rebuilt for some reason
190 Server rebuildServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
192 * This method is used to terminate the indicated server
194 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
195 * passed to the method are passed as properties in a map. This method expects the following properties to be
198 * <dt>org.onap.appc.provider.type</dt>
199 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
200 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
201 * provider types are legal.</dd>
202 * <dt>org.onap.appc.instance.url</dt>
203 * <dd>The fully qualified URL of the instance to be terminate, as it is known to the provider (i.e., the self-link
204 * URL of the server)</dd>
208 * @param properties A map of name-value pairs that supply the parameters needed by this method. The properties
209 * needed are defined above.
210 * @param context The service logic context of the graph being executed.
211 * @return The <code>Server</code> object that represents the VM being rebuilt. The returned server object can be
212 * inspected for the final state of the server once the rebuild has been completed. The method does not
213 * return until the rebuild has either completed or has failed.
214 * @throws APPCException If the server cannot be terminate for some reason
216 Server terminateServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
218 * Returns the symbolic name of the adapter
220 * @return The adapter name
222 String getAdapterName();
223 Server evacuateServer(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
224 Server migrateServer(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
225 Server vmStatuschecker(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
226 Stack terminateStack(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
227 Stack snapshotStack(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
228 Stack restoreStack(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
229 Server attachVolume(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
230 Server dettachVolume(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
232 * This method is used to do the lookup of the indicated server
234 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
235 * passed to the method are passed as properties in a map. This method expects the following properties to be
238 * <dt>org.onap.appc.provider.type</dt>
239 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
240 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
241 * provider types are legal.</dd>
242 * <dt>org.onap.appc.instance.url</dt>
243 * <dd>The fully qualified URL of the instance to be lookup, as it is known to the provider (i.e., the self-link URL
244 * of the server)</dd>
248 * @param properties A map of name-value pairs that supply the parameters needed by this method. The properties
249 * needed are defined above.
250 * @param context The service logic context of the graph being executed.
251 * @return The <code>Server</code> object that represents the VM being rebuilt. The returned server object can be
252 * inspected for the final state of the server once the rebuild has been completed. The method does not
253 * return until the rebuild has either completed or has failed.
254 * @throws APPCException If the server cannot be found for some reason
256 Server lookupServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
260 * @param params A map of name-value pairs that supply the parameters needed by this method. The properties needed
262 * @param ctx The service logic context of the graph being executed.
263 * @return The <code>Image</code> object that represents the VM being restarted. The returned server object can be
264 * inspected for the final state of the server once the restart has been completed. The method does not
265 * return until the restart has either completed or has failed.
266 * @throws APPCException If the server cannot be restarted for some reason
268 Image createSnapshot(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
269 Server rebootServer(Map<String, String> params, SvcLogicContext context) throws APPCException;