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.rest;
28 import org.onap.appc.exceptions.APPCException;
29 import com.att.cdp.zones.model.Server;
30 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
31 import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
34 * This interface defines the operations that the provider adapter exposes.
36 * This interface defines static constant property values that can be used to configure the adapter. These constants are
37 * prefixed with the name PROPERTY_ to indicate that they are configuration properties. These properties are read from
38 * the configuration file for the adapter and are used to define the providers, identity service URLs, and other
39 * information needed by the adapter to interface with an IaaS provider.
42 public interface RestAdapter extends SvcLogicJavaPlugin {
45 * The type of provider to be accessed to locate and operate on a virtual machine instance. This is used to load the
46 * correct provider support through the CDP IaaS abstraction layer and can be OpenStackProvider, BareMetalProvider,
47 * or any other supported provider type.
49 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";
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";
64 * The fully-qualified URL of the instance to be manipulated as it is known to the provider.
66 static final String PROPERTY_IDENTITY_URL = "org.onap.appc.identity.url";
69 * This method is used to restart an existing virtual machine given the fully qualified URL of the machine.
71 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
72 * passed to the method are passed as properties in a map. This method expects the following properties to be
75 * <dt>org.onap.appc.provider.type</dt>
76 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
77 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
78 * provider types are legal.</dd>
79 * <dt>org.onap.appc.instance.url</dt>
80 * <dd>The fully qualified URL of the instance to be restarted, as it is known to the provider (i.e., the self-link
81 * URL of the server)</dd>
86 * A map of name-value pairs that supply the parameters needed by this method. The properties needed are
89 * The service logic context of the graph being executed.
90 * @return The <code>Server</code> object that represents the VM being restarted. The returned server object can be
91 * inspected for the final state of the server once the restart has been completed. The method does not
92 * return until the restart has either completed or has failed.
93 * @throws APPCException
94 * If the server cannot be restarted for some reason
96 // Server restartServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
99 * This method is used to stop the indicated server
101 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
102 * passed to the method are passed as properties in a map. This method expects the following properties to be
105 * <dt>org.onap.appc.provider.type</dt>
106 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
107 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
108 * provider types are legal.</dd>
109 * <dt>org.onap.appc.instance.url</dt>
110 * <dd>The fully qualified URL of the instance to be stopped, as it is known to the provider (i.e., the self-link
111 * URL of the server)</dd>
116 * A map of name-value pairs that supply the parameters needed by this method. The properties needed are
119 * The service logic context of the graph being executed.
120 * @return The <code>Server</code> object that represents the VM being stopped. The returned server object can be
121 * inspected for the final state of the server once the stop has been completed. The method does not return
122 * until the stop has either completed or has failed.
123 * @throws APPCException
124 * If the server cannot be stopped for some reason
126 //Server stopServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
129 * This method is used to start the indicated server
131 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
132 * passed to the method are passed as properties in a map. This method expects the following properties to be
135 * <dt>org.onap.appc.provider.type</dt>
136 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
137 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
138 * provider types are legal.</dd>
139 * <dt>org.onap.appc.instance.url</dt>
140 * <dd>The fully qualified URL of the instance to be started, as it is known to the provider (i.e., the self-link
141 * URL of the server)</dd>
146 * A map of name-value pairs that supply the parameters needed by this method. The properties needed are
149 * The service logic context of the graph being executed.
150 * @return The <code>Server</code> object that represents the VM being started. The returned server object can be
151 * inspected for the final state of the server once the start has been completed. The method does not return
152 * until the start has either completed or has failed.
153 * @throws APPCException
154 * If the server cannot be started for some reason
156 // Server startServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
159 * This method is used to rebuild the indicated server
161 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
162 * passed to the method are passed as properties in a map. This method expects the following properties to be
165 * <dt>org.onap.appc.provider.type</dt>
166 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
167 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
168 * provider types are legal.</dd>
169 * <dt>org.onap.appc.instance.url</dt>
170 * <dd>The fully qualified URL of the instance to be rebuilt, as it is known to the provider (i.e., the self-link
171 * URL of the server)</dd>
176 * A map of name-value pairs that supply the parameters needed by this method. The properties needed are
179 * The service logic context of the graph being executed.
180 * @return The <code>Server</code> object that represents the VM being rebuilt. The returned server object can be
181 * inspected for the final state of the server once the rebuild has been completed. The method does not
182 * return until the rebuild has either completed or has failed.
183 * @throws APPCException
184 * If the server cannot be rebuilt for some reason
186 // Server rebuildServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
189 * Returns the symbolic name of the adapter
191 * @return The adapter name
193 String getAdapterName();
195 // Server evacuateServer(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
197 //Server migrateServer(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
199 void commonGet(Map<String, String> params, SvcLogicContext ctx) ;
201 void commonPost(Map<String, String> params, SvcLogicContext ctx) ;
203 void commonPut(Map<String, String> params, SvcLogicContext ctx) ;
205 void commonDelete(Map<String, String> params, SvcLogicContext ctx) ;