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.rest;
29 import org.openecomp.appc.exceptions.APPCException;
30 import com.att.cdp.zones.model.Server;
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 RestAdapter 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";
70 * This method is used to restart an existing virtual machine given the fully qualified URL of the machine.
72 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
73 * passed to the method are passed as properties in a map. This method expects the following properties to be
76 * <dt>org.openecomp.appc.provider.type</dt>
77 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
78 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
79 * provider types are legal.</dd>
80 * <dt>org.openecomp.appc.instance.url</dt>
81 * <dd>The fully qualified URL of the instance to be restarted, as it is known to the provider (i.e., the self-link
82 * URL of the server)</dd>
87 * A map of name-value pairs that supply the parameters needed by this method. The properties needed are
90 * The service logic context of the graph being executed.
91 * @return The <code>Server</code> object that represents the VM being restarted. The returned server object can be
92 * inspected for the final state of the server once the restart has been completed. The method does not
93 * return until the restart has either completed or has failed.
94 * @throws APPCException
95 * If the server cannot be restarted for some reason
97 // Server restartServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
100 * This method is used to stop the indicated server
102 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
103 * passed to the method are passed as properties in a map. This method expects the following properties to be
106 * <dt>org.openecomp.appc.provider.type</dt>
107 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
108 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
109 * provider types are legal.</dd>
110 * <dt>org.openecomp.appc.instance.url</dt>
111 * <dd>The fully qualified URL of the instance to be stopped, as it is known to the provider (i.e., the self-link
112 * URL of the server)</dd>
117 * A map of name-value pairs that supply the parameters needed by this method. The properties needed are
120 * The service logic context of the graph being executed.
121 * @return The <code>Server</code> object that represents the VM being stopped. The returned server object can be
122 * inspected for the final state of the server once the stop has been completed. The method does not return
123 * until the stop has either completed or has failed.
124 * @throws APPCException
125 * If the server cannot be stopped for some reason
127 //Server stopServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
130 * This method is used to start the indicated server
132 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
133 * passed to the method are passed as properties in a map. This method expects the following properties to be
136 * <dt>org.openecomp.appc.provider.type</dt>
137 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
138 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
139 * provider types are legal.</dd>
140 * <dt>org.openecomp.appc.instance.url</dt>
141 * <dd>The fully qualified URL of the instance to be started, as it is known to the provider (i.e., the self-link
142 * URL of the server)</dd>
147 * A map of name-value pairs that supply the parameters needed by this method. The properties needed are
150 * The service logic context of the graph being executed.
151 * @return The <code>Server</code> object that represents the VM being started. The returned server object can be
152 * inspected for the final state of the server once the start has been completed. The method does not return
153 * until the start has either completed or has failed.
154 * @throws APPCException
155 * If the server cannot be started for some reason
157 // Server startServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
160 * This method is used to rebuild the indicated server
162 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
163 * passed to the method are passed as properties in a map. This method expects the following properties to be
166 * <dt>org.openecomp.appc.provider.type</dt>
167 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
168 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
169 * provider types are legal.</dd>
170 * <dt>org.openecomp.appc.instance.url</dt>
171 * <dd>The fully qualified URL of the instance to be rebuilt, as it is known to the provider (i.e., the self-link
172 * URL of the server)</dd>
177 * A map of name-value pairs that supply the parameters needed by this method. The properties needed are
180 * 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
185 * If the server cannot be rebuilt for some reason
187 // Server rebuildServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
190 * Returns the symbolic name of the adapter
192 * @return The adapter name
194 String getAdapterName();
196 // Server evacuateServer(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
198 //Server migrateServer(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
200 void commonGet(Map<String, String> params, SvcLogicContext ctx) ;
202 void commonPost(Map<String, String> params, SvcLogicContext ctx) ;
204 void commonPut(Map<String, String> params, SvcLogicContext ctx) ;
206 void commonDelete(Map<String, String> params, SvcLogicContext ctx) ;