2  * ============LICENSE_START=======================================================
 
   4  * ================================================================================
 
   5  * Copyright (C) 2017 AT&T Intellectual Property. All rights
 
   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=========================================================
 
  22 package org.openecomp.appc.adapter.iaas;
 
  26 import org.openecomp.appc.exceptions.APPCException;
 
  27 import org.openecomp.appc.exceptions.UnknownProviderException;
 
  28 import com.att.cdp.zones.model.Image;
 
  29 import com.att.cdp.zones.model.Server;
 
  30 import com.att.cdp.zones.model.Stack;
 
  31 import org.openecomp.sdnc.sli.SvcLogicContext;
 
  32 import org.openecomp.sdnc.sli.SvcLogicJavaPlugin;
 
  35  * This interface defines the operations that the provider adapter exposes.
 
  37  * This interface defines static constant property values that can be used to configure the adapter. These constants are
 
  38  * prefixed with the name PROPERTY_ to indicate that they are configuration properties. These properties are read from
 
  39  * the configuration file for the adapter and are used to define the providers, identity service URLs, and other
 
  40  * information needed by the adapter to interface with an IaaS provider.
 
  43 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.openecomp.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.openecomp.appc.provider.name";
 
  60      * The fully-qualified URL of the instance to be manipulated as it is known to the provider.
 
  62     static final String PROPERTY_INSTANCE_URL = "org.openecomp.appc.instance.url";
 
  65      * The fully-qualified URL of the instance to be manipulated as it is known to the provider.
 
  67     static final String PROPERTY_IDENTITY_URL = "org.openecomp.appc.identity.url";
 
  69      * heat stack id to perform operation on stack
 
  71     static final String PROPERTY_STACK_ID = "org.openecomp.appc.stack.id";
 
  73     static final String PROPERTY_SNAPSHOT_ID = "snapshot.id";
 
  75     static final String PROPERTY_INPUT_SNAPSHOT_ID = "org.openecomp.appc.snapshot.id";
 
  77     static final String DG_OUTPUT_PARAM_NAMESPACE = "output.";
 
  80      * This method is used to restart an existing virtual machine given the fully qualified URL of the machine.
 
  82      * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
 
  83      * passed to the method are passed as properties in a map. This method expects the following properties to be
 
  86      * <dt>org.openecomp.appc.provider.type</dt>
 
  87      * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
 
  88      * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
 
  89      * provider types are legal.</dd>
 
  90      * <dt>org.openecomp.appc.instance.url</dt>
 
  91      * <dd>The fully qualified URL of the instance to be restarted, as it is known to the provider (i.e., the self-link
 
  92      * URL of the server)</dd>
 
  97      *            A map of name-value pairs that supply the parameters needed by this method. The properties needed are
 
 100      *            The service logic context of the graph being executed.
 
 101      * @return The <code>Server</code> object that represents the VM being restarted. The returned server object can be
 
 102      *         inspected for the final state of the server once the restart has been completed. The method does not
 
 103      *         return until the restart has either completed or has failed.
 
 104      * @throws APPCException
 
 105      *             If the server cannot be restarted for some reason
 
 107     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.openecomp.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.openecomp.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>
 
 127      *            A map of name-value pairs that supply the parameters needed by this method. The properties needed are
 
 130      *            The service logic context of the graph being executed.
 
 131      * @return The <code>Server</code> object that represents the VM being stopped. The returned server object can be
 
 132      *         inspected for the final state of the server once the stop has been completed. The method does not return
 
 133      *         until the stop has either completed or has failed.
 
 134      * @throws APPCException
 
 135      *             If the server cannot be stopped for some reason
 
 137     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.openecomp.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.openecomp.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>
 
 157      *            A map of name-value pairs that supply the parameters needed by this method. The properties needed are
 
 160      *            The service logic context of the graph being executed.
 
 161      * @return The <code>Server</code> object that represents the VM being started. The returned server object can be
 
 162      *         inspected for the final state of the server once the start has been completed. The method does not return
 
 163      *         until the start has either completed or has failed.
 
 164      * @throws APPCException
 
 165      *             If the server cannot be started for some reason
 
 167     Server startServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
 
 170      * This method is used to rebuild the indicated server
 
 172      * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
 
 173      * passed to the method are passed as properties in a map. This method expects the following properties to be
 
 176      * <dt>org.openecomp.appc.provider.type</dt>
 
 177      * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
 
 178      * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
 
 179      * provider types are legal.</dd>
 
 180      * <dt>org.openecomp.appc.instance.url</dt>
 
 181      * <dd>The fully qualified URL of the instance to be rebuilt, as it is known to the provider (i.e., the self-link
 
 182      * URL of the server)</dd>
 
 187      *            A map of name-value pairs that supply the parameters needed by this method. The properties needed are
 
 190      *            The service logic context of the graph being executed.
 
 191      * @return The <code>Server</code> object that represents the VM being rebuilt. The returned server object can be
 
 192      *         inspected for the final state of the server once the rebuild has been completed. The method does not
 
 193      *         return until the rebuild has either completed or has failed.
 
 194      * @throws APPCException
 
 195      *             If the server cannot be rebuilt for some reason
 
 197     Server rebuildServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
 
 200      * This method is used to terminate the indicated server
 
 202      * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
 
 203      * passed to the method are passed as properties in a map. This method expects the following properties to be
 
 206      * <dt>org.openecomp.appc.provider.type</dt>
 
 207      * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
 
 208      * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
 
 209      * provider types are legal.</dd>
 
 210      * <dt>org.openecomp.appc.instance.url</dt>
 
 211      * <dd>The fully qualified URL of the instance to be terminate, as it is known to the provider (i.e., the self-link
 
 212      * URL of the server)</dd>
 
 217      *            A map of name-value pairs that supply the parameters needed by this method. The properties needed are
 
 220      *            The service logic context of the graph being executed.
 
 221      * @return The <code>Server</code> object that represents the VM being rebuilt. The returned server object can be
 
 222      *         inspected for the final state of the server once the rebuild has been completed. The method does not
 
 223      *         return until the rebuild has either completed or has failed.
 
 224      * @throws APPCException
 
 225      *             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>
 
 266      *            A map of name-value pairs that supply the parameters needed by this method. The properties needed are
 
 269      *            The service logic context of the graph being executed.
 
 270      * @return The <code>Server</code> object that represents the VM being rebuilt. The returned server object can be
 
 271      *         inspected for the final state of the server once the rebuild has been completed. The method does not
 
 272      *         return until the rebuild has either completed or has failed.
 
 273      * @throws APPCException
 
 274      *             If the server cannot be found for some reason
 
 276     Server lookupServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
 
 282      *            A map of name-value pairs that supply the parameters needed by this method. The properties needed are
 
 285      *            The service logic context of the graph being executed.
 
 286      * @return The <code>Image</code> object that represents the VM being restarted. The returned server object can be
 
 287      *         inspected for the final state of the server once the restart has been completed. The method does not
 
 288      *         return until the restart has either completed or has failed.
 
 289      * @throws APPCException
 
 290      *             If the server cannot be restarted for some reason
 
 292     Image createSnapshot(Map<String, String> params, SvcLogicContext ctx) throws APPCException;