1
1
/*******************************************************************************
2
*Copyright (c) 2009 Eucalyptus Systems, Inc.
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation, only version 3 of the License.
9
* This file is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* You should have received a copy of the GNU General Public License along
15
* with this program. If not, see <http://www.gnu.org/licenses/>.
17
* Please contact Eucalyptus Systems, Inc., 130 Castilian
18
* Dr., Goleta, CA 93101 USA or visit <http://www.eucalyptus.com/licenses/>
19
* if you need additional information or have any questions.
21
* This file may incorporate work covered under the following copyright and
24
* Software License Agreement (BSD License)
26
* Copyright (c) 2008, Regents of the University of California
27
* All rights reserved.
29
* Redistribution and use of this software in source and binary forms, with
30
* or without modification, are permitted provided that the following
33
* Redistributions of source code must retain the above copyright notice,
34
* this list of conditions and the following disclaimer.
36
* Redistributions in binary form must reproduce the above copyright
37
* notice, this list of conditions and the following disclaimer in the
38
* documentation and/or other materials provided with the distribution.
40
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
41
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
42
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
43
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
44
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
45
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
46
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
47
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
48
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
49
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
50
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. USERS OF
51
* THIS SOFTWARE ACKNOWLEDGE THE POSSIBLE PRESENCE OF OTHER OPEN SOURCE
52
* LICENSED MATERIAL, COPYRIGHTED MATERIAL OR PATENTED MATERIAL IN THIS
53
* SOFTWARE, AND IF ANY SUCH MATERIAL IS DISCOVERED THE PARTY DISCOVERING
54
* IT MAY INFORM DR. RICH WOLSKI AT THE UNIVERSITY OF CALIFORNIA, SANTA
55
* BARBARA WHO WILL THEN ASCERTAIN THE MOST APPROPRIATE REMEDY, WHICH IN
56
* THE REGENTSā DISCRETION MAY INCLUDE, WITHOUT LIMITATION, REPLACEMENT
57
* OF THE CODE SO IDENTIFIED, LICENSING OF THE CODE SO IDENTIFIED, OR
58
* WITHDRAWAL OF THE CODE CAPABILITY TO THE EXTENT NEEDED TO COMPLY WITH
59
* ANY SUCH LICENSES OR RIGHTS.
60
*******************************************************************************/
62
* Author: chris grzegorczyk <grze@eucalyptus.com>
2
*Copyright (c) 2009 Eucalyptus Systems, Inc.
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation, only version 3 of the License.
9
* This file is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* You should have received a copy of the GNU General Public License along
15
* with this program. If not, see <http://www.gnu.org/licenses/>.
17
* Please contact Eucalyptus Systems, Inc., 130 Castilian
18
* Dr., Goleta, CA 93101 USA or visit <http://www.eucalyptus.com/licenses/>
19
* if you need additional information or have any questions.
21
* This file may incorporate work covered under the following copyright and
24
* Software License Agreement (BSD License)
26
* Copyright (c) 2008, Regents of the University of California
27
* All rights reserved.
29
* Redistribution and use of this software in source and binary forms, with
30
* or without modification, are permitted provided that the following
33
* Redistributions of source code must retain the above copyright notice,
34
* this list of conditions and the following disclaimer.
36
* Redistributions in binary form must reproduce the above copyright
37
* notice, this list of conditions and the following disclaimer in the
38
* documentation and/or other materials provided with the distribution.
40
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
41
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
42
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
43
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
44
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
45
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
46
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
47
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
48
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
49
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
50
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. USERS OF
51
* THIS SOFTWARE ACKNOWLEDGE THE POSSIBLE PRESENCE OF OTHER OPEN SOURCE
52
* LICENSED MATERIAL, COPYRIGHTED MATERIAL OR PATENTED MATERIAL IN THIS
53
* SOFTWARE, AND IF ANY SUCH MATERIAL IS DISCOVERED THE PARTY DISCOVERING
54
* IT MAY INFORM DR. RICH WOLSKI AT THE UNIVERSITY OF CALIFORNIA, SANTA
55
* BARBARA WHO WILL THEN ASCERTAIN THE MOST APPROPRIATE REMEDY, WHICH IN
56
* THE REGENTS' DISCRETION MAY INCLUDE, WITHOUT LIMITATION, REPLACEMENT
57
* OF THE CODE SO IDENTIFIED, LICENSING OF THE CODE SO IDENTIFIED, OR
58
* WITHDRAWAL OF THE CODE CAPABILITY TO THE EXTENT NEEDED TO COMPLY WITH
59
* ANY SUCH LICENSES OR RIGHTS.
60
*******************************************************************************
61
* @author: chris grzegorczyk <grze@eucalyptus.com>
64
63
package edu.ucsb.eucalyptus.msgs
66
public class StartNetworkType extends EucalyptusMessage {
65
import java.util.List;
67
public class CloudClusterMessage extends EucalyptusMessage {
69
public CloudClusterMessage( ) {
73
public CloudClusterMessage( EucalyptusMessage msg ) {
77
public CloudClusterMessage( String userId ) {
81
public class StartNetworkType extends CloudClusterMessage {
71
86
ArrayList<String> clusterControllers = new ArrayList<String>();
74
def StartNetworkType(){}
76
def StartNetworkType(final String userId, final Integer vlan, final String netName)
90
public StartNetworkType(){
93
public StartNetworkType(final String accountId, final String userId, final Integer vlan, final String netName, final String networkUuid) {
95
this.networkUuid = networkUuid;
80
97
this.netName = netName;
84
public class StartNetworkResponseType extends EucalyptusMessage {
101
public class StartNetworkResponseType extends CloudClusterMessage {
86
public class StopNetworkType extends EucalyptusMessage {
103
public class StopNetworkType extends CloudClusterMessage {
90
def StopNetworkType(){}
92
def StopNetworkType(final String userId, final String netName, final Integer vlan)
108
public StopNetworkType(){
111
public StopNetworkType(final String accountId, final String userId, final String netName, final Integer vlan) {
96
114
this.netName = netName;
115
this.accountId = accountId;
99
def StopNetworkType(final StartNetworkType msg)
118
public StopNetworkType(final StartNetworkType msg) {
102
120
this.vlan = msg.vlan;
103
121
this.netName = msg.netName;
108
public class StopNetworkResponseType extends EucalyptusMessage {
111
public class DescribeNetworksType extends EucalyptusMessage {
125
public class StopNetworkResponseType extends CloudClusterMessage {
128
public class DescribeNetworksType extends CloudClusterMessage {
112
129
String nameserver;
130
String dnsDomainName;
113
131
ArrayList<String> clusterControllers = new ArrayList<String>();
116
public class DescribeNetworksResponseType extends EucalyptusMessage {
118
Integer addrsPerNetwork;
134
public class DescribeNetworksResponseType extends CloudClusterMessage {
137
Integer addrIndexMin;
138
Integer addrIndexMax;
119
144
ArrayList<NetworkInfoType> activeNetworks = new ArrayList<NetworkInfoType>();
121
146
public String toString() {
122
return "${this.getClass().getSimpleName()} mode=${mode} addrsPerNet=${addrsPerNetwork} " \
123
+ "\n${this.getClass().getSimpleName()} " + this.activeNetworks*.toString().join( "\n${this.getClass().getSimpleName()} " );
147
return "${this.getClass().getSimpleName()} mode=${mode} addrsPerNet=${addrsPerNet} " \
148
+ "\n${this.getClass().getSimpleName()} " + this.activeNetworks*.toString().join( "\n${this.getClass().getSimpleName()} " );
151
public class AddressMappingInfoType extends EucalyptusData {
127
157
public class NetworkInfoType extends EucalyptusData {
129
160
String networkName;
131
162
ArrayList<String> allocatedAddresses = new ArrayList<String>();
132
163
public String toString( ) {
133
return "NetworkInfoType ${userName} ${networkName} ${vlan} ${allocatedAddresses}";
138
public class AssignAddressType extends EucalyptusMessage {
164
return "NetworkInfoType ${userId} ${networkName} ${vlan} ${allocatedAddresses}";
168
public class ClusterAddressInfo extends EucalyptusData implements Comparable<ClusterAddressInfo> {
173
public ClusterAddressInfo( String address ) {
174
this.address = address;
177
public boolean hasMapping() {
178
return this.instanceIp != null && !"".equals( this.instanceIp ) && !"0.0.0.0".equals( this.instanceIp );
182
public int hashCode( ) {
183
final int prime = 31;
185
result = prime * result + ( ( this.address == null ) ? 0 : this.address.hashCode( ) );
189
public int compareTo( ClusterAddressInfo that ) {
190
return this.address.compareTo( that.address );
194
public boolean equals( Object obj ) {
195
if ( this.is( obj ) ) return true;
196
if ( obj == null ) return false;
197
if ( !getClass( ).equals( obj.getClass( ) ) ) return false;
198
ClusterAddressInfo other = ( ClusterAddressInfo ) obj;
199
if ( this.address == null ) {
200
if ( other.address != null ) return false;
201
} else if ( !this.address.equals( other.address ) ) return false;
205
public String toString( ) {
206
return String.format( "ClusterAddressInfo %s %s", this.address, this.instanceIp );
212
public class AssignAddressType extends CloudClusterMessage {
139
214
String instanceId;
141
216
String destination;
142
def AssignAddressType(final source, final destination, final instanceId )
217
def AssignAddressType(final String uuid, final String source, final String destination, final String instanceId ) {
144
219
this.source = source;
145
220
this.destination = destination;
146
221
this.instanceId = instanceId;
149
def AssignAddressType(final msg, final source, final destination, final instanceId)
224
def AssignAddressType(final BaseMessage msg, final String uuid, final String source, final String destination, final String instanceId) {
152
227
this.source = source;
153
228
this.destination = destination;
154
229
this.instanceId = instanceId;
157
def AssignAddressType()
164
public class AssignAddressResponseType extends EucalyptusMessage {
166
public class UnassignAddressType extends EucalyptusMessage {
232
def AssignAddressType() {
236
public String toString( ) {
237
return "AssignAddress ${this.source}=>${this.destination} ${this.instanceId} ${this.uuid}";
241
public String toSimpleString( ) {
242
return "${super.toSimpleString( )} ${this.source}=>${this.destination} ${this.instanceId} ${this.uuid}";
247
public class AssignAddressResponseType extends CloudClusterMessage {
249
public class UnassignAddressType extends CloudClusterMessage {
169
252
String destination;
171
def UnassignAddressType(final msg, final source, final destination)
254
def UnassignAddressType(final msg, final source, final destination) {
174
256
this.source = source;
175
257
this.destination = destination;
177
def UnassignAddressType(final source, final destination)
259
def UnassignAddressType(final source, final destination) {
180
261
this.source = source;
181
262
this.destination = destination;
185
def UnassignAddressType()
190
public class UnassignAddressResponseType extends EucalyptusMessage {
192
public class DescribePublicAddressesType extends EucalyptusMessage {
194
public class DescribePublicAddressesResponseType extends EucalyptusMessage {
195
ArrayList<String> addresses = new ArrayList<String>();
196
ArrayList<String> mapping = new ArrayList<String>();
266
def UnassignAddressType() {
270
public String toString( ) {
271
return "UnassignAddress ${this.source}=>${this.destination}";
275
public String toSimpleString( ) {
276
return "${super.toSimpleString( )} ${this.source}=>${this.destination}";
279
public class UnassignAddressResponseType extends CloudClusterMessage {
281
public class DescribePublicAddressesType extends CloudClusterMessage {
283
public class DescribePublicAddressesResponseType extends CloudClusterMessage {
284
ArrayList<ClusterAddressInfo> addresses = new ArrayList<ClusterAddressInfo>();
197
285
public String toString() {
198
return "${this.getClass().getSimpleName()} " + addresses.eachWithIndex{ it, i -> "${it} ${mapping[i]}" }.join("\n${this.getClass().getSimpleName()} ");
286
return "${this.getClass().getSimpleName()} " + addresses.each{ it -> "${it}" }.join("\n${this.getClass().getSimpleName()} ");
202
public class ConfigureNetworkType extends EucalyptusMessage {
290
public class ConfigureNetworkType extends CloudClusterMessage {
204
292
ArrayList<PacketFilterRule> rules = new ArrayList<PacketFilterRule>();
206
def ConfigureNetworkType(final EucalyptusMessage msg, final ArrayList<PacketFilterRule> rules)
294
def ConfigureNetworkType(final EucalyptusMessage msg, final ArrayList<PacketFilterRule> rules) {
209
296
this.rules = rules;
212
def ConfigureNetworkType(final ArrayList<PacketFilterRule> rules)
299
def ConfigureNetworkType(final ArrayList<PacketFilterRule> rules) {
214
300
this.rules = rules;
217
def ConfigureNetworkType(){}
303
def ConfigureNetworkType(){
219
public class ConfigureNetworkResponseType extends EucalyptusMessage {
306
public class ConfigureNetworkResponseType extends CloudClusterMessage {