~ubuntu-branches/ubuntu/raring/eucalyptus/raring

« back to all changes in this revision

Viewing changes to clc/modules/msgs/src/main/java/edu/ucsb/eucalyptus/msgs/VmNetwork.groovy

  • Committer: Package Import Robot
  • Author(s): Brian Thomason
  • Date: 2011-11-29 13:17:52 UTC
  • mfrom: (1.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 185.
  • Revision ID: package-import@ubuntu.com-20111129131752-rq31al3ntutv2vvl
Tags: upstream-3.0.999beta1
ImportĀ upstreamĀ versionĀ 3.0.999beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*******************************************************************************
2
 
*Copyright (c) 2009  Eucalyptus Systems, Inc.
3
 
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.
7
 
8
 
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
12
 
*  for more details.
13
 
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/>.
16
 
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.
20
 
21
 
*  This file may incorporate work covered under the following copyright and
22
 
*  permission notice:
23
 
24
 
*    Software License Agreement (BSD License)
25
 
26
 
*    Copyright (c) 2008, Regents of the University of California
27
 
*    All rights reserved.
28
 
29
 
*    Redistribution and use of this software in source and binary forms, with
30
 
*    or without modification, are permitted provided that the following
31
 
*    conditions are met:
32
 
33
 
*      Redistributions of source code must retain the above copyright notice,
34
 
*      this list of conditions and the following disclaimer.
35
 
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.
39
 
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
 
/*
62
 
 * Author: chris grzegorczyk <grze@eucalyptus.com>
 
2
 *Copyright (c) 2009  Eucalyptus Systems, Inc.
 
3
 * 
 
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.
 
7
 * 
 
8
 * 
 
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
 
12
 *  for more details.
 
13
 * 
 
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/>.
 
16
 * 
 
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.
 
20
 * 
 
21
 *  This file may incorporate work covered under the following copyright and
 
22
 *  permission notice:
 
23
 * 
 
24
 *    Software License Agreement (BSD License)
 
25
 * 
 
26
 *    Copyright (c) 2008, Regents of the University of California
 
27
 *    All rights reserved.
 
28
 * 
 
29
 *    Redistribution and use of this software in source and binary forms, with
 
30
 *    or without modification, are permitted provided that the following
 
31
 *    conditions are met:
 
32
 * 
 
33
 *      Redistributions of source code must retain the above copyright notice,
 
34
 *      this list of conditions and the following disclaimer.
 
35
 * 
 
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.
 
39
 * 
 
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>
63
62
 */
64
63
package edu.ucsb.eucalyptus.msgs
65
64
 
66
 
public class StartNetworkType extends EucalyptusMessage {
 
65
import java.util.List;
67
66
 
 
67
public class CloudClusterMessage extends EucalyptusMessage {
 
68
  
 
69
  public CloudClusterMessage( ) {
 
70
    super( );
 
71
  }
 
72
  
 
73
  public CloudClusterMessage( EucalyptusMessage msg ) {
 
74
    super( msg );
 
75
  }
 
76
  
 
77
  public CloudClusterMessage( String userId ) {
 
78
    super( userId );
 
79
  }
 
80
}
 
81
public class StartNetworkType extends CloudClusterMessage {
 
82
  String networkUuid;
68
83
  int vlan;
69
84
  String netName;
70
85
  String nameserver;
71
86
  ArrayList<String> clusterControllers = new ArrayList<String>();
72
 
 
73
 
 
74
 
  def StartNetworkType(){}
75
 
 
76
 
  def StartNetworkType(final String userId, final Integer vlan, final String netName)
77
 
  {
 
87
  String accountId;
 
88
  
 
89
  
 
90
  public StartNetworkType(){
 
91
  }
 
92
  
 
93
  public StartNetworkType(final String accountId, final String userId, final Integer vlan, final String netName, final String networkUuid) {
78
94
    super( userId );
 
95
    this.networkUuid = networkUuid;
79
96
    this.vlan = vlan;
80
97
    this.netName = netName;
81
98
  }
82
99
}
83
100
 
84
 
public class StartNetworkResponseType extends EucalyptusMessage {
 
101
public class StartNetworkResponseType extends CloudClusterMessage {
85
102
}
86
 
public class StopNetworkType extends EucalyptusMessage {
 
103
public class StopNetworkType extends CloudClusterMessage {
87
104
  Integer vlan;
88
105
  String netName;
89
 
 
90
 
  def StopNetworkType(){}
91
 
 
92
 
  def StopNetworkType(final String userId, final String netName, final Integer vlan)
93
 
  {
 
106
  String accountId;
 
107
  
 
108
  public StopNetworkType(){
 
109
  }
 
110
  
 
111
  public StopNetworkType(final String accountId, final String userId, final String netName, final Integer vlan) {
94
112
    super( userId );
95
113
    this.vlan = vlan;
96
114
    this.netName = netName;
 
115
    this.accountId = accountId;
97
116
  }
98
 
 
99
 
  def StopNetworkType(final StartNetworkType msg)
100
 
  {
 
117
  
 
118
  public StopNetworkType(final StartNetworkType msg) {
101
119
    super(msg);
102
120
    this.vlan = msg.vlan;
103
121
    this.netName = msg.netName;
104
122
  }
105
 
 
106
 
}
107
 
 
108
 
public class StopNetworkResponseType extends EucalyptusMessage {
109
 
}
110
 
 
111
 
public class DescribeNetworksType extends EucalyptusMessage {
 
123
}
 
124
 
 
125
public class StopNetworkResponseType extends CloudClusterMessage {
 
126
}
 
127
 
 
128
public class DescribeNetworksType extends CloudClusterMessage {
112
129
  String nameserver;
 
130
  String dnsDomainName;
113
131
  ArrayList<String> clusterControllers = new ArrayList<String>();
114
132
}
115
133
 
116
 
public class DescribeNetworksResponseType extends EucalyptusMessage {
117
 
  Integer mode;
118
 
  Integer addrsPerNetwork;
 
134
public class DescribeNetworksResponseType extends CloudClusterMessage {
 
135
  Integer useVlans;
 
136
  String mode;
 
137
  Integer addrIndexMin;
 
138
  Integer addrIndexMax;
 
139
  Integer vlanMin;
 
140
  Integer vlanMax;
 
141
  String vnetSubnet;
 
142
  String vnetNetmask;
 
143
  Integer addrsPerNet;
119
144
  ArrayList<NetworkInfoType> activeNetworks = new ArrayList<NetworkInfoType>();
120
145
  
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()} " );
124
149
  }
125
150
}
 
151
public class AddressMappingInfoType extends EucalyptusData {
 
152
  String uuid;
 
153
  String source;
 
154
  String destination;
 
155
}
126
156
 
127
157
public class NetworkInfoType extends EucalyptusData {
 
158
  String uuid;
128
159
  Integer vlan;
129
160
  String networkName;
130
 
  String userName;
 
161
  String userId;
131
162
  ArrayList<String> allocatedAddresses = new ArrayList<String>();
132
163
  public String toString( ) {
133
 
    return "NetworkInfoType ${userName} ${networkName} ${vlan} ${allocatedAddresses}";
134
 
  }
135
 
}
136
 
 
137
 
 
138
 
public class AssignAddressType extends EucalyptusMessage {
 
164
    return "NetworkInfoType ${userId} ${networkName} ${vlan} ${allocatedAddresses}";
 
165
  }
 
166
}
 
167
 
 
168
public class ClusterAddressInfo extends EucalyptusData implements Comparable<ClusterAddressInfo> {
 
169
  String uuid;
 
170
  String address;
 
171
  String instanceIp;
 
172
  
 
173
  public ClusterAddressInfo( String address ) {
 
174
    this.address = address;
 
175
  }
 
176
  
 
177
  public boolean hasMapping() {
 
178
    return this.instanceIp != null &&  !"".equals( this.instanceIp ) && !"0.0.0.0".equals( this.instanceIp );
 
179
  }
 
180
  
 
181
  @Override
 
182
  public int hashCode( ) {
 
183
    final int prime = 31;
 
184
    int result = 1;
 
185
    result = prime * result + ( ( this.address == null ) ? 0 : this.address.hashCode( ) );
 
186
    return result;
 
187
  }
 
188
  
 
189
  public int compareTo( ClusterAddressInfo that ) {
 
190
    return this.address.compareTo( that.address );
 
191
  }
 
192
  
 
193
  @Override
 
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;
 
202
    return true;
 
203
  }
 
204
  
 
205
  public String toString( ) {
 
206
    return String.format( "ClusterAddressInfo %s %s", this.address, this.instanceIp );
 
207
  }
 
208
}
 
209
 
 
210
 
 
211
 
 
212
public class AssignAddressType extends CloudClusterMessage {
 
213
  String uuid;
139
214
  String instanceId;
140
215
  String source;
141
216
  String destination;
142
 
  def AssignAddressType(final source, final destination, final instanceId )
143
 
  {
 
217
  def AssignAddressType(final String uuid, final String source, final String destination, final String instanceId ) {
 
218
    this.uuid = uuid;
144
219
    this.source = source;
145
220
    this.destination = destination;
146
221
    this.instanceId = instanceId;
147
222
  }
148
 
 
149
 
  def AssignAddressType(final msg, final source, final destination, final instanceId)
150
 
  {
 
223
  
 
224
  def AssignAddressType(final BaseMessage msg, final String uuid, final String source, final String destination, final String instanceId) {
151
225
    super(msg);
 
226
    this.uuid = uuid;
152
227
    this.source = source;
153
228
    this.destination = destination;
154
229
    this.instanceId = instanceId;
155
230
  }
156
 
 
157
 
  def AssignAddressType()
158
 
  {
159
 
  }
160
 
 
161
 
 
162
 
 
163
 
}
164
 
public class AssignAddressResponseType extends EucalyptusMessage {
165
 
}
166
 
public class UnassignAddressType extends EucalyptusMessage {
167
 
 
 
231
  
 
232
  def AssignAddressType() {
 
233
  }
 
234
 
 
235
  @Override
 
236
  public String toString( ) {
 
237
    return "AssignAddress ${this.source}=>${this.destination} ${this.instanceId} ${this.uuid}";
 
238
  }
 
239
 
 
240
  @Override
 
241
  public String toSimpleString( ) {
 
242
    return "${super.toSimpleString( )} ${this.source}=>${this.destination} ${this.instanceId} ${this.uuid}";
 
243
  }
 
244
  
 
245
  
 
246
}
 
247
public class AssignAddressResponseType extends CloudClusterMessage {
 
248
}
 
249
public class UnassignAddressType extends CloudClusterMessage {
 
250
  
168
251
  String source;
169
252
  String destination;
170
 
 
171
 
  def UnassignAddressType(final msg, final source, final destination)
172
 
  {
 
253
  
 
254
  def UnassignAddressType(final msg, final source, final destination) {
173
255
    super(msg);
174
256
    this.source = source;
175
257
    this.destination = destination;
176
258
  }
177
 
  def UnassignAddressType(final source, final destination)
178
 
  {
179
 
 
 
259
  def UnassignAddressType(final source, final destination) {
 
260
    
180
261
    this.source = source;
181
262
    this.destination = destination;
182
263
  }
183
 
 
184
 
 
185
 
  def UnassignAddressType()
186
 
  {
187
 
  }
188
 
 
189
 
}
190
 
public class UnassignAddressResponseType extends EucalyptusMessage {
191
 
}
192
 
public class DescribePublicAddressesType extends EucalyptusMessage {
193
 
}
194
 
public class DescribePublicAddressesResponseType extends EucalyptusMessage {
195
 
  ArrayList<String> addresses = new ArrayList<String>();
196
 
  ArrayList<String> mapping = new ArrayList<String>();
 
264
  
 
265
  
 
266
  def UnassignAddressType() {
 
267
  }
 
268
 
 
269
  @Override
 
270
  public String toString( ) {
 
271
    return "UnassignAddress ${this.source}=>${this.destination}";
 
272
  }
 
273
 
 
274
  @Override
 
275
  public String toSimpleString( ) {
 
276
    return "${super.toSimpleString( )} ${this.source}=>${this.destination}";
 
277
  }
 
278
}
 
279
public class UnassignAddressResponseType extends CloudClusterMessage {
 
280
}
 
281
public class DescribePublicAddressesType extends CloudClusterMessage {
 
282
}
 
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()} ");
199
287
  }
200
288
}
201
289
 
202
 
public class ConfigureNetworkType extends EucalyptusMessage {
203
 
 
 
290
public class ConfigureNetworkType extends CloudClusterMessage {
 
291
  
204
292
  ArrayList<PacketFilterRule> rules = new ArrayList<PacketFilterRule>();
205
 
 
206
 
  def ConfigureNetworkType(final EucalyptusMessage msg, final ArrayList<PacketFilterRule> rules)
207
 
  {
 
293
  
 
294
  def ConfigureNetworkType(final EucalyptusMessage msg, final ArrayList<PacketFilterRule> rules) {
208
295
    super(msg);
209
296
    this.rules = rules;
210
297
  }
211
 
 
212
 
  def ConfigureNetworkType(final ArrayList<PacketFilterRule> rules)
213
 
  {
 
298
  
 
299
  def ConfigureNetworkType(final ArrayList<PacketFilterRule> rules) {
214
300
    this.rules = rules;
215
301
  }
216
 
 
217
 
  def ConfigureNetworkType(){}
 
302
  
 
303
  def ConfigureNetworkType(){
 
304
  }
218
305
}
219
 
public class ConfigureNetworkResponseType extends EucalyptusMessage {
 
306
public class ConfigureNetworkResponseType extends CloudClusterMessage {
220
307
}