You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ni...@apache.org on 2013/05/11 11:59:53 UTC
[28/51] [partial] merge master
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/DhcpEntryCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/DhcpEntryCommand.java b/core/src/com/cloud/agent/api/routing/DhcpEntryCommand.java
new file mode 100644
index 0000000..fd8d84c
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/DhcpEntryCommand.java
@@ -0,0 +1,142 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api.routing;
+
+
+public class DhcpEntryCommand extends NetworkElementCommand {
+
+ String vmMac;
+ String vmIpAddress;
+ String vmName;
+ String dns;
+ String gateway;
+ String nextServer;
+ String defaultRouter;
+ String staticRoutes;
+ String defaultDns;
+ String vmIp6Address;
+ String ip6Gateway;
+ String duid;
+ private boolean isDefault;
+
+ protected DhcpEntryCommand() {
+
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+
+ public DhcpEntryCommand(String vmMac, String vmIpAddress, String vmName, String vmIp6Address) {
+ this.vmMac = vmMac;
+ this.vmIpAddress = vmIpAddress;
+ this.vmName = vmName;
+ this.vmIp6Address = vmIp6Address;
+ this.setDefault(true);
+ }
+
+ public DhcpEntryCommand(String vmMac, String vmIpAddress, String vmName, String vmIp6Address, String dns, String gateway, String ip6Gateway) {
+ this(vmMac, vmIpAddress, vmName, vmIp6Address);
+ this.dns = dns;
+ this.gateway = gateway;
+ }
+
+ public String getDns() {
+ return dns;
+ }
+
+ public String getGateway() {
+ return gateway;
+ }
+
+ public String getVmMac() {
+ return vmMac;
+ }
+
+ public String getVmIpAddress() {
+ return vmIpAddress;
+ }
+
+ public String getVmName() {
+ return vmName;
+ }
+
+ public void setNextServer(String ip) {
+ nextServer = ip;
+ }
+
+ public String getNextServer() {
+ return nextServer;
+ }
+
+ public String getDefaultRouter() {
+ return defaultRouter;
+ }
+
+ public void setDefaultRouter(String defaultRouter) {
+ this.defaultRouter = defaultRouter;
+ }
+
+ public String getStaticRoutes() {
+ return staticRoutes;
+ }
+
+ public void setStaticRoutes(String staticRoutes) {
+ this.staticRoutes = staticRoutes;
+ }
+
+ public String getDefaultDns() {
+ return defaultDns;
+ }
+
+ public void setDefaultDns(String defaultDns) {
+ this.defaultDns = defaultDns;
+ }
+
+ public String getIp6Gateway() {
+ return ip6Gateway;
+ }
+
+ public void setIp6Gateway(String ip6Gateway) {
+ this.ip6Gateway = ip6Gateway;
+ }
+
+ public String getDuid() {
+ return duid;
+ }
+
+ public void setDuid(String duid) {
+ this.duid = duid;
+ }
+
+ public String getVmIp6Address() {
+ return vmIp6Address;
+ }
+
+ public void setVmIp6Address(String ip6Address) {
+ this.vmIp6Address = ip6Address;
+ }
+
+ public boolean isDefault() {
+ return isDefault;
+ }
+
+ public void setDefault(boolean isDefault) {
+ this.isDefault = isDefault;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/GlobalLoadBalancerConfigAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/GlobalLoadBalancerConfigAnswer.java b/core/src/com/cloud/agent/api/routing/GlobalLoadBalancerConfigAnswer.java
new file mode 100644
index 0000000..e5167fe
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/GlobalLoadBalancerConfigAnswer.java
@@ -0,0 +1,27 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api.routing;
+
+import com.cloud.agent.api.Answer;
+
+public class GlobalLoadBalancerConfigAnswer extends Answer{
+
+ public GlobalLoadBalancerConfigAnswer(boolean success, String details) {
+ this.result = success;
+ this.details = details;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/GlobalLoadBalancerConfigCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/GlobalLoadBalancerConfigCommand.java b/core/src/com/cloud/agent/api/routing/GlobalLoadBalancerConfigCommand.java
new file mode 100644
index 0000000..b3603c8
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/GlobalLoadBalancerConfigCommand.java
@@ -0,0 +1,100 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package com.cloud.agent.api.routing;
+
+import com.cloud.agent.api.Command;
+
+import java.util.List;
+
+/**
+ * GlobalLoadBalancerConfigCommand used for sending the GSLB configuration to GSLB service provider
+ */
+public class GlobalLoadBalancerConfigCommand extends Command {
+
+ // FQDN that represents the globally load balanced service
+ String domainName;
+
+ // type of the globally load balanced service
+ String serviceType;
+
+ // load balancing method to distribute traffic across the sites participating in global service load balancing
+ String lbMethod;
+
+ // session persistence type
+ String persistenceType;
+
+ // unique Id given per gslb rule, that is uniquely represents glsb rule on all participant sites
+ long gslbId;
+
+ // true if global load balancer rule is being deleted
+ boolean revoked;
+
+ // list of the site details that are participating in the GSLB service
+ List<SiteLoadBalancerConfig> siteLoadBalancers;
+
+ public GlobalLoadBalancerConfigCommand(String domainName,
+ String lbMethod,
+ String persistenceType,
+ String serviceType,
+ long gslbId,
+ boolean revoked) {
+ this.domainName = domainName;
+ this.serviceType = serviceType;
+ this.lbMethod = lbMethod;
+ this.persistenceType = persistenceType;
+ this.gslbId = gslbId;
+ this.revoked = revoked;
+ }
+
+ public List<SiteLoadBalancerConfig> getSiteDetails() {
+ return siteLoadBalancers;
+ }
+
+ public void setSiteLoadBalancers(List<SiteLoadBalancerConfig> siteLoadBalancers) {
+ this.siteLoadBalancers = siteLoadBalancers;
+ }
+
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ public String getLoadBalancerMethod() {
+ return lbMethod;
+ }
+
+ public String getPersistenceType() {
+ return persistenceType;
+ }
+
+ public long getGslbId() {
+ return this.gslbId;
+ }
+
+ public String getDomainName() {
+ return domainName;
+ }
+
+ public boolean isForRevoke() {
+ return revoked;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return false;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/HealthCheckLBConfigAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/HealthCheckLBConfigAnswer.java b/core/src/com/cloud/agent/api/routing/HealthCheckLBConfigAnswer.java
new file mode 100644
index 0000000..dfca4ab
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/HealthCheckLBConfigAnswer.java
@@ -0,0 +1,42 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api.routing;
+
+import java.util.List;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.to.LoadBalancerTO;
+import com.cloud.agent.api.to.NicTO;
+
+/**
+ * LoadBalancerConfigCommand sends the load balancer configuration
+ */
+public class HealthCheckLBConfigAnswer extends Answer {
+ List<LoadBalancerTO> loadBalancers;
+
+ protected HealthCheckLBConfigAnswer() {
+ }
+
+ public HealthCheckLBConfigAnswer(List<LoadBalancerTO> loadBalancers) {
+ this.loadBalancers = loadBalancers;
+ }
+
+ public List<LoadBalancerTO> getLoadBalancers() {
+ return loadBalancers;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/HealthCheckLBConfigCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/HealthCheckLBConfigCommand.java b/core/src/com/cloud/agent/api/routing/HealthCheckLBConfigCommand.java
new file mode 100644
index 0000000..f705f6c
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/HealthCheckLBConfigCommand.java
@@ -0,0 +1,39 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api.routing;
+
+import com.cloud.agent.api.to.LoadBalancerTO;
+import com.cloud.agent.api.to.NicTO;
+
+/**
+ * LoadBalancerConfigCommand sends the load balancer configuration
+ */
+public class HealthCheckLBConfigCommand extends NetworkElementCommand {
+ LoadBalancerTO[] loadBalancers;
+
+ protected HealthCheckLBConfigCommand() {
+ }
+
+ public HealthCheckLBConfigCommand(LoadBalancerTO[] loadBalancers) {
+ this.loadBalancers = loadBalancers;
+ }
+
+ public LoadBalancerTO[] getLoadBalancers() {
+ return loadBalancers;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/IpAssocAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/IpAssocAnswer.java b/core/src/com/cloud/agent/api/routing/IpAssocAnswer.java
new file mode 100644
index 0000000..194923c
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/IpAssocAnswer.java
@@ -0,0 +1,48 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api.routing;
+
+import com.cloud.agent.api.Answer;
+
+public class IpAssocAnswer extends Answer{
+ String[] results;
+
+ public static final String errorResult = "Failed";
+
+ protected IpAssocAnswer() {
+ super();
+ }
+
+ public IpAssocAnswer(IpAssocCommand cmd, String[] results) {
+
+ boolean finalResult = true;
+ for (String result : results) {
+ if (result.equals(errorResult)) {
+ finalResult = false;
+ break;
+ }
+ }
+ this.result = finalResult;
+ this.details = null;
+ assert(cmd.getIpAddresses().length == results.length) : "Shouldn't the results match the commands?";
+ this.results = results;
+ }
+
+ String[] getResults() {
+ return results;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/IpAssocCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/IpAssocCommand.java b/core/src/com/cloud/agent/api/routing/IpAssocCommand.java
new file mode 100644
index 0000000..5cdc2da
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/IpAssocCommand.java
@@ -0,0 +1,42 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api.routing;
+
+import com.cloud.agent.api.to.IpAddressTO;
+
+public class IpAssocCommand extends NetworkElementCommand {
+
+ IpAddressTO[] ipAddresses;
+
+ protected IpAssocCommand() {
+ }
+
+ public IpAssocCommand(IpAddressTO[] ips) {
+ this.ipAddresses = ips;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return false;
+ }
+
+ public IpAddressTO[] getIpAddresses() {
+ return ipAddresses;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/IpAssocVpcCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/IpAssocVpcCommand.java b/core/src/com/cloud/agent/api/routing/IpAssocVpcCommand.java
new file mode 100644
index 0000000..e5c900d
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/IpAssocVpcCommand.java
@@ -0,0 +1,29 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api.routing;
+
+import com.cloud.agent.api.to.IpAddressTO;
+
+public class IpAssocVpcCommand extends IpAssocCommand{
+ protected IpAssocVpcCommand() {
+ super();
+ }
+
+ public IpAssocVpcCommand(IpAddressTO[] ips) {
+ super(ips);
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/LoadBalancerConfigCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/LoadBalancerConfigCommand.java b/core/src/com/cloud/agent/api/routing/LoadBalancerConfigCommand.java
new file mode 100644
index 0000000..1c1fb91
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/LoadBalancerConfigCommand.java
@@ -0,0 +1,66 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api.routing;
+
+import com.cloud.agent.api.to.LoadBalancerTO;
+import com.cloud.agent.api.to.NicTO;
+
+/**
+ * LoadBalancerConfigCommand sends the load balancer configuration
+ */
+public class LoadBalancerConfigCommand extends NetworkElementCommand {
+ LoadBalancerTO[] loadBalancers;
+ public String lbStatsVisibility = "guest-network";
+ public String lbStatsPublicIP; /* load balancer listen on this ips for stats */
+ public String lbStatsPrivateIP; /* load balancer listen on this ips for stats */
+ public String lbStatsGuestIP; /* load balancer listen on this ips for stats */
+ public String lbStatsPort = "8081"; /*load balancer listen on this port for stats */
+ public String lbStatsSrcCidrs = "0/0" ; /* TODO : currently there is no filtering based on the source ip */
+ public String lbStatsAuth = "admin1:AdMiN123";
+ public String lbStatsUri = "/admin?stats";
+ NicTO nic;
+ Long vpcId;
+
+ protected LoadBalancerConfigCommand() {
+ }
+
+ public LoadBalancerConfigCommand(LoadBalancerTO[] loadBalancers, Long vpcId) {
+ this.loadBalancers = loadBalancers;
+ this.vpcId = vpcId;
+ }
+
+ public LoadBalancerConfigCommand(LoadBalancerTO[] loadBalancers,String PublicIp,String GuestIp,String PrivateIp, NicTO nic, Long vpcId) {
+ this.loadBalancers = loadBalancers;
+ this.lbStatsPublicIP = PublicIp;
+ this.lbStatsPrivateIP = PrivateIp;
+ this.lbStatsGuestIP = GuestIp;
+ this.nic = nic;
+ this.vpcId = vpcId;
+ }
+
+ public NicTO getNic() {
+ return nic;
+ }
+
+ public LoadBalancerTO[] getLoadBalancers() {
+ return loadBalancers;
+ }
+
+ public Long getVpcId() {
+ return vpcId;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/NetworkElementCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/NetworkElementCommand.java b/core/src/com/cloud/agent/api/routing/NetworkElementCommand.java
new file mode 100644
index 0000000..41ae80f
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/NetworkElementCommand.java
@@ -0,0 +1,53 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api.routing;
+
+import java.util.HashMap;
+
+import com.cloud.agent.api.Command;
+
+public abstract class NetworkElementCommand extends Command {
+ HashMap<String, String> accessDetails = new HashMap<String, String>(0);
+
+ public static final String ACCOUNT_ID = "account.id";
+ public static final String GUEST_NETWORK_CIDR = "guest.network.cidr";
+ public static final String GUEST_NETWORK_GATEWAY = "guest.network.gateway";
+ public static final String GUEST_VLAN_TAG = "guest.vlan.tag";
+ public static final String ROUTER_NAME = "router.name";
+ public static final String ROUTER_IP = "router.ip";
+ public static final String ROUTER_GUEST_IP = "router.guest.ip";
+ public static final String ZONE_NETWORK_TYPE = "zone.network.type";
+ public static final String GUEST_BRIDGE = "guest.bridge";
+
+ protected NetworkElementCommand() {
+ super();
+ }
+
+ public void setAccessDetail(String name, String value) {
+ accessDetails.put(name, value);
+ }
+
+ public String getAccessDetail(String name) {
+ return accessDetails.get(name);
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return false;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/RemoteAccessVpnCfgCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/RemoteAccessVpnCfgCommand.java b/core/src/com/cloud/agent/api/routing/RemoteAccessVpnCfgCommand.java
new file mode 100644
index 0000000..68d7caf
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/RemoteAccessVpnCfgCommand.java
@@ -0,0 +1,78 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api.routing;
+
+
+public class RemoteAccessVpnCfgCommand extends NetworkElementCommand {
+
+ boolean create;
+ String vpnServerIp;
+ String ipRange;
+ String presharedKey;
+ String localIp;
+
+ protected RemoteAccessVpnCfgCommand() {
+ this.create = false;
+ }
+
+ public boolean isCreate() {
+ return create;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+
+
+ public RemoteAccessVpnCfgCommand(boolean create, String vpnServerAddress, String localIp, String ipRange, String ipsecPresharedKey) {
+ this.vpnServerIp = vpnServerAddress;
+ this.ipRange = ipRange;
+ this.presharedKey = ipsecPresharedKey;
+ this.localIp = localIp;
+ this.create = create;
+ }
+
+ public String getVpnServerIp() {
+ return vpnServerIp;
+ }
+
+ public void setVpnServerIp(String vpnServerIp) {
+ this.vpnServerIp = vpnServerIp;
+ }
+
+ public String getIpRange() {
+ return ipRange;
+ }
+
+ public void setIpRange(String ipRange) {
+ this.ipRange = ipRange;
+ }
+
+ public String getPresharedKey() {
+ return presharedKey;
+ }
+
+ public void setPresharedKey(String presharedKey) {
+ this.presharedKey = presharedKey;
+ }
+
+ public String getLocalIp() {
+ return localIp;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/SavePasswordCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/SavePasswordCommand.java b/core/src/com/cloud/agent/api/routing/SavePasswordCommand.java
new file mode 100644
index 0000000..6dac148
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/SavePasswordCommand.java
@@ -0,0 +1,54 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api.routing;
+
+
+public class SavePasswordCommand extends NetworkElementCommand {
+
+ String password;
+ String vmIpAddress;
+ String vmName;
+
+ protected SavePasswordCommand() {
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+
+ public SavePasswordCommand(String password, String vmIpAddress, String vmName) {
+ this.password = password;
+ this.vmIpAddress = vmIpAddress;
+ this.vmName = vmName;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public String getVmIpAddress() {
+ return vmIpAddress;
+ }
+
+ public String getVmName() {
+ return vmName;
+ }
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/SetFirewallRulesAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/SetFirewallRulesAnswer.java b/core/src/com/cloud/agent/api/routing/SetFirewallRulesAnswer.java
new file mode 100644
index 0000000..5268c3d
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/SetFirewallRulesAnswer.java
@@ -0,0 +1,36 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api.routing;
+
+import com.cloud.agent.api.Answer;
+
+public class SetFirewallRulesAnswer extends Answer {
+ String[] results;
+
+ protected SetFirewallRulesAnswer() {
+ }
+
+ public SetFirewallRulesAnswer(SetFirewallRulesCommand cmd, boolean success, String[] results) {
+ super(cmd, success, null);
+ assert (cmd.getRules().length == results.length) : "rules and their results should be the same length don't you think?";
+ this.results = results;
+ }
+
+ public String[] getResults() {
+ return results;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/SetFirewallRulesCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/SetFirewallRulesCommand.java b/core/src/com/cloud/agent/api/routing/SetFirewallRulesCommand.java
new file mode 100644
index 0000000..3841bd7
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/SetFirewallRulesCommand.java
@@ -0,0 +1,98 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api.routing;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import com.cloud.agent.api.to.FirewallRuleTO;
+
+/**
+ *
+ * AccessDetails allow different components to put in information about
+ * how to access the components inside the command.
+ */
+public class SetFirewallRulesCommand extends NetworkElementCommand {
+ FirewallRuleTO[] rules;
+
+ protected SetFirewallRulesCommand() {
+ }
+
+ public SetFirewallRulesCommand(List<FirewallRuleTO> rules) {
+ this.rules = rules.toArray(new FirewallRuleTO[rules.size()]);
+ }
+
+ public FirewallRuleTO[] getRules() {
+ return rules;
+ }
+
+ public String[][] generateFwRules() {
+ String [][] result = new String [2][];
+ Set<String> toAdd = new HashSet<String>();
+
+
+ for (FirewallRuleTO fwTO: rules) {
+ /* example : 172.16.92.44:tcp:80:80:0.0.0.0/0:,200.16.92.44:tcp:220:220:0.0.0.0/0:,
+ * each entry format <ip>:protocol:srcport:destport:scidr:
+ * reverted entry format <ip>:reverted:0:0:0:
+ */
+ if (fwTO.revoked() == true)
+ {
+ StringBuilder sb = new StringBuilder();
+ /* This entry is added just to make sure atleast there will one entry in the list to get the ipaddress */
+ sb.append(fwTO.getSrcIp()).append(":reverted:0:0:0:");
+ String fwRuleEntry = sb.toString();
+ toAdd.add(fwRuleEntry);
+ continue;
+ }
+
+ List<String> cidr;
+ StringBuilder sb = new StringBuilder();
+ sb.append(fwTO.getSrcIp()).append(":").append(fwTO.getProtocol()).append(":");
+ if ("icmp".compareTo(fwTO.getProtocol()) == 0)
+ {
+ sb.append(fwTO.getIcmpType()).append(":").append(fwTO.getIcmpCode()).append(":");
+
+ }else if (fwTO.getStringSrcPortRange() == null)
+ sb.append("0:0").append(":");
+ else
+ sb.append(fwTO.getStringSrcPortRange()).append(":");
+
+ cidr = fwTO.getSourceCidrList();
+ if (cidr == null || cidr.isEmpty())
+ {
+ sb.append("0.0.0.0/0");
+ }else{
+ Boolean firstEntry = true;
+ for (String tag : cidr) {
+ if (!firstEntry) sb.append("-");
+ sb.append(tag);
+ firstEntry = false;
+ }
+ }
+ sb.append(":");
+ String fwRuleEntry = sb.toString();
+
+ toAdd.add(fwRuleEntry);
+
+ }
+ result[0] = toAdd.toArray(new String[toAdd.size()]);
+
+ return result;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/SetNetworkACLAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/SetNetworkACLAnswer.java b/core/src/com/cloud/agent/api/routing/SetNetworkACLAnswer.java
new file mode 100644
index 0000000..dc192ad
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/SetNetworkACLAnswer.java
@@ -0,0 +1,36 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api.routing;
+
+import com.cloud.agent.api.Answer;
+
+public class SetNetworkACLAnswer extends Answer {
+ String[] results;
+
+ protected SetNetworkACLAnswer() {
+ }
+
+ public SetNetworkACLAnswer(SetNetworkACLCommand cmd, boolean success, String[] results) {
+ super(cmd, success, null);
+ assert (cmd.getRules().length == results.length) : "ACLs and their results should be the same length";
+ this.results = results;
+ }
+
+ public String[] getResults() {
+ return results;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/SetNetworkACLCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/SetNetworkACLCommand.java b/core/src/com/cloud/agent/api/routing/SetNetworkACLCommand.java
new file mode 100644
index 0000000..dba7354
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/SetNetworkACLCommand.java
@@ -0,0 +1,97 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package com.cloud.agent.api.routing;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import com.cloud.agent.api.to.NetworkACLTO;
+import com.cloud.agent.api.to.NicTO;
+
+public class SetNetworkACLCommand extends NetworkElementCommand{
+ NetworkACLTO[] rules;
+ NicTO nic;
+
+ protected SetNetworkACLCommand() {
+ }
+
+ public SetNetworkACLCommand(List<NetworkACLTO> rules, NicTO nic) {
+ this.rules = rules.toArray(new NetworkACLTO[rules.size()]);
+ this.nic = nic;
+ }
+
+ public NetworkACLTO[] getRules() {
+ return rules;
+ }
+ public String[][] generateFwRules() {
+ String [][] result = new String [2][];
+ Set<String> toAdd = new HashSet<String>();
+
+
+ for (NetworkACLTO aclTO: rules) {
+ /* example : Ingress:tcp:80:80:0.0.0.0/0:,Egress:tcp:220:220:0.0.0.0/0:,
+ * each entry format Ingress/Egress:protocol:start port: end port:scidrs:
+ * reverted entry format Ingress/Egress:reverted:0:0:0:
+ */
+ if (aclTO.revoked() == true)
+ {
+ StringBuilder sb = new StringBuilder();
+ /* This entry is added just to make sure atleast there will one entry in the list to get the ipaddress */
+ sb.append(aclTO.getTrafficType().toString()).append(":reverted:0:0:0:");
+ String aclRuleEntry = sb.toString();
+ toAdd.add(aclRuleEntry);
+ continue;
+ }
+
+ List<String> cidr;
+ StringBuilder sb = new StringBuilder();
+ sb.append(aclTO.getTrafficType().toString()).append(":").append(aclTO.getProtocol()).append(":");
+ if ("icmp".compareTo(aclTO.getProtocol()) == 0)
+ {
+ sb.append(aclTO.getIcmpType()).append(":").append(aclTO.getIcmpCode()).append(":");
+ } else {
+ sb.append(aclTO.getStringPortRange()).append(":");
+ }
+ cidr = aclTO.getSourceCidrList();
+ if (cidr == null || cidr.isEmpty())
+ {
+ sb.append("0.0.0.0/0");
+ }else{
+ Boolean firstEntry = true;
+ for (String tag : cidr) {
+ if (!firstEntry) sb.append("-");
+ sb.append(tag);
+ firstEntry = false;
+ }
+ }
+ sb.append(":");
+ String aclRuleEntry = sb.toString();
+
+ toAdd.add(aclRuleEntry);
+
+ }
+ result[0] = toAdd.toArray(new String[toAdd.size()]);
+
+ return result;
+ }
+
+ public NicTO getNic() {
+ return nic;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/SetPortForwardingRulesAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/SetPortForwardingRulesAnswer.java b/core/src/com/cloud/agent/api/routing/SetPortForwardingRulesAnswer.java
new file mode 100644
index 0000000..15306fb
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/SetPortForwardingRulesAnswer.java
@@ -0,0 +1,37 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api.routing;
+
+import com.cloud.agent.api.Answer;
+
+public class SetPortForwardingRulesAnswer extends Answer {
+ String[] results;
+ protected SetPortForwardingRulesAnswer() {
+ super();
+ }
+
+ public SetPortForwardingRulesAnswer(SetPortForwardingRulesCommand cmd, String[] results, boolean success) {
+ super(cmd, success, null);
+
+ assert(cmd.getRules().length == results.length) : "Shouldn't the results match the commands?";
+ this.results = results;
+ }
+
+ String[] getResults() {
+ return results;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/SetPortForwardingRulesCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/SetPortForwardingRulesCommand.java b/core/src/com/cloud/agent/api/routing/SetPortForwardingRulesCommand.java
new file mode 100644
index 0000000..a7bf37f
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/SetPortForwardingRulesCommand.java
@@ -0,0 +1,40 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api.routing;
+
+import java.util.List;
+
+import com.cloud.agent.api.to.PortForwardingRuleTO;
+
+public class SetPortForwardingRulesCommand extends NetworkElementCommand {
+ PortForwardingRuleTO[] rules;
+
+ protected SetPortForwardingRulesCommand() {
+ }
+
+ public SetPortForwardingRulesCommand(List<? extends PortForwardingRuleTO> pfRules) {
+ rules = new PortForwardingRuleTO[pfRules.size()];
+ int i = 0;
+ for (PortForwardingRuleTO rule : pfRules) {
+ rules[i++] = rule;
+ }
+ }
+
+ public PortForwardingRuleTO[] getRules() {
+ return rules;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/SetPortForwardingRulesVpcCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/SetPortForwardingRulesVpcCommand.java b/core/src/com/cloud/agent/api/routing/SetPortForwardingRulesVpcCommand.java
new file mode 100644
index 0000000..7228457
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/SetPortForwardingRulesVpcCommand.java
@@ -0,0 +1,30 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api.routing;
+
+import java.util.List;
+
+import com.cloud.agent.api.to.PortForwardingRuleTO;
+
+public class SetPortForwardingRulesVpcCommand extends SetPortForwardingRulesCommand{
+ protected SetPortForwardingRulesVpcCommand() {
+ }
+
+ public SetPortForwardingRulesVpcCommand(List<? extends PortForwardingRuleTO> pfRules) {
+ super(pfRules);
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/SetSourceNatAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/SetSourceNatAnswer.java b/core/src/com/cloud/agent/api/routing/SetSourceNatAnswer.java
new file mode 100644
index 0000000..655f363
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/SetSourceNatAnswer.java
@@ -0,0 +1,27 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api.routing;
+
+import com.cloud.agent.api.Answer;
+
+public class SetSourceNatAnswer extends Answer{
+ public SetSourceNatAnswer() {}
+
+ public SetSourceNatAnswer(SetSourceNatCommand cmd, boolean success, String result) {
+ super(cmd, success, result);
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/SetSourceNatCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/SetSourceNatCommand.java b/core/src/com/cloud/agent/api/routing/SetSourceNatCommand.java
new file mode 100644
index 0000000..96aa001
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/SetSourceNatCommand.java
@@ -0,0 +1,42 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api.routing;
+
+import com.cloud.agent.api.to.IpAddressTO;
+
+public class SetSourceNatCommand extends NetworkElementCommand{
+ IpAddressTO ipAddress;
+ boolean add;
+
+ protected SetSourceNatCommand() {
+ }
+
+ public SetSourceNatCommand(IpAddressTO ip, boolean add) {
+ this.ipAddress = ip;
+ this.add = add;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return false;
+ }
+
+ public IpAddressTO getIpAddress() {
+ return ipAddress;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/SetStaticNatRulesAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/SetStaticNatRulesAnswer.java b/core/src/com/cloud/agent/api/routing/SetStaticNatRulesAnswer.java
new file mode 100644
index 0000000..9b5d09b
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/SetStaticNatRulesAnswer.java
@@ -0,0 +1,37 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api.routing;
+
+import com.cloud.agent.api.Answer;
+
+public class SetStaticNatRulesAnswer extends Answer {
+ String[] results;
+ protected SetStaticNatRulesAnswer() {
+ super();
+ }
+
+ public SetStaticNatRulesAnswer(SetStaticNatRulesCommand cmd, String[] results, boolean success) {
+ super(cmd, success, null);
+
+ assert(cmd.getRules().length == results.length) : "Shouldn't the results match the commands?";
+ this.results = results;
+ }
+
+ String[] getResults() {
+ return results;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/SetStaticNatRulesCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/SetStaticNatRulesCommand.java b/core/src/com/cloud/agent/api/routing/SetStaticNatRulesCommand.java
new file mode 100644
index 0000000..852d161
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/SetStaticNatRulesCommand.java
@@ -0,0 +1,47 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api.routing;
+
+import java.util.List;
+
+import com.cloud.agent.api.to.StaticNatRuleTO;
+
+public class SetStaticNatRulesCommand extends NetworkElementCommand{
+
+ StaticNatRuleTO[] rules;
+ Long vpcId;
+
+ protected SetStaticNatRulesCommand() {
+ }
+
+ public SetStaticNatRulesCommand(List<? extends StaticNatRuleTO> staticNatRules, Long vpcId) {
+ rules = new StaticNatRuleTO[staticNatRules.size()];
+ int i = 0;
+ for (StaticNatRuleTO rule : staticNatRules) {
+ rules[i++] = rule;
+ }
+ this.vpcId = vpcId;
+ }
+
+ public StaticNatRuleTO[] getRules() {
+ return rules;
+ }
+
+ public Long getVpcId() {
+ return vpcId;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/SetStaticRouteAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/SetStaticRouteAnswer.java b/core/src/com/cloud/agent/api/routing/SetStaticRouteAnswer.java
new file mode 100644
index 0000000..76f5bb9
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/SetStaticRouteAnswer.java
@@ -0,0 +1,36 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api.routing;
+
+import com.cloud.agent.api.Answer;
+
+public class SetStaticRouteAnswer extends Answer{
+ String[] results;
+
+ protected SetStaticRouteAnswer() {
+ }
+
+ public SetStaticRouteAnswer(SetStaticRouteCommand cmd, boolean success, String[] results) {
+ super(cmd, success, null);
+ assert (cmd.getStaticRoutes().length == results.length) : "Static routes and their results should be the same length";
+ this.results = results;
+ }
+
+ public String[] getResults() {
+ return results;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/SetStaticRouteCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/SetStaticRouteCommand.java b/core/src/com/cloud/agent/api/routing/SetStaticRouteCommand.java
new file mode 100644
index 0000000..c9c2056
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/SetStaticRouteCommand.java
@@ -0,0 +1,62 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package com.cloud.agent.api.routing;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import com.cloud.network.vpc.StaticRoute;
+import com.cloud.network.vpc.StaticRouteProfile;
+import com.cloud.utils.net.NetUtils;
+
+public class SetStaticRouteCommand extends NetworkElementCommand{
+ StaticRouteProfile[] staticRoutes;
+
+ protected SetStaticRouteCommand() {
+ }
+
+ public SetStaticRouteCommand(List<StaticRouteProfile> staticRoutes) {
+ this.staticRoutes = staticRoutes.toArray(new StaticRouteProfile[staticRoutes.size()]);
+ }
+
+ public StaticRouteProfile[] getStaticRoutes() {
+ return staticRoutes;
+ }
+
+ public String[][] generateSRouteRules() {
+ String [][] result = new String [2][];
+ Set<String> toAdd = new HashSet<String>();
+ for (StaticRouteProfile route: staticRoutes) {
+ /* example : ip:gateway:cidr,
+ */
+ String cidr = route.getCidr();
+ String subnet = NetUtils.getCidrSubNet(cidr);
+ String cidrSize = cidr.split("\\/")[1];
+ String entry;
+ if (route.getState() == StaticRoute.State.Active || route.getState() == StaticRoute.State.Add) {
+ entry = route.getIp4Address() + ":" + route.getGateway() + ":" + subnet + "/" + cidrSize;
+ } else {
+ entry = "Revoke:" + route.getGateway() + ":" + subnet + "/" + cidrSize;
+ }
+ toAdd.add(entry);
+ }
+ result[0] = toAdd.toArray(new String[toAdd.size()]);
+ return result;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/Site2SiteVpnCfgCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/Site2SiteVpnCfgCommand.java b/core/src/com/cloud/agent/api/routing/Site2SiteVpnCfgCommand.java
new file mode 100644
index 0000000..8316303
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/Site2SiteVpnCfgCommand.java
@@ -0,0 +1,154 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api.routing;
+
+public class Site2SiteVpnCfgCommand extends NetworkElementCommand {
+
+ private boolean create;
+ private String localPublicIp;
+ private String localGuestCidr;
+ private String localPublicGateway;
+ private String peerGatewayIp;
+ private String peerGuestCidrList;
+ private String ipsecPsk;
+ private String ikePolicy;
+ private String espPolicy;
+ private long ikeLifetime;
+ private long espLifetime;
+ private boolean dpd;
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+
+ public Site2SiteVpnCfgCommand () {
+ this.create = false;
+ }
+
+ public Site2SiteVpnCfgCommand (boolean create, String localPublicIp, String localPublicGateway, String localGuestCidr, String peerGatewayIp,
+ String peerGuestCidrList, String ikePolicy, String espPolicy, String ipsecPsk, Long ikeLifetime, Long espLifetime, Boolean dpd) {
+ this.create = create;
+ this.setLocalPublicIp(localPublicIp);
+ this.setLocalPublicGateway(localPublicGateway);
+ this.setLocalGuestCidr(localGuestCidr);
+ this.setPeerGatewayIp(peerGatewayIp);
+ this.setPeerGuestCidrList(peerGuestCidrList);
+ this.ipsecPsk = ipsecPsk;
+ this.ikePolicy = ikePolicy;
+ this.espPolicy = espPolicy;
+ this.ikeLifetime = ikeLifetime;
+ this.espLifetime = espLifetime;
+ this.dpd = dpd;
+ }
+
+ public boolean isCreate() {
+ return create;
+ }
+
+ public void setCreate(boolean create) {
+ this.create = create;
+ }
+
+ public String getIpsecPsk() {
+ return ipsecPsk;
+ }
+
+ public void setIpsecPsk(String ipsecPsk) {
+ this.ipsecPsk = ipsecPsk;
+ }
+
+ public String getIkePolicy() {
+ return ikePolicy;
+ }
+
+ public void setIkePolicy(String ikePolicy) {
+ this.ikePolicy = ikePolicy;
+ }
+
+ public String getEspPolicy() {
+ return espPolicy;
+ }
+
+ public void setEspPolicy(String espPolicy) {
+ this.espPolicy = espPolicy;
+ }
+
+ public long getIkeLifetime() {
+ return ikeLifetime;
+ }
+
+ public void setikeLifetime(long ikeLifetime) {
+ this.ikeLifetime = ikeLifetime;
+ }
+
+ public long getEspLifetime() {
+ return espLifetime;
+ }
+
+ public void setEspLifetime(long espLifetime) {
+ this.espLifetime = espLifetime;
+ }
+
+ public Boolean getDpd() {
+ return dpd;
+ }
+
+ public void setDpd(Boolean dpd) {
+ this.dpd = dpd;
+ }
+
+ public String getLocalPublicIp() {
+ return localPublicIp;
+ }
+
+ public void setLocalPublicIp(String localPublicIp) {
+ this.localPublicIp = localPublicIp;
+ }
+
+ public String getLocalGuestCidr() {
+ return localGuestCidr;
+ }
+
+ public void setLocalGuestCidr(String localGuestCidr) {
+ this.localGuestCidr = localGuestCidr;
+ }
+
+ public String getLocalPublicGateway() {
+ return localPublicGateway;
+ }
+
+ public void setLocalPublicGateway(String localPublicGateway) {
+ this.localPublicGateway = localPublicGateway;
+ }
+
+ public String getPeerGatewayIp() {
+ return peerGatewayIp;
+ }
+
+ public void setPeerGatewayIp(String peerGatewayIp) {
+ this.peerGatewayIp = peerGatewayIp;
+ }
+
+ public String getPeerGuestCidrList() {
+ return peerGuestCidrList;
+ }
+
+ public void setPeerGuestCidrList(String peerGuestCidrList) {
+ this.peerGuestCidrList = peerGuestCidrList;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/SiteLoadBalancerConfig.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/SiteLoadBalancerConfig.java b/core/src/com/cloud/agent/api/routing/SiteLoadBalancerConfig.java
new file mode 100644
index 0000000..cca5de8
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/SiteLoadBalancerConfig.java
@@ -0,0 +1,121 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package com.cloud.agent.api.routing;
+
+// details of site participating in the GLSB service, represents configuration load balancer rule and the zone
+// in which the rule is configured
+public class SiteLoadBalancerConfig {
+
+ // true if the site details are local to the zone receiving 'GlobalLoadBalancerConfigCommand'
+ boolean local;
+
+ // true if the site needs to be removed from GSLB service
+ boolean revoked;
+
+ // service type of the 'site load balanced' service
+ String serviceType;
+
+ // public IP corresponding to the site load balanced service
+ String servicePublicIp;
+
+ // port corresponding to the site load balanced service
+ String servicePort;
+
+ // Private IP corresponding to the GSLB service provider in the site.
+ String gslbProviderPrivateIp;
+
+ // Public IP corresponding to the GSLB service provider in the site.
+ String gslbProviderPublicIp;
+
+ // zone id in which site is located
+ long dataCenterId;
+
+ public SiteLoadBalancerConfig(boolean revoked, String serviceType, String servicePublicIp, String servicePort,
+ long dataCenterId) {
+ this.revoked = revoked;
+ this.serviceType = serviceType;
+ this.servicePublicIp = servicePublicIp;
+ this.servicePort = servicePort;
+ this.dataCenterId = dataCenterId;
+ }
+
+ public SiteLoadBalancerConfig(String gslbProviderPublicIP, String gslbProviderPrivateIp, boolean local,
+ boolean revoked, String serviceType, String servicePublicIp, String port,
+ long dataCenterId) {
+ this(revoked, serviceType, servicePublicIp, port, dataCenterId);
+ this.gslbProviderPrivateIp = gslbProviderPrivateIp;
+ this.gslbProviderPublicIp = gslbProviderPublicIP;
+ this.local = local;
+ }
+
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+
+ public String getServicePublicIp() {
+ return servicePublicIp;
+ }
+
+ public void SetServicePublicIp(String servicePublicIp) {
+ this.servicePublicIp = servicePublicIp;
+ }
+
+ public String getServicePort() {
+ return servicePort;
+ }
+
+ public void setServicePort(String port) {
+ this.servicePort = port;
+ }
+
+ public String getGslbProviderPrivateIp() {
+ return gslbProviderPrivateIp;
+ }
+
+ public void setGslbProviderPrivateIp(String privateIp) {
+ this.gslbProviderPrivateIp = privateIp;
+ }
+
+ public String getGslbProviderPublicIp() {
+ return gslbProviderPublicIp;
+ }
+
+ public long getDataCenterId() {
+ return dataCenterId;
+ }
+
+ public void setGslbProviderPublicIp(String publicIp) {
+ this.gslbProviderPublicIp = publicIp;
+ }
+
+ public boolean isLocal() {
+ return local;
+ }
+
+ public void setLocal(boolean local) {
+ this.local = local;
+ }
+
+ public boolean forRevoke() {
+ return revoked;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/UserDataCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/UserDataCommand.java b/core/src/com/cloud/agent/api/routing/UserDataCommand.java
new file mode 100644
index 0000000..f7b38c8
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/UserDataCommand.java
@@ -0,0 +1,63 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api.routing;
+
+
+public class UserDataCommand extends NetworkElementCommand {
+
+ String userData;
+ String vmIpAddress;
+ String routerPrivateIpAddress;
+ String vmName;
+
+ protected UserDataCommand() {
+
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+
+ public UserDataCommand(String userData, String vmIpAddress, String routerPrivateIpAddress, String vmName) {
+ this.userData = userData;
+ this.vmIpAddress = vmIpAddress;
+ this.routerPrivateIpAddress = routerPrivateIpAddress;
+ this.vmName = vmName;
+ }
+
+ public String getRouterPrivateIpAddress() {
+ return routerPrivateIpAddress;
+ }
+
+ public String getVmIpAddress() {
+ return vmIpAddress;
+ }
+
+ public String getVmName() {
+ return vmName;
+ }
+
+ public String getUserData() {
+ return userData;
+ }
+
+ public void setUserData(String userData) {
+ this.userData = userData;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/VmDataCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/VmDataCommand.java b/core/src/com/cloud/agent/api/routing/VmDataCommand.java
new file mode 100644
index 0000000..df88255
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/VmDataCommand.java
@@ -0,0 +1,67 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api.routing;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.cloud.agent.api.LogLevel;
+import com.cloud.agent.api.LogLevel.Log4jLevel;
+
+public class VmDataCommand extends NetworkElementCommand {
+
+ String vmIpAddress;
+ String vmName;
+ @LogLevel(Log4jLevel.Trace)
+ List<String[]> vmData;
+
+ protected VmDataCommand() {
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+
+ public VmDataCommand(String vmIpAddress) {
+ this(vmIpAddress, null);
+ }
+
+ public String getVmName() {
+ return vmName;
+ }
+
+ public VmDataCommand(String vmIpAddress, String vmName) {
+ this.vmName = vmName;
+ this.vmIpAddress = vmIpAddress;
+ this.vmData = new ArrayList<String[]>();
+ }
+
+
+ public String getVmIpAddress() {
+ return vmIpAddress;
+ }
+
+ public List<String[]> getVmData() {
+ return vmData;
+ }
+
+ public void addVmData(String folder, String file, String contents) {
+ vmData.add(new String[]{folder, file, contents});
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/VpnUsersCfgCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/VpnUsersCfgCommand.java b/core/src/com/cloud/agent/api/routing/VpnUsersCfgCommand.java
new file mode 100644
index 0000000..ebe725d
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/VpnUsersCfgCommand.java
@@ -0,0 +1,94 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api.routing;
+import java.util.List;
+
+import com.cloud.agent.api.LogLevel;
+import com.cloud.agent.api.LogLevel.Log4jLevel;
+import com.cloud.network.VpnUser;
+
+
+public class VpnUsersCfgCommand extends NetworkElementCommand {
+ public static class UsernamePassword{
+ private String username;
+ @LogLevel(Log4jLevel.Off)
+ private String password;
+ boolean add = true;
+
+ public boolean isAdd() {
+ return add;
+ }
+ public void setAdd(boolean add) {
+ this.add = add;
+ }
+ public String getUsername() {
+ return username;
+ }
+ public void setUsername(String username) {
+ this.username = username;
+ }
+ public String getPassword() {
+ return password;
+ }
+ public void setPassword(String password) {
+ this.password = password;
+ }
+ public UsernamePassword(String username, String password) {
+ super();
+ this.username = username;
+ this.password = password;
+ }
+ public UsernamePassword(String username, String password, boolean add) {
+ super();
+ this.username = username;
+ this.password = password;
+ this.add = add;
+ }
+ protected UsernamePassword() {
+ //for Gson
+ }
+ public String getUsernamePassword() {
+ return getUsername() + "," + getPassword();
+ }
+ }
+ UsernamePassword [] userpwds;
+
+ protected VpnUsersCfgCommand() {
+
+ }
+
+ public VpnUsersCfgCommand(List<VpnUser> addUsers, List<VpnUser> removeUsers) {
+ userpwds = new UsernamePassword[addUsers.size() + removeUsers.size()];
+ int i = 0;
+ for (VpnUser vpnUser: removeUsers) {
+ userpwds[i++] = new UsernamePassword(vpnUser.getUsername(), vpnUser.getPassword(), false);
+ }
+ for (VpnUser vpnUser: addUsers) {
+ userpwds[i++] = new UsernamePassword(vpnUser.getUsername(), vpnUser.getPassword(), true);
+ }
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+
+ public UsernamePassword[] getUserpwds() {
+ return userpwds;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/AbstractDownloadCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/AbstractDownloadCommand.java b/core/src/com/cloud/agent/api/storage/AbstractDownloadCommand.java
new file mode 100644
index 0000000..04b3d43
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/AbstractDownloadCommand.java
@@ -0,0 +1,78 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api.storage;
+
+import com.cloud.storage.Storage.ImageFormat;
+
+public abstract class AbstractDownloadCommand extends ssCommand {
+
+ private String url;
+ private ImageFormat format;
+ private long accountId;
+ private String name;
+
+ protected AbstractDownloadCommand() {
+ }
+
+ protected AbstractDownloadCommand(String name, String url, ImageFormat format, long accountId) {
+ assert(url != null);
+ url = url.replace('\\', '/');
+
+ this.url = url;
+ this.format = format;
+ this.accountId = accountId;
+ this.name = name;
+ }
+
+ protected AbstractDownloadCommand(AbstractDownloadCommand that) {
+ super(that);
+ assert(that.url != null);
+
+ this.url = that.url.replace('\\', '/');
+ this.format = that.format;
+ this.accountId = that.accountId;
+ this.name = that.name;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public ImageFormat getFormat() {
+ return format;
+ }
+
+ public long getAccountId() {
+ return accountId;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+
+ public void setUrl(String url) {
+ assert(url != null);
+ url = url.replace('\\', '/');
+ this.url = url;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/AbstractUploadCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/AbstractUploadCommand.java b/core/src/com/cloud/agent/api/storage/AbstractUploadCommand.java
new file mode 100644
index 0000000..49c04b1
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/AbstractUploadCommand.java
@@ -0,0 +1,68 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api.storage;
+
+import com.cloud.storage.Storage.ImageFormat;
+
+public class AbstractUploadCommand extends StorageCommand{
+
+
+ private String url;
+ private ImageFormat format;
+ private long accountId;
+ private String name;
+
+ protected AbstractUploadCommand() {
+ }
+
+ protected AbstractUploadCommand(String name, String url, ImageFormat format, long accountId) {
+ this.url = url;
+ this.format = format;
+ this.accountId = accountId;
+ this.name = name;
+ }
+
+ protected AbstractUploadCommand(AbstractUploadCommand that) {
+ this(that.name, that.url, that.format, that.accountId);
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public ImageFormat getFormat() {
+ return format;
+ }
+
+ public long getAccountId() {
+ return accountId;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/CopyVolumeAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/CopyVolumeAnswer.java b/core/src/com/cloud/agent/api/storage/CopyVolumeAnswer.java
new file mode 100644
index 0000000..8c55ac3
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/CopyVolumeAnswer.java
@@ -0,0 +1,42 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api.storage;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.Command;
+
+public class CopyVolumeAnswer extends Answer {
+ private String volumeFolder;
+ private String volumePath;
+
+ protected CopyVolumeAnswer() {
+ }
+
+ public CopyVolumeAnswer(Command command, boolean success, String details, String volumeFolder, String volumePath) {
+ super(command, success, details);
+ this.volumeFolder = volumeFolder;
+ this.volumePath = volumePath;
+ }
+
+ public String getVolumeFolder() {
+ return volumeFolder;
+ }
+
+ public String getVolumePath() {
+ return volumePath;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/CopyVolumeCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/CopyVolumeCommand.java b/core/src/com/cloud/agent/api/storage/CopyVolumeCommand.java
new file mode 100644
index 0000000..3d05e9b
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/CopyVolumeCommand.java
@@ -0,0 +1,72 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api.storage;
+
+import com.cloud.agent.api.Command;
+import com.cloud.agent.api.to.StorageFilerTO;
+import com.cloud.storage.StoragePool;
+
+public class CopyVolumeCommand extends Command {
+
+ long volumeId;
+ String volumePath;
+ StorageFilerTO pool;
+ String secondaryStorageURL;
+ boolean toSecondaryStorage;
+ String vmName;
+
+ public CopyVolumeCommand() {
+ }
+
+ public CopyVolumeCommand(long volumeId, String volumePath, StoragePool pool, String secondaryStorageURL, boolean toSecondaryStorage, int wait) {
+ this.volumeId = volumeId;
+ this.volumePath = volumePath;
+ this.pool = new StorageFilerTO(pool);
+ this.secondaryStorageURL = secondaryStorageURL;
+ this.toSecondaryStorage = toSecondaryStorage;
+ setWait(wait);
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+
+ public String getVolumePath() {
+ return volumePath;
+ }
+
+ public long getVolumeId() {
+ return volumeId;
+ }
+
+ public StorageFilerTO getPool() {
+ return pool;
+ }
+
+ public String getSecondaryStorageURL() {
+ return secondaryStorageURL;
+ }
+
+ public boolean toSecondaryStorage() {
+ return toSecondaryStorage;
+ }
+
+ public String getVmName() {
+ return vmName;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/CreateAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/CreateAnswer.java b/core/src/com/cloud/agent/api/storage/CreateAnswer.java
new file mode 100644
index 0000000..ab6cc03
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/CreateAnswer.java
@@ -0,0 +1,53 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api.storage;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.to.VolumeTO;
+
+public class CreateAnswer extends Answer {
+ VolumeTO volume;
+ boolean requestTemplateReload = false;
+ protected CreateAnswer() {
+ }
+
+ public CreateAnswer(CreateCommand cmd, VolumeTO volume) {
+ super(cmd, true, null);
+ this.volume = volume;
+ }
+
+ public CreateAnswer(CreateCommand cmd, String details) {
+ super(cmd, false, details);
+ }
+
+ public CreateAnswer(CreateCommand cmd, String details, boolean requestTemplateReload) {
+ super(cmd, false, details);
+ this.requestTemplateReload = requestTemplateReload;
+ }
+
+ public CreateAnswer(CreateCommand cmd, Exception e) {
+ super(cmd, e);
+ }
+
+ public VolumeTO getVolume() {
+ return volume;
+ }
+
+ public boolean templateReloadRequested() {
+ return requestTemplateReload;
+ }
+}