incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kous...@apache.org
Subject [2/2] git commit: refs/heads/cisco-vnmc-api-integration - Added changes to create ingress fw rules in VNMC
Date Thu, 21 Feb 2013 06:27:02 GMT
Updated Branches:
  refs/heads/cisco-vnmc-api-integration cb2fba9e7 -> 1e38515f3


Added changes to create ingress fw rules in VNMC


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/1e38515f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/1e38515f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/1e38515f

Branch: refs/heads/cisco-vnmc-api-integration
Commit: 1e38515f35f6e567e0118fbea1cdc0dc5ebf9965
Parents: cb2fba9
Author: Koushik Das <koushik.das@citrix.com>
Authored: Thu Feb 21 11:54:44 2013 +0530
Committer: Koushik Das <koushik.das@citrix.com>
Committed: Thu Feb 21 11:54:44 2013 +0530

----------------------------------------------------------------------
 .../network/cisco/associate-acl-policy-set.xml     |   19 +
 .../network/cisco/create-acl-policy-set.xml        |   28 +
 .../scripts/network/cisco/create-acl-policy.xml    |   17 +
 .../network/cisco/create-ingress-acl-rule.xml      |  182 ++++
 .../scripts/network/cisco/delete-acl-policy.xml    |   16 +
 .../scripts/network/cisco/delete-acl-rule.xml      |   17 +
 .../cloud/network/cisco/CiscoVnmcConnection.java   |   88 +-
 .../network/cisco/CiscoVnmcConnectionImpl.java     |  813 +++++++++------
 .../cloud/network/element/CiscoVnmcElement.java    |  473 +++++-----
 .../cloud/network/resource/CiscoVnmcResource.java  |   95 ++-
 .../network/cisco/CiscoVnmcConnectionTest.java     |  432 ++++----
 11 files changed, 1331 insertions(+), 849 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1e38515f/plugins/network-elements/cisco-vnmc/scripts/network/cisco/associate-acl-policy-set.xml
----------------------------------------------------------------------
diff --git a/plugins/network-elements/cisco-vnmc/scripts/network/cisco/associate-acl-policy-set.xml b/plugins/network-elements/cisco-vnmc/scripts/network/cisco/associate-acl-policy-set.xml
new file mode 100755
index 0000000..ae40a88
--- /dev/null
+++ b/plugins/network-elements/cisco-vnmc/scripts/network/cisco/associate-acl-policy-set.xml
@@ -0,0 +1,19 @@
+<configConfMos 
+  cookie="%cookie%" 
+  inHierarchical="false">
+    <inConfigs>
+      <pair key="%espdn%" >
+          <policyVirtualNetworkEdgeProfile
+          connTimeoutRef=""
+          descr="%descr%"
+          dn="%espdn%"
+          egressAclPsetRef="%egresspolicysetname%"
+          ingressAclPsetRef="%ingresspolicysetname%"
+          inspectRef=""
+          name="%name%"
+          natPsetRef="%natpolicysetname%"
+          status="modified"
+          vpnRef=""/>
+      </pair>
+    </inConfigs>
+</configConfMos>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1e38515f/plugins/network-elements/cisco-vnmc/scripts/network/cisco/create-acl-policy-set.xml
----------------------------------------------------------------------
diff --git a/plugins/network-elements/cisco-vnmc/scripts/network/cisco/create-acl-policy-set.xml b/plugins/network-elements/cisco-vnmc/scripts/network/cisco/create-acl-policy-set.xml
new file mode 100755
index 0000000..4038b91
--- /dev/null
+++ b/plugins/network-elements/cisco-vnmc/scripts/network/cisco/create-acl-policy-set.xml
@@ -0,0 +1,28 @@
+
+<configConfMos
+  cookie="%cookie%"
+  inHierarchical="false">
+    <inConfigs>
+    <pair key="%aclpolicyrefdn%">
+      <policyPolicyNameRef
+      dn="%aclpolicyrefdn%"
+      order="100"
+      policyName="%aclpolicyname%"
+      status="created"/>
+    </pair>
+    <pair key="%aclpolicysetdn%">
+      <policyPolicySet
+      descr=""
+      dn="%aclpolicysetdn%"
+      name="%aclpolicysetname%"
+      status="created"/>
+    </pair>
+    </inConfigs>
+</configConfMos>
+
+<!--
+          aclpolicysetdn="org-root/org-vlan-123/org-VDC-vlan-123/pset-foo"
+          aclpolicysetname="foo"
+		  aclpolicyrefdn="org-root/org-vlan-123/org-VDC-vlan-123/pset-foo/polref-bar"
+		  aclpolicyname="bar"
+--!>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1e38515f/plugins/network-elements/cisco-vnmc/scripts/network/cisco/create-acl-policy.xml
----------------------------------------------------------------------
diff --git a/plugins/network-elements/cisco-vnmc/scripts/network/cisco/create-acl-policy.xml b/plugins/network-elements/cisco-vnmc/scripts/network/cisco/create-acl-policy.xml
new file mode 100755
index 0000000..6197011
--- /dev/null
+++ b/plugins/network-elements/cisco-vnmc/scripts/network/cisco/create-acl-policy.xml
@@ -0,0 +1,17 @@
+<configConfMo
+  dn=""
+  cookie="%cookie%"
+  inHierarchical="false">
+    <inConfig>
+      <policyRuleBasedPolicy
+        descr=""
+        dn="%aclpolicydn%"
+        name="%aclpolicyname%"
+        status="created"/>
+    </inConfig>
+</configConfMo>
+
+<!--
+    aclpolicydn="org-root/org-vlan-123/org-VDC-vlan-123/pol-test_policy"
+    aclpolicyname="test_policy"
+--!>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1e38515f/plugins/network-elements/cisco-vnmc/scripts/network/cisco/create-ingress-acl-rule.xml
----------------------------------------------------------------------
diff --git a/plugins/network-elements/cisco-vnmc/scripts/network/cisco/create-ingress-acl-rule.xml b/plugins/network-elements/cisco-vnmc/scripts/network/cisco/create-ingress-acl-rule.xml
new file mode 100755
index 0000000..2c3fdab
--- /dev/null
+++ b/plugins/network-elements/cisco-vnmc/scripts/network/cisco/create-ingress-acl-rule.xml
@@ -0,0 +1,182 @@
+<configConfMos
+  cookie="%cookie%"
+  inHierarchical="false">
+  <inConfigs>
+
+    <pair key="%aclruledn%">
+      <policyRule
+        descr=""
+        dn="%aclruledn%"
+        name="%aclrulename%"
+        order="300"
+        status="created"/>
+    </pair>
+
+    <pair key="%aclruledn%/rule-action-0">
+      <fwpolicyAction
+        actionType="%actiontype%"
+        dn="%aclruledn%/rule-action-0"
+        id="0"
+        status="created"/>
+    </pair>
+
+    <pair key="%aclruledn%/rule-cond-2">
+      <policyRuleCondition
+        dn="%aclruledn%/rule-cond-2"
+        id="2"
+        order="unspecified"
+        status="created"/>
+    </pair>
+    <pair key="%aclruledn%/rule-cond-2/nw-expr2">
+      <policyNetworkExpression
+        dn="%aclruledn%/rule-cond-2/nw-expr2"
+        id="2"
+        opr="eq"
+        status="created"/>
+    </pair>
+    <pair key="%aclruledn%/rule-cond-2/nw-expr2/nw-protocol-2">
+      <policyProtocol
+        dataType="string"
+        descr=""
+        dn="%aclruledn%/rule-cond-2/nw-expr2/nw-protocol-2"
+        id="2"
+        name=""
+        placement="none"
+        status="created"
+        value="%protocolvalue%"/>
+    </pair>
+
+    <pair key="%aclruledn%/rule-cond-3">
+      <policyRuleCondition
+        dn="%aclruledn%/rule-cond-3"
+        id="3"
+        order="unspecified"
+        status="created"/>
+    </pair>
+    <pair key="%aclruledn%/rule-cond-3/nw-expr2">
+      <policyNetworkExpression
+        dn="%aclruledn%/rule-cond-3/nw-expr2"
+        id="2"
+        opr="range"
+        status="created"/>
+    </pair>
+    <pair key="%aclruledn%/rule-cond-3/nw-expr2/nw-attr-qual">
+      <policyNwAttrQualifier
+        attrEp="source"
+        dn="%aclruledn%/rule-cond-3/nw-expr2/nw-attr-qual"
+        status="created"/>
+    </pair>
+    <pair key="%aclruledn%/rule-cond-3/nw-expr2/nw-ip-2">
+      <policyIPAddress
+        dataType="string"
+        descr=""
+        dn="%aclruledn%/rule-cond-3/nw-expr2/nw-ip-2"
+        id="2"
+        name=""
+        placement="begin"
+        status="created"
+        value="%sourcestartip%"/>
+    </pair>
+    <pair key="%aclruledn%/rule-cond-3/nw-expr2/nw-ip-3">
+      <policyIPAddress
+        dataType="string"
+        descr=""
+        dn="%aclruledn%/rule-cond-3/nw-expr2/nw-ip-3"
+        id="3"
+        name=""
+        placement="end"
+        status="created"
+        value="%sourceendip%"/>
+    </pair>
+
+    <pair key="%aclruledn%/rule-cond-4">
+      <policyRuleCondition
+        dn="%aclruledn%/rule-cond-4"
+        id="4"
+        order="unspecified"
+        status="created"/>
+    </pair>
+    <pair key="%aclruledn%/rule-cond-4/nw-expr2">
+      <policyNetworkExpression
+        dn="%aclruledn%/rule-cond-4/nw-expr2"
+        id="2"
+        opr="eq"
+        status="created"/>
+    </pair>
+    <pair key="%aclruledn%/rule-cond-4/nw-expr2/nw-attr-qual">
+      <policyNwAttrQualifier
+        attrEp="destination"
+        dn="%aclruledn%/rule-cond-4/nw-expr2/nw-attr-qual"
+        status="created"/>
+    </pair>
+    <pair key="%aclruledn%/rule-cond-4/nw-expr2/nw-ip-2">
+      <policyIPAddress
+        dataType="string"
+        descr=""
+        dn="%aclruledn%/rule-cond-4/nw-expr2/nw-ip-2"
+        id="2"
+        name=""
+        placement="none"
+        status="created"
+        value="%destip%"/>
+    </pair>
+
+    <pair key="%aclruledn%/rule-cond-5">
+      <policyRuleCondition
+        dn="%aclruledn%/rule-cond-5"
+        id="5"
+        order="unspecified"
+        status="created"/>
+    </pair>
+    <pair key="%aclruledn%/rule-cond-5/nw-expr2">
+      <policyNetworkExpression
+        dn="%aclruledn%/rule-cond-5/nw-expr2"
+        id="2"
+        opr="range"
+        status="created"/>
+    </pair>
+    <pair key="%aclruledn%/rule-cond-5/nw-expr2/nw-attr-qual">
+      <policyNwAttrQualifier
+        attrEp="destination"
+        dn="%aclruledn%/rule-cond-5/nw-expr2/nw-attr-qual"
+        status="created"/>
+    </pair>
+    <pair key="%aclruledn%/rule-cond-5/nw-expr2/nw-port-2">
+      <policyNetworkPort
+        appType="Other"
+        dataType="string"
+        descr=""
+        dn="%aclruledn%/rule-cond-5/nw-expr2/nw-port-2"
+        id="2"
+        name=""
+        placement="begin"
+        status="created"
+        value="%deststartport%"/>
+    </pair>
+    <pair key="%aclruledn%/rule-cond-5/nw-expr2/nw-port-3">
+      <policyNetworkPort
+        appType="Other"
+        dataType="string"
+        descr=""
+        dn="%aclruledn%/rule-cond-5/nw-expr2/nw-port-3"
+        id="3"
+        name=""
+        placement="end"
+        status="created"
+        value="%destendport%"/>
+    </pair>
+
+  </inConfigs>
+</configConfMos>
+
+<!--
+          aclruledn="org-root/org-vlan-123/org-VDC-vlan-123/pol-test_policy/rule-dummy"
+          aclrulename="dummy"
+		  actiontype="drop" or "permit"
+		  protocolvalue = "TCP" or UDP or ICMP
+		  sourcestartip="source start ip"
+		  sourceendip="source end ip"
+		  startport="start port at destination"
+		  endport="end port at destination"
+		  destinationip="public ip at destination"
+--!>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1e38515f/plugins/network-elements/cisco-vnmc/scripts/network/cisco/delete-acl-policy.xml
----------------------------------------------------------------------
diff --git a/plugins/network-elements/cisco-vnmc/scripts/network/cisco/delete-acl-policy.xml b/plugins/network-elements/cisco-vnmc/scripts/network/cisco/delete-acl-policy.xml
new file mode 100755
index 0000000..695d696
--- /dev/null
+++ b/plugins/network-elements/cisco-vnmc/scripts/network/cisco/delete-acl-policy.xml
@@ -0,0 +1,16 @@
+
+<configConfMos
+  cookie="%cookie%"
+  inHierarchical="false">
+    <inConfigs>
+
+      <pair key="%aclpolicydn%">
+        <policyRuleBasedPolicy
+          descr=""
+          dn="%aclpolicydn%"
+          name="%aclpolicyname%"
+          status="deleted,modified"/>
+      </pair>
+
+    </inConfigs>
+</configConfMos>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1e38515f/plugins/network-elements/cisco-vnmc/scripts/network/cisco/delete-acl-rule.xml
----------------------------------------------------------------------
diff --git a/plugins/network-elements/cisco-vnmc/scripts/network/cisco/delete-acl-rule.xml b/plugins/network-elements/cisco-vnmc/scripts/network/cisco/delete-acl-rule.xml
new file mode 100755
index 0000000..92354b0
--- /dev/null
+++ b/plugins/network-elements/cisco-vnmc/scripts/network/cisco/delete-acl-rule.xml
@@ -0,0 +1,17 @@
+
+<configConfMos
+  cookie="%cookie%"
+  inHierarchical="false">
+  <inConfigs>
+
+    <pair key="%aclruledn%">
+      <policyRule
+        descr=""
+        dn="%aclruledn%"
+        name="%aclrulename%"
+        order="300"
+        status="deleted"/>
+    </pair>
+
+  </inConfigs>
+</configConfMos>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1e38515f/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnection.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnection.java b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnection.java
index cf4cf9c..5d59c65 100644
--- a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnection.java
+++ b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnection.java
@@ -22,55 +22,75 @@ import com.cloud.utils.exception.ExecutionException;
 
 public interface CiscoVnmcConnection {
 
-	public boolean createTenant(String tenantName) throws ExecutionException;
+    public boolean createTenant(String tenantName) throws ExecutionException;
 
-	public boolean createTenantVDC(String tenantName) throws ExecutionException;
+    public boolean createTenantVDC(String tenantName) throws ExecutionException;
 
-	public boolean createTenantVDCEdgeDeviceProfile(String tenantName)
-			throws ExecutionException;
+    public boolean createTenantVDCEdgeDeviceProfile(String tenantName)
+            throws ExecutionException;
 
-	public boolean createTenantVDCEdgeStaticRoutePolicy(String tenantName)
-			throws ExecutionException;
+    public boolean createTenantVDCEdgeStaticRoutePolicy(String tenantName)
+            throws ExecutionException;
 
-	public boolean createTenantVDCEdgeStaticRoute(String tenantName,
-			String nextHopIp, String outsideIntf, String destination,
-			String netmask) throws ExecutionException;
+    public boolean createTenantVDCEdgeStaticRoute(String tenantName,
+            String nextHopIp, String outsideIntf, String destination,
+            String netmask) throws ExecutionException;
 
-	public boolean associateTenantVDCEdgeStaticRoutePolicy(String tenantName)
-			throws ExecutionException;
+    public boolean associateTenantVDCEdgeStaticRoutePolicy(String tenantName)
+            throws ExecutionException;
 
-	public boolean associateTenantVDCEdgeDhcpPolicy(String tenantName,
-			String intfName) throws ExecutionException;
+    public boolean associateTenantVDCEdgeDhcpPolicy(String tenantName,
+            String intfName) throws ExecutionException;
 
-	public boolean createTenantVDCEdgeDhcpPolicy(String tenantName,
-			String startIp, String endIp, String subnet, String nameServerIp,
-			String domain) throws ExecutionException;
+    public boolean createTenantVDCEdgeDhcpPolicy(String tenantName,
+            String startIp, String endIp, String subnet, String nameServerIp,
+            String domain) throws ExecutionException;
 
-	public boolean associateTenantVDCEdgeDhcpServerPolicy(String tenantName,
-			String intfName) throws ExecutionException;
+    public boolean associateTenantVDCEdgeDhcpServerPolicy(String tenantName,
+            String intfName) throws ExecutionException;
 
-	public boolean createTenantVDCEdgeSecurityProfile(String tenantName)
-			throws ExecutionException;
+    public boolean createTenantVDCEdgeSecurityProfile(String tenantName)
+            throws ExecutionException;
 
-	public boolean createTenantVDCSourceNATPool(String tenantName,
-			String publicIp) throws ExecutionException;
+    public boolean createTenantVDCSourceNATPool(String tenantName,
+            String publicIp) throws ExecutionException;
 
-	public boolean createTenantVDCSourceNATPolicy(String tenantName,
-			String startSourceIp, String endSourceIp) throws ExecutionException;
+    public boolean createTenantVDCSourceNATPolicy(String tenantName,
+            String startSourceIp, String endSourceIp) throws ExecutionException;
 
-	public boolean createTenantVDCNatPolicySet(String tenantName)
-			throws ExecutionException;
+    public boolean createTenantVDCNatPolicySet(String tenantName)
+            throws ExecutionException;
 
-	public boolean associateNatPolicySet(String tenantName)
-			throws ExecutionException;
+    public boolean associateNatPolicySet(String tenantName)
+            throws ExecutionException;
 
-	public boolean createEdgeFirewall(String tenantName, String publicIp,
-			String insideIp, String insideSubnet, String outsideSubnet)
-			throws ExecutionException;
+    public boolean createIngressAclRule(String tenantName, String identifier,
+            String protocol, String sourceStartIp, String sourceEndIp,
+            String destStartPort, String destEndPort, String destIp)
+            throws ExecutionException;
 
-	public Map<String, String> listUnAssocAsa1000v() throws ExecutionException;
+    public boolean deleteAclRule(String tenantName, String identifier)
+            throws ExecutionException;
 
-	public boolean assocAsa1000v(String tenantName, String firewallDn)
-			throws ExecutionException;
+    public boolean createTenantVDCAclPolicy(String tenantName, boolean ingress)
+            throws ExecutionException;
+
+    public boolean deleteTenantVDCAclPolicy(String tenantName, boolean ingress)
+            throws ExecutionException;
+
+    public boolean createTenantVDCAclPolicySet(String tenantName, boolean ingress)
+            throws ExecutionException;
+
+    public boolean associateAclPolicySet(String tenantName)
+            throws ExecutionException;
+
+    public boolean createEdgeFirewall(String tenantName, String publicIp,
+            String insideIp, String insideSubnet, String outsideSubnet)
+            throws ExecutionException;
+
+    public Map<String, String> listUnAssocAsa1000v() throws ExecutionException;
+
+    public boolean assocAsa1000v(String tenantName, String firewallDn)
+            throws ExecutionException;
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1e38515f/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnectionImpl.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnectionImpl.java b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnectionImpl.java
index d7f17a3..b304e05 100644
--- a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnectionImpl.java
+++ b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnectionImpl.java
@@ -19,9 +19,7 @@ package com.cloud.network.cisco;
 import java.io.BufferedReader;
 import java.io.FileReader;
 import java.io.StringReader;
-import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 
 import javax.xml.parsers.DocumentBuilderFactory;
@@ -40,11 +38,11 @@ import com.cloud.utils.exception.ExecutionException;
 import com.cloud.utils.script.Script;
 
 public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection {
-	
+
     private String _ip;
     private String _username;
     private String _password;
-	private String _cookie;
+    private String _cookie;
 
     private final Logger s_logger = Logger.getLogger(CiscoVnmcConnectionImpl.class);
 
@@ -64,6 +62,12 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection {
         CREATE_SOURCE_NAT_POLICY("create-source-nat-policy.xml", "policy-mgr"),
         CREATE_NAT_POLICY_SET("create-nat-policy-set.xml", "policy-mgr"),
         RESOLVE_NAT_POLICY_SET("associate-nat-policy-set.xml", "policy-mgr"),
+        CREATE_INGRESS_ACL_RULE("create-ingress-acl-rule.xml", "policy-mgr"),
+        DELETE_ACL_RULE("delete-acl-rule.xml", "policy-mgr"),
+        CREATE_ACL_POLICY("create-acl-policy.xml", "policy-mgr"),
+        DELETE_ACL_POLICY("delete-acl-policy.xml", "policy-mgr"),
+        CREATE_ACL_POLICY_SET("create-acl-policy-set.xml", "policy-mgr"),
+        RESOLVE_ACL_POLICY_SET("associate-acl-policy-set.xml", "policy-mgr"),
         CREATE_EDGE_FIREWALL("create-edge-firewall.xml", "resource-mgr"),
         LIST_UNASSOC_ASA1000V("list-unassigned-asa1000v.xml", "resource-mgr"),
         ASSIGN_ASA1000V("assoc-asa1000v.xml", "resource-mgr");
@@ -98,7 +102,7 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection {
                 String line;
                 while ((line = br.readLine()) != null) {
                     //xml += line.replaceAll("\n"," ");
-                	xml += line;
+                    xml += line;
                 }
 
                 return xml;
@@ -108,19 +112,19 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection {
             }
         }
 
-		public String getService() {
-			return service;
-		}
-    }	
+        public String getService() {
+            return service;
+        }
+    }    
 
     public CiscoVnmcConnectionImpl(String hostIp, String userName, String password) {
-    	this._ip = hostIp;
-    	this._username = userName;
-    	this._password = password;
-    	
-	}
+        this._ip = hostIp;
+        this._username = userName;
+        this._password = password;
+        
+    }
 
-	public boolean login() throws ExecutionException {
+    public boolean login() throws ExecutionException {
         String xml = VnmcXml.LOGIN.getXml();
         String service = VnmcXml.LOGIN.getService();
         xml = replaceXmlValue(xml, "username", _username);
@@ -129,98 +133,97 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection {
         Map<String, String> checked = checkResponse(response, "outCookie", "errorCode", "response");
         
         if (checked.get("errorCode") != null)
-        	return false;
+            return false;
         _cookie = checked.get("outCookie");
         if (_cookie == null) {
-        	return false;
+            return false;
         }
         return true;
     }
-    
+
     private String getDnForTenant(String tenantName) {
-    	return "org-root/org-" + tenantName;
+        return "org-root/org-" + tenantName;
     }
-    
+
     private String getDnForTenantVDC(String tenantName) {
-    	return getDnForTenant(tenantName) + "/org-VDC-" + tenantName;
+        return getDnForTenant(tenantName) + "/org-VDC-" + tenantName;
     }
-    
+
     private String getDnForTenantVDCEdgeDeviceProfile(String tenantName) {
-    	return getDnForTenantVDC(tenantName) + "/edsp-" + getNameForEdgeDeviceServiceProfile(tenantName);
+        return getDnForTenantVDC(tenantName) + "/edsp-" + getNameForEdgeDeviceServiceProfile(tenantName);
     }
-    
+
     private String getDnForTenantVDCEdgeSecurityProfile(String tenantName) {
-    	return getDnForTenantVDC(tenantName) + "/vnep-" + getNameForEdgeDeviceSecurityProfile(tenantName);
+        return getDnForTenantVDC(tenantName) + "/vnep-" + getNameForEdgeDeviceSecurityProfile(tenantName);
     }
-    
+
     private String getDnForEdgeDeviceRoutingPolicy(String tenantName) {
-    	return getDnForTenantVDC(tenantName) + "/routing-policy-" + getNameForEdgeDeviceRoutePolicy(tenantName);
-    	//FIXME: any other construct is unreliable. why?
+        return getDnForTenantVDC(tenantName) + "/routing-policy-" + getNameForEdgeDeviceRoutePolicy(tenantName);
+        //FIXME: any other construct is unreliable. why?
     }
-    
+
     private String getDnForEdgeDeviceRoute(String tenantName, int id) {
-    	return getDnForEdgeDeviceRoutingPolicy(tenantName) + "/sroute-" + id ;
+        return getDnForEdgeDeviceRoutingPolicy(tenantName) + "/sroute-" + id ;
     }
-    
+
     private String getDnForDhcpPolicy(String tenantName, String intfName) {
-    	return getDnForTenantVDCEdgeDeviceProfile(tenantName) + "/dhcp-" + intfName;
+        return getDnForTenantVDCEdgeDeviceProfile(tenantName) + "/dhcp-" + intfName;
     }
-    
+
     private String getNameForDhcpPolicy(String tenantName) {
-    	return tenantName + "-Dhcp-Policy";
+        return tenantName + "-Dhcp-Policy";
     }
-    
+
     private String getNameForDhcpServer(String tenantName) {
-    	return tenantName + "-Dhcp-Server";
+        return tenantName + "-Dhcp-Server";
     }
-    
+
     private String getDnForDhcpServerPolicy(String tenantName) {
-    	return getDnForTenantVDC(tenantName) + "/dhcp-server-" + getNameForDhcpPolicy(tenantName);
+        return getDnForTenantVDC(tenantName) + "/dhcp-server-" + getNameForDhcpPolicy(tenantName);
     }
-    
+
     private String getNameForIpRange() {
-    	return "iprange";
+        return "iprange";
     }
-    
+
     private String getDnForDhcpIpRange(String tenantName) {
-    	return getDnForDhcpServerPolicy(tenantName) + "/ip-range-" + getNameForIpRange();
+        return getDnForDhcpServerPolicy(tenantName) + "/ip-range-" + getNameForIpRange();
     }
-    
+
     private String getNameForDNSService(String tenantName) {
-    	return tenantName + "-DNS";
+        return tenantName + "-DNS";
     }
-   
-    
+
     private String getDnForDnsService(String tenantName) {
-    	return getDnForDhcpServerPolicy(tenantName) + "/dns-svc-" + getNameForDNSService(tenantName); 
+        return getDnForDhcpServerPolicy(tenantName) + "/dns-svc-" + getNameForDNSService(tenantName); 
     }
-    
+
     private String getDnForDnsServer(String tenantName, String dnsip) {
-    	return getDnForDnsService(tenantName) + "/dns-" + dnsip; 
+        return getDnForDnsService(tenantName) + "/dns-" + dnsip; 
     }
-    
+
     private String getNameForTenantVDC(String tenantName) {
-    	return "VDC-" + tenantName;
+        return "VDC-" + tenantName;
     }
-    
+
     private String getNameForEdgeDeviceServiceProfile(String tenantName) {
-    	return "EDSP-" + tenantName;
+        return "EDSP-" + tenantName;
     }
-    
+
     private String getNameForEdgeDeviceSecurityProfile(String tenantName) {
-    	return "ESP-" + tenantName;
+        return "ESP-" + tenantName;
     }
-    
+
     private String getNameForEdgeDeviceRoutePolicy(String tenantName) {
-    	return "EDSP-" + tenantName + "-Routes";//FIXME: this has to match DN somehow?
+        return "EDSP-" + tenantName + "-Routes";//FIXME: this has to match DN somehow?
     }
-        
+
     /* (non-Javadoc)
-	 * @see com.cloud.network.resource.CiscoVnmcConnection#createTenant(java.lang.String)
-	 */
+     * @see com.cloud.network.resource.CiscoVnmcConnection#createTenant(java.lang.String)
+     */
     @Override
-	public boolean createTenant(String tenantName) throws ExecutionException {
-    	 String xml = VnmcXml.CREATE_TENANT.getXml();
+    public boolean createTenant(String tenantName) throws ExecutionException {
+         String xml = VnmcXml.CREATE_TENANT.getXml();
          String service = VnmcXml.CREATE_TENANT.getService();
          xml = replaceXmlValue(xml, "cookie", _cookie);
          xml = replaceXmlValue(xml, "descr", "Tenant for account " + tenantName);
@@ -230,13 +233,13 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection {
          String response =  sendRequest(service, xml);
          return verifySuccess(response);
     }
-    
+
     /* (non-Javadoc)
-	 * @see com.cloud.network.resource.CiscoVnmcConnection#createTenantVDC(java.lang.String)
-	 */
+     * @see com.cloud.network.resource.CiscoVnmcConnection#createTenantVDC(java.lang.String)
+     */
     @Override
-	public boolean createTenantVDC(String tenantName) throws ExecutionException {
-   	 String xml = VnmcXml.CREATE_VDC.getXml();
+    public boolean createTenantVDC(String tenantName) throws ExecutionException {
+        String xml = VnmcXml.CREATE_VDC.getXml();
         String service = VnmcXml.CREATE_VDC.getService();
         xml = replaceXmlValue(xml, "cookie", _cookie);
         xml = replaceXmlValue(xml, "descr", "VDC for Tenant" + tenantName);
@@ -247,13 +250,13 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection {
         
         return verifySuccess(response);
    }
-    
+
     /* (non-Javadoc)
-	 * @see com.cloud.network.resource.CiscoVnmcConnection#createTenantVDCEdgeDeviceProfile(java.lang.String)
-	 */
+     * @see com.cloud.network.resource.CiscoVnmcConnection#createTenantVDCEdgeDeviceProfile(java.lang.String)
+     */
     @Override
-	public boolean createTenantVDCEdgeDeviceProfile(String tenantName) throws ExecutionException {
-      	 String xml = VnmcXml.CREATE_EDGE_DEVICE_PROFILE.getXml();
+    public boolean createTenantVDCEdgeDeviceProfile(String tenantName) throws ExecutionException {
+           String xml = VnmcXml.CREATE_EDGE_DEVICE_PROFILE.getXml();
            String service = VnmcXml.CREATE_EDGE_DEVICE_PROFILE.getService();
            xml = replaceXmlValue(xml, "cookie", _cookie);
            xml = replaceXmlValue(xml, "descr", "Edge Device Profile for Tenant VDC" + tenantName);
@@ -266,30 +269,29 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection {
     }
 
     /* (non-Javadoc)
-	 * @see com.cloud.network.resource.CiscoVnmcConnection#createTenantVDCEdgeStaticRoutePolicy(java.lang.String)
-	 */
+     * @see com.cloud.network.resource.CiscoVnmcConnection#createTenantVDCEdgeStaticRoutePolicy(java.lang.String)
+     */
     @Override
-	public boolean createTenantVDCEdgeStaticRoutePolicy(String tenantName) throws ExecutionException {
-     	 String xml = VnmcXml.CREATE_EDGE_ROUTE_POLICY.getXml();
+    public boolean createTenantVDCEdgeStaticRoutePolicy(String tenantName) throws ExecutionException {
+          String xml = VnmcXml.CREATE_EDGE_ROUTE_POLICY.getXml();
           String service = VnmcXml.CREATE_EDGE_ROUTE_POLICY.getService();
           xml = replaceXmlValue(xml, "cookie", _cookie);
           xml = replaceXmlValue(xml, "name", getNameForEdgeDeviceRoutePolicy(tenantName));//FIXME: this has to match DN somehow?
           xml = replaceXmlValue(xml, "routepolicydn", getDnForEdgeDeviceRoutingPolicy(tenantName));
           xml = replaceXmlValue(xml, "descr", "Routing Policy for Edge Device for Tenant " + tenantName);
 
-
           String response =  sendRequest(service, xml);
           return verifySuccess(response);
    }
-    
+
     /* (non-Javadoc)
-	 * @see com.cloud.network.resource.CiscoVnmcConnection#createTenantVDCEdgeStaticRoute(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
-	 */
+     * @see com.cloud.network.resource.CiscoVnmcConnection#createTenantVDCEdgeStaticRoute(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
+     */
     @Override
-	public boolean createTenantVDCEdgeStaticRoute(String tenantName, 
-    		String nextHopIp, String outsideIntf,
-    		String destination, String netmask) throws ExecutionException {
-    	 String xml = VnmcXml.CREATE_EDGE_ROUTE.getXml();
+    public boolean createTenantVDCEdgeStaticRoute(String tenantName, 
+            String nextHopIp, String outsideIntf,
+            String destination, String netmask) throws ExecutionException {
+         String xml = VnmcXml.CREATE_EDGE_ROUTE.getXml();
          String service = VnmcXml.CREATE_EDGE_ROUTE.getService();
          xml = replaceXmlValue(xml, "cookie", _cookie);
          xml = replaceXmlValue(xml, "routedn", getDnForEdgeDeviceRoute(tenantName, 2));//TODO: why 2?
@@ -304,13 +306,13 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection {
          String response =  sendRequest(service, xml);
          return verifySuccess(response);
     }
-    
+
     /* (non-Javadoc)
-	 * @see com.cloud.network.resource.CiscoVnmcConnection#associateTenantVDCEdgeStaticRoutePolicy(java.lang.String)
-	 */
+     * @see com.cloud.network.resource.CiscoVnmcConnection#associateTenantVDCEdgeStaticRoutePolicy(java.lang.String)
+     */
     @Override
-	public boolean associateTenantVDCEdgeStaticRoutePolicy(String tenantName) throws ExecutionException {
-    	 String xml = VnmcXml.RESOLVE_EDGE_ROUTE_POLICY.getXml();
+    public boolean associateTenantVDCEdgeStaticRoutePolicy(String tenantName) throws ExecutionException {
+         String xml = VnmcXml.RESOLVE_EDGE_ROUTE_POLICY.getXml();
          String service = VnmcXml.RESOLVE_EDGE_ROUTE_POLICY.getService();
          xml = replaceXmlValue(xml, "cookie", _cookie);
          xml = replaceXmlValue(xml, "profilename", getNameForEdgeDeviceServiceProfile(tenantName));
@@ -320,13 +322,13 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection {
          String response =  sendRequest(service, xml);
          return verifySuccess(response);
     }
-    
+
     /* (non-Javadoc)
-	 * @see com.cloud.network.resource.CiscoVnmcConnection#associateTenantVDCEdgeDhcpPolicy(java.lang.String, java.lang.String)
-	 */
+     * @see com.cloud.network.resource.CiscoVnmcConnection#associateTenantVDCEdgeDhcpPolicy(java.lang.String, java.lang.String)
+     */
     @Override
-	public boolean associateTenantVDCEdgeDhcpPolicy(String tenantName, String intfName) throws ExecutionException {
-   	 String xml = VnmcXml.RESOLVE_EDGE_DHCP_POLICY.getXml();
+    public boolean associateTenantVDCEdgeDhcpPolicy(String tenantName, String intfName) throws ExecutionException {
+        String xml = VnmcXml.RESOLVE_EDGE_DHCP_POLICY.getXml();
         String service = VnmcXml.RESOLVE_EDGE_DHCP_POLICY.getService();
         xml = replaceXmlValue(xml, "cookie", _cookie);
         xml = replaceXmlValue(xml, "dhcpdn", getDnForDhcpPolicy(tenantName, intfName));
@@ -336,39 +338,39 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection {
         
         return verifySuccess(response);
     }
-    
+
     /* (non-Javadoc)
-	 * @see com.cloud.network.resource.CiscoVnmcConnection#createTenantVDCEdgeDhcpPolicy(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
-	 */
+     * @see com.cloud.network.resource.CiscoVnmcConnection#createTenantVDCEdgeDhcpPolicy(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
+     */
     @Override
-	public boolean createTenantVDCEdgeDhcpPolicy(String tenantName, 
-    		String startIp, String endIp, String subnet, String nameServerIp, String domain) throws ExecutionException {
-    	String xml = VnmcXml.CREATE_DHCP_POLICY.getXml();
-    	String service = VnmcXml.CREATE_DHCP_POLICY.getService();
-    	xml = replaceXmlValue(xml, "cookie", _cookie);
-    	xml = replaceXmlValue(xml, "dhcpserverdn", getDnForDhcpServerPolicy(tenantName));
-    	xml = replaceXmlValue(xml, "dhcpserverdescr", "DHCP server for " + tenantName);
-    	xml = replaceXmlValue(xml, "dhcpservername", getNameForDhcpPolicy(tenantName));
-    	xml = replaceXmlValue(xml, "iprangedn", getDnForDhcpIpRange(tenantName));
-    	xml = replaceXmlValue(xml, "startip", startIp);
-    	xml = replaceXmlValue(xml, "endip", endIp);
-    	xml = replaceXmlValue(xml, "subnet", subnet);
-    	xml = replaceXmlValue(xml, "domain", domain);
-    	xml = replaceXmlValue(xml, "dnsservicedn", getDnForDnsService(tenantName));
-    	xml = replaceXmlValue(xml, "dnsservicename", getNameForDNSService(tenantName));
-    	xml = replaceXmlValue(xml, "nameserverip", nameServerIp);
-    	xml = replaceXmlValue(xml, "nameserverdn", getDnForDnsServer(tenantName, nameServerIp));
-
-    	String response =  sendRequest(service, xml);
-    	return verifySuccess(response);
+    public boolean createTenantVDCEdgeDhcpPolicy(String tenantName, 
+            String startIp, String endIp, String subnet, String nameServerIp, String domain) throws ExecutionException {
+        String xml = VnmcXml.CREATE_DHCP_POLICY.getXml();
+        String service = VnmcXml.CREATE_DHCP_POLICY.getService();
+        xml = replaceXmlValue(xml, "cookie", _cookie);
+        xml = replaceXmlValue(xml, "dhcpserverdn", getDnForDhcpServerPolicy(tenantName));
+        xml = replaceXmlValue(xml, "dhcpserverdescr", "DHCP server for " + tenantName);
+        xml = replaceXmlValue(xml, "dhcpservername", getNameForDhcpPolicy(tenantName));
+        xml = replaceXmlValue(xml, "iprangedn", getDnForDhcpIpRange(tenantName));
+        xml = replaceXmlValue(xml, "startip", startIp);
+        xml = replaceXmlValue(xml, "endip", endIp);
+        xml = replaceXmlValue(xml, "subnet", subnet);
+        xml = replaceXmlValue(xml, "domain", domain);
+        xml = replaceXmlValue(xml, "dnsservicedn", getDnForDnsService(tenantName));
+        xml = replaceXmlValue(xml, "dnsservicename", getNameForDNSService(tenantName));
+        xml = replaceXmlValue(xml, "nameserverip", nameServerIp);
+        xml = replaceXmlValue(xml, "nameserverdn", getDnForDnsServer(tenantName, nameServerIp));
+
+        String response =  sendRequest(service, xml);
+        return verifySuccess(response);
     }
-    
+
     /* (non-Javadoc)
-	 * @see com.cloud.network.resource.CiscoVnmcConnection#associateTenantVDCEdgeDhcpServerPolicy(java.lang.String, java.lang.String)
-	 */
+     * @see com.cloud.network.resource.CiscoVnmcConnection#associateTenantVDCEdgeDhcpServerPolicy(java.lang.String, java.lang.String)
+     */
     @Override
-	public boolean associateTenantVDCEdgeDhcpServerPolicy(String tenantName, String intfName) throws ExecutionException {
-      	 String xml = VnmcXml.RESOLVE_EDGE_DHCP_SERVER_POLICY.getXml();
+    public boolean associateTenantVDCEdgeDhcpServerPolicy(String tenantName, String intfName) throws ExecutionException {
+           String xml = VnmcXml.RESOLVE_EDGE_DHCP_SERVER_POLICY.getXml();
            String service = VnmcXml.RESOLVE_EDGE_DHCP_SERVER_POLICY.getService();
            xml = replaceXmlValue(xml, "cookie", _cookie);
            xml = replaceXmlValue(xml, "dhcpdn", getDnForDhcpPolicy(tenantName, intfName));
@@ -378,253 +380,392 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection {
            String response =  sendRequest(service, xml);
            return verifySuccess(response);
     }
-    
+
     /* (non-Javadoc)
-	 * @see com.cloud.network.resource.CiscoVnmcConnection#createTenantVDCEdgeSecurityProfile(java.lang.String)
-	 */
+     * @see com.cloud.network.resource.CiscoVnmcConnection#createTenantVDCEdgeSecurityProfile(java.lang.String)
+     */
     @Override
-	public boolean createTenantVDCEdgeSecurityProfile(String tenantName) throws ExecutionException {
-    	String xml = VnmcXml.CREATE_EDGE_SECURITY_PROFILE.getXml();
-    	String service = VnmcXml.CREATE_EDGE_SECURITY_PROFILE.getService();
-    	xml = replaceXmlValue(xml, "cookie", _cookie);
-    	xml = replaceXmlValue(xml, "descr", "Edge Security Profile for Tenant VDC" + tenantName);
-    	xml = replaceXmlValue(xml, "name", getNameForEdgeDeviceSecurityProfile(tenantName));
-    	xml = replaceXmlValue(xml, "espdn", getDnForTenantVDCEdgeSecurityProfile(tenantName));
-    	xml = replaceXmlValue(xml, "egressref", "default-egress");
-    	xml = replaceXmlValue(xml, "ingressref", "default-ingress"); //FIXME: allows everything
-
-    	String response =  sendRequest(service, xml);
-
-    	return verifySuccess(response);
+    public boolean createTenantVDCEdgeSecurityProfile(String tenantName) throws ExecutionException {
+        String xml = VnmcXml.CREATE_EDGE_SECURITY_PROFILE.getXml();
+        String service = VnmcXml.CREATE_EDGE_SECURITY_PROFILE.getService();
+        xml = replaceXmlValue(xml, "cookie", _cookie);
+        xml = replaceXmlValue(xml, "descr", "Edge Security Profile for Tenant VDC" + tenantName);
+        xml = replaceXmlValue(xml, "name", getNameForEdgeDeviceSecurityProfile(tenantName));
+        xml = replaceXmlValue(xml, "espdn", getDnForTenantVDCEdgeSecurityProfile(tenantName));
+        xml = replaceXmlValue(xml, "egressref", "default-egress");
+        xml = replaceXmlValue(xml, "ingressref", "default-ingress"); //FIXME: allows everything
+
+        String response =  sendRequest(service, xml);
+
+        return verifySuccess(response);
    }
-    
+
     private String getNameForSourceNatPool(String tenantName) {
-    	return "Source-NAT-Pool-For-" + tenantName;
+        return "Source-NAT-Pool-For-" + tenantName;
     }
-    
+
     private String getDnForSourceNatPool(String tenantName) {
-    	return getDnForTenantVDC(tenantName) + "/objgrp-" + getNameForSourceNatPool(tenantName);
+        return getDnForTenantVDC(tenantName) + "/objgrp-" + getNameForSourceNatPool(tenantName);
     }
-    
+
     private String getDnForSourceNatPoolExpr(String tenantName) {
-    	return getDnForSourceNatPool(tenantName) + "/objgrp-expr-2";
+        return getDnForSourceNatPool(tenantName) + "/objgrp-expr-2";
     }
-    
+
     private String getDnForSourceNatPublicIp(String tenantName) {
-    	return getDnForSourceNatPoolExpr(tenantName) + "/nw-ip-2";
+        return getDnForSourceNatPoolExpr(tenantName) + "/nw-ip-2";
     }
-    
+
     /* (non-Javadoc)
-	 * @see com.cloud.network.resource.CiscoVnmcConnection#createTenantVDCSourceNATPool(java.lang.String, java.lang.String)
-	 */
+     * @see com.cloud.network.resource.CiscoVnmcConnection#createTenantVDCSourceNATPool(java.lang.String, java.lang.String)
+     */
     @Override
-	public boolean createTenantVDCSourceNATPool(String tenantName, String publicIp) throws ExecutionException {
-    	String xml = VnmcXml.CREATE_SOURCE_NAT_POOL.getXml();
-    	String service = VnmcXml.CREATE_SOURCE_NAT_POOL.getService();
-    	xml = replaceXmlValue(xml, "cookie", _cookie);
-    	xml = replaceXmlValue(xml, "descr", "Source NAT pool for Tenant VDC " + tenantName);
-    	xml = replaceXmlValue(xml, "name", getNameForSourceNatPool(tenantName));
-    	xml = replaceXmlValue(xml, "snatpooldn", getDnForSourceNatPool(tenantName));
-    	xml = replaceXmlValue(xml, "snatpoolexprdn", getDnForSourceNatPoolExpr(tenantName));
-    	xml = replaceXmlValue(xml, "publicipdn", getDnForSourceNatPublicIp(tenantName));
-    	xml = replaceXmlValue(xml, "publicip", publicIp);
+    public boolean createTenantVDCSourceNATPool(String tenantName, String publicIp) throws ExecutionException {
+        String xml = VnmcXml.CREATE_SOURCE_NAT_POOL.getXml();
+        String service = VnmcXml.CREATE_SOURCE_NAT_POOL.getService();
+        xml = replaceXmlValue(xml, "cookie", _cookie);
+        xml = replaceXmlValue(xml, "descr", "Source NAT pool for Tenant VDC " + tenantName);
+        xml = replaceXmlValue(xml, "name", getNameForSourceNatPool(tenantName));
+        xml = replaceXmlValue(xml, "snatpooldn", getDnForSourceNatPool(tenantName));
+        xml = replaceXmlValue(xml, "snatpoolexprdn", getDnForSourceNatPoolExpr(tenantName));
+        xml = replaceXmlValue(xml, "publicipdn", getDnForSourceNatPublicIp(tenantName));
+        xml = replaceXmlValue(xml, "publicip", publicIp);
 
-    	String response =  sendRequest(service, xml);
+        String response =  sendRequest(service, xml);
 
-    	return verifySuccess(response);
+        return verifySuccess(response);
     }
-    
-    
+
     private String getNameForSourceNatPolicy(String tenantName) {
-       return "Source-NAT-For-" + tenantName;	
+       return "Source-NAT-For-" + tenantName;    
     }
-    
+
     private String getDnForSourceNatPolicy(String tenantName) {
-    	return getDnForTenantVDC(tenantName) + "/natpol-" + getNameForSourceNatPolicy(tenantName);
+        return getDnForTenantVDC(tenantName) + "/natpol-" + getNameForSourceNatPolicy(tenantName);
     }
-    
+
     private String getNameForSourceNatRule(String tenantName) {
-    	return "Source-NAT-Policy-Rule-" + tenantName;
+        return "Source-NAT-Policy-Rule-" + tenantName;
     }
-    
+
     private String getDnForSourceNatRule(String tenantName) {
-    	return getDnForSourceNatPolicy(tenantName) + "/rule-" + getNameForSourceNatRule(tenantName);
+        return getDnForSourceNatPolicy(tenantName) + "/rule-" + getNameForSourceNatRule(tenantName);
     }
-    
+
     private String getDnForSourceNatRuleAction(String tenantName) {
-    	return getDnForSourceNatRule(tenantName) + "/nat-action";
+        return getDnForSourceNatRule(tenantName) + "/nat-action";
     }
-    
+
     private String getDnForSourceNatRuleRule(String tenantName) {
-    	return getDnForSourceNatRule(tenantName) + "/rule-cond-2";
+        return getDnForSourceNatRule(tenantName) + "/rule-cond-2";
     }
-    
+
     private String getDnForSourceNatRuleRange(String tenantName) {
-    	return getDnForSourceNatRuleRule(tenantName) + "/nw-expr2";
+        return getDnForSourceNatRuleRule(tenantName) + "/nw-expr2";
     }
-    
+
     private String getDnForSourceNatRuleRangeIp(String tenantName, int id) {
-    	return getDnForSourceNatRuleRange(tenantName) + "/nw-ip-" + id;
+        return getDnForSourceNatRuleRange(tenantName) + "/nw-ip-" + id;
     }
-    
+
     private String getDnForSourceNatRuleRangeAttr(String tenantName) {
-    	return getDnForSourceNatRuleRange(tenantName) + "/nw-attr-qual";
+        return getDnForSourceNatRuleRange(tenantName) + "/nw-attr-qual";
     }
-    
+
     /* (non-Javadoc)
-	 * @see com.cloud.network.resource.CiscoVnmcConnection#createTenantVDCSourceNATPolicy(java.lang.String, java.lang.String, java.lang.String)
-	 */
+     * @see com.cloud.network.resource.CiscoVnmcConnection#createTenantVDCSourceNATPolicy(java.lang.String, java.lang.String, java.lang.String)
+     */
     @Override
-	public boolean createTenantVDCSourceNATPolicy(String tenantName, 
-    		String startSourceIp, String endSourceIp) throws ExecutionException {
-    	
-    	String xml = VnmcXml.CREATE_SOURCE_NAT_POLICY.getXml();
-    	String service = VnmcXml.CREATE_SOURCE_NAT_POLICY.getService();
-    	xml = replaceXmlValue(xml, "cookie", _cookie);
-    	xml = replaceXmlValue(xml, "descr", "Source NAT Policy for Tenant VDC " + tenantName);
-    	xml = replaceXmlValue(xml, "srcTranslatedIpPool", getNameForSourceNatPool(tenantName));
-    	xml = replaceXmlValue(xml, "natrulename", getNameForSourceNatRule(tenantName));
-    	xml = replaceXmlValue(xml, "natpolname", getNameForSourceNatPolicy(tenantName));
-    	xml = replaceXmlValue(xml, "natruleruledescr", "Source NAT Policy for Tenant " + tenantName);
-    	xml = replaceXmlValue(xml, "natpoldescr", "Source NAT Rule for Tenant " + tenantName);
-    	xml = replaceXmlValue(xml, "natpoldn", getDnForSourceNatPolicy(tenantName));
-    	xml = replaceXmlValue(xml, "natruledn", getDnForSourceNatRule(tenantName));
-    	xml = replaceXmlValue(xml, "sourcestartip", startSourceIp);
-    	xml = replaceXmlValue(xml, "sourceendip", endSourceIp);
-    	xml = replaceXmlValue(xml, "sourcenatpoolname", getNameForSourceNatPool(tenantName));
-
-    	
-    	xml = replaceXmlValue(xml, "natactiondn", getDnForSourceNatRuleAction(tenantName));
-    	xml = replaceXmlValue(xml, "natruleruledn", getDnForSourceNatRuleRule(tenantName));
-    	xml = replaceXmlValue(xml, "natrangedn", getDnForSourceNatRuleRange(tenantName));
-    	xml = replaceXmlValue(xml, "natipdn2", getDnForSourceNatRuleRangeIp(tenantName, 2));
-    	xml = replaceXmlValue(xml, "natipdn3", getDnForSourceNatRuleRangeIp(tenantName, 3));
-
-    	xml = replaceXmlValue(xml, "natsnatruleconddn", getDnForSourceNatRuleRangeAttr(tenantName));
-
-    	String response =  sendRequest(service, xml);
-
-    	return verifySuccess(response);
+    public boolean createTenantVDCSourceNATPolicy(String tenantName, 
+            String startSourceIp, String endSourceIp) throws ExecutionException {
+
+        String xml = VnmcXml.CREATE_SOURCE_NAT_POLICY.getXml();
+        String service = VnmcXml.CREATE_SOURCE_NAT_POLICY.getService();
+        xml = replaceXmlValue(xml, "cookie", _cookie);
+        xml = replaceXmlValue(xml, "descr", "Source NAT Policy for Tenant VDC " + tenantName);
+        xml = replaceXmlValue(xml, "srcTranslatedIpPool", getNameForSourceNatPool(tenantName));
+        xml = replaceXmlValue(xml, "natrulename", getNameForSourceNatRule(tenantName));
+        xml = replaceXmlValue(xml, "natpolname", getNameForSourceNatPolicy(tenantName));
+        xml = replaceXmlValue(xml, "natruleruledescr", "Source NAT Policy for Tenant " + tenantName);
+        xml = replaceXmlValue(xml, "natpoldescr", "Source NAT Rule for Tenant " + tenantName);
+        xml = replaceXmlValue(xml, "natpoldn", getDnForSourceNatPolicy(tenantName));
+        xml = replaceXmlValue(xml, "natruledn", getDnForSourceNatRule(tenantName));
+        xml = replaceXmlValue(xml, "sourcestartip", startSourceIp);
+        xml = replaceXmlValue(xml, "sourceendip", endSourceIp);
+        xml = replaceXmlValue(xml, "sourcenatpoolname", getNameForSourceNatPool(tenantName));
+
+        xml = replaceXmlValue(xml, "natactiondn", getDnForSourceNatRuleAction(tenantName));
+        xml = replaceXmlValue(xml, "natruleruledn", getDnForSourceNatRuleRule(tenantName));
+        xml = replaceXmlValue(xml, "natrangedn", getDnForSourceNatRuleRange(tenantName));
+        xml = replaceXmlValue(xml, "natipdn2", getDnForSourceNatRuleRangeIp(tenantName, 2));
+        xml = replaceXmlValue(xml, "natipdn3", getDnForSourceNatRuleRangeIp(tenantName, 3));
+
+        xml = replaceXmlValue(xml, "natsnatruleconddn", getDnForSourceNatRuleRangeAttr(tenantName));
+
+        String response =  sendRequest(service, xml);
+
+        return verifySuccess(response);
     }
-    
+
     private String getNameForNatPolicySet(String tenantName) {
-    	return "NAT-Policy-Set-" + tenantName;
+        return "NAT-Policy-Set-" + tenantName;
     }
 
     private String getDnForNatPolicySet(String tenantName) {
-    	return getDnForTenantVDC(tenantName) + "/natpset-" + getNameForNatPolicySet(tenantName) ;
+        return getDnForTenantVDC(tenantName) + "/natpset-" + getNameForNatPolicySet(tenantName) ;
     }
-    
-    private String getDnForNatPolicySetRef(String tenantName) {
-    	return getDnForNatPolicySet(tenantName) + "/polref-" + getNameForSourceNatPolicy(tenantName) ;
+
+    private String getDnForNatPolicyRef(String tenantName) {
+        return getDnForNatPolicySet(tenantName) + "/polref-" + getNameForSourceNatPolicy(tenantName) ;
     }
-    
+
     /* (non-Javadoc)
-	 * @see com.cloud.network.resource.CiscoVnmcConnection#createTenantVDCNatPolicySet(java.lang.String)
-	 */
+     * @see com.cloud.network.resource.CiscoVnmcConnection#createTenantVDCNatPolicySet(java.lang.String)
+     */
     @Override
-	public boolean createTenantVDCNatPolicySet(String tenantName) throws ExecutionException {
-    	String xml = VnmcXml.CREATE_NAT_POLICY_SET.getXml();
-    	String service = VnmcXml.CREATE_NAT_POLICY_SET.getService();
-    	xml = replaceXmlValue(xml, "cookie", _cookie);
-    	//xml = replaceXmlValue(xml, "descr", "Nat Policy Set for Tenant VDC " + tenantName);
-    	xml = replaceXmlValue(xml, "natpolicyname", getNameForSourceNatPolicy(tenantName));
-    	xml = replaceXmlValue(xml, "natpolicysetname", getNameForNatPolicySet(tenantName));
-    	xml = replaceXmlValue(xml, "natpolicysetdn", getDnForNatPolicySet(tenantName));
-    	xml = replaceXmlValue(xml, "natpolicyrefdn", getDnForNatPolicySetRef(tenantName));
+    public boolean createTenantVDCNatPolicySet(String tenantName) throws ExecutionException {
+        String xml = VnmcXml.CREATE_NAT_POLICY_SET.getXml();
+        String service = VnmcXml.CREATE_NAT_POLICY_SET.getService();
+        xml = replaceXmlValue(xml, "cookie", _cookie);
+        //xml = replaceXmlValue(xml, "descr", "Nat Policy Set for Tenant VDC " + tenantName);
+        xml = replaceXmlValue(xml, "natpolicyname", getNameForSourceNatPolicy(tenantName));
+        xml = replaceXmlValue(xml, "natpolicysetname", getNameForNatPolicySet(tenantName));
+        xml = replaceXmlValue(xml, "natpolicysetdn", getDnForNatPolicySet(tenantName));
+        xml = replaceXmlValue(xml, "natpolicyrefdn", getDnForNatPolicyRef(tenantName));
 
-    	String response =  sendRequest(service, xml);
+        String response =  sendRequest(service, xml);
 
-    	return verifySuccess(response);
+        return verifySuccess(response);
     }
-    
+
     /* (non-Javadoc)
-	 * @see com.cloud.network.resource.CiscoVnmcConnection#associateNatPolicySet(java.lang.String)
-	 */
+     * @see com.cloud.network.resource.CiscoVnmcConnection#associateNatPolicySet(java.lang.String)
+     */
     @Override
-	public boolean associateNatPolicySet(String tenantName) throws ExecutionException {
-    	String xml = VnmcXml.RESOLVE_NAT_POLICY_SET.getXml();
-    	String service = VnmcXml.RESOLVE_NAT_POLICY_SET.getService();
-    	xml = replaceXmlValue(xml, "cookie", _cookie);
-    	xml = replaceXmlValue(xml, "descr", "Edge Security Profile for Tenant VDC" + tenantName);
-    	xml = replaceXmlValue(xml, "name", getNameForEdgeDeviceSecurityProfile(tenantName));
-    	xml = replaceXmlValue(xml, "espdn", getDnForTenantVDCEdgeSecurityProfile(tenantName));
-    	xml = replaceXmlValue(xml, "egressref", "default-egress");
-    	xml = replaceXmlValue(xml, "ingressref", "default-ingress");
-    	xml = replaceXmlValue(xml, "natpolicysetname", getNameForNatPolicySet(tenantName));
+    public boolean associateNatPolicySet(String tenantName) throws ExecutionException {
+        String xml = VnmcXml.RESOLVE_NAT_POLICY_SET.getXml();
+        String service = VnmcXml.RESOLVE_NAT_POLICY_SET.getService();
+        xml = replaceXmlValue(xml, "cookie", _cookie);
+        xml = replaceXmlValue(xml, "descr", "Edge Security Profile for Tenant VDC" + tenantName);
+        xml = replaceXmlValue(xml, "name", getNameForEdgeDeviceSecurityProfile(tenantName));
+        xml = replaceXmlValue(xml, "espdn", getDnForTenantVDCEdgeSecurityProfile(tenantName));
+        xml = replaceXmlValue(xml, "egressref", "default-egress");
+        xml = replaceXmlValue(xml, "ingressref", "default-ingress");
+        xml = replaceXmlValue(xml, "natpolicysetname", getNameForNatPolicySet(tenantName));
+
+        String response =  sendRequest(service, xml);
 
-    	String response =  sendRequest(service, xml);
+        return verifySuccess(response);
+    }
 
-    	return verifySuccess(response);
+    private String getNameForAclPolicySet(String tenantName, boolean ingress) {
+        return (ingress ? "Ingress-" : "Egress-") + "ACL-Policy-Set-" + tenantName;
     }
-    
+
+    private String getDnForAclPolicySet(String tenantName, boolean ingress) {
+        return getDnForTenantVDC(tenantName) + "/pset-" + getNameForAclPolicySet(tenantName, ingress) ;
+    }
+
+    private String getNameForAclPolicy(String tenantName, boolean ingress) {
+        return (ingress ? "Ingress-" : "Egress-") + "ACL-For-" + tenantName;
+    }
+
+    private String getDnForAclPolicy(String tenantName, boolean ingress) {
+        return getDnForTenantVDC(tenantName) + "/pol-" + getNameForAclPolicy(tenantName, ingress);
+    }
+
+    private String getDnForAclPolicyRef(String tenantName, boolean ingress) {
+        return getDnForAclPolicySet(tenantName, ingress) + "/polref-" + getNameForAclPolicy(tenantName, ingress);
+    }
+
+    private String getNameForAclRule(String tenantName, String identifier, boolean ingress) {
+        return (ingress ? "Ingress-" : "Egress-") + "ACL-Rule-For-" + tenantName + "-" + identifier;
+    }
+
+    private String getDnForAclRule(String tenantName, String identifier, boolean ingress) {
+        return getDnForAclPolicy(tenantName, ingress) + "/rule-" + getNameForAclRule(tenantName, identifier, ingress);
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.resource.CiscoVnmcConnection#createTenantVDCAclPolicy(java.lang.String)
+     */
+    @Override
+    public boolean createTenantVDCAclPolicy(String tenantName, boolean ingress) throws ExecutionException {
+        String xml = VnmcXml.CREATE_ACL_POLICY.getXml();
+        String service = VnmcXml.CREATE_ACL_POLICY.getService();
+        xml = replaceXmlValue(xml, "cookie", _cookie);
+        //xml = replaceXmlValue(xml, "descr", "ACL Policy for Tenant VDC " + tenantName);
+        xml = replaceXmlValue(xml, "aclpolicyname", getNameForAclPolicy(tenantName, ingress));
+        xml = replaceXmlValue(xml, "aclpolicydn", getDnForAclPolicy(tenantName, ingress));
+
+        String response =  sendRequest(service, xml);
+
+        return verifySuccess(response);
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.resource.CiscoVnmcConnection#deleteTenantVDCAclPolicy(java.lang.String)
+     */
+    @Override
+    public boolean deleteTenantVDCAclPolicy(String tenantName, boolean ingress) throws ExecutionException {
+        String xml = VnmcXml.DELETE_ACL_POLICY.getXml();
+        String service = VnmcXml.DELETE_ACL_POLICY.getService();
+        xml = replaceXmlValue(xml, "cookie", _cookie);
+        xml = replaceXmlValue(xml, "aclpolicyname", getNameForAclPolicy(tenantName, ingress));
+        xml = replaceXmlValue(xml, "aclpolicydn", getDnForAclPolicy(tenantName, ingress));
+
+        String response =  sendRequest(service, xml);
+
+        return verifySuccess(response);
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.resource.CiscoVnmcConnection#createTenantVDCAclPolicySet(java.lang.String)
+     */
+    @Override
+    public boolean createTenantVDCAclPolicySet(String tenantName, boolean ingress) throws ExecutionException {
+        String xml = VnmcXml.CREATE_ACL_POLICY_SET.getXml();
+        String service = VnmcXml.CREATE_ACL_POLICY_SET.getService();
+        xml = replaceXmlValue(xml, "cookie", _cookie);
+        //xml = replaceXmlValue(xml, "descr", "ACL Policy Set for Tenant VDC " + tenantName);
+        xml = replaceXmlValue(xml, "aclpolicyname", getNameForAclPolicy(tenantName, ingress));
+        xml = replaceXmlValue(xml, "aclpolicysetname", getNameForAclPolicySet(tenantName, ingress));
+        xml = replaceXmlValue(xml, "aclpolicysetdn", getDnForAclPolicySet(tenantName, ingress));
+        xml = replaceXmlValue(xml, "aclpolicyrefdn", getDnForAclPolicyRef(tenantName, ingress));
+
+        String response =  sendRequest(service, xml);
+
+        return verifySuccess(response);
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.resource.CiscoVnmcConnection#associateAclPolicySet(java.lang.String)
+     */
+    @Override
+    public boolean associateAclPolicySet(String tenantName) throws ExecutionException {
+        String xml = VnmcXml.RESOLVE_ACL_POLICY_SET.getXml();
+        String service = VnmcXml.RESOLVE_ACL_POLICY_SET.getService();
+        xml = replaceXmlValue(xml, "cookie", _cookie);
+        xml = replaceXmlValue(xml, "descr", "Edge Security Profile for Tenant VDC" + tenantName);
+        xml = replaceXmlValue(xml, "name", getNameForEdgeDeviceSecurityProfile(tenantName));
+        xml = replaceXmlValue(xml, "espdn", getDnForTenantVDCEdgeSecurityProfile(tenantName));
+        //xml = replaceXmlValue(xml, "egresspolicysetname", getNameForAclPolicySet(tenantName, false));
+        xml = replaceXmlValue(xml, "egresspolicysetname", "default-egress"); //FIXME
+        xml = replaceXmlValue(xml, "ingresspolicysetname", getNameForAclPolicySet(tenantName, true));
+        xml = replaceXmlValue(xml, "natpolicysetname", getNameForNatPolicySet(tenantName));
+
+        String response =  sendRequest(service, xml);
+
+        return verifySuccess(response);
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.resource.CiscoVnmcConnection#createIngressAclRule(java.lang.String)
+     */
+    @Override
+    public boolean createIngressAclRule(String tenantName, String identifier,
+            String protocol, String sourceStartIp, String sourceEndIp,
+            String destStartPort, String destEndPort, String destIp) throws ExecutionException {
+        String xml = VnmcXml.CREATE_INGRESS_ACL_RULE.getXml();
+        String service = VnmcXml.CREATE_INGRESS_ACL_RULE.getService();
+        xml = replaceXmlValue(xml, "cookie", _cookie);
+        //xml = replaceXmlValue(xml, "descr", "Ingress ACL Policy for Tenant VDC" + tenantName);
+        xml = replaceXmlValue(xml, "aclruledn", getDnForAclRule(tenantName, identifier, true));
+        xml = replaceXmlValue(xml, "aclrulename", getNameForAclRule(tenantName, identifier, true));
+        xml = replaceXmlValue(xml, "actiontype", "permit");
+        xml = replaceXmlValue(xml, "protocolvalue", protocol);
+        xml = replaceXmlValue(xml, "sourcestartip", sourceStartIp);
+        xml = replaceXmlValue(xml, "sourceendip", sourceEndIp);
+        xml = replaceXmlValue(xml, "deststartport", destStartPort);
+        xml = replaceXmlValue(xml, "destendport", destEndPort);
+        xml = replaceXmlValue(xml, "destip", destIp);
+
+        String response =  sendRequest(service, xml);
+
+        return verifySuccess(response);
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.resource.CiscoVnmcConnection#deleteAclRule(java.lang.String)
+     */
+    @Override
+    public boolean deleteAclRule(String tenantName, String identifier) throws ExecutionException {
+        String xml = VnmcXml.DELETE_ACL_RULE.getXml();
+        String service = VnmcXml.DELETE_ACL_RULE.getService();
+        xml = replaceXmlValue(xml, "cookie", _cookie);
+        xml = replaceXmlValue(xml, "aclruledn", getDnForAclRule(tenantName, identifier, true));
+        xml = replaceXmlValue(xml, "aclrulename", getNameForAclRule(tenantName, identifier, true));
+
+        String response =  sendRequest(service, xml);
+
+        return verifySuccess(response);
+    }
+
     private String getNameForEdgeFirewall(String tenantName) {
-    	return "ASA-1000v-" + tenantName;
+        return "ASA-1000v-" + tenantName;
     }
-    
+
     private String getDnForEdgeFirewall(String tenantName) {
-    	return getDnForTenantVDC(tenantName) + "/efw-" + getNameForEdgeFirewall(tenantName);
+        return getDnForTenantVDC(tenantName) + "/efw-" + getNameForEdgeFirewall(tenantName);
     }
-    
+
     private String getNameForEdgeInsideIntf(String tenantName) {
-    	return "Edge_Inside"; //TODO: make this configurable
+        return "Edge_Inside"; //TODO: make this configurable
     }
-    
+
     private String getNameForEdgeOutsideIntf(String tenantName) {
-    	return "Edge_Outside"; //TODO: make this configurable
+        return "Edge_Outside"; //TODO: make this configurable
     }
-    
+
     private String getDnForOutsideIntf(String tenantName) {
-    	return getDnForEdgeFirewall(tenantName) + "/interface-" + getNameForEdgeOutsideIntf(tenantName);
+        return getDnForEdgeFirewall(tenantName) + "/interface-" + getNameForEdgeOutsideIntf(tenantName);
     }
-    
+
     private String getDnForInsideIntf(String tenantName) {
-    	return getDnForEdgeFirewall(tenantName) + "/interface-" + getNameForEdgeInsideIntf(tenantName);
+        return getDnForEdgeFirewall(tenantName) + "/interface-" + getNameForEdgeInsideIntf(tenantName);
     }
-    
+
     /* (non-Javadoc)
-	 * @see com.cloud.network.resource.CiscoVnmcConnection#createEdgeFirewall(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
-	 */
+     * @see com.cloud.network.resource.CiscoVnmcConnection#createEdgeFirewall(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
+     */
     @Override
-	public boolean createEdgeFirewall(String tenantName, String publicIp, String insideIp, 
-    		String insideSubnet, String outsideSubnet) throws ExecutionException {
-    	
-    	String xml = VnmcXml.CREATE_EDGE_FIREWALL.getXml();
-    	String service = VnmcXml.CREATE_EDGE_FIREWALL.getService();
-    	xml = replaceXmlValue(xml, "cookie", _cookie);
-    	xml = replaceXmlValue(xml, "edgefwdescr", "Edge Firewall for Tenant VDC " + tenantName);
-    	xml = replaceXmlValue(xml, "edgefwname", getNameForEdgeFirewall(tenantName));
-    	xml = replaceXmlValue(xml, "edgefwdn", getDnForEdgeFirewall(tenantName));
-    	xml = replaceXmlValue(xml, "insideintfname", getNameForEdgeInsideIntf(tenantName));
-    	xml = replaceXmlValue(xml, "outsideintfname", getNameForEdgeOutsideIntf(tenantName));
+    public boolean createEdgeFirewall(String tenantName, String publicIp, String insideIp, 
+            String insideSubnet, String outsideSubnet) throws ExecutionException {
+
+        String xml = VnmcXml.CREATE_EDGE_FIREWALL.getXml();
+        String service = VnmcXml.CREATE_EDGE_FIREWALL.getService();
+        xml = replaceXmlValue(xml, "cookie", _cookie);
+        xml = replaceXmlValue(xml, "edgefwdescr", "Edge Firewall for Tenant VDC " + tenantName);
+        xml = replaceXmlValue(xml, "edgefwname", getNameForEdgeFirewall(tenantName));
+        xml = replaceXmlValue(xml, "edgefwdn", getDnForEdgeFirewall(tenantName));
+        xml = replaceXmlValue(xml, "insideintfname", getNameForEdgeInsideIntf(tenantName));
+        xml = replaceXmlValue(xml, "outsideintfname", getNameForEdgeOutsideIntf(tenantName));
 
-    	xml = replaceXmlValue(xml, "insideintfdn", getDnForInsideIntf(tenantName));
-    	xml = replaceXmlValue(xml, "outsideintfdn", getDnForOutsideIntf(tenantName));
+        xml = replaceXmlValue(xml, "insideintfdn", getDnForInsideIntf(tenantName));
+        xml = replaceXmlValue(xml, "outsideintfdn", getDnForOutsideIntf(tenantName));
 
-    	xml = replaceXmlValue(xml, "deviceserviceprofiledn", getDnForEdgeFirewall(tenantName) + "/device-service-profile");
-    	xml = replaceXmlValue(xml, "outsideintfsp", getDnForOutsideIntf(tenantName)  + "/interface-service-profile");
+        xml = replaceXmlValue(xml, "deviceserviceprofiledn", getDnForEdgeFirewall(tenantName) + "/device-service-profile");
+        xml = replaceXmlValue(xml, "outsideintfsp", getDnForOutsideIntf(tenantName)  + "/interface-service-profile");
 
-    	xml = replaceXmlValue(xml, "secprofileref", getNameForEdgeDeviceSecurityProfile(tenantName));
-    	xml = replaceXmlValue(xml, "deviceserviceprofile", getNameForEdgeDeviceServiceProfile(tenantName));
+        xml = replaceXmlValue(xml, "secprofileref", getNameForEdgeDeviceSecurityProfile(tenantName));
+        xml = replaceXmlValue(xml, "deviceserviceprofile", getNameForEdgeDeviceServiceProfile(tenantName));
 
+        xml = replaceXmlValue(xml, "insideip", insideIp);
+        xml = replaceXmlValue(xml, "publicip", publicIp);
+        xml = replaceXmlValue(xml, "insidesubnet", insideSubnet);
+        xml = replaceXmlValue(xml, "outsidesubnet", outsideSubnet);
 
-    	xml = replaceXmlValue(xml, "insideip", insideIp);
-    	xml = replaceXmlValue(xml, "publicip", publicIp);
-    	xml = replaceXmlValue(xml, "insidesubnet", insideSubnet);
-    	xml = replaceXmlValue(xml, "outsidesubnet", outsideSubnet);
-    	
-    	String response =  sendRequest(service, xml);
+        String response =  sendRequest(service, xml);
 
-    	return verifySuccess(response);
+        return verifySuccess(response);
 
     }
-    
-    
+
     /* (non-Javadoc)
-	 * @see com.cloud.network.resource.CiscoVnmcConnection#listUnAssocAsa1000v()
-	 */
+     * @see com.cloud.network.resource.CiscoVnmcConnection#listUnAssocAsa1000v()
+     */
     @Override
-	public Map<String, String> listUnAssocAsa1000v() throws ExecutionException {
+    public Map<String, String> listUnAssocAsa1000v() throws ExecutionException {
 
         String xml = VnmcXml.LIST_UNASSOC_ASA1000V.getXml();
         String service = VnmcXml.LIST_UNASSOC_ASA1000V.getService();
@@ -645,12 +786,12 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection {
         return result;
 
     }
-    
+
     /* (non-Javadoc)
-	 * @see com.cloud.network.resource.CiscoVnmcConnection#assocAsa1000v(java.lang.String, java.lang.String)
-	 */
+     * @see com.cloud.network.resource.CiscoVnmcConnection#assocAsa1000v(java.lang.String, java.lang.String)
+     */
     @Override
-	public boolean assocAsa1000v(String tenantName, String firewallDn) throws ExecutionException {
+    public boolean assocAsa1000v(String tenantName, String firewallDn) throws ExecutionException {
 
         String xml = VnmcXml.ASSIGN_ASA1000V.getXml();
         String service = VnmcXml.ASSIGN_ASA1000V.getService();
@@ -663,59 +804,58 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection {
         return verifySuccess(response);
 
     }
-    
 
     private String sendRequest(String service, String xmlRequest) throws ExecutionException {
-    	org.apache.commons.httpclient.protocol.Protocol myhttps = 
-    			new org.apache.commons.httpclient.protocol.Protocol("https", new EasySSLProtocolSocketFactory(), 443);
-    	HttpClient client = new HttpClient();
-    	client.getHostConfiguration().setHost(_ip, 443, myhttps);
-    	byte[] response = null;
-    	PostMethod method = new PostMethod("/xmlIM/" + service);
-    	
-    	method.setRequestBody(xmlRequest);
-    	
-    	try{
-    	    int statusCode = client.executeMethod(method);
-    	             
-    	    if (statusCode != HttpStatus.SC_OK) {
-    	        throw new Exception("Error code : " + statusCode);
-    	    }
-    	    response = method.getResponseBody();
-    	}catch(Exception e){
-    	    System.out.println(e.getMessage());
-    	    throw new ExecutionException(e.getMessage());
-    	}
-    	System.out.println(new String(response));
-    	return new String(response);
+        org.apache.commons.httpclient.protocol.Protocol myhttps = 
+                new org.apache.commons.httpclient.protocol.Protocol("https", new EasySSLProtocolSocketFactory(), 443);
+        HttpClient client = new HttpClient();
+        client.getHostConfiguration().setHost(_ip, 443, myhttps);
+        byte[] response = null;
+        PostMethod method = new PostMethod("/xmlIM/" + service);
+        
+        method.setRequestBody(xmlRequest);
+        
+        try{
+            int statusCode = client.executeMethod(method);
+                     
+            if (statusCode != HttpStatus.SC_OK) {
+                throw new Exception("Error code : " + statusCode);
+            }
+            response = method.getResponseBody();
+        }catch(Exception e){
+            System.out.println(e.getMessage());
+            throw new ExecutionException(e.getMessage());
+        }
+        System.out.println(new String(response));
+        return new String(response);
     }
-    
+
     private Map<String, String> checkResponse(String xmlResponse, String... keys) throws ExecutionException {
         Document xmlDoc = getDocument(xmlResponse);
         Map<String, String> result = new HashMap<String, String>();
         Node topElement = xmlDoc.getChildNodes().item(0);
         if (topElement != null) {
-        	for (String key: keys){
-        		Node valueNode = topElement.getAttributes().getNamedItem(key);
-        		result.put(key, valueNode==null?null:valueNode.getNodeValue());
-        	}
+            for (String key: keys){
+                Node valueNode = topElement.getAttributes().getNamedItem(key);
+                result.put(key, valueNode==null?null:valueNode.getNodeValue());
+            }
         }
         return result;
     }
 
-    private boolean verifySuccess(String xmlResponse) throws ExecutionException {                                                                                                                                                                                                   
-    	Map<String, String> checked = checkResponse(xmlResponse, "errorCode", "errorDescr");
+    private boolean verifySuccess(String xmlResponse) throws ExecutionException {
+        Map<String, String> checked = checkResponse(xmlResponse, "errorCode", "errorDescr");
 
-    	if (checked.get("errorCode") != null) {
-    		String errorCode = checked.get("errorCode");
-    		if (errorCode.equals("103")) {
-    			//tenant already exists
-    			return true;
-    		}
-    		String errorDescr = checked.get("errorDescr");
-    		throw new ExecutionException(errorDescr);
-    	}
-    	return true;
+        if (checked.get("errorCode") != null) {
+            String errorCode = checked.get("errorCode");
+            if (errorCode.equals("103")) {
+                //tenant already exists
+                return true;
+            }
+            String errorDescr = checked.get("errorDescr");
+            throw new ExecutionException(errorDescr);
+        }
+        return true;
     }
 
     /*
@@ -767,5 +907,4 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection {
 
     }
 
-
 }


Mime
View raw message