Merge branch 'master' into ui-install-wizard

Conflicts:
	ui/index-test.html
	ui/index.jsp
	ui/scripts-test/system.js
	ui/scripts/ui-custom/installWizard.js
This commit is contained in:
Brian Federle 2011-11-11 12:00:56 -08:00
commit b911cd7df5
296 changed files with 17110 additions and 6568 deletions

View File

@ -4,7 +4,6 @@
package com.cloud.resource;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -18,9 +17,7 @@ import com.cloud.agent.api.Answer;
import com.cloud.agent.api.CheckVirtualMachineAnswer;
import com.cloud.agent.api.CheckVirtualMachineCommand;
import com.cloud.agent.api.Command;
import com.cloud.agent.api.PingCommand;
import com.cloud.agent.api.PingRoutingCommand;
import com.cloud.agent.api.PingRoutingWithNwGroupsCommand;
import com.cloud.agent.api.PrepareForMigrationCommand;
import com.cloud.agent.api.ReadyAnswer;

View File

@ -329,8 +329,7 @@ public class Agent implements HandlerFactory, IAgentControl {
addr = InetAddress.getLocalHost();
} catch (final UnknownHostException e) {
s_logger.warn("unknow host? ", e);
// ignore
return;
throw new CloudRuntimeException("Cannot get local IP address");
}
final Script command = new Script("hostname", 500, s_logger);

View File

@ -25,7 +25,7 @@ import com.cloud.utils.component.Adapter;
import com.cloud.utils.component.ComponentLibraryBase;
import com.cloud.utils.component.ComponentLocator.ComponentInfo;
import com.cloud.utils.component.Manager;
import com.cloud.utils.component.SystemIntegrityChecker;
import com.cloud.utils.component.PluggableService;
import com.cloud.utils.db.GenericDao;
@ -63,5 +63,17 @@ public class AgentComponentLibraryBase extends ComponentLibraryBase {
protected void populateAdapters() {
}
protected void populateServices() {
}
@Override
public Map<String, ComponentInfo<PluggableService>> getPluggableServices() {
if (_pluggableServices.size() == 0) {
populateServices();
}
return _pluggableServices;
}
}

View File

@ -63,8 +63,8 @@ import com.cloud.agent.api.ReadyAnswer;
import com.cloud.agent.api.ReadyCommand;
import com.cloud.agent.api.RebootAnswer;
import com.cloud.agent.api.RebootCommand;
import com.cloud.agent.api.SecurityGroupRuleAnswer;
import com.cloud.agent.api.SecurityGroupRulesCmd;
import com.cloud.agent.api.SecurityIngressRuleAnswer;
import com.cloud.agent.api.SecurityIngressRulesCmd;
import com.cloud.agent.api.StartAnswer;
import com.cloud.agent.api.StartCommand;
import com.cloud.agent.api.StartupCommand;
@ -234,8 +234,8 @@ public class FakeComputingResource extends ServerResourceBase implements ServerR
return execute((GetStorageStatsCommand) cmd);
} else if (cmd instanceof ModifyStoragePoolCommand) {
return execute((ModifyStoragePoolCommand) cmd);
} else if (cmd instanceof SecurityGroupRulesCmd) {
return execute((SecurityGroupRulesCmd) cmd);
} else if (cmd instanceof SecurityIngressRulesCmd) {
return execute((SecurityIngressRulesCmd) cmd);
} else if (cmd instanceof StartCommand ) {
return execute((StartCommand) cmd);
} else if (cmd instanceof CleanupNetworkRulesCmd) {
@ -257,9 +257,9 @@ public class FakeComputingResource extends ServerResourceBase implements ServerR
return new Answer(cmd);
}
private Answer execute(SecurityGroupRulesCmd cmd) {
private Answer execute(SecurityIngressRulesCmd cmd) {
s_logger.info("Programmed network rules for vm " + cmd.getVmName() + " guestIp=" + cmd.getGuestIp() + ", numrules=" + cmd.getRuleSet().length);
return new SecurityGroupRuleAnswer(cmd);
return new SecurityIngressRuleAnswer(cmd);
}
private Answer execute(ModifyStoragePoolCommand cmd) {

View File

@ -120,8 +120,8 @@ import com.cloud.agent.api.ReadyCommand;
import com.cloud.agent.api.RebootAnswer;
import com.cloud.agent.api.RebootCommand;
import com.cloud.agent.api.RebootRouterCommand;
import com.cloud.agent.api.SecurityGroupRuleAnswer;
import com.cloud.agent.api.SecurityGroupRulesCmd;
import com.cloud.agent.api.SecurityIngressRuleAnswer;
import com.cloud.agent.api.SecurityIngressRulesCmd;
import com.cloud.agent.api.StartAnswer;
import com.cloud.agent.api.StartCommand;
import com.cloud.agent.api.StartupCommand;
@ -913,8 +913,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
return execute((CreateStoragePoolCommand) cmd);
} else if (cmd instanceof ModifyStoragePoolCommand) {
return execute((ModifyStoragePoolCommand) cmd);
} else if (cmd instanceof SecurityGroupRulesCmd) {
return execute((SecurityGroupRulesCmd) cmd);
} else if (cmd instanceof SecurityIngressRulesCmd) {
return execute((SecurityIngressRulesCmd) cmd);
} else if (cmd instanceof DeleteStoragePoolCommand) {
return execute((DeleteStoragePoolCommand) cmd);
} else if (cmd instanceof FenceCommand ) {
@ -1568,7 +1568,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
return answer;
}
private Answer execute(SecurityGroupRulesCmd cmd) {
private Answer execute(SecurityIngressRulesCmd cmd) {
String vif = null;
String brname = null;
try {
@ -1577,10 +1577,10 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
vif = nics.get(0).getDevName();
brname = nics.get(0).getBrName();
} catch (LibvirtException e) {
return new SecurityGroupRuleAnswer(cmd, false, e.toString());
return new SecurityIngressRuleAnswer(cmd, false, e.toString());
}
boolean result = add_network_rules(cmd.getRuleType(), cmd.getVmName(),
boolean result = add_network_rules(cmd.getVmName(),
Long.toString(cmd.getVmId()),
cmd.getGuestIp(),cmd.getSignature(),
Long.toString(cmd.getSeqNum()),
@ -1589,10 +1589,10 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
if (!result) {
s_logger.warn("Failed to program network rules for vm " + cmd.getVmName());
return new SecurityGroupRuleAnswer(cmd, false, "programming network rules failed");
return new SecurityIngressRuleAnswer(cmd, false, "programming network rules failed");
} else {
s_logger.debug("Programmed network rules for vm " + cmd.getVmName() + " guestIp=" + cmd.getGuestIp() + ", numrules=" + cmd.getRuleSet().length);
return new SecurityGroupRuleAnswer(cmd);
return new SecurityIngressRuleAnswer(cmd);
}
}
@ -3540,7 +3540,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
return true;
}
private boolean add_network_rules(String ruleType, String vmName, String vmId, String guestIP, String sig, String seq, String mac, String rules, String vif, String brname) {
private boolean add_network_rules(String vmName, String vmId, String guestIP, String sig, String seq, String mac, String rules, String vif, String brname) {
if (!_can_bridge_firewall) {
return false;
}
@ -3551,7 +3551,6 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
cmd.add("--vmname", vmName);
cmd.add("--vmid", vmId);
cmd.add("--vmip", guestIP);
cmd.add("--ruletype", ruleType);
cmd.add("--sig", sig);
cmd.add("--seq", seq);
cmd.add("--vmmac", mac);

View File

@ -27,4 +27,9 @@ import com.cloud.user.OwnedBy;
*
*/
public interface ControlledEntity extends OwnedBy, PartOf {
public enum ACLType {
Account,
Domain
}
}

View File

@ -0,0 +1,39 @@
/**
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.agent.api;
public class CheckNetworkAnswer extends Answer {
// indicate if agent reconnect is needed after setupNetworkNames command
private boolean _reconnect;
public CheckNetworkAnswer() {}
public CheckNetworkAnswer(CheckNetworkCommand cmd, boolean result, String details, boolean reconnect) {
super(cmd, result, details);
_reconnect = reconnect;
}
public CheckNetworkAnswer(CheckNetworkCommand cmd, boolean result, String details) {
this(cmd, result, details, false);
}
public boolean needReconnect() {
return _reconnect;
}
}

View File

@ -0,0 +1,43 @@
/**
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.agent.api;
import java.util.List;
import com.cloud.network.PhysicalNetworkSetupInfo;
public class CheckNetworkCommand extends Command {
List<PhysicalNetworkSetupInfo> networkInfoList;
public CheckNetworkCommand(List<PhysicalNetworkSetupInfo> networkInfoList) {
this.networkInfoList = networkInfoList;
}
public List<PhysicalNetworkSetupInfo> getPhysicalNetworkInfoList() {
return networkInfoList;
}
protected CheckNetworkCommand() {
}
@Override
public boolean executeInSequence() {
return true;
}
}

View File

@ -0,0 +1,47 @@
/**
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.agent.api;
public class SecurityEgressRuleAnswer extends Answer {
Long logSequenceNumber = null;
Long vmId = null;
protected SecurityEgressRuleAnswer() {
}
public SecurityEgressRuleAnswer(SecurityEgressRulesCmd cmd) {
super(cmd);
this.logSequenceNumber = cmd.getSeqNum();
this.vmId = cmd.getVmId();
}
public SecurityEgressRuleAnswer(SecurityEgressRulesCmd cmd, boolean result, String detail) {
super(cmd, result, detail);
this.logSequenceNumber = cmd.getSeqNum();
this.vmId = cmd.getVmId();
}
public Long getLogSequenceNumber() {
return logSequenceNumber;
}
public Long getVmId() {
return vmId;
}
}

View File

@ -0,0 +1,144 @@
/**
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.agent.api;
public class SecurityEgressRulesCmd extends Command {
public static class EgressIpPortAndProto {
String proto;
int startPort;
int endPort;
String [] allowedCidrs;
public EgressIpPortAndProto() { }
public EgressIpPortAndProto(String proto, int startPort, int endPort,
String[] allowedCidrs) {
super();
this.proto = proto;
this.startPort = startPort;
this.endPort = endPort;
this.allowedCidrs = allowedCidrs;
}
public String[] getAllowedCidrs() {
return allowedCidrs;
}
public void setAllowedCidrs(String[] allowedCidrs) {
this.allowedCidrs = allowedCidrs;
}
public String getProto() {
return proto;
}
public int getStartPort() {
return startPort;
}
public int getEndPort() {
return endPort;
}
}
String guestIp;
String vmName;
String guestMac;
String signature;
Long seqNum;
Long vmId;
EgressIpPortAndProto [] ruleSet;
public SecurityEgressRulesCmd() {
super();
}
public SecurityEgressRulesCmd(String guestIp, String guestMac, String vmName, Long vmId, String signature, Long seqNum, EgressIpPortAndProto[] ruleSet) {
super();
this.guestIp = guestIp;
this.vmName = vmName;
this.ruleSet = ruleSet;
this.guestMac = guestMac;
this.signature = signature;
this.seqNum = seqNum;
this.vmId = vmId;
}
@Override
public boolean executeInSequence() {
return true;
}
public EgressIpPortAndProto[] getRuleSet() {
return ruleSet;
}
public void setRuleSet(EgressIpPortAndProto[] ruleSet) {
this.ruleSet = ruleSet;
}
public String getGuestIp() {
return guestIp;
}
public String getVmName() {
return vmName;
}
public String stringifyRules() {
StringBuilder ruleBuilder = new StringBuilder();
for (SecurityEgressRulesCmd.EgressIpPortAndProto ipPandP: getRuleSet()) {
ruleBuilder.append(ipPandP.getProto()).append(":").append(ipPandP.getStartPort()).append(":").append(ipPandP.getEndPort()).append(":");
for (String cidr: ipPandP.getAllowedCidrs()) {
ruleBuilder.append(cidr).append(",");
}
ruleBuilder.append("NEXT");
ruleBuilder.append(" ");
}
return ruleBuilder.toString();
}
public String getSignature() {
return signature;
}
public String getGuestMac() {
return guestMac;
}
public Long getSeqNum() {
return seqNum;
}
public Long getVmId() {
return vmId;
}
}

View File

@ -17,7 +17,7 @@
*/
package com.cloud.agent.api;
public class SecurityGroupRuleAnswer extends Answer {
public class SecurityIngressRuleAnswer extends Answer {
public static enum FailureReason {
NONE,
UNKNOWN,
@ -29,23 +29,23 @@ public class SecurityGroupRuleAnswer extends Answer {
FailureReason reason = FailureReason.NONE;
protected SecurityGroupRuleAnswer() {
protected SecurityIngressRuleAnswer() {
}
public SecurityGroupRuleAnswer(SecurityGroupRulesCmd cmd) {
public SecurityIngressRuleAnswer(SecurityIngressRulesCmd cmd) {
super(cmd);
this.logSequenceNumber = cmd.getSeqNum();
this.vmId = cmd.getVmId();
}
public SecurityGroupRuleAnswer(SecurityGroupRulesCmd cmd, boolean result, String detail) {
public SecurityIngressRuleAnswer(SecurityIngressRulesCmd cmd, boolean result, String detail) {
super(cmd, result, detail);
this.logSequenceNumber = cmd.getSeqNum();
this.vmId = cmd.getVmId();
reason = FailureReason.PROGRAMMING_FAILED;
}
public SecurityGroupRuleAnswer(SecurityGroupRulesCmd cmd, boolean result, String detail, FailureReason r) {
public SecurityIngressRuleAnswer(SecurityIngressRulesCmd cmd, boolean result, String detail, FailureReason r) {
super(cmd, result, detail);
this.logSequenceNumber = cmd.getSeqNum();
this.vmId = cmd.getVmId();

View File

@ -26,12 +26,11 @@ import org.apache.commons.codec.digest.DigestUtils;
import org.apache.log4j.Logger;
import com.cloud.agent.api.LogLevel.Log4jLevel;
import com.cloud.network.security.SecurityRule.SecurityRuleType;
import com.cloud.utils.net.NetUtils;
public class SecurityGroupRulesCmd extends Command {
private static Logger s_logger = Logger.getLogger(SecurityGroupRulesCmd.class);
public class SecurityIngressRulesCmd extends Command {
private static Logger s_logger = Logger.getLogger(SecurityIngressRulesCmd.class);
public static class IpPortAndProto {
String proto;
int startPort;
@ -81,14 +80,13 @@ public class SecurityGroupRulesCmd extends Command {
Long vmId;
Long msId;
IpPortAndProto [] ruleSet;
SecurityRuleType ruleType;
public SecurityGroupRulesCmd() {
public SecurityIngressRulesCmd() {
super();
}
public SecurityGroupRulesCmd(SecurityRuleType ruleType, String guestIp, String guestMac, String vmName, Long vmId, String signature, Long seqNum, IpPortAndProto[] ruleSet) {
public SecurityIngressRulesCmd(String guestIp, String guestMac, String vmName, Long vmId, String signature, Long seqNum, IpPortAndProto[] ruleSet) {
super();
this.guestIp = guestIp;
this.vmName = vmName;
@ -97,17 +95,12 @@ public class SecurityGroupRulesCmd extends Command {
this.signature = signature;
this.seqNum = seqNum;
this.vmId = vmId;
this.ruleType = ruleType;
if (signature == null) {
String stringified = stringifyRules();
this.signature = DigestUtils.md5Hex(stringified);
}
}
public String getRuleType(){
if (this.ruleType == SecurityRuleType.EgressRule) return SecurityRuleType.EgressRule.getType();
return SecurityRuleType.IngressRule.getType();
}
@Override
public boolean executeInSequence() {
@ -136,7 +129,7 @@ public class SecurityGroupRulesCmd extends Command {
public String stringifyRules() {
StringBuilder ruleBuilder = new StringBuilder();
for (SecurityGroupRulesCmd.IpPortAndProto ipPandP: getRuleSet()) {
for (SecurityIngressRulesCmd.IpPortAndProto ipPandP: getRuleSet()) {
ruleBuilder.append(ipPandP.getProto()).append(":").append(ipPandP.getStartPort()).append(":").append(ipPandP.getEndPort()).append(":");
for (String cidr: ipPandP.getAllowedCidrs()) {
ruleBuilder.append(cidr).append(",");
@ -157,7 +150,7 @@ public class SecurityGroupRulesCmd extends Command {
public String stringifyCompressedRules() {
StringBuilder ruleBuilder = new StringBuilder();
for (SecurityGroupRulesCmd.IpPortAndProto ipPandP: getRuleSet()) {
for (SecurityIngressRulesCmd.IpPortAndProto ipPandP: getRuleSet()) {
ruleBuilder.append(ipPandP.getProto()).append(":").append(ipPandP.getStartPort()).append(":").append(ipPandP.getEndPort()).append(":");
for (String cidr: ipPandP.getAllowedCidrs()) {
//convert cidrs in the form "a.b.c.d/e" to "hexvalue of 32bit ip/e"
@ -169,12 +162,12 @@ public class SecurityGroupRulesCmd extends Command {
return ruleBuilder.toString();
}
/*
* Compress the security group rules using zlib compression to allow the call to the hypervisor
* Compress the ingress rules using zlib compression to allow the call to the hypervisor
* to scale beyond 8k cidrs.
*/
public String compressStringifiedRules() {
StringBuilder ruleBuilder = new StringBuilder();
for (SecurityGroupRulesCmd.IpPortAndProto ipPandP: getRuleSet()) {
for (SecurityIngressRulesCmd.IpPortAndProto ipPandP: getRuleSet()) {
ruleBuilder.append(ipPandP.getProto()).append(":").append(ipPandP.getStartPort()).append(":").append(ipPandP.getEndPort()).append(":");
for (String cidr: ipPandP.getAllowedCidrs()) {
ruleBuilder.append(cidr).append(",");
@ -191,7 +184,7 @@ public class SecurityGroupRulesCmd extends Command {
dzip.write(stringified.getBytes());
dzip.close();
} catch (IOException e) {
s_logger.warn("Exception while compressing security group rules");
s_logger.warn("Exception while compressing ingress rules");
return null;
}
return Base64.encodeBase64String(out.toByteArray());

View File

@ -96,7 +96,7 @@ public class ApiConstants {
public static final String IS_PUBLIC = "ispublic";
public static final String IS_READY = "isready";
public static final String IS_RECURSIVE = "isrecursive";
public static final String IS_SHARED = "isshared";
public static final String IS_LB_SHARED = "islbshared";
public static final String ISO_FILTER = "isofilter";
public static final String ISO_GUEST_OS_NONE = "None";
public static final String JOB_ID = "jobid";
@ -155,7 +155,6 @@ public class ApiConstants {
public static final String SECURITY_GROUP_NAMES = "securitygroupnames";
public static final String SECURITY_GROUP_NAME = "securitygroupname";
public static final String SECURITY_GROUP_ID = "securitygroupid";
public static final String SECURITY_GROUP_EANBLED = "securitygroupenabled";
public static final String SENT = "sent";
public static final String SENT_BYTES = "sentbytes";
public static final String SERVICE_OFFERING_ID = "serviceofferingid";
@ -211,7 +210,6 @@ public class ApiConstants {
public static final String IS_SYSTEM = "issystem";
public static final String AVAILABILITY = "availability";
public static final String NETWORKRATE = "networkrate";
public static final String GUEST_IP_TYPE = "guestiptype";
public static final String HOST_TAGS = "hosttags";
public static final String SSH_KEYPAIR = "keypair";
public static final String HOST_CPU_CAPACITY = "hostcpucapacity";
@ -241,8 +239,6 @@ public class ApiConstants {
public static final String PING_CIFS_PASSWORD = "pingcifspassword";
public static final String CHECKSUM="checksum";
public static final String NETWORK_DEVICE_TYPE = "networkdevicetype";
public static final String EXTERNAL_LB_TYPE = "externallbtype";
public static final String EXTERNAL_FIREWALL_TYPE = "externalfirewalltype";
public static final String NETWORK_DEVICE_PARAMETER_LIST = "networkdeviceparameterlist";
public static final String ZONE_TOKEN = "zonetoken";
public static final String DHCP_PROVIDER = "dhcpprovider";
@ -272,4 +268,40 @@ public class ApiConstants {
public static final String ACCEPT = "accept";
public static final String SORT_KEY = "sortkey";
public static final String ACCOUNT_DETAILS = "accountdetails";
public static final String DHCP_SERVICE = "dhcpservice";
public static final String DNS_SERVICE = "dnsservice";
public static final String SOURCE_NAT_SERVICE = "sourcenatservice";
public static final String STATIC_NAT_SERVICE = "staticnatservice";
public static final String PORT_FORWARDING_SERVICE = "staticnatservice";
public static final String VPN_SERVICE = "vpnservice";
public static final String USERDATA_SERVICE = "userdataservice";
public static final String LB_SERVICE = "lbservice";
public static final String FIREWALL_SERVICE = "firewallservice";
public static final String GATEWAY_SERVICE = "gatewayservice";
public static final String SERVICE_PROVIDER_LIST = "serviceproviderlist";
public static final String SERVICE_CAPABILITY_LIST = "servicecapabilitylist";
public static final String PROVIDER = "provider";
public static final String NETWORK_SPEED = "networkspeed";
public static final String BROADCAST_DOMAIN_RANGE = "broadcastdomainrange";
public static final String ISOLATION_METHODS = "isolationmethods";
public static final String PHYSICAL_NETWORK_ID = "physicalnetworkid";
public static final String DEST_PHYSICAL_NETWORK_ID = "destinationphysicalnetworkid";
public static final String ENABLED = "enabled";
public static final String SERVICE_NAME = "servicename";
public static final String DHCP_RANGE = "dhcprange";
public static final String UUID = "uuid";
public static final String SECURITY_GROUP_EANBLED = "securitygroupenabled";
public static final String GUEST_IP_TYPE = "guestiptype";
public static final String XEN_NETWORK_LABEL = "xennetworklabel";
public static final String KVM_NETWORK_LABEL = "kvmnetworklabel";
public static final String VMWARE_NETWORK_LABEL = "vmwarenetworklabel";
public static final String NETWORK_SERVICE_PROVIDER_ID = "nspid";
public static final String SECURITY_GROUP_SERVICE = "securitygroupservice";
public static final String SERVICE_LIST = "servicelist";
public static final String CAN_ENABLE_INDIVIDUAL_SERVICE = "canenableindividualservice";
public static final String SUPPORTED_SERVICES = "supportedservices";
public static final String NSP_ID= "nspid";
public static final String ACL_TYPE= "acltype";
public static final String IS_SOURCE_NAT_SHARED = "isshared";
}

View File

@ -15,20 +15,18 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.network.vpn;
package com.cloud.api;
import java.util.List;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.Network;
import com.cloud.network.RemoteAccessVpn;
import com.cloud.network.VpnUser;
import com.cloud.utils.component.Adapter;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
public interface RemoteAccessVpnElement extends Adapter {
String[] applyVpnUsers(RemoteAccessVpn vpn, List<? extends VpnUser> users) throws ResourceUnavailableException;
import com.cloud.utils.component.PluggableService;
boolean startVpn(Network network, RemoteAccessVpn vpn) throws ResourceUnavailableException;
boolean stopVpn(Network network, RemoteAccessVpn vpn) throws ResourceUnavailableException;
@Target(FIELD)
@Retention(RUNTIME)
public @interface PlugService {
Class<? extends PluggableService> pluggableService() default PluggableService.class;
}

View File

@ -43,15 +43,18 @@ import com.cloud.api.response.ListResponse;
import com.cloud.api.response.LoadBalancerResponse;
import com.cloud.api.response.NetworkOfferingResponse;
import com.cloud.api.response.NetworkResponse;
import com.cloud.api.response.PhysicalNetworkResponse;
import com.cloud.api.response.PodResponse;
import com.cloud.api.response.ProjectAccountResponse;
import com.cloud.api.response.ProjectInvitationResponse;
import com.cloud.api.response.ProjectResponse;
import com.cloud.api.response.ProviderResponse;
import com.cloud.api.response.RemoteAccessVpnResponse;
import com.cloud.api.response.ResourceCountResponse;
import com.cloud.api.response.ResourceLimitResponse;
import com.cloud.api.response.SecurityGroupResponse;
import com.cloud.api.response.ServiceOfferingResponse;
import com.cloud.api.response.ServiceResponse;
import com.cloud.api.response.SnapshotPolicyResponse;
import com.cloud.api.response.SnapshotResponse;
import com.cloud.api.response.StoragePoolResponse;
@ -60,8 +63,10 @@ import com.cloud.api.response.SystemVmInstanceResponse;
import com.cloud.api.response.SystemVmResponse;
import com.cloud.api.response.TemplatePermissionsResponse;
import com.cloud.api.response.TemplateResponse;
import com.cloud.api.response.TrafficTypeResponse;
import com.cloud.api.response.UserResponse;
import com.cloud.api.response.UserVmResponse;
import com.cloud.api.response.VirtualRouterProviderResponse;
import com.cloud.api.response.VlanIpRangeResponse;
import com.cloud.api.response.VolumeResponse;
import com.cloud.api.response.VpnUsersResponse;
@ -80,14 +85,21 @@ import com.cloud.host.Host;
import com.cloud.hypervisor.HypervisorCapabilities;
import com.cloud.network.IpAddress;
import com.cloud.network.Network;
import com.cloud.network.Network.Provider;
import com.cloud.network.Network.Service;
import com.cloud.network.PhysicalNetwork;
import com.cloud.network.PhysicalNetworkServiceProvider;
import com.cloud.network.PhysicalNetworkTrafficType;
import com.cloud.network.RemoteAccessVpn;
import com.cloud.network.VirtualRouterProvider;
import com.cloud.network.VpnUser;
import com.cloud.network.router.VirtualRouter;
import com.cloud.network.rules.FirewallRule;
import com.cloud.network.rules.LoadBalancer;
import com.cloud.network.rules.PortForwardingRule;
import com.cloud.network.rules.StaticNatRule;
import com.cloud.network.security.SecurityRule;
import com.cloud.network.security.EgressRule;
import com.cloud.network.security.IngressRule;
import com.cloud.network.security.SecurityGroup;
import com.cloud.network.security.SecurityGroupRules;
import com.cloud.offering.DiskOffering;
@ -186,7 +198,9 @@ public interface ResponseGenerator {
ListResponse<SecurityGroupResponse> createSecurityGroupResponses(List<? extends SecurityGroupRules> networkGroups);
SecurityGroupResponse createSecurityGroupResponseFromSecurityGroupRule(List<? extends SecurityRule> SecurityRules);
SecurityGroupResponse createSecurityGroupResponseFromIngressRule(List<? extends IngressRule> ingressRules);
SecurityGroupResponse createSecurityGroupResponseFromEgressRule(List<? extends EgressRule> egressRules);
SecurityGroupResponse createSecurityGroupResponse(SecurityGroup group);
@ -236,4 +250,16 @@ public interface ResponseGenerator {
SwiftResponse createSwiftResponse(Swift swift);
PhysicalNetworkResponse createPhysicalNetworkResponse(PhysicalNetwork result);
ServiceResponse createNetworkServiceResponse(Service service);
ProviderResponse createNetworkServiceProviderResponse(Provider serviceProvider);
ProviderResponse createNetworkServiceProviderResponse(PhysicalNetworkServiceProvider result);
TrafficTypeResponse createTrafficTypeResponse(PhysicalNetworkTrafficType result);
VirtualRouterProviderResponse createVirtualRouterProviderResponse(VirtualRouterProvider result);
}

View File

@ -0,0 +1,131 @@
/**
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.commands;
import java.util.List;
import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.BaseAsyncCreateCmd;
import com.cloud.api.BaseCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.ProviderResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.network.PhysicalNetworkServiceProvider;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@Implementation(description="Adds a network serviceProvider to a physical network", responseObject=ProviderResponse.class)
public class AddNetworkServiceProviderCmd extends BaseAsyncCreateCmd {
public static final Logger s_logger = Logger.getLogger(AddNetworkServiceProviderCmd.class.getName());
private static final String s_name = "addnetworkserviceproviderresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, required=true, description="the Physical Network ID to add the provider to")
private Long physicalNetworkId;
@Parameter(name=ApiConstants.DEST_PHYSICAL_NETWORK_ID, type=CommandType.LONG, description="the destination Physical Network ID to bridge to")
private Long destinationPhysicalNetworkId;
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="the name for the physical network service provider")
private String name;
@Parameter(name=ApiConstants.SERVICE_LIST, type=CommandType.LIST, collectionType = CommandType.STRING, description="the list of services to be enabled for this physical network service provider")
private List<String> enabledServices;
@Override
public String getEntityTable() {
return "physical_network_service_providers";
}
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
public Long getPhysicalNetworkId() {
return physicalNetworkId;
}
public String getProviderName() {
return name;
}
public Long getDestinationPhysicalNetworkId() {
return destinationPhysicalNetworkId;
}
public List<String> getEnabledServices() {
return enabledServices;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;
}
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
@Override
public void execute(){
UserContext.current().setEventDetails("Network ServiceProvider Id: "+getEntityId());
PhysicalNetworkServiceProvider result = _networkService.getCreatedPhysicalNetworkServiceProvider(getEntityId());
if (result != null) {
ProviderResponse response = _responseGenerator.createNetworkServiceProviderResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add service provider to physical network");
}
}
@Override
public void create() throws ResourceAllocationException {
PhysicalNetworkServiceProvider result = _networkService.addProviderToPhysicalNetwork(getPhysicalNetworkId(), getProviderName(), getDestinationPhysicalNetworkId(), getEnabledServices());
if (result != null) {
setEntityId(result.getId());
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add service provider entity to physical network");
}
}
@Override
public String getEventType() {
return EventTypes.EVENT_SERVICE_PROVIDER_CREATE;
}
@Override
public String getEventDescription() {
return "Adding physical network ServiceProvider: " + getEntityId();
}
}

View File

@ -0,0 +1,147 @@
/**
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.commands;
import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.BaseAsyncCreateCmd;
import com.cloud.api.BaseCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.TrafficTypeResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.network.PhysicalNetworkTrafficType;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@Implementation(description="Adds traffic type to a physical network", responseObject=TrafficTypeResponse.class)
public class AddTrafficTypeCmd extends BaseAsyncCreateCmd {
public static final Logger s_logger = Logger.getLogger(AddTrafficTypeCmd.class.getName());
private static final String s_name = "addtraffictyperesponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, required=true, description="the Physical Network ID")
private Long physicalNetworkId;
@Parameter(name=ApiConstants.TRAFFIC_TYPE, type=CommandType.STRING, required=true, description="the trafficType to be added to the physical network")
private String trafficType;
@Parameter(name=ApiConstants.XEN_NETWORK_LABEL, type=CommandType.STRING, description="The network name label of the physical device dedicated to this traffic on a XenServer host")
private String xenLabel;
@Parameter(name=ApiConstants.KVM_NETWORK_LABEL, type=CommandType.STRING, description="The network name label of the physical device dedicated to this traffic on a KVM host")
private String kvmLabel;
@Parameter(name=ApiConstants.VMWARE_NETWORK_LABEL, type=CommandType.STRING, description="The network name label of the physical device dedicated to this traffic on a VMware host")
private String vmwareLabel;
@Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, description="The VLAN id to be used for Management traffic by VMware host")
private String vlan;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@Override
public String getEntityTable() {
return "physical_network_traffic_types";
}
public Long getPhysicalNetworkId() {
return physicalNetworkId;
}
public String getTrafficType() {
return trafficType;
}
public String getXenLabel() {
return xenLabel;
}
public String getKvmLabel() {
return kvmLabel;
}
public String getVmwareLabel() {
return vmwareLabel;
}
public void setVlan(String vlan) {
this.vlan = vlan;
}
public String getVlan() {
return vlan;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;
}
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
@Override
public void execute(){
UserContext.current().setEventDetails("TrafficType Id: "+getEntityId());
PhysicalNetworkTrafficType result = _networkService.getPhysicalNetworkTrafficType(getEntityId());
if (result != null) {
TrafficTypeResponse response = _responseGenerator.createTrafficTypeResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add traffic type to physical network");
}
}
@Override
public void create() throws ResourceAllocationException {
PhysicalNetworkTrafficType result = _networkService.addTrafficTypeToPhysicalNetwork(getPhysicalNetworkId(), getTrafficType(), getXenLabel(), getKvmLabel(), getVmwareLabel(), getVlan());
if (result != null) {
setEntityId(result.getId());
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add traffic type to physical network");
}
}
@Override
public String getEventType() {
return EventTypes.EVENT_TRAFFIC_TYPE_CREATE;
}
@Override
public String getEventDescription() {
return "Adding physical network traffic type: " + getEntityId();
}
}

View File

@ -106,7 +106,7 @@ public class AssociateIPAddrCmd extends BaseAsyncCreateCmd {
DataCenter zone = _configService.getZone(getZoneId());
if (zone.getNetworkType() == NetworkType.Advanced) {
List<? extends Network> networks = _networkService.getVirtualNetworksOwnedByAccountInZone(getZoneId(), _accountService.getAccount(getEntityOwnerId()));
List<? extends Network> networks = _networkService.getIsolatedNetworksOwnedByAccountInZone(getZoneId(), _accountService.getAccount(getEntityOwnerId()));
if (networks.size() == 0) {
String domain = _domainService.getDomain(getDomainId()).getName();
throw new InvalidParameterValueException("Account name=" + getAccountName() + " domain=" + domain + " doesn't have virtual networks in zone=" + zone.getName());
@ -114,8 +114,7 @@ public class AssociateIPAddrCmd extends BaseAsyncCreateCmd {
assert (networks.size() <= 1) : "Too many virtual networks. This logic should be obsolete";
return networks.get(0).getId();
} else {
Network defaultGuestNetwork = _networkService.getSystemNetworkByZoneAndTrafficType(zone.getId(), TrafficType.Guest);
Network defaultGuestNetwork = _networkService.getExclusiveGuestNetwork(zoneId);
if (defaultGuestNetwork == null) {
throw new InvalidParameterValueException("Unable to find a default Guest network for account " + getAccountName() + " in domain id=" + getDomainId());
} else {

View File

@ -1,233 +0,0 @@
/**
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.commands;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.BaseAsyncCmd;
import com.cloud.api.BaseCmd;
import com.cloud.api.IdentityMapper;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.SecurityGroupRuleResponse;
import com.cloud.api.response.SecurityGroupResponse;
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.network.security.SecurityRule;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
import com.cloud.utils.StringUtils;
@Implementation(responseObject = SecurityGroupRuleResponse.class, description = "Authorizes a particular egress rule for this security group")
@SuppressWarnings("rawtypes")
public class AuthorizeSecurityGroupEgressCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(AuthorizeSecurityGroupIngressCmd.class.getName());
private static final String s_name = "authorizesecuritygroupegressresponse";
// ///////////////////////////////////////////////////
// ////////////// API parameters /////////////////////
// ///////////////////////////////////////////////////
@Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, description = "TCP is default. UDP is the other supported protocol")
private String protocol;
@Parameter(name = ApiConstants.START_PORT, type = CommandType.INTEGER, description = "start port for this egress rule")
private Integer startPort;
@Parameter(name = ApiConstants.END_PORT, type = CommandType.INTEGER, description = "end port for this egress rule")
private Integer endPort;
@Parameter(name = ApiConstants.ICMP_TYPE, type = CommandType.INTEGER, description = "type of the icmp message being sent")
private Integer icmpType;
@Parameter(name = ApiConstants.ICMP_CODE, type = CommandType.INTEGER, description = "error code for this icmp message")
private Integer icmpCode;
@Parameter(name=ApiConstants.CIDR_LIST, type=CommandType.LIST, collectionType=CommandType.STRING, description="the cidr list associated")
private List cidrList;
@Parameter(name = ApiConstants.USER_SECURITY_GROUP_LIST, type = CommandType.MAP, description = "user to security group mapping")
private Map userSecurityGroupList;
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="an optional domainId for the security group. If the account parameter is used, domainId must also be used.")
private Long domainId;
@Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="an optional account for the security group. Must be used with domainId.")
private String accountName;
@IdentityMapper(entityTableName="projects")
@Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="an optional project of the security group")
private Long projectId;
@IdentityMapper(entityTableName="security_group")
@Parameter(name=ApiConstants.SECURITY_GROUP_ID, type=CommandType.LONG, description="The ID of the security group. Mutually exclusive with securityGroupName parameter")
private Long securityGroupId;
@Parameter(name=ApiConstants.SECURITY_GROUP_NAME, type=CommandType.STRING, description="The name of the security group. Mutually exclusive with securityGroupName parameter")
private String securityGroupName;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
public String getAccountName() {
return accountName;
}
public List getCidrList() {
return cidrList;
}
public Integer getEndPort() {
return endPort;
}
public Integer getIcmpCode() {
return icmpCode;
}
public Integer getIcmpType() {
return icmpType;
}
public Long getSecurityGroupId() {
if (securityGroupId != null && securityGroupName != null) {
throw new InvalidParameterValueException("securityGroupId and securityGroupName parameters are mutually exclusive");
}
if (securityGroupName != null) {
securityGroupId = _responseGenerator.getSecurityGroupId(securityGroupName, getEntityOwnerId());
if (securityGroupId == null) {
throw new InvalidParameterValueException("Unable to find security group " + securityGroupName + " for account id=" + getEntityOwnerId());
}
securityGroupName = null;
}
if (securityGroupId == null) {
throw new InvalidParameterValueException("Either securityGroupId or securityGroupName is required by authorizeSecurityGroupIngress command");
}
return securityGroupId;
}
public String getProtocol() {
if (protocol == null) {
return "all";
}
return protocol;
}
public Integer getStartPort() {
return startPort;
}
public Map getUserSecurityGroupList() {
return userSecurityGroupList;
}
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;
}
public static String getResultObjectName() {
return "securitygroup";
}
@Override
public long getEntityOwnerId() {
Long accountId = getAccountId(accountName, domainId, projectId);
if (accountId == null) {
return UserContext.current().getCaller().getId();
}
return accountId;
}
@Override
public String getEventType() {
return EventTypes.EVENT_SECURITY_GROUP_AUTHORIZE_EGRESS;
}
@Override
public String getEventDescription() {
StringBuilder sb = new StringBuilder();
if (getUserSecurityGroupList() != null) {
sb.append("group list(group/account): ");
Collection userGroupCollection = getUserSecurityGroupList().values();
Iterator iter = userGroupCollection.iterator();
HashMap userGroup = (HashMap) iter.next();
String group = (String) userGroup.get("group");
String authorizedAccountName = (String) userGroup.get("account");
sb.append(group + "/" + authorizedAccountName);
while (iter.hasNext()) {
userGroup = (HashMap) iter.next();
group = (String) userGroup.get("group");
authorizedAccountName = (String) userGroup.get("account");
sb.append(", " + group + "/" + authorizedAccountName);
}
} else if (getCidrList() != null) {
sb.append("cidr list: ");
sb.append(StringUtils.join(getCidrList(), ", "));
} else {
sb.append("<error: no egress parameters>");
}
return "authorizing egress to group: " + getSecurityGroupId() + " to " + sb.toString();
}
@Override
public void execute() {
List<? extends SecurityRule> egressRules = _securityGroupService.authorizeSecurityGroupEgress(this);
if (egressRules != null && !egressRules.isEmpty()) {
SecurityGroupResponse response = _responseGenerator.createSecurityGroupResponseFromSecurityGroupRule(egressRules);
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to authorize security group egress rule(s)");
}
}
@Override
public AsyncJob.Type getInstanceType() {
return AsyncJob.Type.SecurityGroup;
}
@Override
public Long getInstanceId() {
return getSecurityGroupId();
}
}

View File

@ -33,16 +33,18 @@ import com.cloud.api.IdentityMapper;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.SecurityGroupRuleResponse;
import com.cloud.api.BaseCmd.CommandType;
import com.cloud.api.response.IngressRuleResponse;
import com.cloud.api.response.SecurityGroupResponse;
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.network.security.SecurityRule;
import com.cloud.network.security.IngressRule;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
import com.cloud.utils.StringUtils;
@Implementation(responseObject = SecurityGroupRuleResponse.class, description = "Authorizes a particular ingress rule for this security group")
@Implementation(responseObject = IngressRuleResponse.class, description = "Authorizes a particular ingress rule for this security group")
@SuppressWarnings("rawtypes")
public class AuthorizeSecurityGroupIngressCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(AuthorizeSecurityGroupIngressCmd.class.getName());
@ -210,9 +212,9 @@ public class AuthorizeSecurityGroupIngressCmd extends BaseAsyncCmd {
@Override
public void execute() {
List<? extends SecurityRule> ingressRules = _securityGroupService.authorizeSecurityGroupIngress(this);
List<? extends IngressRule> ingressRules = _securityGroupService.authorizeSecurityGroupIngress(this);
if (ingressRules != null && !ingressRules.isEmpty()) {
SecurityGroupResponse response = _responseGenerator.createSecurityGroupResponseFromSecurityGroupRule(ingressRules);
SecurityGroupResponse response = _responseGenerator.createSecurityGroupResponseFromIngressRule(ingressRules);
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to authorize security group ingress rule(s)");

View File

@ -0,0 +1,127 @@
/**
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.commands;
import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.BaseAsyncCmd;
import com.cloud.api.BaseCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.PlugService;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.VirtualRouterProviderResponse;
import com.cloud.network.VirtualRouterProvider;
import com.cloud.network.element.VirtualRouterElementService;
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@Implementation(responseObject=VirtualRouterProviderResponse.class, description="Configures a virtual router element.")
public class ConfigureVirtualRouterElementCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(ConfigureVirtualRouterElementCmd.class.getName());
private static final String s_name = "configurevirtualrouterelementresponse";
@PlugService
private VirtualRouterElementService _service;
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the virtual router provider")
private Long id;
@Parameter(name=ApiConstants.ENABLED, type=CommandType.BOOLEAN, required=true, description="Enabled/Disabled the service provider")
private Boolean enabled;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
public void setId(Long id) {
this.id = id;
}
public Long getId() {
return id;
}
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
public Boolean getEnabled() {
return enabled;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;
}
public static String getResultObjectName() {
return "boolean";
}
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
@Override
public String getEventType() {
return EventTypes.EVENT_NETWORK_ELEMENT_CONFIGURE;
}
@Override
public String getEventDescription() {
return "configuring virtual router provider: " + id;
}
public AsyncJob.Type getInstanceType() {
return AsyncJob.Type.None;
}
public Long getInstanceId() {
return id;
}
@Override
public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException{
UserContext.current().setEventDetails("Virtual router element: " + id);
VirtualRouterProvider result = _service.configure(this);
if (result != null){
VirtualRouterProviderResponse routerResponse = _responseGenerator.createVirtualRouterProviderResponse(result);
routerResponse.setResponseName(getCommandName());
this.setResponseObject(routerResponse);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to configure the virtual router provider");
}
}
}

View File

@ -18,22 +18,22 @@
package com.cloud.api.commands;
import java.util.List;
import org.apache.log4j.Logger;
import com.cloud.acl.ControlledEntity;
import com.cloud.api.ApiConstants;
import com.cloud.api.BaseCmd;
import com.cloud.api.IdentityMapper;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.BaseCmd.CommandType;
import com.cloud.api.response.NetworkResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.network.Network;
import com.cloud.user.Account;
import com.cloud.network.Network.GuestType;
import com.cloud.offering.NetworkOffering;
import com.cloud.user.UserContext;
@Implementation(description="Creates a network", responseObject=NetworkResponse.class)
@ -86,17 +86,17 @@ public class CreateNetworkCmd extends BaseCmd {
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="domain ID of the account owning a network")
private Long domainId;
@Parameter(name=ApiConstants.IS_SHARED, type=CommandType.BOOLEAN, description="true is network is shared across accounts in the Zone")
private Boolean isShared;
@Parameter(name=ApiConstants.IS_DEFAULT, type=CommandType.BOOLEAN, description="true if network is default, false otherwise")
private Boolean isDefault;
@Parameter(name=ApiConstants.NETWORK_DOMAIN, type=CommandType.STRING, description="network domain")
private String networkDomain;
@Parameter(name=ApiConstants.TAGS, type=CommandType.LIST, collectionType=CommandType.STRING, description="Tag the network")
private List<String> tags;
@Parameter(name=ApiConstants.ACL_TYPE, type=CommandType.STRING, description="Access control type; supported values are account and domain. If not specified, defaulted to Account. Account means that only the account owner can use the network, domain - all accouns in the domain can use the network")
private String aclType;
@Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, description="the Physical Network ID the network belongs to")
private Long physicalNetworkId;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@ -104,14 +104,6 @@ public class CreateNetworkCmd extends BaseCmd {
public Long getNetworkOfferingId() {
return networkOfferingId;
}
public List<String> getTags() {
return tags;
}
public Long getZoneId() {
return zoneId;
}
public String getGateway() {
return gateway;
@ -149,10 +141,6 @@ public class CreateNetworkCmd extends BaseCmd {
return displayText;
}
public boolean getIsShared() {
return isShared == null ? false : isShared;
}
public Boolean isDefault() {
return isDefault;
}
@ -164,11 +152,44 @@ public class CreateNetworkCmd extends BaseCmd {
public Long getProjectId() {
return projectId;
}
public String getAclType() {
return aclType == null ? ControlledEntity.ACLType.Account.toString() : aclType;
}
public Long getZoneId() {
Long physicalNetworkId = getPhysicalNetworkId();
if (physicalNetworkId == null && zoneId == null) {
throw new InvalidParameterValueException("Zone id is required");
}
return zoneId;
}
public Long getPhysicalNetworkId() {
NetworkOffering offering = _configService.getNetworkOffering(networkOfferingId);
if (offering == null) {
throw new InvalidParameterValueException("Unable to find network offering by id " + networkOfferingId);
}
if (physicalNetworkId != null) {
if (offering.getGuestType() == GuestType.Shared) {
return physicalNetworkId;
} else {
throw new InvalidParameterValueException("Physical network id can be specified for networks of guest ip type " + GuestType.Shared + " only.");
}
} else {
if (zoneId == null) {
throw new InvalidParameterValueException("ZoneId is required as physicalNetworkId is null");
}
return _networkService.findPhysicalNetworkId(zoneId, offering.getTags());
}
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;

View File

@ -18,6 +18,13 @@
package com.cloud.api.commands;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
@ -26,6 +33,9 @@ import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.NetworkOfferingResponse;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.network.Network.Capability;
import com.cloud.network.Network.Service;
import com.cloud.offering.NetworkOffering;
import com.cloud.offering.NetworkOffering.Availability;
import com.cloud.user.Account;
@ -45,29 +55,68 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
@Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, required=true, description="the display text of the network offering")
private String displayText;
@Parameter(name=ApiConstants.TRAFFIC_TYPE, type=CommandType.STRING, required=true, description="the traffic type for the network offering, supported types are Public, Management, Control, Guest, Vlan or Storage.")
@Parameter(name=ApiConstants.TRAFFIC_TYPE, type=CommandType.STRING, required=true, description="the traffic type for the network offering. Supported type in current release is GUEST only")
private String traffictype;
@Parameter(name=ApiConstants.GUEST_IP_TYPE, type=CommandType.STRING, required=true, description="the guest ip type for the network offering, supported types are Direct and Virtual.")
private String guestIpType;
@Parameter(name=ApiConstants.MAX_CONNECTIONS, type=CommandType.INTEGER, description="maximum number of concurrent connections supported by the network offering")
private Integer maxConnections;
@Parameter(name=ApiConstants.TAGS, type=CommandType.STRING, description="the tags for the network offering.", length=4096)
private String tags;
@Parameter(name=ApiConstants.SPECIFY_VLAN, type=CommandType.BOOLEAN, description="true is network offering supports vlans")
@Parameter(name=ApiConstants.SPECIFY_VLAN, type=CommandType.BOOLEAN, description="true if network offering supports vlans")
private Boolean specifyVlan;
@Parameter(name=ApiConstants.AVAILABILITY, type=CommandType.STRING, description="the availability of network offering. Default value is Required")
@Parameter(name=ApiConstants.AVAILABILITY, type=CommandType.STRING, description="the availability of network offering. Default value is Optional")
private String availability;
@Parameter(name=ApiConstants.NETWORKRATE, type=CommandType.INTEGER, description="data transfer rate in megabits per second allowed.")
@Parameter(name=ApiConstants.NETWORKRATE, type=CommandType.INTEGER, description="data transfer rate in megabits per second allowed")
private Integer networkRate;
@Parameter(name=ApiConstants.SERVICE_OFFERING_ID, type=CommandType.LONG, description="the service offering ID used by virtual router provider")
private Long serviceOfferingId;
@Parameter(name=ApiConstants.GUEST_IP_TYPE, type=CommandType.STRING, required=true, description="guest type of the network offering: Shared or Isolated")
private String guestIptype;
@Parameter(name=ApiConstants.DHCP_SERVICE, type=CommandType.BOOLEAN, description="true if network offering supports dhcp service")
private Boolean dhcpService;
@Parameter(name=ApiConstants.DNS_SERVICE, type=CommandType.BOOLEAN, description="true if network offering supports dns service")
private Boolean dnsService;
@Parameter(name=ApiConstants.GATEWAY_SERVICE, type=CommandType.BOOLEAN, description="true if network offering supports gateway service")
private Boolean gatewayService;
@Parameter(name=ApiConstants.FIREWALL_SERVICE, type=CommandType.BOOLEAN, description="true if network offering supports firewall service")
private Boolean firewallService;
@Parameter(name=ApiConstants.LB_SERVICE, type=CommandType.BOOLEAN, description="true if network offering supports lb service")
private Boolean lbService;
@Parameter(name=ApiConstants.USERDATA_SERVICE, type=CommandType.BOOLEAN, description="true if network offering supports user data service")
private Boolean userdataService;
@Parameter(name=ApiConstants.SOURCE_NAT_SERVICE, type=CommandType.BOOLEAN, description="true if network offering supports source nat service")
private Boolean sourceNatService;
@Parameter(name=ApiConstants.STATIC_NAT_SERVICE, type=CommandType.BOOLEAN, description="true if network offering supports static nat service")
private Boolean staticNatService;
@Parameter(name=ApiConstants.PORT_FORWARDING_SERVICE, type=CommandType.BOOLEAN, description="true if network offering supports port forwarding service")
private Boolean portForwardingService;
@Parameter(name=ApiConstants.VPN_SERVICE, type=CommandType.BOOLEAN, description="true if network offering supports vpn service")
private Boolean vpnService;
@Parameter(name=ApiConstants.SECURITY_GROUP_SERVICE, type=CommandType.BOOLEAN, description="true if network offering supports security group service")
private Boolean securityGroupService;
@Parameter(name = ApiConstants.SERVICE_PROVIDER_LIST, type = CommandType.MAP, description = "provider to service mapping. If not specified, the provider for the service will be mapped to the default provider on the physical network")
private Map serviceProviderList;
@Parameter(name=ApiConstants.REDUNDANT_ROUTER, type=CommandType.BOOLEAN, description="if network offering supports redundant router.")
private Boolean redundantRouter;
@Parameter(name = ApiConstants.SERVICE_CAPABILITY_LIST, type = CommandType.MAP, description = "desired service capabilities as part of network offering")
private Map serviceCapabilistList;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@ -98,20 +147,125 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
}
public String getAvailability() {
//Verify availability
return availability == null ? Availability.Required.toString() : availability;
return availability == null ? Availability.Optional.toString() : availability;
}
public Integer getNetworkRate() {
return networkRate;
}
public String getGuestIpType() {
return guestIpType;
public static String getName() {
return _name;
}
public Boolean getRedundantRouter() {
return redundantRouter == null ? false : redundantRouter;
public Integer getMaxConnections() {
return maxConnections;
}
public Long getServiceOfferingId() {
return serviceOfferingId;
}
public Boolean getDhcpService() {
return dhcpService == null ? false : dhcpService;
}
public Boolean getDnsService() {
return dnsService == null ? false : dnsService;
}
public Boolean getGatewayService() {
return gatewayService == null ? false : gatewayService;
}
public Boolean getFirewallService() {
return firewallService == null ? false : firewallService;
}
public Boolean getLbService() {
return lbService == null ? false : lbService;
}
public Boolean getUserdataService() {
return userdataService == null ? false : userdataService;
}
public Boolean getSourceNatService() {
return sourceNatService == null ? false : sourceNatService;
}
public Boolean getStaticNatService() {
return staticNatService == null ? false : staticNatService;
}
public Boolean getPortForwardingService() {
return portForwardingService == null ? false : portForwardingService;
}
public Boolean getVpnService() {
return vpnService == null ? false : vpnService;
}
public Boolean getSecurityGroupService() {
return securityGroupService == null ? false : securityGroupService;
}
public String getGuestIpType() {
return guestIptype;
}
public Map<String, List<String>> getServiceProviders() {
Map<String, List<String>> serviceProviderMap = null;
if (serviceProviderList != null && !serviceProviderList.isEmpty()) {
serviceProviderMap = new HashMap<String, List<String>>();
Collection servicesCollection = serviceProviderList.values();
Iterator iter = servicesCollection.iterator();
while (iter.hasNext()) {
HashMap<String, String> services = (HashMap<String, String>) iter.next();
String service = services.get("service");
String provider = services.get("provider");
List<String> providerList = null;
if (serviceProviderMap.containsKey(service)) {
providerList = serviceProviderMap.get(service);
} else {
providerList = new ArrayList<String>();
}
providerList.add(provider);
serviceProviderMap.put(service, providerList);
}
}
return serviceProviderMap;
}
public Map<Capability, String> getServiceCapabilities(Service service) {
Map<Capability, String> capabilityMap = null;
if (serviceCapabilistList != null && !serviceCapabilistList.isEmpty()) {
capabilityMap = new HashMap <Capability, String>();
Collection serviceCapabilityCollection = serviceCapabilistList.values();
Iterator iter = serviceCapabilityCollection.iterator();
while (iter.hasNext()) {
HashMap<String, String> svcCapabilityMap = (HashMap<String, String>) iter.next();
Capability capability = null;
String svc = (String) svcCapabilityMap.get("service");
String capabilityName = (String) svcCapabilityMap.get("capabilityType");
String capabilityValue = (String) svcCapabilityMap.get("capabilityValue");
if (capabilityName != null) {
capability = Capability.getCapability(capabilityName);
}
if ((capability == null) || (capabilityName == null) || (capabilityValue == null) ) {
throw new InvalidParameterValueException("Invalid capability:" + capabilityName + " capability value:" + capabilityValue);
}
if (svc.equalsIgnoreCase(service.getName())) {
capabilityMap.put(capability, capabilityValue);
}
}
}
return capabilityMap;
}
/////////////////////////////////////////////////////

View File

@ -0,0 +1,162 @@
/**
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.commands;
import java.util.List;
import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.BaseAsyncCreateCmd;
import com.cloud.api.BaseCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.PhysicalNetworkResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.network.PhysicalNetwork;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@Implementation(description="Creates a physical network", responseObject=PhysicalNetworkResponse.class)
public class CreatePhysicalNetworkCmd extends BaseAsyncCreateCmd {
public static final Logger s_logger = Logger.getLogger(CreatePhysicalNetworkCmd.class.getName());
private static final String s_name = "createphysicalnetworkresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required=true, description="the Zone ID for the physical network")
private Long zoneId;
@Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, description="the VLAN for the physical network")
private String vlan;
@Parameter(name=ApiConstants.NETWORK_SPEED, type=CommandType.STRING, description="the speed for the physical network[1G/10G]")
private String speed;
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="domain ID of the account owning a physical network")
private Long domainId;
@Parameter(name=ApiConstants.BROADCAST_DOMAIN_RANGE, type=CommandType.STRING, description="the broadcast domain range for the physical network[Pod or Zone]")
private String broadcastDomainRange;
@Parameter(name=ApiConstants.TAGS, type=CommandType.LIST, collectionType=CommandType.STRING, description="Tag the physical network")
private List<String> tags;
@Parameter(name=ApiConstants.ISOLATION_METHODS, type=CommandType.LIST, collectionType=CommandType.STRING, description="the isolation method for the physical network[VLAN/L3/GRE]")
private List<String> isolationMethods;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
public List<String> getTags() {
return tags;
}
@Override
public String getEntityTable() {
return "physical_network";
}
public Long getZoneId() {
return zoneId;
}
public String getVlan() {
return vlan;
}
public Long getDomainId() {
return domainId;
}
public String getBroadcastDomainRange() {
return broadcastDomainRange;
}
public List<String> getIsolationMethods() {
return isolationMethods;
}
public String getNetworkSpeed() {
return speed;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;
}
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
@Override
public String getEventType() {
return EventTypes.EVENT_PHYSICAL_NETWORK_CREATE;
}
@Override
public String getCreateEventType() {
return EventTypes.EVENT_PHYSICAL_NETWORK_CREATE;
}
@Override
public String getCreateEventDescription() {
return "creating Physical Network";
}
@Override
public String getEventDescription() {
return "creating Physical Network. Id: "+getEntityId();
}
@Override
public void execute(){
UserContext.current().setEventDetails("Physical Network Id: "+getEntityId());
PhysicalNetwork result = _networkService.getCreatedPhysicalNetwork(getEntityId());
if (result != null) {
PhysicalNetworkResponse response = _responseGenerator.createPhysicalNetworkResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create physical network");
}
}
@Override
public void create() throws ResourceAllocationException {
PhysicalNetwork result = _networkService.createPhysicalNetwork(getZoneId(),getVlan(),getNetworkSpeed(), getIsolationMethods(),getBroadcastDomainRange(),getDomainId(), getTags());
if (result != null) {
setEntityId(result.getId());
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create physical network entity");
}
}
}

View File

@ -0,0 +1,118 @@
/**
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.commands;
import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.BaseAsyncCreateCmd;
import com.cloud.api.BaseCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.PlugService;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.VirtualRouterProviderResponse;
import com.cloud.network.VirtualRouterProvider;
import com.cloud.network.element.VirtualRouterElementService;
import com.cloud.event.EventTypes;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.network.VirtualRouterProvider;
import com.cloud.network.element.VirtualRouterElementService;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@Implementation(responseObject=VirtualRouterProviderResponse.class, description="Create a virtual router element.")
public class CreateVirtualRouterElementCmd extends BaseAsyncCreateCmd {
public static final Logger s_logger = Logger.getLogger(CreateVirtualRouterElementCmd.class.getName());
private static final String s_name = "createvirtualrouterelementresponse";
@PlugService
private VirtualRouterElementService _service;
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.NETWORK_SERVICE_PROVIDER_ID, type=CommandType.LONG, required=true, description="the network service provider ID of the virtual router element")
private Long nspId;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
public void setNspId(Long nspId) {
this.nspId = nspId;
}
@Override
public String getEntityTable() {
return "virtual_router_providers";
}
public Long getNspId() {
return nspId;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;
}
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
@Override
public void execute(){
UserContext.current().setEventDetails("Virtual router element Id: "+getEntityId());
VirtualRouterProvider result = _service.getCreatedElement(getEntityId());
if (result != null) {
VirtualRouterProviderResponse response = _responseGenerator.createVirtualRouterProviderResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add Virtual Router entity to physical network");
}
}
@Override
public void create() throws ResourceAllocationException {
VirtualRouterProvider result = _service.addElement(getNspId());
if (result != null) {
setEntityId(result.getId());
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add Virtual Router entity to physical network");
}
}
@Override
public String getEventType() {
return EventTypes.EVENT_SERVICE_PROVIDER_CREATE;
}
@Override
public String getEventDescription() {
return "Adding physical network ServiceProvider Virtual Router: " + getEntityId();
}
}

View File

@ -84,6 +84,9 @@ public class CreateVlanIpRangeCmd extends BaseCmd {
@Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.LONG, description="the network id")
private Long networkID;
@Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, description="the physical network id")
private Long physicalNetworkId;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@ -139,6 +142,11 @@ public class CreateVlanIpRangeCmd extends BaseCmd {
return networkID;
}
public Long getPhysicalNetworkId() {
return physicalNetworkId;
}
@Override
public String getCommandName() {
return s_name;

View File

@ -58,9 +58,6 @@ public class CreateZoneCmd extends BaseCmd {
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="the name of the Zone")
private String zoneName;
@Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, description="the VLAN for the Zone")
private String vlan;
@Parameter(name=ApiConstants.DOMAIN, type=CommandType.STRING, description="Network domain name for the networks in the zone")
private String domain;
@ -71,11 +68,11 @@ public class CreateZoneCmd extends BaseCmd {
@Parameter(name=ApiConstants.NETWORK_TYPE, type=CommandType.STRING, required=true, description="network type of the zone, can be Basic or Advanced")
private String networkType;
@Parameter(name=ApiConstants.SECURITY_GROUP_EANBLED, type=CommandType.BOOLEAN, description="true if network is security group enabled, false otherwise")
private Boolean securitygroupenabled;
@Parameter(name=ApiConstants.ALLOCATION_STATE, type=CommandType.STRING, description="Allocation state of this Zone for allocation of new resources")
private String allocationState;
@Parameter(name=ApiConstants.SECURITY_GROUP_EANBLED, type=CommandType.BOOLEAN, description="true if network is security group enabled, false otherwise")
private Boolean securitygroupenabled;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@ -105,10 +102,6 @@ public class CreateZoneCmd extends BaseCmd {
return zoneName;
}
public String getVlan() {
return vlan;
}
public String getDomain() {
return domain;
}
@ -121,21 +114,20 @@ public class CreateZoneCmd extends BaseCmd {
return networkType;
}
public Boolean isSecurityGroupEnabled() {
public String getAllocationState() {
return allocationState;
}
public Boolean getSecuritygroupenabled() {
if (securitygroupenabled == null) {
return false;
}
return securitygroupenabled;
}
public String getAllocationState() {
return allocationState;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
@Override
public String getCommandName() {
return s_name;

View File

@ -0,0 +1,102 @@
/**
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.commands;
import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.BaseAsyncCmd;
import com.cloud.api.BaseCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.SuccessResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.user.Account;
@Implementation(description="Deletes a Network Service Provider.", responseObject=SuccessResponse.class)
public class DeleteNetworkServiceProviderCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeleteNetworkServiceProviderCmd.class.getName());
private static final String s_name = "deletenetworkserviceproviderresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the network service provider")
private Long id;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
public Long getId() {
return id;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;
}
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
@Override
public void execute(){
try{
boolean result = _networkService.deleteNetworkServiceProvider(getId());
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete network service provider");
}
} catch (ResourceUnavailableException ex) {
s_logger.warn("Exception: ", ex);
throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
} catch (ConcurrentOperationException ex) {
s_logger.warn("Exception: ", ex);
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
}
}
@Override
public String getEventType() {
return EventTypes.EVENT_SERVICE_PROVIDER_DELETE;
}
@Override
public String getEventDescription() {
return "Deleting Physical network ServiceProvider: " + getId();
}
}

View File

@ -0,0 +1,93 @@
/**
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.commands;
import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.BaseAsyncCmd;
import com.cloud.api.BaseCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.SuccessResponse;
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@Implementation(description="Deletes a Physical Network.", responseObject=SuccessResponse.class)
public class DeletePhysicalNetworkCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeletePhysicalNetworkCmd.class.getName());
private static final String s_name = "deletephysicalnetworkresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the Physical network")
private Long id;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
public Long getId() {
return id;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;
}
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
@Override
public void execute(){
UserContext.current().setEventDetails("Physical Network Id: " + id);
boolean result = _networkService.deletePhysicalNetwork(getId());
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete physical network");
}
}
@Override
public String getEventDescription() {
return "Deleting Physical network: " + getId();
}
@Override
public String getEventType() {
return EventTypes.EVENT_PHYSICAL_NETWORK_DELETE;
}
}

View File

@ -0,0 +1,91 @@
/**
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.commands;
import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.BaseAsyncCmd;
import com.cloud.api.BaseCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.SuccessResponse;
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
@Implementation(description="Deletes traffic type of a physical network", responseObject=SuccessResponse.class)
public class DeleteTrafficTypeCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeleteTrafficTypeCmd.class.getName());
private static final String s_name = "deletetraffictyperesponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="traffic type id")
private Long id;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
public Long getId() {
return id;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;
}
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
@Override
public void execute(){
boolean result = _networkService.deletePhysicalNetworkTrafficType(getId());
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
}else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete traffic type");
}
}
@Override
public String getEventDescription() {
return "Deleting Traffic Type: " + getId();
}
@Override
public String getEventType() {
return EventTypes.EVENT_TRAFFIC_TYPE_DELETE;
}
}

View File

@ -245,14 +245,6 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
return hostId;
}
private String getIpAddress() {
return ipAddress;
}
private String getKeyboard() {
return keyboard;
}
private Map<Long, String> getIpToNetworkMap() {
if ((networkIds != null || ipAddress != null) && ipToNetworkList != null) {
throw new InvalidParameterValueException("NetworkIds and ipAddress can't be specified along with ipToNetworkMap parameter");
@ -394,7 +386,7 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
displayName, diskOfferingId, size, group, getHypervisor(), userData, sshKeyPairName, getIpToNetworkMap(), ipAddress, keyboard);
}
} else {
if (zone.isSecurityGroupEnabled()) {
if (zone.isSecurityGroupEnabled()) {
vm = _userVmService.createAdvancedSecurityGroupVirtualMachine(zone, serviceOffering, template, getNetworkIds(), getSecurityGroupIdList(),
owner, name, displayName, diskOfferingId, size, group, getHypervisor(), userData, sshKeyPairName, getIpToNetworkMap(), ipAddress, keyboard);
} else {

View File

@ -31,6 +31,7 @@ import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.network.IpAddress;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@Implementation(description="Disassociates an ip address from the account.", responseObject=SuccessResponse.class)
@ -99,6 +100,10 @@ public class DisassociateIPAddrCmd extends BaseAsyncCmd {
}
ownerId = ip.getAccountId();
}
if (ownerId == null) {
return Account.ACCOUNT_ID_SYSTEM;
}
return ownerId;
}

View File

@ -60,19 +60,26 @@ public class ListNetworkOfferingsCmd extends BaseListCmd {
@Parameter(name=ApiConstants.SPECIFY_VLAN, type=CommandType.BOOLEAN, description="the tags for the network offering.")
private Boolean specifyVlan;
@Parameter(name=ApiConstants.IS_SHARED, type=CommandType.BOOLEAN, description="true is network offering supports vlans")
private Boolean isShared;
@Parameter(name=ApiConstants.AVAILABILITY, type=CommandType.STRING, description="the availability of network offering. Default value is Required")
private String availability;
@Parameter(name=ApiConstants.GUEST_IP_TYPE, type=CommandType.STRING, description="the guest ip type for the network offering, supported types are Direct and Virtual.")
private String guestIpType;
@IdentityMapper(entityTableName="data_center")
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="list netowrk offerings available for network creation in specific zone")
private Long zoneId;
@Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="list network offerings by state")
private String state;
@Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.LONG, description="the ID of the network. Pass this in if you want to see the available network offering that a network can be changed to.")
private Long networkId;
@Parameter(name=ApiConstants.GUEST_IP_TYPE, type=CommandType.STRING, description="list network offerings by guest type: Shared or Isolated")
private String guestIpType;
//Network information
@Parameter(name=ApiConstants.SUPPORTED_SERVICES, type=CommandType.LIST, collectionType=CommandType.STRING, description="list network offerings supporting certain services")
private List<String> supportedServices;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@ -101,20 +108,28 @@ public class ListNetworkOfferingsCmd extends BaseListCmd {
return specifyVlan;
}
public Boolean getIsShared() {
return isShared;
}
public String getAvailability() {
return availability;
}
public Long getZoneId() {
return zoneId;
}
public String getState() {
return state;
}
public Long getNetworkId() {
return networkId;
}
public String getGuestIpType() {
return guestIpType;
}
public Long getZoneId() {
return zoneId;
public List<String> getSupportedServices() {
return supportedServices;
}
/////////////////////////////////////////////////////

View File

@ -0,0 +1,89 @@
/**
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.commands;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.response.ListResponse;
import com.cloud.api.response.ProviderResponse;
import com.cloud.network.PhysicalNetworkServiceProvider;
import com.cloud.user.Account;
@Implementation(description="Lists network serviceproviders for a given physical network.", responseObject=ProviderResponse.class)
public class ListNetworkServiceProvidersCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListNetworkServiceProvidersCmd.class.getName());
private static final String _name = "listnetworkserviceprovidersresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, required=true, description="the Physical Network ID")
private Long physicalNetworkId;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
public void setPhysicalNetworkId(Long physicalNetworkId) {
this.physicalNetworkId = physicalNetworkId;
}
public Long getPhysicalNetworkId() {
return physicalNetworkId;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
return _name;
}
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
@Override
public void execute(){
List<? extends PhysicalNetworkServiceProvider> serviceProviders = _networkService.listNetworkServiceProviders(getPhysicalNetworkId());
ListResponse<ProviderResponse> response = new ListResponse<ProviderResponse>();
List<ProviderResponse> serviceProvidersResponses = new ArrayList<ProviderResponse>();
for (PhysicalNetworkServiceProvider serviceProvider : serviceProviders) {
ProviderResponse serviceProviderResponse = _responseGenerator.createNetworkServiceProviderResponse(serviceProvider);
serviceProvidersResponses.add(serviceProviderResponse);
}
response.setResponses(serviceProvidersResponses);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
}

View File

@ -0,0 +1,88 @@
/**
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.commands;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.response.ListResponse;
import com.cloud.api.response.ServiceResponse;
import com.cloud.network.Network;
import com.cloud.user.Account;
@Implementation(description="Lists all network services provided by CloudStack or for the given Provider.", responseObject=ServiceResponse.class)
public class ListNetworkServicesCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListNetworkServicesCmd.class.getName());
private static final String _name = "listnetworkservicesresponse";
@Parameter(name=ApiConstants.PROVIDER, type=CommandType.STRING, description="network service provider name")
private String providerName;
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
public void setProviderName(String providerName) {
this.providerName = providerName;
}
public String getProviderName() {
return providerName;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
return _name;
}
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
@Override
public void execute(){
List<? extends Network.Service> services = _networkService.listNetworkServices(getProviderName());
ListResponse<ServiceResponse> response = new ListResponse<ServiceResponse>();
List<ServiceResponse> servicesResponses = new ArrayList<ServiceResponse>();
for (Network.Service service : services) {
ServiceResponse serviceResponse = _responseGenerator.createNetworkServiceResponse(service);
servicesResponses.add(serviceResponse);
}
response.setResponses(servicesResponses);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
}

View File

@ -28,7 +28,6 @@ import com.cloud.api.BaseListCmd;
import com.cloud.api.IdentityMapper;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.BaseCmd.CommandType;
import com.cloud.api.response.ListResponse;
import com.cloud.api.response.NetworkResponse;
import com.cloud.network.Network;
@ -58,13 +57,13 @@ public class ListNetworksCmd extends BaseListCmd {
private Long zoneId;
@Parameter(name=ApiConstants.TYPE, type=CommandType.STRING, description="the type of the network")
private String type;
private String guestIpType;
@Parameter(name=ApiConstants.IS_SYSTEM, type=CommandType.BOOLEAN, description="true if network is system, false otherwise")
private Boolean isSystem;
@Parameter(name=ApiConstants.IS_SHARED, type=CommandType.BOOLEAN, description="true if network is shared across accounts in the Zone, false otherwise")
private Boolean isShared;
@Parameter(name=ApiConstants.ACL_TYPE, type=CommandType.STRING, description="list networks by ACL (access control list) type. Supported values are Account and Domain")
private String aclType;
@Parameter(name=ApiConstants.IS_DEFAULT, type=CommandType.BOOLEAN, description="true if network is default, false otherwise")
private Boolean isDefault;
@ -75,6 +74,12 @@ public class ListNetworksCmd extends BaseListCmd {
@IdentityMapper(entityTableName="projects")
@Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="list networks by project id")
private Long projectId;
@Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, description="list networks by physical network id")
private Long physicalNetworkId;
@Parameter(name=ApiConstants.SUPPORTED_SERVICES, type=CommandType.LIST, collectionType=CommandType.STRING, description="list network offerings supporting certain services")
private List<String> supportedServices;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@ -96,19 +101,19 @@ public class ListNetworksCmd extends BaseListCmd {
return zoneId;
}
public String getType() {
return type;
public String getGuestIpType() {
return guestIpType;
}
public Boolean getIsSystem() {
return isSystem;
}
public Boolean getIsShared() {
return isShared;
}
public Boolean isDefault() {
public String getAclType() {
return aclType;
}
public Boolean isDefault() {
return isDefault;
}
@ -120,6 +125,14 @@ public class ListNetworksCmd extends BaseListCmd {
return projectId;
}
public Long getPhysicalNetworkId() {
return physicalNetworkId;
}
public List<String> getSupportedServices() {
return supportedServices;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////

View File

@ -0,0 +1,100 @@
/**
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.commands;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.BaseCmd;
import com.cloud.api.BaseListCmd;
import com.cloud.api.IdentityMapper;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.ListResponse;
import com.cloud.api.response.PhysicalNetworkResponse;
import com.cloud.network.PhysicalNetwork;
import com.cloud.user.Account;
@Implementation(description="Lists physical networks", responseObject=PhysicalNetworkResponse.class)
public class ListPhysicalNetworksCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListPhysicalNetworksCmd.class.getName());
private static final String s_name = "listphysicalnetworksresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@IdentityMapper(entityTableName="physical_networks")
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list physical network by id")
private Long id;
@IdentityMapper(entityTableName="data_center")
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the Zone ID for the physical network")
private Long zoneId;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
public Long getId() {
return id;
}
public Long getZoneId() {
return zoneId;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;
}
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
@Override
public void execute(){
List<? extends PhysicalNetwork> result = _networkService.searchPhysicalNetworks(getId(),getZoneId(), this.getKeyword(), this.getStartIndex(), this.getPageSizeVal());
if (result != null) {
ListResponse<PhysicalNetworkResponse> response = new ListResponse<PhysicalNetworkResponse>();
List<PhysicalNetworkResponse> networkResponses = new ArrayList<PhysicalNetworkResponse>();
for (PhysicalNetwork network : result) {
PhysicalNetworkResponse networkResponse = _responseGenerator.createPhysicalNetworkResponse(network);
networkResponses.add(networkResponse);
}
response.setResponses(networkResponses);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to search for physical networks");
}
}
}

View File

@ -71,7 +71,7 @@ public class ListSSHKeyPairsCmd extends BaseListCmd {
List<SSHKeyPairResponse> responses = new ArrayList<SSHKeyPairResponse>();
for (SSHKeyPair result : resultList) {
SSHKeyPairResponse r = new SSHKeyPairResponse(result.getName(), result.getFingerprint());
r.setObjectName("keypair");
r.setObjectName("sshkeypair");
responses.add(r);
}

View File

@ -27,7 +27,6 @@ import com.cloud.api.BaseListCmd;
import com.cloud.api.IdentityMapper;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.BaseCmd.CommandType;
import com.cloud.api.response.ListResponse;
import com.cloud.api.response.ServiceOfferingResponse;
import com.cloud.offering.ServiceOffering;

View File

@ -0,0 +1,88 @@
/**
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.commands;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.response.ListResponse;
import com.cloud.api.response.ProviderResponse;
import com.cloud.network.Network;
import com.cloud.user.Account;
@Implementation(description="Lists all network serviceproviders supported by CloudStack or for the given service.", responseObject=ProviderResponse.class)
public class ListSupportedNetworkServiceProvidersCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListSupportedNetworkServiceProvidersCmd.class.getName());
private static final String _name = "listsupportednetworkserviceprovidersresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.SERVICE_NAME, type=CommandType.STRING, description="network service name")
private String serviceName;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
public void setServiceName(String serviceName) {
this.serviceName = serviceName;
}
public String getServiceName() {
return serviceName;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
return _name;
}
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
@Override
public void execute(){
List<? extends Network.Provider> serviceProviders = _networkService.listSupportedNetworkServiceProviders(getServiceName());
ListResponse<ProviderResponse> response = new ListResponse<ProviderResponse>();
List<ProviderResponse> serviceProvidersResponses = new ArrayList<ProviderResponse>();
for (Network.Provider serviceProvider : serviceProviders) {
ProviderResponse serviceProviderResponse = _responseGenerator.createNetworkServiceProviderResponse(serviceProvider);
serviceProvidersResponses.add(serviceProviderResponse);
}
response.setResponses(serviceProvidersResponses);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
}

View File

@ -0,0 +1,90 @@
/**
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.commands;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.response.ListResponse;
import com.cloud.api.response.ProviderResponse;
import com.cloud.api.response.TrafficTypeResponse;
import com.cloud.network.PhysicalNetworkTrafficType;
import com.cloud.user.Account;
@Implementation(description="Lists traffic types of a given physical network.", responseObject=ProviderResponse.class)
public class ListTrafficTypesCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListTrafficTypesCmd.class.getName());
private static final String _name = "listtraffictypesresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, required=true, description="the Physical Network ID")
private Long physicalNetworkId;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
public void setPhysicalNetworkId(Long physicalNetworkId) {
this.physicalNetworkId = physicalNetworkId;
}
public Long getPhysicalNetworkId() {
return physicalNetworkId;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
return _name;
}
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
@Override
public void execute(){
List<? extends PhysicalNetworkTrafficType> trafficTypes = _networkService.listTrafficTypes(getPhysicalNetworkId());
ListResponse<TrafficTypeResponse> response = new ListResponse<TrafficTypeResponse>();
List<TrafficTypeResponse> trafficTypesResponses = new ArrayList<TrafficTypeResponse>();
for (PhysicalNetworkTrafficType trafficType : trafficTypes) {
TrafficTypeResponse trafficTypeResponse = _responseGenerator.createTrafficTypeResponse(trafficType);
trafficTypesResponses.add(trafficTypeResponse);
}
response.setResponses(trafficTypesResponses);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
}

View File

@ -0,0 +1,90 @@
package com.cloud.api.commands;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.PlugService;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.ListResponse;
import com.cloud.api.response.VirtualRouterProviderResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.VirtualRouterProvider;
import com.cloud.network.element.VirtualRouterElementService;
@Implementation(description="Lists all available virtual router elements.", responseObject=VirtualRouterProviderResponse.class)
public class ListVirtualRouterElementsCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListNetworkOfferingsCmd.class.getName());
private static final String _name = "listvirtualrouterelementsresponse";
@PlugService
private VirtualRouterElementService _service;
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list virtual router elements by id")
private Long id;
@Parameter(name=ApiConstants.NSP_ID, type=CommandType.LONG, description="list virtual router elements by network service provider id")
private Long nspId;
@Parameter(name=ApiConstants.ENABLED, type=CommandType.BOOLEAN, description="list network offerings by enabled state")
private Boolean enabled;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
public void setId(Long id) {
this.id = id;
}
public Long getId() {
return id;
}
public void setNspId(Long nspId) {
this.nspId = nspId;
}
public Long getNspId() {
return nspId;
}
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
public Boolean getEnabled() {
return enabled;
}
@Override
public String getCommandName() {
return _name;
}
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
List<? extends VirtualRouterProvider> providers = _service.searchForVirtualRouterElement(this);
ListResponse<VirtualRouterProviderResponse> response = new ListResponse<VirtualRouterProviderResponse>();
List<VirtualRouterProviderResponse> providerResponses = new ArrayList<VirtualRouterProviderResponse>();
for (VirtualRouterProvider provider : providers) {
VirtualRouterProviderResponse providerResponse = _responseGenerator.createVirtualRouterProviderResponse(provider);
providerResponses.add(providerResponse);
}
response.setResponses(providerResponses);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
}

View File

@ -28,14 +28,11 @@ import com.cloud.api.IdentityMapper;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.BaseCmd.CommandType;
import com.cloud.api.response.ListResponse;
import com.cloud.api.response.TemplateResponse;
import com.cloud.async.AsyncJob;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.template.VirtualMachineTemplate;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@Implementation(description="Registers an existing template into the Cloud.com cloud. ", responseObject=TemplateResponse.class)

View File

@ -1,111 +0,0 @@
/**
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.commands;
import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.BaseAsyncCmd;
import com.cloud.api.BaseCmd;
import com.cloud.api.IdentityMapper;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.SuccessResponse;
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.network.security.SecurityGroup;
import com.cloud.user.Account;
@Implementation(responseObject = SuccessResponse.class, description = "Deletes a particular egress rule from this security group")
public class RevokeSecurityGroupEgressCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(RevokeSecurityGroupEgressCmd.class.getName());
private static final String s_name = "revokesecuritygroupegress";
// ///////////////////////////////////////////////////
// ////////////// API parameters /////////////////////
// ///////////////////////////////////////////////////
@IdentityMapper(entityTableName="security_group_rule")
@Parameter(name = ApiConstants.ID, type = CommandType.LONG, required = true, description = "The ID of the egress rule")
private Long id;
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
public Long getId() {
return id;
}
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;
}
public static String getResultObjectName() {
return "revokesecuritygroupegress";
}
@Override
public long getEntityOwnerId() {
SecurityGroup group = _entityMgr.findById(SecurityGroup.class, getId());
if (group != null) {
return group.getAccountId();
}
return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
}
@Override
public String getEventType() {
return EventTypes.EVENT_SECURITY_GROUP_REVOKE_EGRESS;
}
@Override
public String getEventDescription() {
return "revoking egress rule id: " + getId();
}
@Override
public void execute() {
boolean result = _securityGroupService.revokeSecurityGroupEgress(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to revoke security group egress rule");
}
}
@Override
public AsyncJob.Type getInstanceType() {
return AsyncJob.Type.SecurityGroup;
}
@Override
public Long getInstanceId() {
return getId();
}
}

View File

@ -43,7 +43,7 @@ public class RevokeSecurityGroupIngressCmd extends BaseAsyncCmd {
// ////////////// API parameters /////////////////////
// ///////////////////////////////////////////////////
@IdentityMapper(entityTableName="security_group_rule")
@IdentityMapper(entityTableName="security_ingress_rule")
@Parameter(name = ApiConstants.ID, type = CommandType.LONG, required = true, description = "The ID of the ingress rule")
private Long id;

View File

@ -18,8 +18,6 @@
package com.cloud.api.commands;
import java.util.List;
import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
@ -35,6 +33,8 @@ import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.network.Network;
import com.cloud.user.Account;
import com.cloud.user.User;
import com.cloud.user.UserContext;
@Implementation(description="Updates a network", responseObject=NetworkResponse.class)
@ -56,9 +56,6 @@ public class UpdateNetworkCmd extends BaseAsyncCmd {
@Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, description="the new display text for the network")
private String displayText;
@Parameter(name=ApiConstants.TAGS, type=CommandType.LIST, collectionType=CommandType.STRING, description="tags for the network")
private List<String> tags;
@Parameter(name=ApiConstants.NETWORK_DOMAIN, type=CommandType.STRING, description="network domain")
private String networkDomain;
@ -82,16 +79,12 @@ public class UpdateNetworkCmd extends BaseAsyncCmd {
return displayText;
}
public List<String> getTags() {
return tags;
}
private String getNetworkDomain() {
return networkDomain;
}
private Long getNetworkOfferingId() {
return networkOfferingId == null ? 0 : networkOfferingId;
return networkOfferingId;
}
/////////////////////////////////////////////////////
@ -115,7 +108,9 @@ public class UpdateNetworkCmd extends BaseAsyncCmd {
@Override
public void execute() throws InsufficientCapacityException, ConcurrentOperationException{
Network result = _networkService.updateNetwork(getId(), getNetworkName(), getDisplayText(), tags, UserContext.current().getCaller(), getNetworkDomain(), getNetworkOfferingId());
User callerUser = _accountService.getActiveUser(UserContext.current().getCallerUserId());
Account callerAccount = _accountService.getActiveAccountById(callerUser.getAccountId());
Network result = _networkService.updateNetwork(getId(), getNetworkName(), getDisplayText(), callerAccount, callerUser, getNetworkDomain(), getNetworkOfferingId());
if (result != null) {
NetworkResponse response = _responseGenerator.createNetworkResponse(result);
response.setResponseName(getCommandName());
@ -125,6 +120,7 @@ public class UpdateNetworkCmd extends BaseAsyncCmd {
}
}
@Override
public String getEventDescription() {
return "Updating network: " + getId();
}

View File

@ -18,7 +18,12 @@
package com.cloud.api.commands;
import java.util.UUID;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
@ -28,10 +33,11 @@ import com.cloud.api.IdentityMapper;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.BaseCmd.CommandType;
import com.cloud.api.response.NetworkOfferingResponse;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.network.Network.Capability;
import com.cloud.network.Network.Service;
import com.cloud.offering.NetworkOffering;
import com.cloud.offering.NetworkOffering.Availability;
import com.cloud.user.Account;
@Implementation(description="Updates a network offering.", responseObject=NetworkOfferingResponse.class)
@ -58,6 +64,48 @@ public class UpdateNetworkOfferingCmd extends BaseCmd {
@Parameter(name=ApiConstants.SORT_KEY, type=CommandType.INTEGER, description="sort key of the network offering, integer")
private Integer sortKey;
@Parameter(name=ApiConstants.DHCP_SERVICE, type=CommandType.BOOLEAN, description="true is network offering supports dhcp service")
private Boolean dhcpService;
@Parameter(name=ApiConstants.DNS_SERVICE, type=CommandType.BOOLEAN, description="true is network offering supports dns service")
private Boolean dnsService;
@Parameter(name=ApiConstants.GATEWAY_SERVICE, type=CommandType.BOOLEAN, description="true is network offering supports gateway service")
private Boolean gatewayService;
@Parameter(name=ApiConstants.FIREWALL_SERVICE, type=CommandType.BOOLEAN, description="true is network offering supports firewall service")
private Boolean firewallService;
@Parameter(name=ApiConstants.LB_SERVICE, type=CommandType.BOOLEAN, description="true is network offering supports lb service")
private Boolean lbService;
@Parameter(name=ApiConstants.USERDATA_SERVICE, type=CommandType.BOOLEAN, description="true is network offering supports user data service")
private Boolean userdataService;
@Parameter(name=ApiConstants.SOURCE_NAT_SERVICE, type=CommandType.BOOLEAN, description="true is network offering supports source nat service")
private Boolean sourceNatService;
@Parameter(name=ApiConstants.STATIC_NAT_SERVICE, type=CommandType.BOOLEAN, description="true if network offering supports static nat service")
private Boolean staticNatService;
@Parameter(name=ApiConstants.PORT_FORWARDING_SERVICE, type=CommandType.BOOLEAN, description="true if network offering supports port forwarding service")
private Boolean portForwardingService;
@Parameter(name=ApiConstants.VPN_SERVICE, type=CommandType.BOOLEAN, description="true is network offering supports vpn service")
private Boolean vpnService;
@Parameter(name=ApiConstants.SECURITY_GROUP_SERVICE, type=CommandType.BOOLEAN, description="true if network offering supports security service")
private Boolean securityGroupService;
@Parameter(name = ApiConstants.SERVICE_PROVIDER_LIST, type = CommandType.MAP, description = "provider to service mapping. If not specified, the provider for the service will be mapped to the default provider on the physical network")
private Map serviceProviderList;
@Parameter(name = ApiConstants.SERVICE_CAPABILITY_LIST, type = CommandType.MAP, description = "desired service capabilities as part of network offering")
private Map serviceCapabilistList;
@Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="update state for the network offering")
private String state;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@ -76,7 +124,110 @@ public class UpdateNetworkOfferingCmd extends BaseCmd {
}
public String getAvailability() {
return availability == null ? Availability.Required.toString() : availability;
return availability;
}
public Boolean getDhcpService() {
return dhcpService == null ? false : dhcpService;
}
public Boolean getDnsService() {
return dnsService == null ? false : dnsService;
}
public Boolean getGatewayService() {
return gatewayService == null ? false : gatewayService;
}
public Boolean getFirewallService() {
return firewallService == null ? false : firewallService;
}
public Boolean getLbService() {
return lbService == null ? false : lbService;
}
public Boolean getUserdataService() {
return userdataService == null ? false : userdataService;
}
public Boolean getSourceNatService() {
return sourceNatService == null ? false : sourceNatService;
}
public Boolean getStaticNatService() {
return staticNatService == null ? false : staticNatService;
}
public Boolean getPortForwardingService() {
return portForwardingService == null ? false : portForwardingService;
}
public Boolean getVpnService() {
return vpnService == null ? false : vpnService;
}
public Boolean getSecurityGroupService() {
return securityGroupService == null ? false : securityGroupService;
}
public Map<String, List<String>> getServiceProviders() {
Map<String, List<String>> serviceProviderMap = null;
if (serviceProviderList != null && !serviceProviderList.isEmpty()) {
serviceProviderMap = new HashMap<String, List<String>>();
Collection servicesCollection = serviceProviderList.values();
Iterator iter = servicesCollection.iterator();
while (iter.hasNext()) {
HashMap<String, String> services = (HashMap<String, String>) iter.next();
String service = services.get("service");
String provider = services.get("provider");
List<String> providerList = null;
if (serviceProviderMap.containsKey(service)) {
providerList = serviceProviderMap.get(service);
} else {
providerList = new ArrayList<String>();
}
providerList.add(provider);
serviceProviderMap.put(service, providerList);
}
}
return serviceProviderMap;
}
public Map<Capability, String> getServiceCapabilities(Service service) {
Map<Capability, String> capabilityMap = null;
if (serviceCapabilistList != null && !serviceCapabilistList.isEmpty()) {
capabilityMap = new HashMap <Capability, String>();
Collection serviceCapabilityCollection = serviceCapabilistList.values();
Iterator iter = serviceCapabilityCollection.iterator();
while (iter.hasNext()) {
HashMap<String, String> svcCapabilityMap = (HashMap<String, String>) iter.next();
Capability capability = null;
String svc = (String) svcCapabilityMap.get("service");
String capabilityName = (String) svcCapabilityMap.get("capabilityType");
String capabilityValue = (String) svcCapabilityMap.get("capabilityValue");
if (capabilityName != null) {
capability = Capability.getCapability(capabilityName);
}
if ((capability == null) || (capabilityName == null) || (capabilityValue == null) ) {
throw new InvalidParameterValueException("Invalid capability:" + capabilityName + " capability value:" + capabilityValue);
}
if (svc.equalsIgnoreCase(service.getName())) {
capabilityMap.put(capability, capabilityValue);
}
}
}
return capabilityMap;
}
public String getState() {
return state;
}
public Integer getSortKey() {

View File

@ -0,0 +1,105 @@
/**
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.commands;
import java.util.List;
import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.BaseAsyncCmd;
import com.cloud.api.BaseCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.ProviderResponse;
import com.cloud.event.EventTypes;
import com.cloud.network.PhysicalNetworkServiceProvider;
import com.cloud.user.Account;
@Implementation(description="Updates a network serviceProvider of a physical network", responseObject=ProviderResponse.class)
public class UpdateNetworkServiceProviderCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(UpdateNetworkServiceProviderCmd.class.getName());
private static final String s_name = "updatenetworkserviceproviderresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="Enabled/Disabled/Shutdown the physical network service provider")
private String state;
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="network service provider id")
private Long id;
@Parameter(name=ApiConstants.SERVICE_LIST, type=CommandType.LIST, collectionType = CommandType.STRING, description="the list of services to be enabled for this physical network service provider")
private List<String> enabledServices;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
public String getState() {
return state;
}
private Long getId() {
return id;
}
public List<String> getEnabledServices() {
return enabledServices;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;
}
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
@Override
public void execute(){
PhysicalNetworkServiceProvider result = _networkService.updateNetworkServiceProvider(getId(), getState(), getEnabledServices());
if (result != null) {
ProviderResponse response = _responseGenerator.createNetworkServiceProviderResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add service provider to physical network");
}
}
@Override
public String getEventType() {
return EventTypes.EVENT_SERVICE_PROVIDER_UPDATE;
}
@Override
public String getEventDescription() {
return "Updating physical network ServiceProvider: " + getId();
}
}

View File

@ -0,0 +1,121 @@
/**
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.commands;
import java.util.List;
import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.BaseAsyncCmd;
import com.cloud.api.BaseCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.PhysicalNetworkResponse;
import com.cloud.event.EventTypes;
import com.cloud.network.PhysicalNetwork;
import com.cloud.user.Account;
@Implementation(description="Updates a physical network", responseObject=PhysicalNetworkResponse.class)
public class UpdatePhysicalNetworkCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(UpdatePhysicalNetworkCmd.class.getName());
private static final String s_name = "updatephysicalnetworkresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="physical network id")
private Long id;
@Parameter(name=ApiConstants.NETWORK_SPEED, type=CommandType.STRING, description="the speed for the physical network[1G/10G]")
private String speed;
@Parameter(name=ApiConstants.TAGS, type=CommandType.LIST, collectionType=CommandType.STRING, description="Tag the physical network")
private List<String> tags;
@Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="Enabled/Disabled")
private String state;
@Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, description="the VLAN for the physical network")
private String vlan;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
public List<String> getTags() {
return tags;
}
public String getNetworkSpeed() {
return speed;
}
public String getState() {
return state;
}
public Long getId() {
return id;
}
public String getVlan() {
return vlan;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;
}
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
@Override
public void execute(){
PhysicalNetwork result = _networkService.updatePhysicalNetwork(getId(),getNetworkSpeed(), getTags(), getVlan(), getState());
if (result != null) {
PhysicalNetworkResponse response = _responseGenerator.createPhysicalNetworkResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update physical network");
}
}
@Override
public String getEventDescription() {
return "Updating Physical network: " + getId();
}
@Override
public String getEventType() {
return EventTypes.EVENT_PHYSICAL_NETWORK_UPDATE;
}
}

View File

@ -0,0 +1,113 @@
/**
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.commands;
import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.BaseAsyncCmd;
import com.cloud.api.BaseCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.TrafficTypeResponse;
import com.cloud.event.EventTypes;
import com.cloud.network.PhysicalNetworkTrafficType;
import com.cloud.user.Account;
@Implementation(description="Updates traffic type of a physical network", responseObject=TrafficTypeResponse.class)
public class UpdateTrafficTypeCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(UpdateTrafficTypeCmd.class.getName());
private static final String s_name = "updatetraffictyperesponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="traffic type id")
private Long id;
@Parameter(name=ApiConstants.XEN_NETWORK_LABEL, type=CommandType.STRING, description="The network name label of the physical device dedicated to this traffic on a XenServer host")
private String xenLabel;
@Parameter(name=ApiConstants.KVM_NETWORK_LABEL, type=CommandType.STRING, description="The network name label of the physical device dedicated to this traffic on a KVM host")
private String kvmLabel;
@Parameter(name=ApiConstants.VMWARE_NETWORK_LABEL, type=CommandType.STRING, description="The network name label of the physical device dedicated to this traffic on a VMware host")
private String vmwareLabel;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
public Long getId() {
return id;
}
public String getXenLabel() {
return xenLabel;
}
public String getKvmLabel() {
return kvmLabel;
}
public String getVmwareLabel() {
return vmwareLabel;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;
}
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
@Override
public void execute(){
PhysicalNetworkTrafficType result = _networkService.updatePhysicalNetworkTrafficType(getId(), getXenLabel(), getKvmLabel(), getVmwareLabel());
if (result != null) {
TrafficTypeResponse response = _responseGenerator.createTrafficTypeResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update traffic type");
}
}
@Override
public String getEventDescription() {
return "Updating Traffic Type: " + getId();
}
@Override
public String getEventType() {
return EventTypes.EVENT_TRAFFIC_TYPE_UPDATE;
}
}

View File

@ -65,9 +65,6 @@ public class UpdateZoneCmd extends BaseCmd {
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the Zone")
private String zoneName;
@Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, description="the VLAN for the Zone")
private String vlan;
@Parameter(name=ApiConstants.IS_PUBLIC, type=CommandType.BOOLEAN, description="updates a private zone to public if set, but not vice-versa")
private Boolean isPublic;
@ -118,10 +115,6 @@ public class UpdateZoneCmd extends BaseCmd {
return zoneName;
}
public String getVlan() {
return vlan;
}
public Boolean isPublic() {
return isPublic;
}

View File

@ -22,11 +22,11 @@ import com.cloud.api.IdentityProxy;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
public class SecurityGroupRuleResponse extends BaseResponse {
@SerializedName("ruleid") @Param(description="the id of the security group rule")
private IdentityProxy ruleId = new IdentityProxy("security_group_rule");
public class EgressRuleResponse extends BaseResponse {
@SerializedName("ruleid") @Param(description="the id of the ingress rule")
private IdentityProxy ruleId = new IdentityProxy("security_egress_rule");
@SerializedName("protocol") @Param(description="the protocol of the security group rule")
@SerializedName("protocol") @Param(description="the protocol of the ingress rule")
private String protocol;
@SerializedName(ApiConstants.ICMP_TYPE) @Param(description="the type of the ICMP message response")
@ -35,19 +35,19 @@ public class SecurityGroupRuleResponse extends BaseResponse {
@SerializedName(ApiConstants.ICMP_CODE) @Param(description="the code for the ICMP message response")
private Integer icmpCode;
@SerializedName(ApiConstants.START_PORT) @Param(description="the starting IP of the security group rule")
@SerializedName(ApiConstants.START_PORT) @Param(description="the starting IP of the ingress rule")
private Integer startPort;
@SerializedName(ApiConstants.END_PORT) @Param(description="the ending IP of the security group rule ")
@SerializedName(ApiConstants.END_PORT) @Param(description="the ending IP of the ingress rule ")
private Integer endPort;
@SerializedName(ApiConstants.SECURITY_GROUP_NAME) @Param(description="security group name")
private String securityGroupName;
@SerializedName(ApiConstants.ACCOUNT) @Param(description="account owning the security group rule")
@SerializedName(ApiConstants.ACCOUNT) @Param(description="account owning the ingress rule")
private String accountName;
@SerializedName(ApiConstants.CIDR) @Param(description="the CIDR notation for the base IP address of the security group rule")
@SerializedName(ApiConstants.CIDR) @Param(description="the CIDR notation for the base IP address of the ingress rule")
private String cidr;
public Long getRuleId() {

View File

@ -39,8 +39,6 @@ public class HypervisorCapabilitiesResponse extends BaseResponse {
@SerializedName(ApiConstants.SECURITY_GROUP_EANBLED) @Param(description="true if security group is supported")
private boolean isSecurityGroupEnabled;
@Override
public Long getObjectId() {
return getId();

View File

@ -187,27 +187,6 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR
return getId();
}
/*
@Override
public Long getJobId() {
return super.getJobId();
}
@Override
public void setJobId(Long jobId) {
super.setJobId(jobId);
}
@Override
public Integer getJobStatus() {
return jobStatus;
}
@Override
public void setJobStatus(Integer jobStatus) {
this.jobStatus = jobStatus;
}
*/
@Override
public void setProjectId(Long projectId) {
this.projectId.setValue(projectId);

View File

@ -0,0 +1,124 @@
/**
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.response;
import com.cloud.api.ApiConstants;
import com.cloud.api.IdentityProxy;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
public class IngressRuleResponse extends BaseResponse {
@SerializedName("ruleid") @Param(description="the id of the ingress rule")
private IdentityProxy ruleId = new IdentityProxy("security_ingress_rule");
@SerializedName("protocol") @Param(description="the protocol of the ingress rule")
private String protocol;
@SerializedName(ApiConstants.ICMP_TYPE) @Param(description="the type of the ICMP message response")
private Integer icmpType;
@SerializedName(ApiConstants.ICMP_CODE) @Param(description="the code for the ICMP message response")
private Integer icmpCode;
@SerializedName(ApiConstants.START_PORT) @Param(description="the starting IP of the ingress rule")
private Integer startPort;
@SerializedName(ApiConstants.END_PORT) @Param(description="the ending IP of the ingress rule ")
private Integer endPort;
@SerializedName(ApiConstants.SECURITY_GROUP_NAME) @Param(description="security group name")
private String securityGroupName;
@SerializedName(ApiConstants.ACCOUNT) @Param(description="account owning the ingress rule")
private String accountName;
@SerializedName(ApiConstants.CIDR) @Param(description="the CIDR notation for the base IP address of the ingress rule")
private String cidr;
public Long getRuleId() {
return ruleId.getValue();
}
public void setRuleId(Long ruleId) {
this.ruleId.setValue(ruleId);
}
public String getProtocol() {
return protocol;
}
public void setProtocol(String protocol) {
this.protocol = protocol;
}
public Integer getIcmpType() {
return icmpType;
}
public void setIcmpType(Integer icmpType) {
this.icmpType = icmpType;
}
public Integer getIcmpCode() {
return icmpCode;
}
public void setIcmpCode(Integer icmpCode) {
this.icmpCode = icmpCode;
}
public Integer getStartPort() {
return startPort;
}
public void setStartPort(Integer startPort) {
this.startPort = startPort;
}
public Integer getEndPort() {
return endPort;
}
public void setEndPort(Integer endPort) {
this.endPort = endPort;
}
public String getSecurityGroupName() {
return securityGroupName;
}
public void setSecurityGroupName(String securityGroupName) {
this.securityGroupName = securityGroupName;
}
public String getAccountName() {
return accountName;
}
public void setAccountName(String accountName) {
this.accountName = accountName;
}
public String getCidr() {
return cidr;
}
public void setCidr(String cidr) {
this.cidr = cidr;
}
}

View File

@ -19,162 +19,139 @@
package com.cloud.api.response;
import java.util.Date;
import java.util.List;
import com.cloud.api.ApiConstants;
import com.cloud.api.IdentityProxy;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
@SuppressWarnings("unused")
public class NetworkOfferingResponse extends BaseResponse{
@SerializedName("id") @Param(description="the id of the network offering")
private IdentityProxy id = new IdentityProxy("network_offerings");
private final IdentityProxy id = new IdentityProxy("network_offerings");
@SerializedName("name") @Param(description="the name of the network offering")
@SerializedName(ApiConstants.NAME) @Param(description="the name of the network offering")
private String name;
@SerializedName("displaytext") @Param(description="an alternate display text of the network offering.")
@SerializedName(ApiConstants.DISPLAY_TEXT) @Param(description="an alternate display text of the network offering.")
private String displayText;
@SerializedName("tags") @Param(description="the tags for the network offering")
@SerializedName(ApiConstants.TAGS) @Param(description="the tags for the network offering")
private String tags;
@SerializedName("created") @Param(description="the date this network offering was created")
@SerializedName(ApiConstants.CREATED) @Param(description="the date this network offering was created")
private Date created;
@SerializedName("maxconnections") @Param(description="the max number of concurrent connection the network offering supports")
@SerializedName(ApiConstants.MAX_CONNECTIONS) @Param(description="the max number of concurrent connection the network offering supports")
private Integer maxConnections;
@SerializedName("traffictype") @Param(description="the traffic type for the network offering, supported types are Public, Management, Control, Guest, Vlan or Storage.")
@SerializedName(ApiConstants.TRAFFIC_TYPE) @Param(description="the traffic type for the network offering, supported types are Public, Management, Control, Guest, Vlan or Storage.")
private String trafficType;
@SerializedName("isdefault") @Param(description="true if network offering is default, false otherwise")
@SerializedName(ApiConstants.IS_DEFAULT) @Param(description="true if network offering is default, false otherwise")
private Boolean isDefault;
@SerializedName("specifyvlan") @Param(description="true if network offering supports vlans, false otherwise")
@SerializedName(ApiConstants.SPECIFY_VLAN) @Param(description="true if network offering supports vlans, false otherwise")
private Boolean specifyVlan;
@SerializedName("availability") @Param(description="availability of the network offering")
@SerializedName(ApiConstants.AVAILABILITY) @Param(description="availability of the network offering")
private String availability;
@SerializedName(ApiConstants.GUEST_IP_TYPE) @Param(description="guest ip type of the network offering")
private String guestIpType;
@SerializedName(ApiConstants.NETWORKRATE) @Param(description="data transfer rate in megabits per second allowed.")
private Integer networkRate;
@SerializedName(ApiConstants.REDUNDANT_ROUTER) @Param(description="true if redundant router would be enabled, false otherwise")
private Boolean redundantRouter;
public Long getId() {
return id.getValue();
}
@SerializedName(ApiConstants.STATE) @Param(description="state of the network offering. Can be Disabled/Enabled/Inactive")
private String state;
@SerializedName(ApiConstants.GUEST_IP_TYPE) @Param(description="guest type of the network offering, can be Shared or Isolated")
private String guestIpType;
@SerializedName("service") @Param(description="the list of supported services", responseObject = ServiceResponse.class)
private List<ServiceResponse> services;
@SerializedName(ApiConstants.IS_LB_SHARED) @Param(description="true if load balncer service offered is shared by multiple networks", responseObject = ServiceResponse.class)
private Boolean isLbShared;
@SerializedName(ApiConstants.IS_SOURCE_NAT_SHARED) @Param(description="true if soruce NAT service offered is shared by multiple networks", responseObject = ServiceResponse.class)
private Boolean isSourceNatShared;
@SerializedName(ApiConstants.REDUNDANT_ROUTER) @Param(description="true if gateway service offered redundant router", responseObject = ServiceResponse.class)
private Boolean isRedundantRouter;
public void setId(Long id) {
this.id.setValue(id);
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDisplayText() {
return displayText;
}
public void setDisplayText(String displayText) {
this.displayText = displayText;
}
public String getTags() {
return tags;
}
public void setTags(String tags) {
this.tags = tags;
}
public Date getCreated() {
return created;
}
public void setCreated(Date created) {
this.created = created;
}
public Integer getMaxconnections() {
return maxConnections;
}
public void setMaxconnections(Integer maxConnections) {
this.maxConnections = maxConnections;
}
public String getTrafficType() {
return trafficType;
}
public void setTrafficType(String trafficType) {
this.trafficType = trafficType;
}
public Boolean getIsDefault() {
return isDefault;
}
public void setIsDefault(Boolean isDefault) {
this.isDefault = isDefault;
}
public Integer getMaxConnections() {
return maxConnections;
}
public void setMaxConnections(Integer maxConnections) {
this.maxConnections = maxConnections;
}
public Boolean getSpecifyVlan() {
return specifyVlan;
}
public void setSpecifyVlan(Boolean specifyVlan) {
this.specifyVlan = specifyVlan;
}
public String getAvailability() {
return availability;
}
public void setAvailability(String availability) {
this.availability = availability;
}
public Integer getNetworkRate() {
return networkRate;
}
public void setNetworkRate(Integer networkRate) {
this.networkRate = networkRate;
}
public String getGuestIpType() {
return guestIpType;
public void setServices(List<ServiceResponse> services) {
this.services = services;
}
public void setGuestIpType(String guestIpType) {
this.guestIpType = guestIpType;
}
public Boolean getRedundantRouter() {
return redundantRouter;
public void setState(String state) {
this.state = state;
}
public void setRedundantRouter(Boolean redundantRouter) {
this.redundantRouter = redundantRouter;
public void setGuestIpType(String type) {
this.guestIpType = type;
}
public void setIsLBShared(boolean isLbSared) {
this.isLbShared = isLbSared;
}
public void setIsSourceNatShared(boolean isSourceNatShared) {
this.isSourceNatShared = isSourceNatShared;
}
public void setIsRedundantRouter(Boolean isRedundantRouter) {
this.isRedundantRouter = isRedundantRouter;
}
}

View File

@ -70,9 +70,6 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes
@SerializedName("networkofferingavailability") @Param(description="availability of the network offering the network is created from")
private String networkOfferingAvailability;
@SerializedName(ApiConstants.IS_SHARED) @Param(description="true if network is shared, false otherwise")
private Boolean isShared;
@SerializedName(ApiConstants.IS_SYSTEM) @Param(description="true if network is system, false otherwise")
private Boolean isSystem;
@ -121,11 +118,12 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes
@SerializedName(ApiConstants.NETWORK_DOMAIN) @Param(description="the network domain")
private String networkDomain;
@SerializedName(ApiConstants.SECURITY_GROUP_EANBLED) @Param(description="true if security group is enabled, false otherwise")
private Boolean isSecurityGroupEnabled;
@SerializedName(ApiConstants.PHYSICAL_NETWORK_ID) @Param(description="the physical network id")
private Long physicalNetworkId;
@SerializedName(ApiConstants.ACL_TYPE) @Param(description="acl type - access type to the network")
private String aclType;
@SerializedName(ApiConstants.TAGS) @Param(description="comma separated tag")
private String tags;
public void setId(Long id) {
this.id.setValue(id);
@ -203,10 +201,6 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes
this.displaytext = displaytext;
}
public void setIsShared(Boolean isShared) {
this.isShared = isShared;
}
public void setStartIp(String startIp) {
this.startIp = startIp;
}
@ -243,23 +237,6 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes
this.networkDomain = networkDomain;
}
public void setIsSecurityGroupEnabled(Boolean sgEnabled) {
this.isSecurityGroupEnabled = sgEnabled;
}
public void setTags(List<String> tags) {
if (tags == null || tags.size() == 0) {
return;
}
StringBuilder buf = new StringBuilder();
for (String tag : tags) {
buf.append(tag).append(",");
}
this.tags = buf.delete(buf.length()-1, buf.length()).toString();
}
@Override
public void setProjectId(Long projectId) {
this.projectId.setValue(projectId);
@ -269,7 +246,13 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes
public void setProjectName(String projectName) {
this.projectName = projectName;
}
public void setPhysicalNetworkId(Long physicalNetworkId) {
this.physicalNetworkId = physicalNetworkId;
}
public void setAclType(String aclType) {
this.aclType = aclType;
}
}

View File

@ -17,25 +17,27 @@
*/
package com.cloud.api.response;
import com.cloud.api.ApiConstants;
import com.cloud.api.IdentityProxy;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
@SuppressWarnings("unused")
public class NicResponse extends BaseResponse {
@SerializedName("id") @Param(description="the ID of the nic")
private IdentityProxy id = new IdentityProxy("nics");
private final IdentityProxy id = new IdentityProxy("nics");
@SerializedName("networkid") @Param(description="the ID of the corresponding network")
private IdentityProxy networkid = new IdentityProxy("networks");
private final IdentityProxy networkId = new IdentityProxy("networks");
@SerializedName("netmask") @Param(description="the netmask of the nic")
@SerializedName(ApiConstants.NETMASK) @Param(description="the netmask of the nic")
private String netmask;
@SerializedName("gateway") @Param(description="the gateway of the nic")
@SerializedName(ApiConstants.GATEWAY) @Param(description="the gateway of the nic")
private String gateway;
@SerializedName("ipaddress") @Param(description="the ip address of the nic")
@SerializedName(ApiConstants.IP_ADDRESS) @Param(description="the ip address of the nic")
private String ipaddress;
@SerializedName("isolationuri") @Param(description="the isolation uri of the nic")
@ -44,13 +46,13 @@ public class NicResponse extends BaseResponse {
@SerializedName("broadcasturi") @Param(description="the broadcast uri of the nic")
private String broadcastUri;
@SerializedName("traffictype") @Param(description="the traffic type of the nic")
@SerializedName(ApiConstants.TRAFFIC_TYPE) @Param(description="the traffic type of the nic")
private String trafficType;
@SerializedName("type") @Param(description="the type of the nic")
@SerializedName(ApiConstants.TYPE) @Param(description="the type of the nic")
private String type;
@SerializedName("isdefault") @Param(description="true if nic is default, false otherwise")
@SerializedName(ApiConstants.IS_DEFAULT) @Param(description="true if nic is default, false otherwise")
private Boolean isDefault;
@SerializedName("macaddress") @Param(description="true if nic is default, false otherwise")
@ -65,81 +67,45 @@ public class NicResponse extends BaseResponse {
}
public Long getNetworkid() {
return networkid.getValue();
return networkId.getValue();
}
public void setNetworkid(Long networkid) {
this.networkid.setValue(networkid);
}
public String getNetmask() {
return netmask;
this.networkId.setValue(networkid);
}
public void setNetmask(String netmask) {
this.netmask = netmask;
}
public String getGateway() {
return gateway;
}
public void setGateway(String gateway) {
this.gateway = gateway;
}
public String getIpaddress() {
return ipaddress;
}
public void setIpaddress(String ipaddress) {
this.ipaddress = ipaddress;
}
public String getIsolationUri() {
return isolationUri;
}
public void setIsolationUri(String isolationUri) {
this.isolationUri = isolationUri;
}
public String getBroadcastUri() {
return broadcastUri;
}
public void setBroadcastUri(String broadcastUri) {
this.broadcastUri = broadcastUri;
}
public String getTrafficType() {
return trafficType;
}
public void setTrafficType(String trafficType) {
this.trafficType = trafficType;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Boolean getIsDefault() {
return isDefault;
}
public void setIsDefault(Boolean isDefault) {
this.isDefault = isDefault;
}
public String getMacAddress() {
return macAddress;
}
public void setMacAddress(String macAddress) {
this.macAddress = macAddress;
}

View File

@ -0,0 +1,114 @@
/**
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.response;
import java.util.List;
import com.cloud.api.ApiConstants;
import com.cloud.api.IdentityProxy;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
public class PhysicalNetworkResponse extends BaseResponse{
@SerializedName(ApiConstants.ID) @Param(description="the id of the physical network")
private IdentityProxy id = new IdentityProxy("physical_networks");
@SerializedName(ApiConstants.BROADCAST_DOMAIN_RANGE) @Param(description="Broadcast domain range of the physical network")
private String broadcastDomainRange;
@SerializedName(ApiConstants.ZONE_ID) @Param(description="zone id of the physical network")
private IdentityProxy zoneId = new IdentityProxy("data_center");
@SerializedName(ApiConstants.STATE) @Param(description="state of the physical network")
private String state;
@SerializedName(ApiConstants.VLAN) @Param(description="the vlan of the physical network")
private String vlan;
@SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain id of the physical network owner")
private Long domainId;
@SerializedName(ApiConstants.TAGS) @Param(description="comma separated tag")
private String tags;
@SerializedName(ApiConstants.ISOLATION_METHODS) @Param(description="isolation methods")
private String isolationMethods;
@SerializedName(ApiConstants.NETWORK_SPEED) @Param(description="the speed of the physical network")
private String networkSpeed;
public void setId(long id) {
this.id.setValue(id);
}
public void setZoneId(Long zoneId) {
this.zoneId.setValue(zoneId);
}
public void setState(String state) {
this.state = state;
}
public void setDomainId(Long domainId) {
this.domainId = domainId;
}
public void setVlan(String vlan) {
this.vlan = vlan;
}
public void setTags(List<String> tags) {
if (tags == null || tags.size() == 0) {
return;
}
StringBuilder buf = new StringBuilder();
for (String tag : tags) {
buf.append(tag).append(",");
}
this.tags = buf.delete(buf.length()-1, buf.length()).toString();
}
public void setBroadcastDomainRange(String broadcastDomainRange) {
this.broadcastDomainRange = broadcastDomainRange;
}
public void setNetworkSpeed(String networkSpeed) {
this.networkSpeed = networkSpeed;
}
public void setIsolationMethods(List<String> isolationMethods) {
if (isolationMethods == null || isolationMethods.size() == 0) {
return;
}
StringBuilder buf = new StringBuilder();
for (String isolationMethod : isolationMethods) {
buf.append(isolationMethod).append(",");
}
this.isolationMethods = buf.delete(buf.length()-1, buf.length()).toString();
}
}

View File

@ -0,0 +1,105 @@
/**
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.response;
import java.util.List;
import com.cloud.api.ApiConstants;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
@SuppressWarnings("unused")
public class ProviderResponse extends BaseResponse {
@SerializedName(ApiConstants.NAME) @Param(description="the provider name")
private String name;
@SerializedName(ApiConstants.PHYSICAL_NETWORK_ID) @Param(description="the physical network this belongs to")
private Long physicalNetworkId;
@SerializedName(ApiConstants.DEST_PHYSICAL_NETWORK_ID) @Param(description="the destination physical network")
private Long destinationPhysicalNetworkId;
@SerializedName(ApiConstants.STATE) @Param(description="state of the network provider")
private String state;
@SerializedName(ApiConstants.ID) @Param(description="id of the network provider")
private Long id;
@SerializedName(ApiConstants.SERVICE_LIST) @Param(description="services for this provider")
private List<String> services;
@SerializedName(ApiConstants.CAN_ENABLE_INDIVIDUAL_SERVICE) @Param(description="true if individual services can be enabled/disabled")
private Boolean canEnableIndividualServices;
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setPhysicalNetworkId(long physicalNetworkId) {
this.physicalNetworkId = physicalNetworkId;
}
public long getphysicalNetworkId() {
return physicalNetworkId;
}
public void setDestinationPhysicalNetworkId(long destPhysicalNetworkId) {
this.destinationPhysicalNetworkId = destPhysicalNetworkId;
}
public long getDestinationPhysicalNetworkId() {
return destinationPhysicalNetworkId;
}
public void setState(String state) {
this.state = state;
}
public String getState() {
return this.state;
}
public void setId(Long id) {
this.id = id;
}
public Long getId() {
return this.id;
}
public void setServices(List<String> services) {
this.services = services;
}
public List<String> getServices() {
return services;
}
public Boolean getCanEnableIndividualServices() {
return canEnableIndividualServices;
}
public void setCanEnableIndividualServices(Boolean canEnableIndividualServices) {
this.canEnableIndividualServices = canEnableIndividualServices;
}
}

View File

@ -50,12 +50,12 @@ public class SecurityGroupResponse extends BaseResponse implements ControlledEnt
@SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name of the security group")
private String domainName;
@SerializedName("ingressrule") @Param(description="the list of ingress rules associated with the security group", responseObject = SecurityGroupRuleResponse.class)
private List<SecurityGroupRuleResponse> ingressRules;
@SerializedName("ingressrule") @Param(description="the list of ingress rules associated with the security group", responseObject = IngressRuleResponse.class)
private List<IngressRuleResponse> ingressRules;
@SerializedName("egressrule") @Param(description="the list of ingress rules associated with the security group", responseObject = EgressRuleResponse.class)
private List<EgressRuleResponse> egressRules;
@SerializedName("egressrule") @Param(description="the list of egress rules associated with the security group", responseObject = SecurityGroupRuleResponse.class)
private List<SecurityGroupRuleResponse> egressRules;
public void setId(Long id) {
this.id.setValue(id);
}
@ -84,14 +84,14 @@ public class SecurityGroupResponse extends BaseResponse implements ControlledEnt
this.domainName = domainName;
}
public void setSecurityGroupIngressRules(List<SecurityGroupRuleResponse> securityGroupRules) {
this.ingressRules = securityGroupRules;
}
public void setSecurityGroupEgressRules(List<SecurityGroupRuleResponse> securityGroupRules) {
this.egressRules = securityGroupRules;
public void setIngressRules(List<IngressRuleResponse> ingressRules) {
this.ingressRules = ingressRules;
}
public void setEgressRules(List<EgressRuleResponse> egressRules) {
this.egressRules = egressRules;
}
@Override
public Long getObjectId() {
return getId();

View File

@ -23,11 +23,15 @@ import com.cloud.api.ApiConstants;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
@SuppressWarnings("unused")
public class ServiceResponse extends BaseResponse {
@SerializedName(ApiConstants.NAME) @Param(description="the service name")
private String name;
@SerializedName(ApiConstants.PROVIDER) @Param(description="the service provider name")
private List<ProviderResponse> providers;
@SerializedName("capability") @Param(description="the list of capabilities", responseObject = CapabilityResponse.class)
private List<CapabilityResponse> capabilities;
@ -39,11 +43,11 @@ public class ServiceResponse extends BaseResponse {
this.name = name;
}
public List<CapabilityResponse> getCapabilities() {
return capabilities;
}
public void setCapabilities(List<CapabilityResponse> capabilities) {
this.capabilities = capabilities;
}
public void setProviders(List<ProviderResponse> providers) {
this.providers = providers;
}
}

View File

@ -132,22 +132,6 @@ public class SystemVmResponse extends BaseResponse {
this.systemVmType = systemVmType;
}
public Long getJobId() {
return jobId.getValue();
}
public void setJobId(Long jobId) {
this.jobId.setValue(jobId);
}
public Integer getJobStatus() {
return jobStatus;
}
public void setJobStatus(Integer jobStatus) {
this.jobStatus = jobStatus;
}
public Long getZoneId() {
return zoneId.getValue();
}

View File

@ -229,23 +229,6 @@ public class TemplateResponse extends BaseResponse implements ControlledEntityRe
public void setHypervisor(String hypervisor) {
this.hypervisor = hypervisor;
}
/*
public Long getJobId() {
return super.getJobId();
}
public void setJobId(Long jobId) {
super.setJobId(jobId);
}
public Integer getJobStatus() {
return jobStatus;
}
public void setJobStatus(Integer jobStatus) {
this.jobStatus = jobStatus;
}
*/
@Override
public void setDomainName(String domainName) {

View File

@ -0,0 +1,92 @@
/**
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.api.response;
import com.cloud.api.ApiConstants;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
@SuppressWarnings("unused")
public class TrafficTypeResponse extends BaseResponse {
@SerializedName(ApiConstants.ID) @Param(description="id of the network provider")
private Long id;
@SerializedName(ApiConstants.TRAFFIC_TYPE) @Param(description="the trafficType to be added to the physical network")
private String trafficType;
@SerializedName(ApiConstants.PHYSICAL_NETWORK_ID) @Param(description="the physical network this belongs to")
private Long physicalNetworkId;
@SerializedName(ApiConstants.XEN_NETWORK_LABEL) @Param(description="The network name label of the physical device dedicated to this traffic on a XenServer host")
private String xenNetworkLabel;
@SerializedName(ApiConstants.KVM_NETWORK_LABEL) @Param(description="The network name label of the physical device dedicated to this traffic on a KVM host")
private String kvmNetworkLabel;
@SerializedName(ApiConstants.VMWARE_NETWORK_LABEL) @Param(description="The network name label of the physical device dedicated to this traffic on a VMware host")
private String vmwareNetworkLabel;
public void setPhysicalNetworkId(long physicalNetworkId) {
this.physicalNetworkId = physicalNetworkId;
}
public long getphysicalNetworkId() {
return physicalNetworkId;
}
public void setId(Long id) {
this.id = id;
}
public Long getId() {
return this.id;
}
public String getTrafficType() {
return trafficType;
}
public void setTrafficType(String trafficType) {
this.trafficType = trafficType;
}
public String getXenLabel() {
return xenNetworkLabel;
}
public String getKvmLabel() {
return kvmNetworkLabel;
}
public void setXenLabel(String xenLabel) {
this.xenNetworkLabel = xenLabel;
}
public void setKvmLabel(String kvmLabel) {
this.kvmNetworkLabel = kvmLabel;
}
public void setVmwareLabel(String vmwareNetworkLabel) {
this.vmwareNetworkLabel = vmwareNetworkLabel;
}
public String getVmwareLabel() {
return vmwareNetworkLabel;
}
}

View File

@ -0,0 +1,81 @@
package com.cloud.api.response;
import com.cloud.api.ApiConstants;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
public class VirtualRouterProviderResponse extends BaseResponse implements ControlledEntityResponse {
@SerializedName(ApiConstants.ID) @Param(description="the id of the router")
private Long id;
@SerializedName(ApiConstants.NSP_ID) @Param(description="the physical network service provider id of the provider")
private Long nspId;
@SerializedName(ApiConstants.ENABLED) @Param(description="Enabled/Disabled the service provider")
private Boolean enabled;
@SerializedName(ApiConstants.ACCOUNT) @Param(description="the account associated with the provider")
private String accountName;
@SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the ipaddress")
private Long projectId;
@SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the address")
private String projectName;
@SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain ID associated with the provider")
private Long domainId;
@SerializedName(ApiConstants.DOMAIN) @Param(description="the domain associated with the provider")
private String domainName;
@Override
public void setAccountName(String accountName) {
this.accountName = accountName;
}
public void setId(Long id) {
this.id = id;
}
public Long getId() {
return id;
}
@Override
public void setDomainId(Long domainId) {
this.domainId = domainId;
}
@Override
public void setDomainName(String domainName) {
this.domainName = domainName;
}
@Override
public void setProjectId(Long projectId) {
this.projectId = projectId;
}
@Override
public void setProjectName(String projectName) {
this.projectName = projectName;
}
public void setNspId(Long nspId) {
this.nspId = nspId;
}
public Long getNspId() {
return nspId;
}
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
public Boolean getEnabled() {
return enabled;
}
}

View File

@ -74,6 +74,9 @@ public class VlanIpRangeResponse extends BaseResponse implements ControlledEntit
@SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the vlan range")
private String projectName;
@SerializedName(ApiConstants.PHYSICAL_NETWORK_ID) @Param(description="the physical network this belongs to")
private Long physicalNetworkId;
public void setId(Long id) {
this.id.setValue(id);
@ -144,4 +147,12 @@ public class VlanIpRangeResponse extends BaseResponse implements ControlledEntit
public void setProjectName(String projectName) {
this.projectName = projectName;
}
public void setPhysicalNetworkId(long physicalNetworkId) {
this.physicalNetworkId = physicalNetworkId;
}
public long getphysicalNetworkId() {
return physicalNetworkId;
}
}

View File

@ -1,4 +1,5 @@
/**
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
*
* This software is licensed under the GNU General Public License v3 or later.
@ -41,7 +42,6 @@ public interface DataCenter extends Grouping {
Long getDomainId();
String getDescription();
String getDomain();
String getVnet();
NetworkType getNetworkType();
String getInternalDns1();

View File

@ -41,5 +41,7 @@ public interface Vlan {
public VlanType getVlanType();
public Long getNetworkId();
public Long getPhysicalNetworkId();
}

View File

@ -25,19 +25,21 @@ public class DataCenterDeployment implements DeploymentPlan {
Long _clusterId;
Long _poolId;
Long _hostId;
Long _physicalNetworkId;
ExcludeList _avoids = null;
boolean _recreateDisks;
public DataCenterDeployment(long dataCenterId) {
this(dataCenterId, null, null, null, null);
this(dataCenterId, null, null, null, null, null);
}
public DataCenterDeployment(long dataCenterId, Long podId, Long clusterId, Long hostId, Long poolId) {
public DataCenterDeployment(long dataCenterId, Long podId, Long clusterId, Long hostId, Long poolId, Long physicalNetworkId) {
_dcId = dataCenterId;
_podId = podId;
_clusterId = clusterId;
_hostId = hostId;
_poolId = poolId;
_physicalNetworkId = physicalNetworkId;
}
@Override
@ -74,4 +76,9 @@ public class DataCenterDeployment implements DeploymentPlan {
public void setAvoids(ExcludeList avoids) {
_avoids = avoids;
}
@Override
public Long getPhysicalNetworkId() {
return _physicalNetworkId;
}
}

View File

@ -63,4 +63,6 @@ public interface DeploymentPlan {
* the ExcludeList to avoid for deployment
*/
public ExcludeList getAvoids();
Long getPhysicalNetworkId();
}

View File

@ -174,8 +174,6 @@ public class EventTypes {
// Security Groups
public static final String EVENT_SECURITY_GROUP_AUTHORIZE_INGRESS = "SG.AUTH.INGRESS";
public static final String EVENT_SECURITY_GROUP_REVOKE_INGRESS = "SG.REVOKE.INGRESS";
public static final String EVENT_SECURITY_GROUP_AUTHORIZE_EGRESS = "SG.AUTH.EGRESS";
public static final String EVENT_SECURITY_GROUP_REVOKE_EGRESS = "SG.REVOKE.EGRESS";
public static final String EVENT_SECURITY_GROUP_CREATE = "SG.CREATE";
public static final String EVENT_SECURITY_GROUP_DELETE = "SG.DELETE";
@ -217,4 +215,23 @@ public class EventTypes {
public static final String EVENT_PROJECT_INVITATION_UPDATE = "PROJECT.INVITATION.UPDATE";
public static final String EVENT_PROJECT_INVITATION_REMOVE = "PROJECT.INVITATION.REMOVE";
public static final String EVENT_PROJECT_ACCOUNT_REMOVE = "PROJECT.ACCOUNT.REMOVE";
//Network as a Service
public static final String EVENT_NETWORK_ELEMENT_CONFIGURE = "NETWORK.ELEMENT.CONFIGURE";
//Physical Network Events
public static final String EVENT_PHYSICAL_NETWORK_CREATE = "PHYSICAL.NETWORK.CREATE";
public static final String EVENT_PHYSICAL_NETWORK_DELETE = "PHYSICAL.NETWORK.DELETE";
public static final String EVENT_PHYSICAL_NETWORK_UPDATE = "PHYSICAL.NETWORK.UPDATE";
//Physical Network Service Provider Events
public static final String EVENT_SERVICE_PROVIDER_CREATE = "SERVICE.PROVIDER.CREATE";
public static final String EVENT_SERVICE_PROVIDER_DELETE = "SERVICE.PROVIDER.DELETE";
public static final String EVENT_SERVICE_PROVIDER_UPDATE = "SERVICE.PROVIDER.UPDATE";
//Physical Network TrafficType Events
public static final String EVENT_TRAFFIC_TYPE_CREATE = "TRAFFIC.TYPE.CREATE";
public static final String EVENT_TRAFFIC_TYPE_DELETE = "TRAFFIC.TYPE.DELETE";
public static final String EVENT_TRAFFIC_TYPE_UPDATE = "TRAFFIC.TYPE.UPDATE";
}

View File

@ -21,7 +21,6 @@ public class Hypervisor {
public static enum HypervisorType {
None, //for storage hosts
Xen,
XenServer,
KVM,
VMware,
@ -38,10 +37,7 @@ public class Hypervisor {
if (hypervisor == null) {
return HypervisorType.None;
}
if (hypervisor.equalsIgnoreCase("Xen")) {
return HypervisorType.Xen;
} else if (hypervisor.equalsIgnoreCase("XenServer")) {
if (hypervisor.equalsIgnoreCase("XenServer")) {
return HypervisorType.XenServer;
} else if (hypervisor.equalsIgnoreCase("KVM")) {
return HypervisorType.KVM;

View File

@ -22,10 +22,12 @@
package com.cloud.network;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import com.cloud.acl.ControlledEntity;
import com.cloud.acl.ControlledEntity.ACLType;
import com.cloud.network.Networks.BroadcastDomainType;
import com.cloud.network.Networks.Mode;
import com.cloud.network.Networks.TrafficType;
@ -37,21 +39,26 @@ import com.cloud.utils.fsm.StateMachine;
* owned by an account.
*/
public interface Network extends ControlledEntity {
public enum GuestIpType {
Virtual,
Direct,
public enum GuestType {
Shared,
Isolated
}
public static class Service {
private static List<Service> supportedServices = new ArrayList<Service>();
public static final Service Vpn = new Service("Vpn", Capability.SupportedVpnTypes);
public static final Service Dhcp = new Service("Dhcp");
public static final Service Dns = new Service("Dns", Capability.AllowDnsSuffixModification);
public static final Service Gateway = new Service("Gateway", Capability.Redundancy);
public static final Service Firewall = new Service("Firewall", Capability.PortForwarding, Capability.StaticNat, Capability.SupportedProtocols, Capability.MultipleIps, Capability.SupportedSourceNatTypes, Capability.TrafficStatistics);
public static final Service Lb = new Service("Lb", Capability.SupportedLBAlgorithms, Capability.SupportedProtocols, Capability.TrafficStatistics, Capability.LoadBalancingSupportedIps);
public static final Service Gateway = new Service("Gateway");
public static final Service Firewall = new Service("Firewall", Capability.SupportedProtocols, Capability.MultipleIps, Capability.SupportedSourceNatTypes, Capability.TrafficStatistics);
public static final Service Lb = new Service("Lb", Capability.SupportedLBAlgorithms, Capability.SupportedLBIsolation, Capability.SupportedProtocols, Capability.TrafficStatistics, Capability.LoadBalancingSupportedIps);
public static final Service UserData = new Service("UserData");
public static final Service SourceNat = new Service("SourceNat");
public static final Service StaticNat = new Service("StaticNat");
public static final Service PortForwarding = new Service("PortForwarding");
public static final Service SecurityGroup = new Service("SecurityGroup");
private String name;
private Capability[] caps;
@ -59,6 +66,7 @@ public interface Network extends ControlledEntity {
public Service(String name, Capability... caps) {
this.name = name;
this.caps = caps;
supportedServices.add(this);
}
public String getName() {
@ -83,55 +91,102 @@ public interface Network extends ControlledEntity {
return success;
}
public static Service getService(String serviceName) {
for (Service service : supportedServices) {
if (service.getName().equalsIgnoreCase(serviceName)) {
return service;
}
}
return null;
}
public static List<Service> listAllServices(){
return supportedServices;
}
}
/**
* Provider -> NetworkElement must always be one-to-one mapping. Thus for each NetworkElement we need a separate Provider added in here.
*/
public static class Provider {
public static final Provider VirtualRouter = new Provider("VirtualRouter");
public static final Provider DhcpServer = new Provider("DhcpServer");
public static final Provider JuniperSRX = new Provider("JuniperSRX");
public static final Provider F5BigIp = new Provider("F5BigIp");
public static final Provider NetscalerMPX = new Provider("NetscalerMPX");
public static final Provider ExternalDhcpServer = new Provider("ExternalDhcpServer");
public static final Provider ExternalGateWay = new Provider("ExternalGateWay");
public static final Provider ElasticLoadBalancerVm = new Provider("ElasticLoadBalancerVm");
public static final Provider None = new Provider("None");
private static List<Provider> supportedProviders = new ArrayList<Provider>();
public static final Provider VirtualRouter = new Provider("VirtualRouter", false);
public static final Provider JuniperSRX = new Provider("JuniperSRX", true);
public static final Provider F5BigIp = new Provider("F5BigIp", true);
public static final Provider Netscaler = new Provider("Netscaler", true);
public static final Provider ExternalDhcpServer = new Provider("ExternalDhcpServer", true);
public static final Provider ExternalGateWay = new Provider("ExternalGateWay", true);
public static final Provider ElasticLoadBalancerVm = new Provider("ElasticLoadBalancerVm", false);
public static final Provider RedundantVirtualRouter = new Provider("RedundantVirtualRouter", false);
public static final Provider SecurityGroupProvider = new Provider("SecurityGroupProvider", false);
public static final Provider None = new Provider("None", false);
//the default provider
public static final Provider defaultProvider = VirtualRouter;
private String name;
private boolean isExternal;
public Provider(String name) {
public Provider(String name, boolean isExternal) {
this.name = name;
this.isExternal = isExternal;
supportedProviders.add(this);
}
public String getName() {
return name;
}
public boolean isExternal() {
return isExternal;
}
public static Provider getProvider(String providerName) {
for (Provider provider : supportedProviders) {
if (provider.getName().equalsIgnoreCase(providerName)) {
return provider;
}
}
return null;
}
}
public static class Capability {
public static final Capability PortForwarding = new Capability("PortForwarding");
public static final Capability StaticNat = new Capability("StaticNat");
private static List<Capability> supportedCapabilities = new ArrayList<Capability>();
public static final Capability SupportedProtocols = new Capability("SupportedProtocols");
public static final Capability SupportedLBAlgorithms = new Capability("SupportedLbAlgorithms");
public static final Capability SupportedLBIsolation = new Capability("SupportedLBIsolation");
public static final Capability MultipleIps = new Capability("MultipleIps");
public static final Capability SupportedSourceNatTypes = new Capability("SupportedSourceNatTypes");
public static final Capability SupportedVpnTypes = new Capability("SupportedVpnTypes");
public static final Capability TrafficStatistics = new Capability("TrafficStatistics");
public static final Capability LoadBalancingSupportedIps = new Capability("LoadBalancingSupportedIps");
public static final Capability AllowDnsSuffixModification = new Capability("AllowDnsSuffixModification");
public static final Capability Redundancy = new Capability("Redundancy");
public static final Capability RedundantRouter = new Capability("RedundantRouter");
private String name;
public Capability(String name) {
this.name = name;
supportedCapabilities.add(this);
}
public String getName() {
return name;
}
public static Capability getCapability(String capabilityName) {
for (Capability capability : supportedCapabilities) {
if (capability.getName().equalsIgnoreCase(capabilityName)) {
return capability;
}
}
return null;
}
}
enum Event {
@ -219,20 +274,19 @@ public interface Network extends ControlledEntity {
URI getBroadcastUri();
GuestIpType getGuestType();
String getDisplayText();
boolean getIsShared();
String getReservationId();
boolean isDefault();
String getNetworkDomain();
boolean isSecurityGroupEnabled();
GuestType getGuestType();
List<String> getTags();
Long getPhysicalNetworkId();
void setPhysicalNetworkId(Long physicalNetworkId);
ACLType getAclType();
}

View File

@ -19,7 +19,6 @@
package com.cloud.network;
import java.net.URI;
import java.util.List;
import com.cloud.network.Networks.BroadcastDomainType;
import com.cloud.network.Networks.Mode;
@ -43,14 +42,13 @@ public class NetworkProfile implements Network {
private String cidr;
private long networkOfferingId;
private long related;
private GuestIpType guestIpType;
private String displayText;
private boolean isShared;
private String reservationId;
private boolean isDefault;
private String networkDomain;
private boolean isSecurityGroupEnabled;
private List<String> tags;
private Network.GuestType guestType;
private Long physicalNetworkId;
private ACLType aclType;
public NetworkProfile(Network network) {
this.id = network.getId();
@ -66,19 +64,14 @@ public class NetworkProfile implements Network {
this.cidr = network.getCidr();
this.networkOfferingId = network.getNetworkOfferingId();
this.related = network.getRelated();
this.guestIpType = network.getGuestType();
this.displayText = network.getDisplayText();
this.isShared = network.getIsShared();
this.reservationId = network.getReservationId();
this.isDefault = network.isDefault();
this.networkDomain = network.getNetworkDomain();
this.domainId = network.getDomainId();
this.isSecurityGroupEnabled = network.isSecurityGroupEnabled();
}
@Override
public List<String> getTags() {
return tags;
this.guestType = network.getGuestType();
this.physicalNetworkId = network.getPhysicalNetworkId();
this.aclType = network.getAclType();
}
public String getDns1() {
@ -166,21 +159,11 @@ public class NetworkProfile implements Network {
return related;
}
@Override
public GuestIpType getGuestType() {
return guestIpType;
}
@Override
public String getDisplayText() {
return displayText;
}
@Override
public boolean getIsShared() {
return isShared;
}
@Override
public String getReservationId() {
return reservationId;
@ -200,9 +183,24 @@ public class NetworkProfile implements Network {
public long getDomainId() {
return domainId;
}
@Override
public Network.GuestType getGuestType(){
return guestType;
}
@Override
public boolean isSecurityGroupEnabled() {
return isSecurityGroupEnabled;
public Long getPhysicalNetworkId() {
return physicalNetworkId;
}
@Override
public void setPhysicalNetworkId(Long physicalNetworkId) {
this.physicalNetworkId = physicalNetworkId;
}
@Override
public ACLType getAclType() {
return aclType;
}
}

View File

@ -19,6 +19,7 @@ package com.cloud.network;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.cloud.api.commands.AssociateIPAddrCmd;
import com.cloud.api.commands.CreateNetworkCmd;
@ -30,16 +31,15 @@ import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.Network.Capability;
import com.cloud.network.Network.Provider;
import com.cloud.network.Network.Service;
import com.cloud.network.Networks.TrafficType;
import com.cloud.offering.NetworkOffering;
import com.cloud.user.Account;
import com.cloud.user.User;
public interface NetworkService {
List<? extends Network> getVirtualNetworksOwnedByAccountInZone(long zoneId, Account owner);
List<? extends NetworkOffering> listNetworkOfferings();
List<? extends Network> getIsolatedNetworksOwnedByAccountInZone(long zoneId, Account owner);
IpAddress allocateIP(AssociateIPAddrCmd cmd) throws ResourceAllocationException, InsufficientAddressCapacityException, ConcurrentOperationException;
@ -72,17 +72,61 @@ public interface NetworkService {
NetworkProfile convertNetworkToNetworkProfile(long networkId);
Map<Service, Map<Capability, String>> getZoneCapabilities(long zoneId);
Map<Service, Map<Capability, String>> getNetworkCapabilities(long networkId, long zoneId);
Map<Service, Map<Capability, String>> getNetworkCapabilities(long networkId);
boolean isNetworkAvailableInDomain(long networkId, long domainId);
Long getDedicatedNetworkDomain(long networkId);
Network updateNetwork(long networkId, String name, String displayText, List<String> tags, Account caller, String domainSuffix, long networkOfferingId);
Network updateNetwork(long networkId, String name, String displayText, Account callerAccount, User callerUser, String domainSuffix, Long networkOfferingId);
Integer getNetworkRate(long networkId, Long vmId);
Network getSystemNetworkByZoneAndTrafficType(long zoneId, TrafficType trafficType);
Map<String, Set<String>> listNetworkOfferingServices(long networkOfferingId);
PhysicalNetwork createPhysicalNetwork(Long zoneId, String vnetRange, String networkSpeed, List<String> isolationMethods, String broadcastDomainRange, Long domainId, List<String> tags);
List<? extends PhysicalNetwork> searchPhysicalNetworks(Long id, Long zoneId, String keyword, Long startIndex, Long pageSize);
PhysicalNetwork updatePhysicalNetwork(Long id, String networkSpeed, List<String> tags, String newVnetRangeString, String state);
boolean deletePhysicalNetwork(Long id);
List<? extends Service> listNetworkServices(String providerName);
List<? extends Provider> listSupportedNetworkServiceProviders(String serviceName);
PhysicalNetworkServiceProvider addProviderToPhysicalNetwork(Long physicalNetworkId, String providerName, Long destinationPhysicalNetworkId, List<String> enabledServices);
List<? extends PhysicalNetworkServiceProvider> listNetworkServiceProviders(Long physicalNetworkId);
PhysicalNetworkServiceProvider updateNetworkServiceProvider(Long id, String state, List<String> enabledServices);
boolean deleteNetworkServiceProvider(Long id) throws ConcurrentOperationException, ResourceUnavailableException;
PhysicalNetwork getPhysicalNetwork(Long physicalNetworkId);
PhysicalNetwork getCreatedPhysicalNetwork(Long physicalNetworkId);
PhysicalNetworkServiceProvider getPhysicalNetworkServiceProvider(Long providerId);
PhysicalNetworkServiceProvider getCreatedPhysicalNetworkServiceProvider(Long providerId);
long findPhysicalNetworkId(long zoneId, String tag);
PhysicalNetworkTrafficType addTrafficTypeToPhysicalNetwork(Long physicalNetworkId, String trafficType, String xenLabel, String kvmLabel, String vmwareLabel, String vlan);
PhysicalNetworkTrafficType getPhysicalNetworkTrafficType(Long id);
PhysicalNetworkTrafficType updatePhysicalNetworkTrafficType(Long id, String xenLabel, String kvmLabel, String vmwareLabel);
boolean deletePhysicalNetworkTrafficType(Long id);
List<? extends PhysicalNetworkTrafficType> listTrafficTypes(Long physicalNetworkId);
PhysicalNetwork getDefaultPhysicalNetworkByZoneAndTrafficType(long zoneId, TrafficType trafficType);
Network getExclusiveGuestNetwork(long zoneId);
}

View File

@ -103,7 +103,17 @@ public class Networks {
Storage,
Management,
Control,
Vpn
Vpn;
public static boolean isSystemNetwork(TrafficType trafficType) {
if(Storage.equals(trafficType)
|| Management.equals(trafficType)
|| Control.equals(trafficType)){
return true;
}
return false;
}
};
public enum IsolationType {

View File

@ -0,0 +1,68 @@
/**
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
*
*/
package com.cloud.network;
import java.util.List;
/**
* This defines the specifics of a physical network present in a data center
*
*/
public interface PhysicalNetwork {
public enum State {
Disabled,
Enabled;
}
public enum IsolationMethod {
VLAN,
L3,
GRE;
}
public enum BroadcastDomainRange {
POD,
ZONE;
}
long getId();
BroadcastDomainRange getBroadcastDomainRange();
//TrafficType getTrafficType();
long getDataCenterId();
State getState();
List<String> getTags();
List<String> getIsolationMethods();
Long getDomainId();
String getVnet();
String getSpeed();
}

View File

@ -0,0 +1,73 @@
/**
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
*
*/
package com.cloud.network;
import java.util.List;
import com.cloud.network.Network.Service;
/**
* This defines the specifics of a physical network service provider
*
*/
public interface PhysicalNetworkServiceProvider {
public enum State {
Disabled,
Enabled,
Shutdown;
}
long getId();
State getState();
long getPhysicalNetworkId();
String getProviderName();
long getDestinationPhysicalNetworkId();
void setState(State state);
boolean isLbServiceProvided();
boolean isVpnServiceProvided();
boolean isDhcpServiceProvided();
boolean isDnsServiceProvided();
boolean isGatewayServiceProvided();
boolean isFirewallServiceProvided();
boolean isSourcenatServiceProvided();
boolean isUserdataServiceProvided();
boolean isSecuritygroupServiceProvided();
List<Service> getEnabledServices();
}

View File

@ -0,0 +1,88 @@
/**
* Copyright (C) 2010 VMOps, Inc. All rights reserved.
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.network;
/**
* PhysicalNetworkNames provides the labels to identify per traffic type
* the physical networks available to the host .
*/
public class PhysicalNetworkSetupInfo {
//physical network ID as seen by Mgmt server
Long physicalNetworkId;
String privateNetworkName;
String publicNetworkName;
String guestNetworkName;
String storageNetworkName;
//this is used by VmWare to identify the vlan to use for management traffic
String mgmtVlan;
public PhysicalNetworkSetupInfo(){
}
public String getPrivateNetworkName() {
return privateNetworkName;
}
public String getPublicNetworkName() {
return publicNetworkName;
}
public String getGuestNetworkName() {
return guestNetworkName;
}
public String getStorageNetworkName() {
return storageNetworkName;
}
public void setPrivateNetworkName(String privateNetworkName) {
this.privateNetworkName = privateNetworkName;
}
public void setPublicNetworkName(String publicNetworkName) {
this.publicNetworkName = publicNetworkName;
}
public void setGuestNetworkName(String guestNetworkName) {
this.guestNetworkName = guestNetworkName;
}
public void setStorageNetworkName(String storageNetworkName) {
this.storageNetworkName = storageNetworkName;
}
public Long getPhysicalNetworkId() {
return physicalNetworkId;
}
public void setPhysicalNetworkId(Long physicalNetworkId) {
this.physicalNetworkId = physicalNetworkId;
}
public String getMgmtVlan() {
return mgmtVlan;
}
public void setMgmtVlan(String mgmtVlan) {
this.mgmtVlan = mgmtVlan;
}
}

View File

@ -0,0 +1,45 @@
/**
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
*
*/
package com.cloud.network;
import com.cloud.network.Networks.TrafficType;
/**
* This defines the specifics of a physical network traffic type
*
*/
public interface PhysicalNetworkTrafficType {
long getId();
long getPhysicalNetworkId();
TrafficType getTrafficType();
String getXenNetworkLabel();
String getKvmNetworkLabel();
String getVmwareNetworkLabel();
}

View File

@ -22,21 +22,22 @@ import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.router.VirtualRouter;
import com.cloud.utils.component.PluggableService;
public interface VirtualNetworkApplianceService{
public interface VirtualNetworkApplianceService {
/**
* Starts domain router
* @param cmd the command specifying router's id
* @return DomainRouter object
*/
VirtualRouter startRouter(long routerId, boolean restartNetwork) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
VirtualRouter startRouter(long routerId, boolean reprogramNetwork) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
/**
* Reboots domain router
* @param cmd the command specifying router's id
* @return router if successful
*/
VirtualRouter rebootRouter(long routerId, boolean restartNetwork) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
VirtualRouter rebootRouter(long routerId, boolean reprogramNetwork) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
VirtualRouter upgradeRouter(UpgradeRouterCmd cmd);

View File

@ -0,0 +1,31 @@
/**
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.network;
public interface VirtualRouterProvider {
public enum VirtualRouterProviderType {
VirtualRouter,
RedundantVirtualRouter,
ElasticLoadBalancerVm
}
public VirtualRouterProviderType getType();
public long getId();
public boolean isEnabled();
public long getNspId();
}

View File

@ -0,0 +1,15 @@
package com.cloud.network.element;
import com.cloud.deploy.DeployDestination;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.Network;
import com.cloud.vm.NicProfile;
import com.cloud.vm.ReservationContext;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
public interface DhcpServiceProvider extends NetworkElement {
boolean addDhcpEntry(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException;
}

View File

@ -0,0 +1,28 @@
package com.cloud.network.element;
import java.util.List;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.Network;
import com.cloud.network.PublicIpAddress;
import com.cloud.network.rules.FirewallRule;
public interface FirewallServiceProvider extends NetworkElement {
/**
* Apply rules
* @param network
* @param rules
* @return
* @throws ResourceUnavailableException
*/
boolean applyFWRules(Network network, List<? extends FirewallRule> rules) throws ResourceUnavailableException;
/**
* Apply ip addresses to this network
* @param network
* @param ipAddress
* @return
* @throws ResourceUnavailableException
*/
boolean applyIps(Network network, List<? extends PublicIpAddress> ipAddress) throws ResourceUnavailableException;
}

View File

@ -0,0 +1,18 @@
package com.cloud.network.element;
import java.util.List;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.Network;
import com.cloud.network.lb.LoadBalancingRule;
public interface LoadBalancingServiceProvider extends NetworkElement {
/**
* Apply rules
* @param network
* @param rules
* @return
* @throws ResourceUnavailableException
*/
boolean applyLBRules(Network network, List<LoadBalancingRule> rules) throws ResourceUnavailableException;
}

View File

@ -21,7 +21,6 @@
*/
package com.cloud.network.element;
import java.util.List;
import java.util.Map;
import com.cloud.deploy.DeployDestination;
@ -33,9 +32,7 @@ import com.cloud.network.Network;
import com.cloud.network.Network.Capability;
import com.cloud.network.Network.Provider;
import com.cloud.network.Network.Service;
import com.cloud.network.PublicIpAddress;
import com.cloud.network.rules.FirewallRule;
import com.cloud.network.rules.StaticNat;
import com.cloud.network.PhysicalNetworkServiceProvider;
import com.cloud.offering.NetworkOffering;
import com.cloud.utils.component.Adapter;
import com.cloud.vm.NicProfile;
@ -50,6 +47,10 @@ public interface NetworkElement extends Adapter {
Map<Service, Map<Capability, String>> getCapabilities();
/**
* NOTE:
* NetworkElement -> Network.Provider is a one-to-one mapping. While adding a new NetworkElement, one must add a new Provider name to Network.Provider.
*/
Provider getProvider();
/**
@ -91,22 +92,12 @@ public interface NetworkElement extends Adapter {
* The network is being shutdown.
* @param network
* @param context
* @param cleanup TODO
* @return
* @throws ConcurrentOperationException
* @throws ResourceUnavailableException
*/
boolean shutdown(Network network, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException;
/**
* The network is being restarted.
* @param network
* @param context
* @param cleanup If need to clean up old network elements
* @return
* @throws ConcurrentOperationException
* @throws ResourceUnavailableException
*/
boolean restart(Network network, ReservationContext context, boolean cleanup) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
boolean shutdown(Network network, ReservationContext context, boolean cleanup) throws ConcurrentOperationException, ResourceUnavailableException;
/**
* The network is being destroyed.
@ -116,32 +107,26 @@ public interface NetworkElement extends Adapter {
*/
boolean destroy(Network network) throws ConcurrentOperationException, ResourceUnavailableException;
/**
* Check if the instances of this Element are configured to be used on the physical network referred by this provider.
* @param provider
* @return boolean true/false
*/
boolean isReady(PhysicalNetworkServiceProvider provider);
/**
* Apply ip addresses to this network
* @param network
* @param ipAddress
* @return
* The network service provider is being shutdown. This should shutdown all instances of this element deployed for this provider.
* @param context
* @param networkServiceProvider
* @return boolean success/failure
* @throws ConcurrentOperationException
* @throws ResourceUnavailableException
*/
boolean applyIps(Network network, List<? extends PublicIpAddress> ipAddress) throws ResourceUnavailableException;
boolean shutdownProviderInstances(PhysicalNetworkServiceProvider provider, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException;
/**
* Apply rules
* @param network
* @param rules
* @return
* @throws ResourceUnavailableException
* This should return true if out of multiple services provided by this element, only some can be enabled. If all the services MUST be provided, this should return false.
* @return true/false
*/
boolean applyRules(Network network, List<? extends FirewallRule> rules) throws ResourceUnavailableException;
/**
* Creates static nat rule (public IP to private IP mapping) on the network element
* @param config
* @param rules
* @return
* @throws ResourceUnavailableException
*/
boolean applyStaticNats(Network config, List<? extends StaticNat> rules) throws ResourceUnavailableException;
boolean canEnableIndividualServices();
}

View File

@ -0,0 +1,18 @@
package com.cloud.network.element;
import java.util.List;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.Network;
import com.cloud.network.rules.PortForwardingRule;
public interface PortForwardingServiceProvider extends NetworkElement {
/**
* Apply rules
* @param network
* @param rules
* @return
* @throws ResourceUnavailableException
*/
boolean applyPFRules(Network network, List<PortForwardingRule> rules) throws ResourceUnavailableException;
}

View File

@ -0,0 +1,16 @@
package com.cloud.network.element;
import java.util.List;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.Network;
import com.cloud.network.RemoteAccessVpn;
import com.cloud.network.VpnUser;
public interface RemoteAccessVPNServiceProvider extends NetworkElement {
String[] applyVpnUsers(RemoteAccessVpn vpn, List<? extends VpnUser> users) throws ResourceUnavailableException;
boolean startVpn(Network network, RemoteAccessVpn vpn) throws ResourceUnavailableException;
boolean stopVpn(Network network, RemoteAccessVpn vpn) throws ResourceUnavailableException;
}

View File

@ -0,0 +1,4 @@
package com.cloud.network.element;
public interface SourceNatServiceProvider extends NetworkElement {
}

View File

@ -0,0 +1,18 @@
package com.cloud.network.element;
import java.util.List;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.Network;
import com.cloud.network.rules.StaticNat;
public interface StaticNatServiceProvider extends NetworkElement {
/**
* Creates static nat rule (public IP to private IP mapping) on the network element
* @param config
* @param rules
* @return
* @throws ResourceUnavailableException
*/
boolean applyStaticNats(Network config, List<? extends StaticNat> rules) throws ResourceUnavailableException;
}

View File

@ -0,0 +1,17 @@
package com.cloud.network.element;
import com.cloud.deploy.DeployDestination;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.Network;
import com.cloud.uservm.UserVm;
import com.cloud.vm.NicProfile;
import com.cloud.vm.ReservationContext;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
public interface UserDataServiceProvider extends NetworkElement {
public boolean addPasswordAndUserdata(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException;
boolean savePassword(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) throws ResourceUnavailableException;
}

View File

@ -0,0 +1,15 @@
package com.cloud.network.element;
import java.util.List;
import com.cloud.api.commands.ConfigureVirtualRouterElementCmd;
import com.cloud.api.commands.ListVirtualRouterElementsCmd;
import com.cloud.network.VirtualRouterProvider;
import com.cloud.utils.component.PluggableService;
public interface VirtualRouterElementService extends PluggableService{
VirtualRouterProvider configure(ConfigureVirtualRouterElementCmd cmd);
VirtualRouterProvider addElement(Long nspId);
VirtualRouterProvider getCreatedElement(long id);
List<? extends VirtualRouterProvider> searchForVirtualRouterElement(ListVirtualRouterElementsCmd cmd);
}

View File

@ -31,73 +31,171 @@ import com.cloud.network.NetworkProfile;
import com.cloud.offering.NetworkOffering;
import com.cloud.user.Account;
import com.cloud.utils.component.Adapter;
import com.cloud.utils.net.Ip4Address;
import com.cloud.vm.NicProfile;
import com.cloud.vm.ReservationContext;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
/**
* NetworkGuru takes a network offering requested and figures
* out the correct network configuration needed to add
* to the account in order to support this network.
* NetworkGuru has the following functionalities
* - Issues the ip address for the network that it is responsible for.
* - Designs a virtual network depending on the network offering.
* - Implements the virtual network when a virtual machine requires the network to be started.
*
* There can be multiple NetworkGurus in a CloudStack system. Each NetworkGuru
* is used by CloudStack to issue isolation and ip addresses and to reclaim
* resources when VMs are gone.
*
* A Network goes through the following life cycles through the NetworkGuru.
* - When a guest network is created, NetworkGuru is asked to "design" the network.
* This means the NetworkGuru checks the parameters such as cidr, gateway,
* vlan, etc and returns a network that can work with those paremeters.
* Note that at this point the network is only a virtual network. It has
* not been substantiated with resources, such as vlan, to make the network
* functional in the physical environment. At this stage, the network is in
* Allocated state.
*
* - When the first virtual machine is about to be started and requires network
* services, the guest network needs to have resources to make it usable
* within the physical environment. At this time, the NetworkGuru is
* called with the implement() method to acquire those resources.
*
* - For every virtual machine starting in the network, the NetworkGuru is
* asked via the reserve() method to make sure everything the virtual
* machine needs to be functional in the network is reserved.
*
* - For every virtual machine being stopped in the network, the NetworkGuru
* is informed via the release() method to make sure resources occupied
* by the virtual machine is released.
*
* - If all virtual machines within the network have been stopped, the guest
* network is garbage collected. When a guest network is garbage collected
* the NetworkGuru is informed via the shutdown() method to release any
* resources it allocated to that network.
*
* - When a guest network is being deleted, the NetworkGuru is informed via
* the trash() method.
*
*/
public interface NetworkGuru extends Adapter {
/**
* Design a network configuration given the information.
* @param offering network offering that contains the information.
* @param plan where is this network configuration will be deployed.
* @param userSpecified user specified parameters for this network configuration.
* @param owner owner of this network configuration.
* @return NetworkConfiguration
* Cloud stack requires the NetworkGuru to design a guest network given
* the software packages Once a NetworkGuru returns the designed network,
* that NetworkGuru is forever associated with the guest network. It is
* very important for the NetworkGuru implementation to be very specific
* about the network it is responsible for designing. Things that can
* be used to make determination can be isolation methods, services
* provided on the guest network and the service provider that's on the
* guest network.
*
* If a network is already fully substantiated with the necessary resources
* during this design phase, then the state should be set to Setup. If
* the resources are not allocated at this point, the state should be set
* to Allocated.
*
* @param offering network offering that contains the package of services
* the end user intends to use on that network.
* @param plan where is this network being deployed.
* @param userSpecified user specified parameters for this network.
* @param owner owner of this network.
* @return Network
*/
Network design(NetworkOffering offering, DeploymentPlan plan, Network userSpecified, Account owner);
/**
* allocate a nic in this network. This method implementation cannot take a long time as it is meant to allocate for
* the DB.
* For guest networks that are in Allocated state after the design stage,
* resources are allocated when the guest network is actually being used
* by a virtual machine. implement() is called to acquire those resources.
*
* @param network
* configuration to allocate the nic in.
* @param nic
* user specified
* @param vm
* virtual machine the network configuration will be in.
* @return NicProfile.
* @throws InsufficientVirtualNetworkCapcityException
* @throws InsufficientAddressCapacityException
* @param network network to be implemented.
* @param offering network offering that the network was created with.
* @param destination where the network is being deployed in.
* @return a fully implemented Network.
* @throws InsufficientVirtualNetworkCapcityException if there's not
* enough resources to make the guest network usable in the physical
* environment. At this time, the admin generally must be involved to
* allocate more resources before any more guest network can be implemented.
*/
Network implement(Network network, NetworkOffering offering, DeployDestination destination, ReservationContext context) throws InsufficientVirtualNetworkCapcityException;
/**
* Once a guest network has been designed, virtual machines can be
* created. allocated() is called for the NetworkGuru to design a nic
* that will make the virtual machine work within the guest network.
*
* @param network guest network that the virtual machine will be deployed in.
* @param nic nic information that the end user wants to set. The
* NetworkGuru should check this information with the guest
* network settings to make sure everything will work.
* @param vm virtual machine that is about to be deployed.
* @return NicProfile nic with all of the information
* @throws InsufficientVirtualNetworkCapcityException if there's
* insufficient capacity within the guest network.
* @throws InsufficientAddressCapacityException if there are not addresses
* to be assigned.
*/
NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException;
/**
* Fully implement the network configuration as specified.
*
* @param network
* network configuration
* @param offering
* offering that the network configuration was based on.
* @param destination
* where were deploying to.
* @return a fully implemented NetworkConfiguration.
* @throws InsufficientVirtualNetworkCapcityException
*/
Network implement(Network network, NetworkOffering offering, DeployDestination destination, ReservationContext context) throws InsufficientVirtualNetworkCapcityException;
/**
* reserve a nic for this VM in this network.
* @param nic
* @param network
* @param vm
* @param dest
* @return
* @throws InsufficientVirtualNetworkCapcityException
* @throws InsufficientAddressCapacityException
* @throws ConcurrentOperationException
* NetworkGuru is asked to acquire an IPv4 address.
* @param network guest network that this IPv4 address is acquired in.
* @param requestedIp ip address that is being requested.
* @param reservationId id used to refer to this reservation.
* @return Ip4Address ipv4 address
*/
Ip4Address acquireIp4Address(Network network, String requestedIp, String reservationId) throws InsufficientAddressCapacityException;
/**
* Release the IPv4 address acquired.
*
* @param network guest network that it was acquired in.
* @param reservationId reservation id that it was acquired in.
* @return true if release was successful; false if not.
*/
boolean releaseIp4Address(Network network, String reservationId);
/**
* Once a guest network is implemented, then the virtual machine must
* be allocated its resources in order for it to participate within the
* guest network. reserve() is called for the NetworkGuru to make sure
* that works.
*
* @param nic nic that the vm is using to access the guest network.
* @param network guest network the vm is in.
* @param vm vm
* @param dest destination the vm is deployed to
* @param context Reservation context from which to get the owner, caller, and reservation id
* @throws InsufficientVirtualNetworkCapcityException if there's not enough
* resources.
* @throws InsufficientAddressCapacityException if there's not enough ip
* addresses.
* @throws ConcurrentOperationException if there are multiple operations
* happening on this guest network or vm.
*/
void reserve(NicProfile nic, Network network, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException;
/**
* When a virtual machine is stopped, the NetworkGuru is informed via the
* release() method to release any resources.
*
* @param nic nic that the vm is using to access the guest network.
* @param vm virtual machine
* @param reservationId reservation id passed to it in the ReservationContext
* @return true if release is successful or false if unsuccessful.
*/
boolean release(NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, String reservationId);
/**
* When a virtual machine is destroyed, the NetworkGuru is informed via
* the deallocate() method to make sure any resources that are allocated
* are released.
*
* @param network guest network that the vm was running in.
* @param nic nic that the vm was using to access the guest network.
* @param vm virtual machine being destroyed.
*/
void deallocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm);
/**
@ -109,17 +207,26 @@ public interface NetworkGuru extends Adapter {
@Deprecated
void updateNicProfile(NicProfile profile, Network network);
/**
* When no virtual machines are running in the network, the network is
* shutdown and all physical resources are released. The NetworkGuru is
* informed via the shutdown method().
*
* @param network guest network being shut down
* @param offering network offering the guest network was created with.
*/
void shutdown(NetworkProfile network, NetworkOffering offering);
/**
* Throw away the design.
* @param network
* @param offering
* @param owner
* @return
* When a guest network is destroyed, the NetworkGuru is informed via the
* trash() method to recover any resources.
*
* @param network guest network being destroyed.
* @param offering network offering the guest network was created with.
* @param owner owner of the network.
* @return true if trash was successful; false if not.
*/
boolean trash(Network network, NetworkOffering offering, Account owner);
void updateNetworkProfile(NetworkProfile networkProfile);
}

View File

@ -152,6 +152,10 @@ public class LoadBalancingRule implements FirewallRule, LoadBalancer{
public boolean isRevoked() {
return revoked;
}
public void setRevoked(boolean revoked) {
this.revoked = revoked;
}
}
@Override

View File

@ -25,8 +25,7 @@ import com.cloud.vm.VirtualMachine;
*/
public interface VirtualRouter extends VirtualMachine {
public enum Role {
DHCP_FIREWALL_LB_PASSWD_USERDATA,
DHCP_USERDATA, LB
VIRTUAL_ROUTER, LB
}
Role getRole();
boolean getIsRedundantRouter();

View File

@ -0,0 +1,39 @@
/**
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.network.security;
import com.cloud.async.AsyncInstanceCreateStatus;
public interface EgressRule {
long getId();
long getSecurityGroupId();
int getStartPort();
int getEndPort();
String getProtocol();
AsyncInstanceCreateStatus getCreateStatus();
Long getAllowedNetworkId();
String getAllowedDestinationIpCidr();
}

View File

@ -23,21 +23,7 @@ import com.cloud.async.AsyncInstanceCreateStatus;
* @author ahuang
*
*/
public interface SecurityRule {
public static class SecurityRuleType {
public static final SecurityRuleType IngressRule = new SecurityRuleType("ingress");
public static final SecurityRuleType EgressRule = new SecurityRuleType("egress");
public SecurityRuleType(String type) {
this._type = type;
}
public String getType(){
return _type;
}
private String _type;
}
public interface IngressRule {
long getId();
long getSecurityGroupId();
@ -45,14 +31,8 @@ public interface SecurityRule {
int getStartPort();
int getEndPort();
String getType();
SecurityRuleType getRuleType();
String getProtocol();
String getUuid();
String getProtocol();
AsyncInstanceCreateStatus getCreateStatus();

View File

@ -16,7 +16,6 @@
*
*/
package com.cloud.network.security;
import com.cloud.network.security.SecurityRule.SecurityRuleType;
public interface SecurityGroupRules {
long getId();
@ -40,6 +39,4 @@ public interface SecurityGroupRules {
Long getAllowedNetworkId();
String getAllowedSourceIpCidr();
SecurityRuleType getRuleType();
}

View File

@ -20,12 +20,10 @@ package com.cloud.network.security;
import java.util.List;
import com.cloud.api.commands.AuthorizeSecurityGroupIngressCmd;
import com.cloud.api.commands.AuthorizeSecurityGroupEgressCmd;
import com.cloud.api.commands.CreateSecurityGroupCmd;
import com.cloud.api.commands.DeleteSecurityGroupCmd;
import com.cloud.api.commands.ListSecurityGroupsCmd;
import com.cloud.api.commands.RevokeSecurityGroupIngressCmd;
import com.cloud.api.commands.RevokeSecurityGroupEgressCmd;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.ResourceInUseException;
@ -38,7 +36,6 @@ public interface SecurityGroupService {
*/
public SecurityGroup createSecurityGroup(CreateSecurityGroupCmd command) throws PermissionDeniedException, InvalidParameterValueException;
boolean revokeSecurityGroupIngress(RevokeSecurityGroupIngressCmd cmd);
boolean revokeSecurityGroupEgress(RevokeSecurityGroupEgressCmd cmd);
boolean deleteSecurityGroup(DeleteSecurityGroupCmd cmd) throws ResourceInUseException;
@ -49,8 +46,6 @@ public interface SecurityGroupService {
*/
public List<? extends SecurityGroupRules> searchForSecurityGroupRules(ListSecurityGroupsCmd cmd) throws PermissionDeniedException, InvalidParameterValueException;
public List<? extends SecurityRule> authorizeSecurityGroupIngress(AuthorizeSecurityGroupIngressCmd cmd);
public List<? extends SecurityRule> authorizeSecurityGroupEgress(AuthorizeSecurityGroupEgressCmd cmd);
public List<? extends IngressRule> authorizeSecurityGroupIngress(AuthorizeSecurityGroupIngressCmd cmd);
}

Some files were not shown because too many files have changed in this diff Show More