forked from apache/cloudstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNetworkTO.java
More file actions
184 lines (152 loc) · 4.46 KB
/
Copy pathNetworkTO.java
File metadata and controls
184 lines (152 loc) · 4.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.agent.api.to;
import java.net.URI;
import com.cloud.network.Networks.BroadcastDomainType;
import com.cloud.network.Networks.TrafficType;
/**
* Transfer object to transfer network settings.
*/
public class NetworkTO {
protected String uuid;
protected String ip;
protected String netmask;
protected String gateway;
protected String mac;
protected String dns1;
protected String dns2;
protected BroadcastDomainType broadcastType;
protected TrafficType type;
protected URI broadcastUri;
protected URI isolationUri;
protected boolean isSecurityGroupEnabled;
protected String name;
public NetworkTO() {
}
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public BroadcastDomainType getBroadcastType() {
return broadcastType;
}
public void setBroadcastType(BroadcastDomainType broadcastType) {
this.broadcastType = broadcastType;
}
public void setIp(String ip) {
this.ip = ip;
}
public void setNetmask(String netmask) {
this.netmask = netmask;
}
public void setGateway(String gateway) {
this.gateway = gateway;
}
public void setMac(String mac) {
this.mac = mac;
}
public void setDns1(String dns1) {
this.dns1 = dns1;
}
public void setDns2(String dns2) {
this.dns2 = dns2;
}
public void setType(TrafficType type) {
this.type = type;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setSecurityGroupEnabled(boolean enabled) {
this.isSecurityGroupEnabled = enabled;
}
/**
* This constructor is usually for hosts where the other information are not important.
*
* @param ip ip address
* @param netmask netmask
* @param mac mac address
*/
public NetworkTO(String ip, String netmask, String mac) {
this(ip, netmask, mac, null, null, null);
}
/**
* This is the full constructor and should be used for VM's network as it contains
* the full information about what is needed.
*
* @param ip
* @param vlan
* @param netmask
* @param mac
* @param gateway
* @param dns1
* @param dns2
*/
public NetworkTO(String ip, String netmask, String mac, String gateway, String dns1, String dns2) {
this.ip = ip;
this.netmask = netmask;
this.mac = mac;
this.gateway = gateway;
this.dns1 = dns1;
this.dns2 = dns2;
}
public String getIp() {
return ip;
}
public String getNetmask() {
return netmask;
}
public String getGateway() {
return gateway;
}
public String getMac() {
return mac;
}
public String getDns1() {
return dns1;
}
public String getDns2() {
return dns2;
}
public TrafficType getType() {
return type;
}
public URI getBroadcastUri() {
return broadcastUri;
}
public void setBroadcastUri(URI broadcastUri) {
// only do this if the scheme needs aligning with the broadcastUri
if (broadcastUri != null && getBroadcastType() == null) {
setBroadcastType(BroadcastDomainType.getSchemeValue(broadcastUri));
}
this.broadcastUri = broadcastUri;
}
public URI getIsolationUri() {
return isolationUri;
}
public void setIsolationuri(URI isolationUri) {
this.isolationUri = isolationUri;
}
public boolean isSecurityGroupEnabled() {
return this.isSecurityGroupEnabled;
}
}