You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bf...@apache.org on 2014/02/20 20:17:50 UTC

[44/50] [abbrv] git commit: updated refs/heads/ui-restyle to c64bfa5

CLOUDSTACK-6047: Introduce QueryCommand

QueryCommand is a kind of command which request the state rather than configure.
QueryCommands need to be executed immediately and cannot be aggregated.


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

Branch: refs/heads/ui-restyle
Commit: 711b3083701e8b9852714e1817a022f039bf3235
Parents: 8b341b0
Author: Sheng Yang <sh...@citrix.com>
Authored: Wed Feb 19 19:12:07 2014 -0800
Committer: Sheng Yang <sh...@citrix.com>
Committed: Wed Feb 19 19:47:14 2014 -0800

----------------------------------------------------------------------
 .../com/cloud/agent/api/CheckRouterCommand.java |   5 +
 .../api/CheckS2SVpnConnectionsCommand.java      |   9 +-
 .../com/cloud/agent/api/GetDomRVersionCmd.java  |   5 +
 .../api/routing/NetworkElementCommand.java      |   4 +
 .../virtualnetwork/VirtualRoutingResource.java  | 281 ++++++++-----------
 5 files changed, 132 insertions(+), 172 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/711b3083/core/src/com/cloud/agent/api/CheckRouterCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CheckRouterCommand.java b/core/src/com/cloud/agent/api/CheckRouterCommand.java
index 6215fc3..c89cdf7 100644
--- a/core/src/com/cloud/agent/api/CheckRouterCommand.java
+++ b/core/src/com/cloud/agent/api/CheckRouterCommand.java
@@ -27,4 +27,9 @@ public class CheckRouterCommand extends NetworkElementCommand {
     public CheckRouterCommand() {
         super();
     }
+
+    @Override
+    public boolean isQuery() {
+        return true;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/711b3083/core/src/com/cloud/agent/api/CheckS2SVpnConnectionsCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CheckS2SVpnConnectionsCommand.java b/core/src/com/cloud/agent/api/CheckS2SVpnConnectionsCommand.java
index 9cfb53b..bbd7c5f 100644
--- a/core/src/com/cloud/agent/api/CheckS2SVpnConnectionsCommand.java
+++ b/core/src/com/cloud/agent/api/CheckS2SVpnConnectionsCommand.java
@@ -16,10 +16,10 @@
 // under the License.
 package com.cloud.agent.api;
 
-import java.util.List;
-
 import com.cloud.agent.api.routing.NetworkElementCommand;
 
+import java.util.List;
+
 public class CheckS2SVpnConnectionsCommand extends NetworkElementCommand {
     List<String> vpnIps;
 
@@ -36,4 +36,9 @@ public class CheckS2SVpnConnectionsCommand extends NetworkElementCommand {
     public List<String> getVpnIps() {
         return vpnIps;
     }
+
+    @Override
+    public boolean isQuery() {
+        return true;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/711b3083/core/src/com/cloud/agent/api/GetDomRVersionCmd.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/GetDomRVersionCmd.java b/core/src/com/cloud/agent/api/GetDomRVersionCmd.java
index 577c386..7a73fac 100644
--- a/core/src/com/cloud/agent/api/GetDomRVersionCmd.java
+++ b/core/src/com/cloud/agent/api/GetDomRVersionCmd.java
@@ -27,4 +27,9 @@ public class GetDomRVersionCmd extends NetworkElementCommand {
     public GetDomRVersionCmd() {
         super();
     }
+
+    @Override
+    public boolean isQuery() {
+        return true;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/711b3083/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
index f13037c..120c717 100644
--- a/core/src/com/cloud/agent/api/routing/NetworkElementCommand.java
+++ b/core/src/com/cloud/agent/api/routing/NetworkElementCommand.java
@@ -66,4 +66,8 @@ public abstract class NetworkElementCommand extends Command {
     public int getAnswersCount() {
         return 1;
     }
+
+    public boolean isQuery() {
+        return false;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/711b3083/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java b/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
index 49a5c0a..7845da0 100755
--- a/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
+++ b/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
@@ -133,59 +133,58 @@ public class VirtualRoutingResource {
                 return new Answer(cmd, false, rc.getDetails());
             }
 
+            if (cmd.isQuery()) {
+                return executeQueryCommand(cmd);
+            }
+
+            List<ConfigItem> cfg;
             if (cmd instanceof SetPortForwardingRulesVpcCommand) {
-                return execute((SetPortForwardingRulesVpcCommand)cmd);
+                cfg = generateConfig((SetPortForwardingRulesVpcCommand)cmd);
             } else if (cmd instanceof SetPortForwardingRulesCommand) {
-                return execute((SetPortForwardingRulesCommand)cmd);
+                cfg = generateConfig((SetPortForwardingRulesCommand)cmd);
             } else if (cmd instanceof SetStaticRouteCommand) {
-                return execute((SetStaticRouteCommand)cmd);
+                cfg = generateConfig((SetStaticRouteCommand)cmd);
             } else if (cmd instanceof SetStaticNatRulesCommand) {
-                return execute((SetStaticNatRulesCommand)cmd);
+                cfg = generateConfig((SetStaticNatRulesCommand)cmd);
             } else if (cmd instanceof LoadBalancerConfigCommand) {
-                return execute((LoadBalancerConfigCommand)cmd);
+                cfg = generateConfig((LoadBalancerConfigCommand)cmd);
             } else if (cmd instanceof SavePasswordCommand) {
-                return execute((SavePasswordCommand)cmd);
+                cfg = generateConfig((SavePasswordCommand)cmd);
             } else if (cmd instanceof DhcpEntryCommand) {
-                return execute((DhcpEntryCommand)cmd);
+                cfg = generateConfig((DhcpEntryCommand)cmd);
             } else if (cmd instanceof CreateIpAliasCommand) {
-                return execute((CreateIpAliasCommand)cmd);
+                cfg = generateConfig((CreateIpAliasCommand)cmd);
             } else if (cmd instanceof DnsMasqConfigCommand) {
-                return execute((DnsMasqConfigCommand)cmd);
+                cfg = generateConfig((DnsMasqConfigCommand)cmd);
             } else if (cmd instanceof DeleteIpAliasCommand) {
-                return execute((DeleteIpAliasCommand)cmd);
+                cfg = generateConfig((DeleteIpAliasCommand)cmd);
             } else if (cmd instanceof VmDataCommand) {
-                return execute((VmDataCommand)cmd);
-            } else if (cmd instanceof CheckRouterCommand) {
-                return execute((CheckRouterCommand)cmd);
+                cfg = generateConfig((VmDataCommand)cmd);
             } else if (cmd instanceof SetFirewallRulesCommand) {
-                return execute((SetFirewallRulesCommand)cmd);
+                cfg = generateConfig((SetFirewallRulesCommand)cmd);
             } else if (cmd instanceof BumpUpPriorityCommand) {
-                return execute((BumpUpPriorityCommand)cmd);
+                cfg = generateConfig((BumpUpPriorityCommand)cmd);
             } else if (cmd instanceof RemoteAccessVpnCfgCommand) {
-                return execute((RemoteAccessVpnCfgCommand)cmd);
+                cfg = generateConfig((RemoteAccessVpnCfgCommand)cmd);
             } else if (cmd instanceof VpnUsersCfgCommand) {
-                return execute((VpnUsersCfgCommand)cmd);
-            } else if (cmd instanceof GetDomRVersionCmd) {
-                return execute((GetDomRVersionCmd)cmd);
+                cfg = generateConfig((VpnUsersCfgCommand)cmd);
             } else if (cmd instanceof Site2SiteVpnCfgCommand) {
-                return execute((Site2SiteVpnCfgCommand)cmd);
-            } else if (cmd instanceof CheckS2SVpnConnectionsCommand) {
-                return execute((CheckS2SVpnConnectionsCommand)cmd);
+                cfg = generateConfig((Site2SiteVpnCfgCommand)cmd);
             } else if (cmd instanceof SetMonitorServiceCommand) {
-                return execute((SetMonitorServiceCommand)cmd);
+                cfg = generateConfig((SetMonitorServiceCommand)cmd);
             } else if (cmd instanceof SetupGuestNetworkCommand) {
-                return execute((SetupGuestNetworkCommand)cmd);
+                cfg = generateConfig((SetupGuestNetworkCommand)cmd);
             } else if (cmd instanceof SetNetworkACLCommand) {
-                return execute((SetNetworkACLCommand)cmd);
+                cfg = generateConfig((SetNetworkACLCommand)cmd);
             } else if (cmd instanceof SetSourceNatCommand) {
-                return execute((SetSourceNatCommand)cmd);
-            } else if (cmd instanceof IpAssocVpcCommand) {
-                return execute((IpAssocVpcCommand)cmd);
+                cfg = generateConfig((SetSourceNatCommand)cmd);
             } else if (cmd instanceof IpAssocCommand) {
-                return execute((IpAssocCommand)cmd);
+                cfg = generateConfig((IpAssocCommand)cmd);
             } else {
                 return Answer.createUnsupportedCommandAnswer(cmd);
             }
+
+            return applyConfig(cmd, cfg);
         } catch (final IllegalArgumentException e) {
             return new Answer(cmd, false, e.getMessage());
         } finally {
@@ -200,10 +199,22 @@ public class VirtualRoutingResource {
         private String script;
         private String args;
         private String info;
+        private String filePath;
+        private String fileName;
+        private String fileContents;
+        private boolean isFile;
 
         public ConfigItem(String script, String args) {
             this.script = script;
             this.args = args;
+            this.isFile = false;
+        }
+
+        public ConfigItem(String filePath, String fileName, String fileContents) {
+            this.filePath = filePath;
+            this.fileName = fileName;
+            this.fileContents = fileContents;
+            this.isFile = true;
         }
 
         public String getScript() {
@@ -229,15 +240,69 @@ public class VirtualRoutingResource {
         public void setInfo(String info) {
             this.info = info;
         }
+
+        public String getFilePath() {
+            return filePath;
+        }
+
+        public void setFilePath(String filePath) {
+            this.filePath = filePath;
+        }
+
+        public String getFileName() {
+            return fileName;
+        }
+
+        public void setFileName(String fileName) {
+            this.fileName = fileName;
+        }
+
+        public String getFileContents() {
+            return fileContents;
+        }
+
+        public void setFileContents(String fileContents) {
+            this.fileContents = fileContents;
+        }
+
+        public boolean isFile() {
+            return isFile;
+        }
+    }
+
+    private Answer executeQueryCommand(NetworkElementCommand cmd) {
+        if (cmd instanceof CheckRouterCommand) {
+            return execute((CheckRouterCommand)cmd);
+        } else if (cmd instanceof GetDomRVersionCmd) {
+            return execute((GetDomRVersionCmd)cmd);
+        } else if (cmd instanceof CheckS2SVpnConnectionsCommand) {
+            return execute((CheckS2SVpnConnectionsCommand)cmd);
+        } else {
+            s_logger.error("Unknown query command in VirtualRoutingResource!");
+            return Answer.createUnsupportedCommandAnswer(cmd);
+        }
+    }
+
+    private ExecutionResult applyConfigToVR(NetworkElementCommand cmd, ConfigItem c) {
+        if (c.isFile()) {
+            return _vrDeployer.createFileInVR(cmd.getRouterAccessIp(), c.getFilePath(), c.getFileName(), c.getFileContents());
+        } else {
+            return _vrDeployer.executeInVR(cmd.getRouterAccessIp(), c.getScript(), c.getArgs());
+        }
     }
 
     private Answer applyConfig(NetworkElementCommand cmd, List<ConfigItem> cfg) {
         int answersCount = cmd.getAnswersCount();
-        assert (cfg.size() <= answersCount) : "Why there are more commands than answers?";
 
-        if (cfg.size() == 1 && answersCount == 1) {
-            ConfigItem c = cfg.get(0);
-            ExecutionResult result = _vrDeployer.executeInVR(cmd.getRouterAccessIp(), c.getScript(), c.getArgs());
+        // Use the last answer as final answer
+        if (answersCount == 1) {
+            ExecutionResult result = new ExecutionResult(false, "Not executed");
+            for (ConfigItem c : cfg) {
+                result = applyConfigToVR(cmd, c);
+                if (!result.isSuccess()) {
+                    break;
+                }
+            }
             return new Answer(cmd, result.isSuccess(), result.getDetails());
         }
 
@@ -246,7 +311,7 @@ public class VirtualRoutingResource {
         boolean finalResult = true;
         int i = 0, j;
         for (ConfigItem c : cfg) {
-            results[i] = _vrDeployer.executeInVR(cmd.getRouterAccessIp(), c.getScript(), c.getArgs());
+            results[i] = applyConfigToVR(cmd, c);
             if (c.getInfo() != null) {
                 if (results[i].isSuccess()) {
                     results[i].setDetails(c.getInfo() + " - success: " + results[i].getDetails());
@@ -287,11 +352,6 @@ public class VirtualRoutingResource {
         return cfg;
     }
 
-    private Answer execute(VpnUsersCfgCommand cmd) {
-        List<ConfigItem> cfg = generateConfig(cmd);
-        return applyConfig(cmd, cfg);
-    }
-
     private List<ConfigItem> generateConfig(RemoteAccessVpnCfgCommand cmd) {
         LinkedList<ConfigItem> cfg = new LinkedList<>();
         String args = "";
@@ -316,11 +376,6 @@ public class VirtualRoutingResource {
         return cfg;
     }
 
-    private Answer execute(RemoteAccessVpnCfgCommand cmd) {
-        List<ConfigItem> cfg = generateConfig(cmd);
-        return applyConfig(cmd, cfg);
-    }
-
     private List<ConfigItem> generateConfig(SetFirewallRulesCommand cmd) {
         LinkedList<ConfigItem> cfg = new LinkedList<>();
 
@@ -361,11 +416,6 @@ public class VirtualRoutingResource {
         return cfg;
     }
 
-    private Answer execute(SetFirewallRulesCommand cmd) {
-        List<ConfigItem> cfg = generateConfig(cmd);
-        return applyConfig(cmd, cfg);
-    }
-
     private List<ConfigItem> generateConfig(SetPortForwardingRulesCommand cmd) {
         LinkedList<ConfigItem> cfg = new LinkedList<>();
 
@@ -383,11 +433,6 @@ public class VirtualRoutingResource {
         return cfg;
     }
 
-    private Answer execute(SetPortForwardingRulesCommand cmd) {
-        List<ConfigItem> cfg = generateConfig(cmd);
-        return applyConfig(cmd, cfg);
-    }
-
     private List<ConfigItem> generateConfig(SetStaticNatRulesCommand cmd) {
         LinkedList<ConfigItem> cfg = new LinkedList<>();
         if (cmd.getVpcId() != null) {
@@ -419,16 +464,23 @@ public class VirtualRoutingResource {
         return cfg;
     }
 
-    private Answer execute(SetStaticNatRulesCommand cmd) {
-        List<ConfigItem> cfg = generateConfig(cmd);
-        return applyConfig(cmd, cfg);
-    }
-
     private List<ConfigItem> generateConfig(LoadBalancerConfigCommand cmd) {
         LinkedList<ConfigItem> cfg = new LinkedList<>();
 
         String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
         LoadBalancerConfigurator cfgtr = new HAProxyConfigurator();
+
+        String[] config = cfgtr.generateConfiguration(cmd);
+        String tmpCfgFileContents = "";
+        for (int i = 0; i < config.length; i++) {
+            tmpCfgFileContents += config[i];
+            tmpCfgFileContents += "\n";
+        }
+
+        String tmpCfgFilePath = "/etc/haproxy/";
+        String tmpCfgFileName = "haproxy.cfg.new";
+        cfg.add(new ConfigItem(tmpCfgFilePath, tmpCfgFileName, tmpCfgFileContents));
+
         String[][] rules = cfgtr.generateFwRules(cmd);
 
         String[] addRules = rules[LoadBalancerConfigurator.ADD];
@@ -473,37 +525,6 @@ public class VirtualRoutingResource {
         return cfg;
     }
 
-    private Answer execute(LoadBalancerConfigCommand cmd) {
-        String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
-
-        if (routerIp == null) {
-            return new Answer(cmd);
-        }
-
-        LoadBalancerConfigurator cfgtr = new HAProxyConfigurator();
-        String[] config = cfgtr.generateConfiguration(cmd);
-        String tmpCfgFileContents = "";
-        for (int i = 0; i < config.length; i++) {
-            tmpCfgFileContents += config[i];
-            tmpCfgFileContents += "\n";
-        }
-
-        String tmpCfgFilePath = "/etc/haproxy/";
-        String tmpCfgFileName = "haproxy.cfg.new";
-        ExecutionResult result = _vrDeployer.createFileInVR(cmd.getRouterAccessIp(), tmpCfgFilePath, tmpCfgFileName, tmpCfgFileContents);
-
-        if (!result.isSuccess()) {
-            return new Answer(cmd, false, "Fail to copy LB config file to VR");
-        }
-
-        List<ConfigItem> cfg = generateConfig(cmd);
-        ConfigItem c = cfg.get(0);
-        result = _vrDeployer.executeInVR(cmd.getRouterAccessIp(), c.getScript(), c.getArgs());
-
-        return new Answer(cmd, result.isSuccess(), result.getDetails());
-    }
-
-
     private List<ConfigItem> generateConfig(VmDataCommand cmd) {
         LinkedList<ConfigItem> cfg = new LinkedList<>();
         Map<String, List<String[]>> data = new HashMap<String, List<String[]>>();
@@ -520,11 +541,6 @@ public class VirtualRoutingResource {
         return cfg;
     }
 
-    protected Answer execute(VmDataCommand cmd) {
-        List<ConfigItem> cfg = generateConfig(cmd);
-        return applyConfig(cmd, cfg);
-    }
-
     private List<ConfigItem> generateConfig(SavePasswordCommand cmd) {
         LinkedList<ConfigItem> cfg = new LinkedList<>();
 
@@ -538,11 +554,6 @@ public class VirtualRoutingResource {
         return cfg;
     }
 
-    protected Answer execute(final SavePasswordCommand cmd) {
-        List<ConfigItem> cfg = generateConfig(cmd);
-        return applyConfig(cmd, cfg);
-    }
-
     private List<ConfigItem> generateConfig(DhcpEntryCommand cmd) {
         LinkedList<ConfigItem> cfg = new LinkedList<>();
 
@@ -577,11 +588,6 @@ public class VirtualRoutingResource {
         return cfg;
     }
 
-    protected Answer execute(final DhcpEntryCommand cmd) {
-        List<ConfigItem> cfg = generateConfig(cmd);
-        return applyConfig(cmd, cfg);
-    }
-
     private List<ConfigItem> generateConfig(CreateIpAliasCommand cmd) {
         LinkedList<ConfigItem> cfg = new LinkedList<>();
 
@@ -595,11 +601,6 @@ public class VirtualRoutingResource {
         return cfg;
     }
 
-    protected Answer execute(final CreateIpAliasCommand cmd) {
-        List<ConfigItem> cfg = generateConfig(cmd);
-        return applyConfig(cmd, cfg);
-    }
-
     private List<ConfigItem> generateConfig(DeleteIpAliasCommand cmd) {
         LinkedList<ConfigItem> cfg = new LinkedList<>();
 
@@ -619,11 +620,6 @@ public class VirtualRoutingResource {
         return cfg;
     }
 
-    protected Answer execute(final DeleteIpAliasCommand cmd) {
-        List<ConfigItem> cfg = generateConfig(cmd);
-        return applyConfig(cmd, cfg);
-    }
-
     private List<ConfigItem> generateConfig(DnsMasqConfigCommand cmd) {
         LinkedList<ConfigItem> cfg = new LinkedList<>();
 
@@ -637,11 +633,6 @@ public class VirtualRoutingResource {
         return cfg;
     }
 
-    protected Answer execute(final DnsMasqConfigCommand cmd) {
-        List<ConfigItem> cfg = generateConfig(cmd);
-        return applyConfig(cmd, cfg);
-    }
-
     private CheckS2SVpnConnectionsAnswer execute(CheckS2SVpnConnectionsCommand cmd) {
         String args = "";
         for (String ip : cmd.getVpnIps()) {
@@ -666,11 +657,6 @@ public class VirtualRoutingResource {
         return cfg;
     }
 
-    protected Answer execute(BumpUpPriorityCommand cmd) {
-        List<ConfigItem> cfg = generateConfig(cmd);
-        return applyConfig(cmd, cfg);
-    }
-
     protected Answer execute(GetDomRVersionCmd cmd) {
         final ExecutionResult result = _vrDeployer.executeInVR(cmd.getRouterAccessIp(), VRScripts.VERSION, null);
         if (!result.isSuccess()) {
@@ -732,11 +718,6 @@ public class VirtualRoutingResource {
         return cfg;
     }
 
-    protected Answer execute(Site2SiteVpnCfgCommand cmd) {
-        List<ConfigItem> cfg = generateConfig(cmd);
-        return applyConfig(cmd, cfg);
-    }
-
     protected List<ConfigItem> generateConfig(SetMonitorServiceCommand cmd) {
         LinkedList<ConfigItem> cfg = new LinkedList<>();
 
@@ -752,11 +733,6 @@ public class VirtualRoutingResource {
         return cfg;
     }
 
-    protected Answer execute(SetMonitorServiceCommand cmd) {
-        List<ConfigItem> cfg = generateConfig(cmd);
-        return applyConfig(cmd, cfg);
-    }
-
     protected List<ConfigItem> generateConfig(SetupGuestNetworkCommand cmd) {
         LinkedList<ConfigItem> cfg = new LinkedList<>();
 
@@ -797,11 +773,6 @@ public class VirtualRoutingResource {
         return cfg;
     }
 
-    protected Answer execute(SetupGuestNetworkCommand cmd) {
-        List<ConfigItem> cfg = generateConfig(cmd);
-        return applyConfig(cmd, cfg);
-    }
-
     protected List<ConfigItem> generateConfig(SetNetworkACLCommand cmd) {
         LinkedList<ConfigItem> cfg = new LinkedList<>();
 
@@ -836,11 +807,6 @@ public class VirtualRoutingResource {
         return cfg;
     }
 
-    private Answer execute(SetNetworkACLCommand cmd) {
-        List<ConfigItem> cfg = generateConfig(cmd);
-        return applyConfig(cmd, cfg);
-    }
-
     protected List<ConfigItem> generateConfig(SetSourceNatCommand cmd) {
         LinkedList<ConfigItem> cfg = new LinkedList<>();
 
@@ -856,11 +822,6 @@ public class VirtualRoutingResource {
         return cfg;
     }
 
-    protected Answer execute(SetSourceNatCommand cmd) {
-        List<ConfigItem> cfg = generateConfig(cmd);
-        return applyConfig(cmd, cfg);
-    }
-
     protected List<ConfigItem> generateConfig(SetPortForwardingRulesVpcCommand cmd) {
         LinkedList<ConfigItem> cfg = new LinkedList<>();
 
@@ -878,16 +839,6 @@ public class VirtualRoutingResource {
         return cfg;
     }
 
-    private Answer execute(SetPortForwardingRulesVpcCommand cmd) {
-        List<ConfigItem> cfg = generateConfig(cmd);
-        return applyConfig(cmd, cfg);
-    }
-
-    public Answer execute(IpAssocVpcCommand cmd) {
-        List<ConfigItem> cfg = generateConfig(cmd);
-        return applyConfig(cmd, cfg);
-    }
-
     protected List<ConfigItem> generateConfig(SetStaticRouteCommand cmd) {
         LinkedList<ConfigItem> cfg = new LinkedList<>();
 
@@ -905,11 +856,6 @@ public class VirtualRoutingResource {
         return cfg;
     }
 
-    private Answer execute(SetStaticRouteCommand cmd) {
-        List<ConfigItem> cfg = generateConfig(cmd);
-        return applyConfig(cmd, cfg);
-    }
-
     protected List<ConfigItem> generateConfig(IpAssocCommand cmd) {
         LinkedList<ConfigItem> cfg = new LinkedList<>();
         ConfigItem c;
@@ -989,11 +935,6 @@ public class VirtualRoutingResource {
         return cfg;
     }
 
-    public Answer execute(IpAssocCommand cmd) {
-        List<ConfigItem> cfg = generateConfig(cmd);
-        return applyConfig(cmd, cfg);
-    }
-
     public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException {
         _name = name;