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 VOLUME_ID = "org.onap.appc.volumeid";
82 static final String DEVICE = "org.onap.appc.device";
84 * This method is used to restart an existing virtual machine given the fully qualified URL of the machine.
86 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
87 * passed to the method are passed as properties in a map. This method expects the following properties to be
90 * <dt>org.onap.appc.provider.type</dt>
91 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
92 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
93 * provider types are legal.</dd>
94 * <dt>org.onap.appc.instance.url</dt>
95 * <dd>The fully qualified URL of the instance to be restarted, as it is known to the provider (i.e., the self-link
96 * URL of the server)</dd>
100 * @param properties A map of name-value pairs that supply the parameters needed by this method. The properties
101 * needed are defined above.
102 * @param context The service logic context of the graph being executed.
103 * @return The <code>Server</code> object that represents the VM being restarted. The returned server object can be
104 * inspected for the final state of the server once the restart has been completed. The method does not
105 * return until the restart has either completed or has failed.
106 * @throws APPCException If the server cannot be restarted for some reason
108 Server restartServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
110 * This method is used to stop the indicated server
112 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
113 * passed to the method are passed as properties in a map. This method expects the following properties to be
116 * <dt>org.onap.appc.provider.type</dt>
117 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
118 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
119 * provider types are legal.</dd>
120 * <dt>org.onap.appc.instance.url</dt>
121 * <dd>The fully qualified URL of the instance to be stopped, as it is known to the provider (i.e., the self-link
122 * URL of the server)</dd>
126 * @param properties A map of name-value pairs that supply the parameters needed by this method. The properties
127 * needed are defined above.
128 * @param context The service logic context of the graph being executed.
129 * @return The <code>Server</code> object that represents the VM being stopped. The returned server object can be
130 * inspected for the final state of the server once the stop has been completed. The method does not return
131 * until the stop has either completed or has failed.
132 * @throws APPCException If the server cannot be stopped for some reason
134 Server stopServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
136 * This method is used to start the indicated server
138 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
139 * passed to the method are passed as properties in a map. This method expects the following properties to be
142 * <dt>org.onap.appc.provider.type</dt>
143 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
144 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
145 * provider types are legal.</dd>
146 * <dt>org.onap.appc.instance.url</dt>
147 * <dd>The fully qualified URL of the instance to be started, as it is known to the provider (i.e., the self-link
148 * URL of the server)</dd>
152 * @param properties A map of name-value pairs that supply the parameters needed by this method. The properties
153 * needed are defined above.
154 * @param context The service logic context of the graph being executed.
155 * @return The <code>Server</code> object that represents the VM being started. The returned server object can be
156 * inspected for the final state of the server once the start has been completed. The method does not return
157 * until the start has either completed or has failed.
158 * @throws APPCException If the server cannot be started for some reason
160 Server startServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
162 * This method is used to rebuild the indicated server
164 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
165 * passed to the method are passed as properties in a map. This method expects the following properties to be
168 * <dt>org.onap.appc.provider.type</dt>
169 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
170 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
171 * provider types are legal.</dd>
172 * <dt>org.onap.appc.instance.url</dt>
173 * <dd>The fully qualified URL of the instance to be rebuilt, as it is known to the provider (i.e., the self-link
174 * URL of the server)</dd>
178 * @param properties A map of name-value pairs that supply the parameters needed by this method. The properties
179 * needed are defined above.
180 * @param context The service logic context of the graph being executed.
181 * @return The <code>Server</code> object that represents the VM being rebuilt. The returned server object can be
182 * inspected for the final state of the server once the rebuild has been completed. The method does not
183 * return until the rebuild has either completed or has failed.
184 * @throws APPCException If the server cannot be rebuilt for some reason
186 Server rebuildServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
188 * This method is used to terminate the indicated server
190 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
191 * passed to the method are passed as properties in a map. This method expects the following properties to be
194 * <dt>org.onap.appc.provider.type</dt>
195 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
196 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
197 * provider types are legal.</dd>
198 * <dt>org.onap.appc.instance.url</dt>
199 * <dd>The fully qualified URL of the instance to be terminate, as it is known to the provider (i.e., the self-link
200 * URL of the server)</dd>
204 * @param properties A map of name-value pairs that supply the parameters needed by this method. The properties
205 * needed are defined above.
206 * @param context The service logic context of the graph being executed.
207 * @return The <code>Server</code> object that represents the VM being rebuilt. The returned server object can be
208 * inspected for the final state of the server once the rebuild has been completed. The method does not
209 * return until the rebuild has either completed or has failed.
210 * @throws APPCException If the server cannot be terminate for some reason
212 Server terminateServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
214 * Returns the symbolic name of the adapter
216 * @return The adapter name
218 String getAdapterName();
219 Server evacuateServer(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
220 Server migrateServer(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
221 Server vmStatuschecker(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
222 Stack terminateStack(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
223 Stack snapshotStack(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
224 Stack restoreStack(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
225 Server attachVolume(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
226 Server dettachVolume(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
228 * This method is used to do the lookup of the indicated server
230 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
231 * passed to the method are passed as properties in a map. This method expects the following properties to be
234 * <dt>org.onap.appc.provider.type</dt>
235 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
236 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
237 * provider types are legal.</dd>
238 * <dt>org.onap.appc.instance.url</dt>
239 * <dd>The fully qualified URL of the instance to be lookup, as it is known to the provider (i.e., the self-link URL
240 * of the server)</dd>
244 * @param properties A map of name-value pairs that supply the parameters needed by this method. The properties
245 * needed are defined above.
246 * @param context The service logic context of the graph being executed.
247 * @return The <code>Server</code> object that represents the VM being rebuilt. The returned server object can be
248 * inspected for the final state of the server once the rebuild has been completed. The method does not
249 * return until the rebuild has either completed or has failed.
250 * @throws APPCException If the server cannot be found for some reason
252 Server lookupServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
256 * @param params A map of name-value pairs that supply the parameters needed by this method. The properties needed
258 * @param ctx The service logic context of the graph being executed.
259 * @return The <code>Image</code> object that represents the VM being restarted. The returned server object can be
260 * inspected for the final state of the server once the restart has been completed. The method does not
261 * return until the restart has either completed or has failed.
262 * @throws APPCException If the server cannot be restarted for some reason
264 Image createSnapshot(Map<String, String> params, SvcLogicContext ctx) throws APPCException;