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.chef;
26 import org.openecomp.appc.exceptions.APPCException;
27 import com.att.cdp.zones.model.Server;
28 import org.openecomp.sdnc.sli.SvcLogicContext;
29 import org.openecomp.sdnc.sli.SvcLogicJavaPlugin;
32 * This interface defines the operations that the provider adapter exposes.
34 * This interface defines static constant property values that can be used to configure the adapter. These constants are
35 * prefixed with the name PROPERTY_ to indicate that they are configuration properties. These properties are read from
36 * the configuration file for the adapter and are used to define the providers, identity service URLs, and other
37 * information needed by the adapter to interface with an IaaS provider.
40 public interface ChefAdapter extends SvcLogicJavaPlugin {
43 * The type of provider to be accessed to locate and operate on a virtual machine instance. This is used to load the
44 * correct provider support through the CDP IaaS abstraction layer and can be OpenStackProvider, BareMetalProvider,
45 * or any other supported provider type.
47 static final String PROPERTY_PROVIDER_TYPE = "org.openecomp.appc.provider.type";
50 * The adapter maintains a cache of providers organized by the name of the provider, not its type. This is
51 * equivalent to the system or installation name. All regions within the same installation are assumed to be the
54 static final String PROPERTY_PROVIDER_NAME = "org.openecomp.appc.provider.name";
57 * The fully-qualified URL of the instance to be manipulated as it is known to the provider.
59 static final String PROPERTY_INSTANCE_URL = "org.openecomp.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.openecomp.appc.identity.url";
67 * This method is used to restart an existing virtual machine given the fully qualified URL of the machine.
69 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
70 * passed to the method are passed as properties in a map. This method expects the following properties to be
73 * <dt>org.openecomp.appc.provider.type</dt>
74 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
75 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
76 * provider types are legal.</dd>
77 * <dt>org.openecomp.appc.instance.url</dt>
78 * <dd>The fully qualified URL of the instance to be restarted, as it is known to the provider (i.e., the self-link
79 * URL of the server)</dd>
84 * A map of name-value pairs that supply the parameters needed by this method. The properties needed are
87 * The service logic context of the graph being executed.
88 * @return The <code>Server</code> object that represents the VM being restarted. The returned server object can be
89 * inspected for the final state of the server once the restart has been completed. The method does not
90 * return until the restart has either completed or has failed.
91 * @throws APPCException
92 * If the server cannot be restarted for some reason
94 // Server restartServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
97 * This method is used to stop the indicated server
99 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
100 * passed to the method are passed as properties in a map. This method expects the following properties to be
103 * <dt>org.openecomp.appc.provider.type</dt>
104 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
105 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
106 * provider types are legal.</dd>
107 * <dt>org.openecomp.appc.instance.url</dt>
108 * <dd>The fully qualified URL of the instance to be stopped, as it is known to the provider (i.e., the self-link
109 * URL of the server)</dd>
114 * A map of name-value pairs that supply the parameters needed by this method. The properties needed are
117 * The service logic context of the graph being executed.
118 * @return The <code>Server</code> object that represents the VM being stopped. The returned server object can be
119 * inspected for the final state of the server once the stop has been completed. The method does not return
120 * until the stop has either completed or has failed.
121 * @throws APPCException
122 * If the server cannot be stopped for some reason
124 //Server stopServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
127 * This method is used to start the indicated server
129 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
130 * passed to the method are passed as properties in a map. This method expects the following properties to be
133 * <dt>org.openecomp.appc.provider.type</dt>
134 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
135 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
136 * provider types are legal.</dd>
137 * <dt>org.openecomp.appc.instance.url</dt>
138 * <dd>The fully qualified URL of the instance to be started, as it is known to the provider (i.e., the self-link
139 * URL of the server)</dd>
144 * A map of name-value pairs that supply the parameters needed by this method. The properties needed are
147 * The service logic context of the graph being executed.
148 * @return The <code>Server</code> object that represents the VM being started. The returned server object can be
149 * inspected for the final state of the server once the start has been completed. The method does not return
150 * until the start has either completed or has failed.
151 * @throws APPCException
152 * If the server cannot be started for some reason
154 // Server startServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
157 * This method is used to rebuild the indicated server
159 * This method is invoked from a directed graph as an <code>Executor</code> node. This means that the parameters
160 * passed to the method are passed as properties in a map. This method expects the following properties to be
163 * <dt>org.openecomp.appc.provider.type</dt>
164 * <dd>The appropriate provider type, such as <code>OpenStackProvider</code>. This is used by the CDP IaaS
165 * abstraction layer to dynamically load and open a connection to the appropriate provider type. All CDP supported
166 * provider types are legal.</dd>
167 * <dt>org.openecomp.appc.instance.url</dt>
168 * <dd>The fully qualified URL of the instance to be rebuilt, as it is known to the provider (i.e., the self-link
169 * URL of the server)</dd>
174 * A map of name-value pairs that supply the parameters needed by this method. The properties needed are
177 * The service logic context of the graph being executed.
178 * @return The <code>Server</code> object that represents the VM being rebuilt. The returned server object can be
179 * inspected for the final state of the server once the rebuild has been completed. The method does not
180 * return until the rebuild has either completed or has failed.
181 * @throws APPCException
182 * If the server cannot be rebuilt for some reason
184 // Server rebuildServer(Map<String, String> properties, SvcLogicContext context) throws APPCException;
187 * Returns the symbolic name of the adapter
189 * @return The adapter name
191 String getAdapterName();
193 // Server evacuateServer(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
195 //Server migrateServer(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
197 void trigger(Map<String, String> params, SvcLogicContext ctx) ;
199 void chefGet(Map<String, String> params, SvcLogicContext ctx) ;
201 void chefPut(Map<String, String> params, SvcLogicContext ctx) ;