2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2018 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 * ============LICENSE_END=========================================================
24 package org.onap.appc.adapter.iaas;
27 import org.onap.appc.exceptions.APPCException;
28 import org.onap.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.onap.ccsdk.sli.core.sli.SvcLogicContext;
33 import org.onap.ccsdk.sli.core.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 {
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.onap.appc.provider.type";
52 * The adapter maintains a cache of providers organized by the name of the provider, not its type. This is
53 * equivalent to the system or installation name. All regions within the same installation are assumed to be the
56 static final String PROPERTY_PROVIDER_NAME = "org.onap.appc.provider.name";
58 * The fully-qualified URL of the instance to be manipulated as it is known to the provider.
60 static final String PROPERTY_INSTANCE_URL = "org.onap.appc.instance.url";
62 * The fully-qualified URL of the instance to be manipulated as it is known to the provider.
64 static final String PROPERTY_IDENTITY_URL = "org.onap.appc.identity.url";
66 * The Rebuild VM flag is an optional payload parameter for the Evacuate API.
68 static final String PROPERTY_REBUILD_VM = "org.onap.appc.rebuildvm";
70 * The target host id is an optional payload parameter for the Evacuate API.
72 static final String PROPERTY_TARGETHOST_ID = "org.onap.appc.targethost.id";
74 * heat stack id to perform operation on stack
76 static final String PROPERTY_STACK_ID = "org.onap.appc.stack.id";
77 static final String PROPERTY_SNAPSHOT_ID = "snapshot.id";
78 static final String PROPERTY_INPUT_SNAPSHOT_ID = "org.onap.appc.snapshot.id";
79 static final String DG_OUTPUT_PARAM_NAMESPACE = "output.";
80 static final String SKIP_HYPERVISOR_CHECK = "org.onap.appc.skiphypervisorcheck";
81 static final String PAYLOAD = "payload";
82 static final String VOLUME_ID = "org.onap.appc.volumeid";
83 static final String DEVICE = "org.onap.appc.device";
84 static final String REBOOT_TYPE = "org.onap.appc.reboot.type";
85 static final String PROPERTY_REQUEST_SNAPSHOT_ID = "snapshot-id";
87 * This method is used to restart an existing virtual machine given the fully qualified URL of the machine.
89 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
90 * passed to the method are passed as properties in a map. This method expects the following properties to be
93 * <dt>org.onap.appc.provider.type</dt>
94 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
95 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
96 * provider types are legal.</dd>
97 * <dt>org.onap.appc.instance.url</dt>
98 * <dd>The fully qualified URL of the instance to be restarted, as it is known to the provider (i.e., the self-link
99 * URL of the server)</dd>
103 * @param properties A map of name-value pairs that supply the parameters needed by this method. The properties
104 * needed are defined above.
105 * @param context The service logic context of the graph being executed.
106 * @return The <code>Server</code> object that represents the VM being restarted. The returned server object can be
107 * inspected for the final state of the server once the restart has been completed. The method does not
108 * return until the restart has either completed or has failed.
109 * @throws APPCException If the server cannot be restarted for some reason
111 Server restartServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
113 * This method is used to stop the indicated server
115 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
116 * passed to the method are passed as properties in a map. This method expects the following properties to be
119 * <dt>org.onap.appc.provider.type</dt>
120 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
121 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
122 * provider types are legal.</dd>
123 * <dt>org.onap.appc.instance.url</dt>
124 * <dd>The fully qualified URL of the instance to be stopped, as it is known to the provider (i.e., the self-link
125 * URL of the server)</dd>
129 * @param properties A map of name-value pairs that supply the parameters needed by this method. The properties
130 * needed are defined above.
131 * @param context The service logic context of the graph being executed.
132 * @return The <code>Server</code> object that represents the VM being stopped. The returned server object can be
133 * inspected for the final state of the server once the stop has been completed. The method does not return
134 * until the stop has either completed or has failed.
135 * @throws APPCException If the server cannot be stopped for some reason
137 Server stopServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
139 * This method is used to start the indicated server
141 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
142 * passed to the method are passed as properties in a map. This method expects the following properties to be
145 * <dt>org.onap.appc.provider.type</dt>
146 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
147 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
148 * provider types are legal.</dd>
149 * <dt>org.onap.appc.instance.url</dt>
150 * <dd>The fully qualified URL of the instance to be started, as it is known to the provider (i.e., the self-link
151 * URL of the server)</dd>
155 * @param properties A map of name-value pairs that supply the parameters needed by this method. The properties
156 * needed are defined above.
157 * @param context The service logic context of the graph being executed.
158 * @return The <code>Server</code> object that represents the VM being started. The returned server object can be
159 * inspected for the final state of the server once the start has been completed. The method does not return
160 * until the start has either completed or has failed.
161 * @throws APPCException If the server cannot be started for some reason
163 Server startServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
165 * This method is used to rebuild the indicated server
167 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
168 * passed to the method are passed as properties in a map. This method expects the following properties to be
171 * <dt>org.onap.appc.provider.type</dt>
172 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
173 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
174 * provider types are legal.</dd>
175 * <dt>org.onap.appc.instance.url</dt>
176 * <dd>The fully qualified URL of the instance to be rebuilt, as it is known to the provider (i.e., the self-link
177 * URL of the server)</dd>
181 * @param properties A map of name-value pairs that supply the parameters needed by this method. The properties
182 * needed are defined above.
183 * @param context The service logic context of the graph being executed.
184 * @return The <code>Server</code> object that represents the VM being rebuilt. The returned server object can be
185 * inspected for the final state of the server once the rebuild has been completed. The method does not
186 * return until the rebuild has either completed or has failed.
187 * @throws APPCException If the server cannot be rebuilt for some reason
189 Server rebuildServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
191 * This method is used to terminate the indicated server
193 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
194 * passed to the method are passed as properties in a map. This method expects the following properties to be
197 * <dt>org.onap.appc.provider.type</dt>
198 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
199 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
200 * provider types are legal.</dd>
201 * <dt>org.onap.appc.instance.url</dt>
202 * <dd>The fully qualified URL of the instance to be terminate, as it is known to the provider (i.e., the self-link
203 * URL of the server)</dd>
207 * @param properties A map of name-value pairs that supply the parameters needed by this method. The properties
208 * needed are defined above.
209 * @param context The service logic context of the graph being executed.
210 * @return The <code>Server</code> object that represents the VM being rebuilt. The returned server object can be
211 * inspected for the final state of the server once the rebuild has been completed. The method does not
212 * return until the rebuild has either completed or has failed.
213 * @throws APPCException If the server cannot be terminate for some reason
215 Server terminateServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
217 * Returns the symbolic name of the adapter
219 * @return The adapter name
221 String getAdapterName();
222 Server evacuateServer(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
223 Server migrateServer(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
224 Server vmStatuschecker(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
225 Stack terminateStack(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
226 Stack snapshotStack(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
227 Stack restoreStack(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
228 Server attachVolume(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
229 Server dettachVolume(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
231 * This method is used to do the lookup of the indicated server
233 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
234 * passed to the method are passed as properties in a map. This method expects the following properties to be
237 * <dt>org.onap.appc.provider.type</dt>
238 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
239 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
240 * provider types are legal.</dd>
241 * <dt>org.onap.appc.instance.url</dt>
242 * <dd>The fully qualified URL of the instance to be lookup, as it is known to the provider (i.e., the self-link URL
243 * of the server)</dd>
247 * @param properties A map of name-value pairs that supply the parameters needed by this method. The properties
248 * needed are defined above.
249 * @param context The service logic context of the graph being executed.
250 * @return The <code>Server</code> object that represents the VM being rebuilt. The returned server object can be
251 * inspected for the final state of the server once the rebuild has been completed. The method does not
252 * return until the rebuild has either completed or has failed.
253 * @throws APPCException If the server cannot be found for some reason
255 Server lookupServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
259 * @param params A map of name-value pairs that supply the parameters needed by this method. The properties needed
261 * @param ctx The service logic context of the graph being executed.
262 * @return The <code>Image</code> object that represents the VM being restarted. The returned server object can be
263 * inspected for the final state of the server once the restart has been completed. The method does not
264 * return until the restart has either completed or has failed.
265 * @throws APPCException If the server cannot be restarted for some reason
267 Image createSnapshot(Map<String, String> params, SvcLogicContext ctx) throws APPCException;