cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e...@apache.org
Subject [4/4] git commit: updated refs/heads/master to 3d22a16
Date Thu, 02 Apr 2015 21:21:37 GMT
Bump priority stragety is no longer used for redundant virtual routers

   - With the changes added by the rVPC work, the bump priority became deprecated.
     This commit includes a refactor to get it removed from the following resources:
     * Java classes
     * domain_router table - removing the is_priority_bumpup column
     * Fixing unit tests

All changes were tested with:

XenServer 6.2 running under our VMWare zone
CloudStack Management Server running on MacBook Pro
MySql running on MackBook Pro
Storage Type: Local


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

Branch: refs/heads/master
Commit: 3d22a16c4fb41e845edfc4294e7ce8c00f36c89e
Parents: 3e28747
Author: wilderrodrigues <wrodrigues@schubergphilis.com>
Authored: Thu Apr 2 18:20:29 2015 +0200
Committer: wilderrodrigues <wrodrigues@schubergphilis.com>
Committed: Thu Apr 2 21:50:49 2015 +0200

----------------------------------------------------------------------
 .../com/cloud/agent/api/CheckRouterAnswer.java  |  38 +-
 .../agent/api/SetupGuestNetworkCommand.java     |   6 +-
 .../VirtualRoutingResourceTest.java             | 256 +++++++-------
 .../com/cloud/upgrade/dao/Upgrade451to460.java  |  47 +--
 .../schema/src/com/cloud/vm/DomainRouterVO.java |  66 ++--
 .../com/cloud/agent/manager/MockVmManager.java  |   3 -
 .../cloud/agent/manager/MockVmManagerImpl.java  | 200 +++++------
 .../agent/manager/SimulatorManagerImpl.java     |  86 +++--
 .../network/lb/LoadBalanceRuleHandler.java      | 138 ++++----
 .../lb/InternalLoadBalancerVMManagerImpl.java   | 349 +++++++++----------
 .../InternalLBVMManagerTest.java                | 109 +++---
 .../InternalLBVMServiceTest.java                |  81 +++--
 .../network/router/CommandSetupHelper.java      |   3 +-
 .../com/cloud/network/router/NetworkHelper.java |   2 -
 .../cloud/network/router/NetworkHelperImpl.java |  31 +-
 .../VirtualNetworkApplianceManagerImpl.java     |  50 +--
 .../deployment/RouterDeploymentDefinition.java  |  18 +-
 .../element/VirtualRouterElementTest.java       |  20 +-
 .../RouterDeploymentDefinitionTest.java         | 116 ------
 .../debian/config/opt/cloud/bin/checkrouter.sh  |   2 +-
 .../opt/cloud/templates/checkrouter.sh.templ    |  46 +--
 21 files changed, 680 insertions(+), 987 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3d22a16c/core/src/com/cloud/agent/api/CheckRouterAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CheckRouterAnswer.java b/core/src/com/cloud/agent/api/CheckRouterAnswer.java
index b084d4b..6a95ab1 100644
--- a/core/src/com/cloud/agent/api/CheckRouterAnswer.java
+++ b/core/src/com/cloud/agent/api/CheckRouterAnswer.java
@@ -22,63 +22,49 @@ package com.cloud.agent.api;
 import com.cloud.network.router.VirtualRouter.RedundantState;
 
 public class CheckRouterAnswer extends Answer {
+
     public static final String ROUTER_NAME = "router.name";
     public static final String ROUTER_IP = "router.ip";
     RedundantState state;
-    boolean isBumped;
 
     protected CheckRouterAnswer() {
     }
 
-    public CheckRouterAnswer(CheckRouterCommand cmd, String details, boolean parse) {
+    public CheckRouterAnswer(final CheckRouterCommand cmd, final String details, final boolean parse) {
         super(cmd, true, details);
         if (parse) {
             if (!parseDetails(details)) {
-                this.result = false;
+                result = false;
             }
         }
     }
 
-    public CheckRouterAnswer(CheckRouterCommand cmd, String details) {
+    public CheckRouterAnswer(final CheckRouterCommand cmd, final String details) {
         super(cmd, false, details);
     }
 
-    protected boolean parseDetails(String details) {
-        String[] lines = details.split("&");
-        if (lines.length != 2) {
+    protected boolean parseDetails(final String details) {
+        if (details == null || "".equals(details.trim())) {
+            state = RedundantState.UNKNOWN;
             return false;
         }
-        if (lines[0].startsWith("Status: MASTER")) {
+        if (details.startsWith("Status: MASTER")) {
             state = RedundantState.MASTER;
-        } else if (lines[0].startsWith("Status: BACKUP")) {
+        } else if (details.startsWith("Status: BACKUP")) {
             state = RedundantState.BACKUP;
-        } else if (lines[0].startsWith("Status: FAULT")) {
+        } else if (details.startsWith("Status: FAULT")) {
             state = RedundantState.FAULT;
         } else {
             state = RedundantState.UNKNOWN;
         }
-        if (lines[1].startsWith("Bumped: YES")) {
-            isBumped = true;
-        } else {
-            isBumped = false;
-        }
         return true;
     }
 
-    public void setState(RedundantState state) {
+    public void setState(final RedundantState state) {
         this.state = state;
     }
 
     public RedundantState getState() {
         return state;
     }
-
-    public boolean isBumped() {
-        return isBumped;
-    }
-
-    public void setIsBumped(boolean isBumped) {
-        this.isBumped = isBumped;
-    }
-
-}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3d22a16c/core/src/com/cloud/agent/api/SetupGuestNetworkCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/SetupGuestNetworkCommand.java b/core/src/com/cloud/agent/api/SetupGuestNetworkCommand.java
index 26d4781..0f53daa 100644
--- a/core/src/com/cloud/agent/api/SetupGuestNetworkCommand.java
+++ b/core/src/com/cloud/agent/api/SetupGuestNetworkCommand.java
@@ -28,7 +28,6 @@ public class SetupGuestNetworkCommand extends NetworkElementCommand {
     String defaultDns1 = null;
     String defaultDns2 = null;
     boolean isRedundant = false;
-    Integer priority;
     boolean add = true;
     NicTO nic;
 
@@ -60,14 +59,13 @@ public class SetupGuestNetworkCommand extends NetworkElementCommand {
     protected SetupGuestNetworkCommand() {
     }
 
-    public SetupGuestNetworkCommand(String dhcpRange, String networkDomain, boolean isRedundant, Integer priority, String defaultDns1, String defaultDns2, boolean add,
-            NicTO nic) {
+    public SetupGuestNetworkCommand(final String dhcpRange, final String networkDomain, final boolean isRedundant, final String defaultDns1, final String defaultDns2, final boolean add,
+            final NicTO nic) {
         this.dhcpRange = dhcpRange;
         this.networkDomain = networkDomain;
         this.defaultDns1 = defaultDns1;
         this.defaultDns2 = defaultDns2;
         this.isRedundant = isRedundant;
-        this.priority = priority;
         this.add = add;
         this.nic = nic;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3d22a16c/core/test/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResourceTest.java
----------------------------------------------------------------------
diff --git a/core/test/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResourceTest.java b/core/test/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResourceTest.java
index ea72ff1..5942a17 100644
--- a/core/test/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResourceTest.java
+++ b/core/test/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResourceTest.java
@@ -101,26 +101,26 @@ public class VirtualRoutingResourceTest implements VirtualRouterDeployer {
     String ROUTERNAME = "r-4-VM";
 
     @Override
-    public ExecutionResult executeInVR(String routerIp, String script, String args) {
+    public ExecutionResult executeInVR(final String routerIp, final String script, final String args) {
         return executeInVR(routerIp, script, args, 60);
     }
 
     @Override
-    public ExecutionResult executeInVR(String routerIp, String script, String args, int timeout) {
+    public ExecutionResult executeInVR(final String routerIp, final String script, final String args, final int timeout) {
         assertEquals(routerIp, ROUTERIP);
         verifyCommand(_currentCmd, script, args);
         return new ExecutionResult(true, null);
     }
 
     @Override
-    public ExecutionResult createFileInVR(String routerIp, String path, String filename, String content) {
+    public ExecutionResult createFileInVR(final String routerIp, final String path, final String filename, final String content) {
         assertEquals(routerIp, ROUTERIP);
         verifyFile(_currentCmd, path, filename, content);
         return new ExecutionResult(true, null);
     }
 
     @Override
-    public ExecutionResult prepareCommand(NetworkElementCommand cmd) {
+    public ExecutionResult prepareCommand(final NetworkElementCommand cmd) {
         cmd.setRouterAccessIp(ROUTERIP);
         _currentCmd = cmd;
         if (cmd instanceof IpAssocVpcCommand) {
@@ -138,7 +138,7 @@ public class VirtualRoutingResourceTest implements VirtualRouterDeployer {
     }
 
     @Override
-    public ExecutionResult cleanupCommand(NetworkElementCommand cmd) {
+    public ExecutionResult cleanupCommand(final NetworkElementCommand cmd) {
         return new ExecutionResult(true, null);
     }
 
@@ -147,12 +147,12 @@ public class VirtualRoutingResourceTest implements VirtualRouterDeployer {
         _resource = new VirtualRoutingResource(this);
         try {
             _resource.configure("VRResource", new HashMap<String, Object>());
-        } catch (ConfigurationException e) {
+        } catch (final ConfigurationException e) {
             e.printStackTrace();
         }
     }
 
-    private void verifyFile(NetworkElementCommand cmd, String path, String filename, String content) {
+    private void verifyFile(final NetworkElementCommand cmd, final String path, final String filename, final String content) {
         if (cmd instanceof AggregationControlCommand) {
             verifyFile((AggregationControlCommand)cmd, path, filename, content);
         } else if (cmd instanceof LoadBalancerConfigCommand) {
@@ -160,7 +160,7 @@ public class VirtualRoutingResourceTest implements VirtualRouterDeployer {
         }
     }
 
-    protected void verifyCommand(NetworkElementCommand cmd, String script, String args) {
+    protected void verifyCommand(final NetworkElementCommand cmd, final String script, final String args) {
         if (cmd instanceof SetPortForwardingRulesVpcCommand) {
             verifyArgs((SetPortForwardingRulesVpcCommand) cmd, script, args);
         } else if (cmd instanceof SetPortForwardingRulesCommand) {
@@ -210,54 +210,54 @@ public class VirtualRoutingResourceTest implements VirtualRouterDeployer {
         }
     }
 
-    private void verifyArgs(VpnUsersCfgCommand cmd, String script, String args) {
+    private void verifyArgs(final VpnUsersCfgCommand cmd, final String script, final String args) {
         //To change body of created methods use File | Settings | File Templates.
     }
 
-    private void verifyArgs(SetStaticRouteCommand cmd, String script, String args) {
+    private void verifyArgs(final SetStaticRouteCommand cmd, final String script, final String args) {
         //To change body of created methods use File | Settings | File Templates.
     }
 
-    private void verifyArgs(SetStaticNatRulesCommand cmd, String script, String args) {
+    private void verifyArgs(final SetStaticNatRulesCommand cmd, final String script, final String args) {
         //To change body of created methods use File | Settings | File Templates.
     }
 
     @Test
     public void testBumpUpCommand() {
-        BumpUpPriorityCommand cmd = new BumpUpPriorityCommand();
-        Answer answer = _resource.executeRequest(cmd);
+        final BumpUpPriorityCommand cmd = new BumpUpPriorityCommand();
+        final Answer answer = _resource.executeRequest(cmd);
         assertTrue(answer.getResult());
     }
 
-    private void verifyArgs(BumpUpPriorityCommand cmd, String script, String args) {
+    private void verifyArgs(final BumpUpPriorityCommand cmd, final String script, final String args) {
         assertEquals(script, VRScripts.RVR_BUMPUP_PRI);
         assertEquals(args, null);
     }
 
     @Test
     public void testSetPortForwardingRulesVpcCommand() {
-        SetPortForwardingRulesVpcCommand cmd = generateSetPortForwardingRulesVpcCommand();
+        final SetPortForwardingRulesVpcCommand cmd = generateSetPortForwardingRulesVpcCommand();
 
         // Reset rule check count
         _count = 0;
 
-        Answer answer = _resource.executeRequest(cmd);
+        final Answer answer = _resource.executeRequest(cmd);
         assertTrue(answer instanceof GroupAnswer);
         assertEquals(((GroupAnswer) answer).getResults().length, 2);
         assertTrue(answer.getResult());
     }
 
     protected SetPortForwardingRulesVpcCommand generateSetPortForwardingRulesVpcCommand() {
-        List<PortForwardingRuleTO> pfRules = new ArrayList<>();
+        final List<PortForwardingRuleTO> pfRules = new ArrayList<>();
         pfRules.add(new PortForwardingRuleTO(1, "64.1.1.10", 22, 80, "10.10.1.10", 22, 80, "TCP", false, false));
         pfRules.add(new PortForwardingRuleTO(2, "64.1.1.11", 8080, 8080, "10.10.1.11", 8080, 8080, "UDP", true, false));
-        SetPortForwardingRulesVpcCommand cmd = new SetPortForwardingRulesVpcCommand(pfRules);
+        final SetPortForwardingRulesVpcCommand cmd = new SetPortForwardingRulesVpcCommand(pfRules);
         cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, ROUTERNAME);
         assertEquals(cmd.getAnswersCount(), 2);
         return cmd;
     }
 
-    private void verifyArgs(SetPortForwardingRulesVpcCommand cmd, String script, String args) {
+    private void verifyArgs(final SetPortForwardingRulesVpcCommand cmd, final String script, final String args) {
         assertTrue(script.equals(VRScripts.VPC_PORTFORWARDING));
         _count ++;
         switch (_count) {
@@ -274,27 +274,27 @@ public class VirtualRoutingResourceTest implements VirtualRouterDeployer {
 
     @Test
     public void testSetPortForwardingRulesCommand() {
-        SetPortForwardingRulesCommand cmd = generateSetPortForwardingRulesCommand();
+        final SetPortForwardingRulesCommand cmd = generateSetPortForwardingRulesCommand();
         // Reset rule check count
         _count = 0;
 
-        Answer answer = _resource.executeRequest(cmd);
+        final Answer answer = _resource.executeRequest(cmd);
         assertTrue(answer instanceof GroupAnswer);
         assertEquals(((GroupAnswer) answer).getResults().length, 2);
         assertTrue(answer.getResult());
     }
 
     protected SetPortForwardingRulesCommand generateSetPortForwardingRulesCommand() {
-        List<PortForwardingRuleTO> pfRules = new ArrayList<>();
+        final List<PortForwardingRuleTO> pfRules = new ArrayList<>();
         pfRules.add(new PortForwardingRuleTO(1, "64.1.1.10", 22, 80, "10.10.1.10", 22, 80, "TCP", false, false));
         pfRules.add(new PortForwardingRuleTO(2, "64.1.1.11", 8080, 8080, "10.10.1.11", 8080, 8080, "UDP", true, false));
-        SetPortForwardingRulesCommand cmd = new SetPortForwardingRulesCommand(pfRules);
+        final SetPortForwardingRulesCommand cmd = new SetPortForwardingRulesCommand(pfRules);
         cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, ROUTERNAME);
         assertEquals(cmd.getAnswersCount(), 2);
         return cmd;
     }
 
-    private void verifyArgs(SetPortForwardingRulesCommand cmd, String script, String args) {
+    private void verifyArgs(final SetPortForwardingRulesCommand cmd, final String script, final String args) {
         assertTrue(script.equals(VRScripts.FIREWALL_NAT));
         _count ++;
         switch (_count) {
@@ -311,31 +311,31 @@ public class VirtualRoutingResourceTest implements VirtualRouterDeployer {
 
     @Test
     public void testIpAssocCommand() {
-        IpAssocCommand cmd = generateIpAssocCommand();
+        final IpAssocCommand cmd = generateIpAssocCommand();
         _count = 0;
 
-        Answer answer = _resource.executeRequest(cmd);
+        final Answer answer = _resource.executeRequest(cmd);
         assertTrue(answer instanceof GroupAnswer);
         assertEquals(2, ((GroupAnswer)answer).getResults().length);
         assertTrue(answer.getResult());
 
     }
 
-    private ExecutionResult prepareNetworkElementCommand(IpAssocCommand cmd) {
-        IpAddressTO[] ips = cmd.getIpAddresses();
-        for (IpAddressTO ip : ips) {
+    private ExecutionResult prepareNetworkElementCommand(final IpAssocCommand cmd) {
+        final IpAddressTO[] ips = cmd.getIpAddresses();
+        for (final IpAddressTO ip : ips) {
             ip.setNicDevId(2);
         }
         return new ExecutionResult(true, null);
     }
 
     protected IpAssocCommand generateIpAssocCommand() {
-        List<IpAddressTO> ips = new ArrayList<>();
+        final List<IpAddressTO> ips = new ArrayList<>();
         ips.add(new IpAddressTO(1, "64.1.1.10", true, true, true, "vlan://64", "64.1.1.1", "255.255.255.0", "01:23:45:67:89:AB", 1000, false));
         ips.add(new IpAddressTO(2, "64.1.1.11", false, false, false, "vlan://64", "64.1.1.1", "255.255.255.0", "01:23:45:67:89:AB", 1000, false));
         ips.add(new IpAddressTO(3, "65.1.1.11", true, false, false, "vlan://65", "65.1.1.1", "255.255.255.0", "11:23:45:67:89:AB", 1000, false));
-        IpAddressTO[] ipArray = ips.toArray(new IpAddressTO[ips.size()]);
-        IpAssocCommand cmd = new IpAssocCommand(ipArray);
+        final IpAddressTO[] ipArray = ips.toArray(new IpAddressTO[ips.size()]);
+        final IpAssocCommand cmd = new IpAssocCommand(ipArray);
         cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, ROUTERNAME);
         assertEquals(cmd.getAnswersCount(), 3);
 
@@ -344,38 +344,38 @@ public class VirtualRoutingResourceTest implements VirtualRouterDeployer {
 
     @Test
     public void testIpAssocVpcCommand() {
-        IpAssocVpcCommand cmd = generateIpAssocVpcCommand();
+        final IpAssocVpcCommand cmd = generateIpAssocVpcCommand();
         _count = 0;
 
-        Answer answer = _resource.executeRequest(cmd);
+        final Answer answer = _resource.executeRequest(cmd);
         assertTrue(answer instanceof GroupAnswer);
         assertEquals(2, ((GroupAnswer)answer).getResults().length);
         assertTrue(answer.getResult());
 
     }
 
-    private ExecutionResult prepareNetworkElementCommand(IpAssocVpcCommand cmd) {
-        IpAddressTO[] ips = cmd.getIpAddresses();
-        for (IpAddressTO ip : ips) {
+    private ExecutionResult prepareNetworkElementCommand(final IpAssocVpcCommand cmd) {
+        final IpAddressTO[] ips = cmd.getIpAddresses();
+        for (final IpAddressTO ip : ips) {
             ip.setNicDevId(2);
         }
         return new ExecutionResult(true, null);
     }
 
     protected IpAssocVpcCommand generateIpAssocVpcCommand() {
-        List<IpAddressTO> ips = new ArrayList<IpAddressTO>();
+        final List<IpAddressTO> ips = new ArrayList<IpAddressTO>();
         ips.add(new IpAddressTO(1, "64.1.1.10", true, true, true, "vlan://64", "64.1.1.1", "255.255.255.0", "01:23:45:67:89:AB", 1000, false));
         ips.add(new IpAddressTO(2, "64.1.1.11", false, false, true, "vlan://64", "64.1.1.1", "255.255.255.0", "01:23:45:67:89:AB", 1000, false));
         ips.add(new IpAddressTO(3, "65.1.1.11", true, false, false, "vlan://65", "65.1.1.1", "255.255.255.0", "11:23:45:67:89:AB", 1000, false));
-        IpAddressTO[] ipArray = ips.toArray(new IpAddressTO[ips.size()]);
-        IpAssocVpcCommand cmd = new IpAssocVpcCommand(ipArray);
+        final IpAddressTO[] ipArray = ips.toArray(new IpAddressTO[ips.size()]);
+        final IpAssocVpcCommand cmd = new IpAssocVpcCommand(ipArray);
         cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, ROUTERNAME);
         assertEquals(6, cmd.getAnswersCount()); // AnswersCount is clearly wrong as it doesn't know enough to tell
 
         return cmd;
     }
 
-    private void verifyArgs(IpAssocCommand cmd, String script, String args) {
+    private void verifyArgs(final IpAssocCommand cmd, final String script, final String args) {
         if (cmd instanceof IpAssocVpcCommand) {
             _count ++;
             switch (_count) {
@@ -423,32 +423,32 @@ public class VirtualRoutingResourceTest implements VirtualRouterDeployer {
 
     @Test
     public void testSourceNatCommand() {
-        SetSourceNatCommand cmd = generateSetSourceNatCommand();
-        Answer answer = _resource.executeRequest(cmd);
+        final SetSourceNatCommand cmd = generateSetSourceNatCommand();
+        final Answer answer = _resource.executeRequest(cmd);
         assertTrue(answer.getResult());
     }
 
-    private ExecutionResult prepareNetworkElementCommand(SetSourceNatCommand cmd) {
-        IpAddressTO ip = cmd.getIpAddress();
+    private ExecutionResult prepareNetworkElementCommand(final SetSourceNatCommand cmd) {
+        final IpAddressTO ip = cmd.getIpAddress();
         ip.setNicDevId(1);
         return new ExecutionResult(true, null);
     }
 
     protected SetSourceNatCommand generateSetSourceNatCommand() {
-        IpAddressTO ip = new IpAddressTO(1, "64.1.1.10", true, true, true, "vlan://64", "64.1.1.1", "255.255.255.0", "01:23:45:67:89:AB", 1000, false);
-        SetSourceNatCommand cmd = new SetSourceNatCommand(ip, true);
+        final IpAddressTO ip = new IpAddressTO(1, "64.1.1.10", true, true, true, "vlan://64", "64.1.1.1", "255.255.255.0", "01:23:45:67:89:AB", 1000, false);
+        final SetSourceNatCommand cmd = new SetSourceNatCommand(ip, true);
         cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, ROUTERNAME);
         return cmd;
     }
 
-    private void verifyArgs(SetSourceNatCommand cmd, String script, String args) {
+    private void verifyArgs(final SetSourceNatCommand cmd, final String script, final String args) {
         assertEquals(script, VRScripts.VPC_SOURCE_NAT);
         assertEquals(args, "-A -l 64.1.1.10 -c eth1");
     }
 
     @Test
     public void testNetworkACLCommand() {
-        SetNetworkACLCommand cmd = generateSetNetworkACLCommand();
+        final SetNetworkACLCommand cmd = generateSetNetworkACLCommand();
         _count = 0;
 
         Answer answer = _resource.executeRequest(cmd);
@@ -460,24 +460,24 @@ public class VirtualRoutingResourceTest implements VirtualRouterDeployer {
     }
 
     protected SetNetworkACLCommand generateSetNetworkACLCommand() {
-        List<NetworkACLTO> acls = new ArrayList<>();
-        List<String> cidrs = new ArrayList<>();
+        final List<NetworkACLTO> acls = new ArrayList<>();
+        final List<String> cidrs = new ArrayList<>();
         cidrs.add("192.168.0.1/24");
         cidrs.add("192.168.0.2/24");
         acls.add(new NetworkACLTO(1, "64", "TCP", 20, 80, false, false, cidrs, 0, 0, TrafficType.Ingress, true, 1));
         acls.add(new NetworkACLTO(2, "64", "ICMP", 0, 0, false, false, cidrs, -1, -1, TrafficType.Ingress, false, 2));
         acls.add(new NetworkACLTO(3, "65", "ALL", 0, 0, false, false, cidrs, -1, -1, TrafficType.Egress, true, 3));
-        NicTO nic = new NicTO();
+        final NicTO nic = new NicTO();
         nic.setMac("01:23:45:67:89:AB");
         nic.setIp("192.168.1.1");
         nic.setNetmask("255.255.255.0");
-        SetNetworkACLCommand cmd = new SetNetworkACLCommand(acls, nic);
+        final SetNetworkACLCommand cmd = new SetNetworkACLCommand(acls, nic);
         cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, ROUTERNAME);
 
         return cmd;
     }
 
-    private void verifyArgs(SetNetworkACLCommand cmd, String script, String args) {
+    private void verifyArgs(final SetNetworkACLCommand cmd, final String script, final String args) {
         _count ++;
         switch (_count) {
         case 1:
@@ -496,32 +496,32 @@ public class VirtualRoutingResourceTest implements VirtualRouterDeployer {
         }
     }
 
-    private ExecutionResult prepareNetworkElementCommand(SetNetworkACLCommand cmd) {
-        NicTO nic = cmd.getNic();
+    private ExecutionResult prepareNetworkElementCommand(final SetNetworkACLCommand cmd) {
+        final NicTO nic = cmd.getNic();
         nic.setDeviceId(3);
         return new ExecutionResult(true, null);
     }
 
     @Test
     public void testSetupGuestNetworkCommand() {
-        SetupGuestNetworkCommand cmd = generateSetupGuestNetworkCommand();
-        Answer answer = _resource.executeRequest(cmd);
+        final SetupGuestNetworkCommand cmd = generateSetupGuestNetworkCommand();
+        final Answer answer = _resource.executeRequest(cmd);
         assertTrue(answer.getResult());
     }
 
-    private ExecutionResult prepareNetworkElementCommand(SetupGuestNetworkCommand cmd) {
-        NicTO nic = cmd.getNic();
+    private ExecutionResult prepareNetworkElementCommand(final SetupGuestNetworkCommand cmd) {
+        final NicTO nic = cmd.getNic();
         nic.setDeviceId(4);
         return new ExecutionResult(true, null);
     }
 
     protected SetupGuestNetworkCommand generateSetupGuestNetworkCommand() {
-        NicTO nic = new NicTO();
+        final NicTO nic = new NicTO();
         nic.setMac("01:23:45:67:89:AB");
         nic.setIp("10.1.1.1");
         nic.setNetmask("255.255.255.0");
 
-        SetupGuestNetworkCommand cmd = new SetupGuestNetworkCommand("10.1.1.10-10.1.1.20", "cloud.test", false, 0, "8.8.8.8", "8.8.4.4", true, nic);
+        final SetupGuestNetworkCommand cmd = new SetupGuestNetworkCommand("10.1.1.10-10.1.1.20", "cloud.test", false, "8.8.8.8", "8.8.4.4", true, nic);
         cmd.setAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP, "10.1.1.2");
         cmd.setAccessDetail(NetworkElementCommand.GUEST_NETWORK_GATEWAY, "10.1.1.1");
         cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, ROUTERNAME);
@@ -529,7 +529,7 @@ public class VirtualRoutingResourceTest implements VirtualRouterDeployer {
         return cmd;
     }
 
-    private void verifyArgs(SetupGuestNetworkCommand cmd, String script, String args) {
+    private void verifyArgs(final SetupGuestNetworkCommand cmd, final String script, final String args) {
         // TODO Check the contents of the json file
         //assertEquals(script, VRScripts.VPC_GUEST_NETWORK);
         //assertEquals(args, " -C -M 01:23:45:67:89:AB -d eth4 -i 10.1.1.2 -g 10.1.1.1 -m 24 -n 10.1.1.0 -s 8.8.8.8,8.8.4.4 -e cloud.test");
@@ -537,23 +537,23 @@ public class VirtualRoutingResourceTest implements VirtualRouterDeployer {
 
     @Test
     public void testSetMonitorServiceCommand() {
-        SetMonitorServiceCommand cmd = generateSetMonitorServiceCommand();
-        Answer answer = _resource.executeRequest(cmd);
+        final SetMonitorServiceCommand cmd = generateSetMonitorServiceCommand();
+        final Answer answer = _resource.executeRequest(cmd);
         assertTrue(answer.getResult());
     }
 
     protected SetMonitorServiceCommand generateSetMonitorServiceCommand() {
-        List<MonitorServiceTO> services = new ArrayList<>();
+        final List<MonitorServiceTO> services = new ArrayList<>();
         services.add(new MonitorServiceTO("service", "process", "name", "path", "file", true));
         services.add(new MonitorServiceTO("service_2", "process_2", "name_2", "path_2", "file_2", false));
 
-        SetMonitorServiceCommand cmd = new SetMonitorServiceCommand(services);
+        final SetMonitorServiceCommand cmd = new SetMonitorServiceCommand(services);
         cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, ROUTERNAME);
 
         return cmd;
     }
 
-    private void verifyArgs(SetMonitorServiceCommand cmd, String script, String args) {
+    private void verifyArgs(final SetMonitorServiceCommand cmd, final String script, final String args) {
         assertEquals(script, VRScripts.MONITOR_SERVICE);
         assertEquals(args, " -c [service]:processname=process:servicename=name:pidfile=file:,[service_2]:processname=process_2:servicename=name_2:pidfile=file_2:,");
     }
@@ -578,7 +578,7 @@ public class VirtualRoutingResourceTest implements VirtualRouterDeployer {
         assertTrue(answer.getResult());
     }
 
-    private void verifyArgs(Site2SiteVpnCfgCommand cmd, String script, String args) {
+    private void verifyArgs(final Site2SiteVpnCfgCommand cmd, final String script, final String args) {
         _count ++;
 
         assertEquals(script, VRScripts.S2SVPN_IPSEC);
@@ -612,27 +612,27 @@ public class VirtualRoutingResourceTest implements VirtualRouterDeployer {
     }
 
     protected RemoteAccessVpnCfgCommand generateRemoteAccessVpnCfgCommand1() {
-        RemoteAccessVpnCfgCommand cmd = new RemoteAccessVpnCfgCommand(true, "124.10.10.10", "10.10.1.1", "10.10.1.10-10.10.1.20", "sharedkey", false);
+        final RemoteAccessVpnCfgCommand cmd = new RemoteAccessVpnCfgCommand(true, "124.10.10.10", "10.10.1.1", "10.10.1.10-10.10.1.20", "sharedkey", false);
         cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, ROUTERNAME);
         cmd.setLocalCidr("10.1.1.1/24");
         return cmd;
     }
 
     protected RemoteAccessVpnCfgCommand generateRemoteAccessVpnCfgCommand2() {
-        RemoteAccessVpnCfgCommand cmd = new RemoteAccessVpnCfgCommand(false, "124.10.10.10", "10.10.1.1", "10.10.1.10-10.10.1.20", "sharedkey", false);
+        final RemoteAccessVpnCfgCommand cmd = new RemoteAccessVpnCfgCommand(false, "124.10.10.10", "10.10.1.1", "10.10.1.10-10.10.1.20", "sharedkey", false);
         cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, ROUTERNAME);
         cmd.setLocalCidr("10.1.1.1/24");
         return cmd;
     }
 
     protected RemoteAccessVpnCfgCommand generateRemoteAccessVpnCfgCommand3() {
-        RemoteAccessVpnCfgCommand cmd = new RemoteAccessVpnCfgCommand(true, "124.10.10.10", "10.10.1.1", "10.10.1.10-10.10.1.20", "sharedkey", true);
+        final RemoteAccessVpnCfgCommand cmd = new RemoteAccessVpnCfgCommand(true, "124.10.10.10", "10.10.1.1", "10.10.1.10-10.10.1.20", "sharedkey", true);
         cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, ROUTERNAME);
         cmd.setLocalCidr("10.1.1.1/24");
         return cmd;
     }
 
-    private void verifyArgs(RemoteAccessVpnCfgCommand cmd, String script, String args) {
+    private void verifyArgs(final RemoteAccessVpnCfgCommand cmd, final String script, final String args) {
         _count ++;
 
         assertEquals(script, VRScripts.VPN_L2TP);
@@ -656,27 +656,27 @@ public class VirtualRoutingResourceTest implements VirtualRouterDeployer {
     public void testFirewallRulesCommand() {
         _count = 0;
 
-        Answer answer = _resource.executeRequest(generateSetFirewallRulesCommand());
+        final Answer answer = _resource.executeRequest(generateSetFirewallRulesCommand());
         assertTrue(answer.getResult());
 
         //TODO Didn't test egress rule because not able to generate FirewallRuleVO object
     }
 
     protected SetFirewallRulesCommand generateSetFirewallRulesCommand() {
-        List<FirewallRuleTO> rules = new ArrayList<>();
-        List<String> sourceCidrs = new ArrayList<>();
+        final List<FirewallRuleTO> rules = new ArrayList<>();
+        final List<String> sourceCidrs = new ArrayList<>();
         sourceCidrs.add("10.10.1.1/24");
         sourceCidrs.add("10.10.1.2/24");
         rules.add(new FirewallRuleTO(1, "64.10.10.10", "TCP", 22, 80, false, false, Purpose.Firewall, sourceCidrs, 0, 0));
         rules.add(new FirewallRuleTO(2, "64.10.10.10", "ICMP", 0, 0, false, false, Purpose.Firewall, sourceCidrs, -1, -1));
         rules.add(new FirewallRuleTO(3, "64.10.10.10", "ICMP", 0, 0, true, true, Purpose.Firewall, sourceCidrs, -1, -1));
-        SetFirewallRulesCommand cmd = new SetFirewallRulesCommand(rules);
+        final SetFirewallRulesCommand cmd = new SetFirewallRulesCommand(rules);
         cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, ROUTERNAME);
 
         return cmd;
     }
 
-    private void verifyArgs(SetFirewallRulesCommand cmd, String script, String args) {
+    private void verifyArgs(final SetFirewallRulesCommand cmd, final String script, final String args) {
         assertEquals(script, VRScripts.FIREWALL_INGRESS);
 
         //Since the arguments are generated with a Set
@@ -689,12 +689,12 @@ public class VirtualRoutingResourceTest implements VirtualRouterDeployer {
 
     @Test
     public void testVmDataCommand() {
-        Answer answer = _resource.executeRequest(generateVmDataCommand());
+        final Answer answer = _resource.executeRequest(generateVmDataCommand());
         assertTrue(answer.getResult());
     }
 
     protected VmDataCommand generateVmDataCommand() {
-        VmDataCommand cmd = new VmDataCommand("10.1.10.4", "i-4-VM", true);
+        final VmDataCommand cmd = new VmDataCommand("10.1.10.4", "i-4-VM", true);
         // if you add new metadata files, also edit systemvm/patches/debian/config/var/www/html/latest/.htaccess
         cmd.addVmData("userdata", "user-data", "user-data");
         cmd.addVmData("metadata", "service-offering", "serviceOffering");
@@ -713,24 +713,24 @@ public class VirtualRoutingResourceTest implements VirtualRouterDeployer {
         return cmd;
     }
 
-    private void verifyArgs(VmDataCommand cmd, String script, String args) {
+    private void verifyArgs(final VmDataCommand cmd, final String script, final String args) {
         assertEquals(script, VRScripts.UPDATE_CONFIG);
         assertEquals(args, VRScripts.VM_METADATA_CONFIG);
     }
 
     @Test
     public void testSavePasswordCommand() {
-        Answer answer = _resource.executeRequest(generateSavePasswordCommand());
+        final Answer answer = _resource.executeRequest(generateSavePasswordCommand());
         assertTrue(answer.getResult());
     }
 
     protected SavePasswordCommand generateSavePasswordCommand() {
-        SavePasswordCommand cmd = new SavePasswordCommand("123pass", "10.1.10.4", "i-4-VM", true);
+        final SavePasswordCommand cmd = new SavePasswordCommand("123pass", "10.1.10.4", "i-4-VM", true);
         cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, ROUTERNAME);
         return cmd;
     }
 
-    private void verifyArgs(SavePasswordCommand cmd, String script, String args) {
+    private void verifyArgs(final SavePasswordCommand cmd, final String script, final String args) {
         assertEquals(script, VRScripts.PASSWORD);
         assertEquals(args, "-v 10.1.10.4 -p 123pass");
     }
@@ -750,26 +750,26 @@ public class VirtualRoutingResourceTest implements VirtualRouterDeployer {
     }
 
     protected DhcpEntryCommand generateDhcpEntryCommand1() {
-        DhcpEntryCommand cmd = new DhcpEntryCommand("12:34:56:78:90:AB", "10.1.10.2", "vm1", null, true);
+        final DhcpEntryCommand cmd = new DhcpEntryCommand("12:34:56:78:90:AB", "10.1.10.2", "vm1", null, true);
         cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, ROUTERNAME);
         return cmd;
     }
 
     protected DhcpEntryCommand generateDhcpEntryCommand2() {
-        DhcpEntryCommand cmd = new DhcpEntryCommand("12:34:56:78:90:AB", null, "vm1", "2001:db8:0:0:0:ff00:42:8329", true);
+        final DhcpEntryCommand cmd = new DhcpEntryCommand("12:34:56:78:90:AB", null, "vm1", "2001:db8:0:0:0:ff00:42:8329", true);
         cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, ROUTERNAME);
         cmd.setDuid(NetUtils.getDuidLL(cmd.getVmMac()));
         return cmd;
     }
 
     protected DhcpEntryCommand generateDhcpEntryCommand3() {
-        DhcpEntryCommand cmd = new DhcpEntryCommand("12:34:56:78:90:AB", "10.1.10.2", "vm1", "2001:db8:0:0:0:ff00:42:8329", true);
+        final DhcpEntryCommand cmd = new DhcpEntryCommand("12:34:56:78:90:AB", "10.1.10.2", "vm1", "2001:db8:0:0:0:ff00:42:8329", true);
         cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, ROUTERNAME);
         cmd.setDuid(NetUtils.getDuidLL(cmd.getVmMac()));
         return cmd;
     }
 
-    private void verifyArgs(DhcpEntryCommand cmd, String script, String args) {
+    private void verifyArgs(final DhcpEntryCommand cmd, final String script, final String args) {
         _count ++;
         assertEquals(script, VRScripts.DHCP);
         switch (_count) {
@@ -789,63 +789,63 @@ public class VirtualRoutingResourceTest implements VirtualRouterDeployer {
 
     @Test
     public void testCreateIpAliasCommand() {
-        Answer answer = _resource.executeRequest(generateCreateIpAliasCommand());
+        final Answer answer = _resource.executeRequest(generateCreateIpAliasCommand());
         assertTrue(answer.getResult());
     }
 
     protected CreateIpAliasCommand generateCreateIpAliasCommand() {
-        List<IpAliasTO> aliases = new ArrayList<>();
+        final List<IpAliasTO> aliases = new ArrayList<>();
         aliases.add(new IpAliasTO("169.254.3.10", "255.255.255.0", "1"));
         aliases.add(new IpAliasTO("169.254.3.11", "255.255.255.0", "2"));
         aliases.add(new IpAliasTO("169.254.3.12", "255.255.255.0", "3"));
-        CreateIpAliasCommand cmd = new CreateIpAliasCommand("169.254.3.10", aliases);
+        final CreateIpAliasCommand cmd = new CreateIpAliasCommand("169.254.3.10", aliases);
         cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, ROUTERNAME);
 
         return cmd;
     }
 
-    private void verifyArgs(CreateIpAliasCommand cmd, String script, String args) {
+    private void verifyArgs(final CreateIpAliasCommand cmd, final String script, final String args) {
         assertEquals(script, VRScripts.IPALIAS_CREATE);
         assertEquals(args, "1:169.254.3.10:255.255.255.0-2:169.254.3.11:255.255.255.0-3:169.254.3.12:255.255.255.0-");
     }
 
     @Test
     public void testDeleteIpAliasCommand() {
-        Answer answer = _resource.executeRequest(generateDeleteIpAliasCommand());
+        final Answer answer = _resource.executeRequest(generateDeleteIpAliasCommand());
         assertTrue(answer.getResult());
     }
 
     protected DeleteIpAliasCommand generateDeleteIpAliasCommand() {
-        List<IpAliasTO> aliases = new ArrayList<>();
+        final List<IpAliasTO> aliases = new ArrayList<>();
         aliases.add(new IpAliasTO("169.254.3.10", "255.255.255.0", "1"));
         aliases.add(new IpAliasTO("169.254.3.11", "255.255.255.0", "2"));
         aliases.add(new IpAliasTO("169.254.3.12", "255.255.255.0", "3"));
-        DeleteIpAliasCommand cmd = new DeleteIpAliasCommand("169.254.10.1", aliases, aliases);
+        final DeleteIpAliasCommand cmd = new DeleteIpAliasCommand("169.254.10.1", aliases, aliases);
         cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, ROUTERNAME);
         return cmd;
     }
 
-    private void verifyArgs(DeleteIpAliasCommand cmd, String script, String args) {
+    private void verifyArgs(final DeleteIpAliasCommand cmd, final String script, final String args) {
         assertEquals(script, VRScripts.IPALIAS_DELETE);
         assertEquals(args, "1:169.254.3.10:255.255.255.0-2:169.254.3.11:255.255.255.0-3:169.254.3.12:255.255.255.0-- 1:169.254.3.10:255.255.255.0-2:169.254.3.11:255.255.255.0-3:169.254.3.12:255.255.255.0-");
     }
 
     @Test
     public void testDnsMasqConfigCommand() {
-        Answer answer = _resource.executeRequest(generateDnsMasqConfigCommand());
+        final Answer answer = _resource.executeRequest(generateDnsMasqConfigCommand());
         assertTrue(answer.getResult());
     }
 
     protected DnsMasqConfigCommand generateDnsMasqConfigCommand() {
-        List<DhcpTO> dhcps = new ArrayList<>();
+        final List<DhcpTO> dhcps = new ArrayList<>();
         dhcps.add(new DhcpTO("10.1.20.2", "10.1.20.1", "255.255.255.0", "10.1.20.5"));
         dhcps.add(new DhcpTO("10.1.21.2", "10.1.21.1", "255.255.255.0", "10.1.21.5"));
-        DnsMasqConfigCommand cmd = new DnsMasqConfigCommand(dhcps);
+        final DnsMasqConfigCommand cmd = new DnsMasqConfigCommand(dhcps);
         cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, ROUTERNAME);
         return cmd;
     }
 
-    private void verifyArgs(DnsMasqConfigCommand cmd, String script, String args) {
+    private void verifyArgs(final DnsMasqConfigCommand cmd, final String script, final String args) {
         assertEquals(script, VRScripts.DNSMASQ_CONFIG);
         assertEquals(args, "10.1.20.2:10.1.20.1:255.255.255.0:10.1.20.5-10.1.21.2:10.1.21.1:255.255.255.0:10.1.21.5-");
     }
@@ -863,37 +863,37 @@ public class VirtualRoutingResourceTest implements VirtualRouterDeployer {
     }
 
     protected LoadBalancerConfigCommand generateLoadBalancerConfigCommand1() {
-        List<LoadBalancerTO> lbs = new ArrayList<>();
-        List<LbDestination> dests = new ArrayList<>();
+        final List<LoadBalancerTO> lbs = new ArrayList<>();
+        final List<LbDestination> dests = new ArrayList<>();
         dests.add(new LbDestination(80, 8080, "10.1.10.2", false));
         dests.add(new LbDestination(80, 8080, "10.1.10.2", true));
         lbs.add(new LoadBalancerTO(UUID.randomUUID().toString(), "64.10.1.10", 80, "tcp", "algo", false, false, false, dests));
-        LoadBalancerTO[] arrayLbs = new LoadBalancerTO[lbs.size()];
+        final LoadBalancerTO[] arrayLbs = new LoadBalancerTO[lbs.size()];
         lbs.toArray(arrayLbs);
-        NicTO nic = new NicTO();
-        LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand(arrayLbs, "64.10.2.10", "10.1.10.2", "192.168.1.2", nic, null, "1000", false);
+        final NicTO nic = new NicTO();
+        final LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand(arrayLbs, "64.10.2.10", "10.1.10.2", "192.168.1.2", nic, null, "1000", false);
         cmd.setAccessDetail(NetworkElementCommand.ROUTER_IP, "10.1.10.2");
         cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, ROUTERNAME);
         return cmd;
     }
 
     protected LoadBalancerConfigCommand generateLoadBalancerConfigCommand2() {
-        List<LoadBalancerTO> lbs = new ArrayList<>();
-        List<LbDestination> dests = new ArrayList<>();
+        final List<LoadBalancerTO> lbs = new ArrayList<>();
+        final List<LbDestination> dests = new ArrayList<>();
         dests.add(new LbDestination(80, 8080, "10.1.10.2", false));
         dests.add(new LbDestination(80, 8080, "10.1.10.2", true));
         lbs.add(new LoadBalancerTO(UUID.randomUUID().toString(), "64.10.1.10", 80, "tcp", "algo", false, false, false, dests));
-        LoadBalancerTO[] arrayLbs = new LoadBalancerTO[lbs.size()];
+        final LoadBalancerTO[] arrayLbs = new LoadBalancerTO[lbs.size()];
         lbs.toArray(arrayLbs);
-        NicTO nic = new NicTO();
+        final NicTO nic = new NicTO();
         nic.setIp("10.1.10.2");
-        LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand(arrayLbs, "64.10.2.10", "10.1.10.2", "192.168.1.2", nic, Long.valueOf(1), "1000", false);
+        final LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand(arrayLbs, "64.10.2.10", "10.1.10.2", "192.168.1.2", nic, Long.valueOf(1), "1000", false);
         cmd.setAccessDetail(NetworkElementCommand.ROUTER_IP, "10.1.10.2");
         cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, ROUTERNAME);
         return cmd;
     }
 
-    protected void verifyFile(LoadBalancerConfigCommand cmd, String path, String filename, String content) {
+    protected void verifyFile(final LoadBalancerConfigCommand cmd, final String path, final String filename, final String content) {
         _count ++;
         switch (_count) {
         case 1:
@@ -944,7 +944,7 @@ public class VirtualRoutingResourceTest implements VirtualRouterDeployer {
         }
     }
 
-    private void verifyArgs(LoadBalancerConfigCommand cmd, String script, String args) {
+    private void verifyArgs(final LoadBalancerConfigCommand cmd, final String script, final String args) {
         _count ++;
         switch (_count) {
         case 2:
@@ -963,8 +963,8 @@ public class VirtualRoutingResourceTest implements VirtualRouterDeployer {
     @Test
     @Ignore("Ignore this test while we are experimenting with the commands.")
     public void testAggregationCommands() {
-        List<NetworkElementCommand> cmds = new LinkedList<>();
-        AggregationControlCommand startCmd = new AggregationControlCommand(Action.Start, ROUTERNAME, ROUTERIP, ROUTERGUESTIP);
+        final List<NetworkElementCommand> cmds = new LinkedList<>();
+        final AggregationControlCommand startCmd = new AggregationControlCommand(Action.Start, ROUTERNAME, ROUTERIP, ROUTERGUESTIP);
         cmds.add(startCmd);
         cmds.add(generateIpAssocCommand());
         cmds.add(generateIpAssocVpcCommand());
@@ -995,41 +995,41 @@ public class VirtualRoutingResourceTest implements VirtualRouterDeployer {
         cmds.add(generateSavePasswordCommand());
         cmds.add(generateVmDataCommand());
 
-        AggregationControlCommand finishCmd = new AggregationControlCommand(Action.Finish, ROUTERNAME, ROUTERIP, ROUTERGUESTIP);
+        final AggregationControlCommand finishCmd = new AggregationControlCommand(Action.Finish, ROUTERNAME, ROUTERIP, ROUTERGUESTIP);
         cmds.add(finishCmd);
 
-        for (NetworkElementCommand cmd : cmds) {
-            Answer answer = _resource.executeRequest(cmd);
+        for (final NetworkElementCommand cmd : cmds) {
+            final Answer answer = _resource.executeRequest(cmd);
             assertTrue(answer.getResult());
         }
     }
 
-    private void verifyArgs(AggregationControlCommand cmd, String script, String args) {
+    private void verifyArgs(final AggregationControlCommand cmd, final String script, final String args) {
         assertEquals(script, VRScripts.VR_CFG);
         assertTrue(args.startsWith("-c /var/cache/cloud/VR-"));
         assertTrue(args.endsWith(".cfg"));
     }
 
-    protected void verifyFile(AggregationControlCommand cmd, String path, String filename, String content) {
+    protected void verifyFile(final AggregationControlCommand cmd, final String path, final String filename, final String content) {
         assertEquals(path, "/var/cache/cloud/");
         assertTrue(filename.startsWith("VR-"));
         assertTrue(filename.endsWith(".cfg"));
-        Collection<String> filteredScripts = Collections2.transform(Collections2.filter (
+        final Collection<String> filteredScripts = Collections2.transform(Collections2.filter (
                 Arrays.asList(content.split("</?script>")), new Predicate<String>() {
 
                     @Override
-                    public boolean apply(String str) {
+                    public boolean apply(final String str) {
                         return str.trim().startsWith("/opt/cloud");
                     }
                 }), new Function<String, String>() {
 
-                    @Override
-                    public String apply(String str) {
-                        return str.trim();
-                    }
-                });
-        String[] scripts = filteredScripts.toArray(new String[filteredScripts
-                .size()]);
+            @Override
+            public String apply(final String str) {
+                return str.trim();
+            }
+        });
+        final String[] scripts = filteredScripts.toArray(new String[filteredScripts
+                                                                    .size()]);
 
         assertEquals(
                 "/opt/cloud/bin/ipassoc.sh -A -s -f -l 64.1.1.10/24 -c eth2 -g 64.1.1.1",

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3d22a16c/engine/schema/src/com/cloud/upgrade/dao/Upgrade451to460.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade451to460.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade451to460.java
index 6c1f05e..383654f 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade451to460.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade451to460.java
@@ -33,7 +33,7 @@ public class Upgrade451to460 implements DbUpgrade {
 
     @Override
     public String[] getUpgradableVersionRange() {
-        return new String[] {"4.5.1", "4.6.0"};
+        return new String[] { "4.5.1", "4.6.0" };
     }
 
     @Override
@@ -53,7 +53,7 @@ public class Upgrade451to460 implements DbUpgrade {
             throw new CloudRuntimeException("Unable to find db/schema-451to460.sql");
         }
 
-        return new File[] {new File(script)};
+        return new File[] { new File(script) };
     }
 
     @Override
@@ -62,12 +62,13 @@ public class Upgrade451to460 implements DbUpgrade {
     }
 
     public void updateVMInstanceUserId(final Connection conn) {
-        // For schemas before this, copy first user from an account_id which deployed already running VMs
+        // For schemas before this, copy first user from an account_id which
+        // deployed already running VMs
         s_logger.debug("Updating vm_instance column user_id using first user in vm_instance's account_id");
         final String vmInstanceSql = "SELECT id, account_id FROM `cloud`.`vm_instance`";
         final String userSql = "SELECT id FROM `cloud`.`user` where account_id=?";
         final String userIdUpdateSql = "update `cloud`.`vm_instance` set user_id=? where id=?";
-        try(PreparedStatement selectStatement = conn.prepareStatement(vmInstanceSql)) {
+        try (PreparedStatement selectStatement = conn.prepareStatement(vmInstanceSql)) {
             final ResultSet results = selectStatement.executeQuery();
             while (results.next()) {
                 final long vmId = results.getLong(1);
@@ -95,30 +96,27 @@ public class Upgrade451to460 implements DbUpgrade {
         }
         s_logger.debug("Done updating user Ids for previously deployed VMs");
         addRedundancyForNwAndVpc(conn);
+        removeBumPriorityColumn(conn);
     }
 
     private void addRedundancyForNwAndVpc(final Connection conn) {
         ResultSet rs = null;
-        try (PreparedStatement addRedundantColToVpcOfferingPstmt = conn.prepareStatement(
-                "ALTER TABLE `cloud`.`vpc_offerings` ADD COLUMN `redundant_router_service` tinyint(1) DEFAULT 0");
-                PreparedStatement addRedundantColToVpcPstmt = conn.prepareStatement(
-                        "ALTER TABLE `cloud`.`vpc` ADD COLUMN `redundant` tinyint(1) DEFAULT 0");
-                PreparedStatement addRedundantColToNwPstmt = conn.prepareStatement(
-                        "ALTER TABLE `cloud`.`networks` ADD COLUMN `redundant` tinyint(1) DEFAULT 0");
-
-                // The redundancy of the networks must be based on the redundancy of their network offerings
-                PreparedStatement redundancyPerNwPstmt = conn.prepareStatement(
-                        "select distinct nw.network_offering_id from networks nw join network_offerings off " +
-                        "on nw.network_offering_id = off.id where off.redundant_router_service = 1");
-                PreparedStatement updateNwRedundancyPstmt = conn.prepareStatement(
-                        "update networks set redundant = 1 where network_offering_id = ?");
-                ) {
+        try (PreparedStatement addRedundantColToVpcOfferingPstmt = conn
+                .prepareStatement("ALTER TABLE `cloud`.`vpc_offerings` ADD COLUMN `redundant_router_service` tinyint(1) DEFAULT 0");
+                PreparedStatement addRedundantColToVpcPstmt = conn.prepareStatement("ALTER TABLE `cloud`.`vpc` ADD COLUMN `redundant` tinyint(1) DEFAULT 0");
+                PreparedStatement addRedundantColToNwPstmt = conn.prepareStatement("ALTER TABLE `cloud`.`networks` ADD COLUMN `redundant` tinyint(1) DEFAULT 0");
+
+                // The redundancy of the networks must be based on the
+                // redundancy of their network offerings
+                PreparedStatement redundancyPerNwPstmt = conn.prepareStatement("select distinct nw.network_offering_id from networks nw join network_offerings off "
+                        + "on nw.network_offering_id = off.id where off.redundant_router_service = 1");
+                PreparedStatement updateNwRedundancyPstmt = conn.prepareStatement("update networks set redundant = 1 where network_offering_id = ?");) {
             addRedundantColToVpcPstmt.executeUpdate();
             addRedundantColToVpcOfferingPstmt.executeUpdate();
             addRedundantColToNwPstmt.executeUpdate();
 
             rs = redundancyPerNwPstmt.executeQuery();
-            while(rs.next()){
+            while (rs.next()) {
                 final long nwOfferingId = rs.getLong("nw.network_offering_id");
                 updateNwRedundancyPstmt.setLong(1, nwOfferingId);
                 updateNwRedundancyPstmt.executeUpdate();
@@ -129,6 +127,15 @@ public class Upgrade451to460 implements DbUpgrade {
         }
     }
 
+    private void removeBumPriorityColumn(final Connection conn) {
+        try (PreparedStatement removeBumPriorityColumnPstmt = conn.prepareStatement("ALTER TABLE `cloud`.`domain_router` DROP COLUMN `is_priority_bumpup`");) {
+            removeBumPriorityColumnPstmt.executeUpdate();
+        } catch (final SQLException e) {
+            e.printStackTrace();
+            throw new CloudRuntimeException("Adding redundancy to vpc, networks and vpc_offerings failed", e);
+        }
+    }
+
     @Override
     public File[] getCleanupScripts() {
         final String script = Script.findScript("", "db/schema-451to460-cleanup.sql");
@@ -136,7 +143,7 @@ public class Upgrade451to460 implements DbUpgrade {
             throw new CloudRuntimeException("Unable to find db/schema-451to460-cleanup.sql");
         }
 
-        return new File[] {new File(script)};
+        return new File[] { new File(script) };
     }
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3d22a16c/engine/schema/src/com/cloud/vm/DomainRouterVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/vm/DomainRouterVO.java b/engine/schema/src/com/cloud/vm/DomainRouterVO.java
index f08177c..2596d24 100644
--- a/engine/schema/src/com/cloud/vm/DomainRouterVO.java
+++ b/engine/schema/src/com/cloud/vm/DomainRouterVO.java
@@ -49,12 +49,6 @@ public class DomainRouterVO extends VMInstanceVO implements VirtualRouter {
     @Column(name = "is_redundant_router")
     boolean isRedundantRouter;
 
-    @Column(name = "priority")
-    int priority;
-
-    @Column(name = "is_priority_bumpup")
-    boolean isPriorityBumpUp;
-
     @Column(name = "redundant_state")
     @Enumerated(EnumType.STRING)
     private RedundantState redundantState;
@@ -75,28 +69,24 @@ public class DomainRouterVO extends VMInstanceVO implements VirtualRouter {
     @Column(name = "vpc_id")
     private Long vpcId;
 
-    public DomainRouterVO(long id, long serviceOfferingId, long elementId, String name, long templateId, HypervisorType hypervisorType, long guestOSId, long domainId,
-                          long accountId, long userId, boolean isRedundantRouter, int priority, boolean isPriorityBumpUp, RedundantState redundantState, boolean haEnabled, boolean stopPending,
-                          Long vpcId) {
+    public DomainRouterVO(final long id, final long serviceOfferingId, final long elementId, final String name, final long templateId, final HypervisorType hypervisorType, final long guestOSId, final long domainId,
+            final long accountId, final long userId, final boolean isRedundantRouter, final RedundantState redundantState, final boolean haEnabled, final boolean stopPending,
+            final Long vpcId) {
         super(id, serviceOfferingId, name, name, Type.DomainRouter, templateId, hypervisorType, guestOSId, domainId, accountId, userId, haEnabled);
         this.elementId = elementId;
         this.isRedundantRouter = isRedundantRouter;
-        this.priority = priority;
         this.redundantState = redundantState;
-        this.isPriorityBumpUp = isPriorityBumpUp;
         this.stopPending = stopPending;
         this.vpcId = vpcId;
     }
 
-    public DomainRouterVO(long id, long serviceOfferingId, long elementId, String name, long templateId, HypervisorType hypervisorType, long guestOSId, long domainId,
-                          long accountId, long userId, boolean isRedundantRouter, int priority, boolean isPriorityBumpUp, RedundantState redundantState, boolean haEnabled, boolean stopPending,
-                          Type vmType, Long vpcId) {
+    public DomainRouterVO(final long id, final long serviceOfferingId, final long elementId, final String name, final long templateId, final HypervisorType hypervisorType, final long guestOSId, final long domainId,
+            final long accountId, final long userId, final boolean isRedundantRouter, final RedundantState redundantState, final boolean haEnabled, final boolean stopPending,
+            final Type vmType, final Long vpcId) {
         super(id, serviceOfferingId, name, name, vmType, templateId, hypervisorType, guestOSId, domainId, accountId, userId, haEnabled);
         this.elementId = elementId;
         this.isRedundantRouter = isRedundantRouter;
-        this.priority = priority;
         this.redundantState = redundantState;
-        this.isPriorityBumpUp = isPriorityBumpUp;
         this.stopPending = stopPending;
         this.vpcId = vpcId;
     }
@@ -105,15 +95,15 @@ public class DomainRouterVO extends VMInstanceVO implements VirtualRouter {
         return elementId;
     }
 
-    public void setPublicIpAddress(String publicIpAddress) {
+    public void setPublicIpAddress(final String publicIpAddress) {
         this.publicIpAddress = publicIpAddress;
     }
 
-    public void setPublicMacAddress(String publicMacAddress) {
+    public void setPublicMacAddress(final String publicMacAddress) {
         this.publicMacAddress = publicMacAddress;
     }
 
-    public void setPublicNetmask(String publicNetmask) {
+    public void setPublicNetmask(final String publicNetmask) {
         this.publicNetmask = publicNetmask;
     }
 
@@ -144,16 +134,16 @@ public class DomainRouterVO extends VMInstanceVO implements VirtualRouter {
         return role;
     }
 
-    public void setRole(Role role) {
+    public void setRole(final Role role) {
         this.role = role;
     }
 
     @Override
     public boolean getIsRedundantRouter() {
-        return this.isRedundantRouter;
+        return isRedundantRouter;
     }
 
-    public void setIsRedundantRouter(boolean isRedundantRouter) {
+    public void setIsRedundantRouter(final boolean isRedundantRouter) {
         this.isRedundantRouter = isRedundantRouter;
     }
 
@@ -162,55 +152,39 @@ public class DomainRouterVO extends VMInstanceVO implements VirtualRouter {
         return serviceOfferingId;
     }
 
-    public int getPriority() {
-        return this.priority;
-    }
-
-    public void setPriority(int priority) {
-        this.priority = priority;
-    }
-
     @Override
     public RedundantState getRedundantState() {
-        return this.redundantState;
+        return redundantState;
     }
 
-    public void setRedundantState(RedundantState redundantState) {
+    public void setRedundantState(final RedundantState redundantState) {
         this.redundantState = redundantState;
     }
 
-    public boolean getIsPriorityBumpUp() {
-        return this.isPriorityBumpUp;
-    }
-
-    public void setIsPriorityBumpUp(boolean isPriorityBumpUp) {
-        this.isPriorityBumpUp = isPriorityBumpUp;
-    }
-
     @Override
     public boolean isStopPending() {
-        return this.stopPending;
+        return stopPending;
     }
 
     @Override
-    public void setStopPending(boolean stopPending) {
+    public void setStopPending(final boolean stopPending) {
         this.stopPending = stopPending;
     }
 
     @Override
     public String getTemplateVersion() {
-        return this.templateVersion;
+        return templateVersion;
     }
 
-    public void setTemplateVersion(String templateVersion) {
+    public void setTemplateVersion(final String templateVersion) {
         this.templateVersion = templateVersion;
     }
 
     public String getScriptsVersion() {
-        return this.scriptsVersion;
+        return scriptsVersion;
     }
 
-    public void setScriptsVersion(String scriptsVersion) {
+    public void setScriptsVersion(final String scriptsVersion) {
         this.scriptsVersion = scriptsVersion;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3d22a16c/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockVmManager.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockVmManager.java b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockVmManager.java
index 1fb1153..44c652a 100644
--- a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockVmManager.java
+++ b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockVmManager.java
@@ -20,7 +20,6 @@ import java.util.HashMap;
 import java.util.Map;
 
 import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.BumpUpPriorityCommand;
 import com.cloud.agent.api.CheckRouterAnswer;
 import com.cloud.agent.api.CheckRouterCommand;
 import com.cloud.agent.api.CheckVirtualMachineCommand;
@@ -98,8 +97,6 @@ public interface MockVmManager extends Manager {
 
     CheckRouterAnswer checkRouter(CheckRouterCommand cmd);
 
-    Answer bumpPriority(BumpUpPriorityCommand cmd);
-
     Answer CleanupNetworkRules(CleanupNetworkRulesCmd cmd, SimulatorInfo info);
 
     Answer scaleVm(ScaleVmCommand cmd);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3d22a16c/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockVmManagerImpl.java b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockVmManagerImpl.java
index f77e12b..dbe8ade 100644
--- a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockVmManagerImpl.java
+++ b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockVmManagerImpl.java
@@ -31,7 +31,6 @@ import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 
 import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.BumpUpPriorityCommand;
 import com.cloud.agent.api.CheckRouterAnswer;
 import com.cloud.agent.api.CheckRouterCommand;
 import com.cloud.agent.api.CheckVirtualMachineAnswer;
@@ -110,12 +109,12 @@ public class MockVmManagerImpl extends ManagerBase implements MockVmManager {
     }
 
     @Override
-    public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
+    public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException {
 
         return true;
     }
 
-    public String startVM(String vmName, NicTO[] nics, int cpuHz, long ramSize, String bootArgs, String hostGuid) {
+    public String startVM(final String vmName, final NicTO[] nics, final int cpuHz, final long ramSize, final String bootArgs, final String hostGuid) {
 
         TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.SIMULATOR_DB);
         MockHost host = null;
@@ -129,7 +128,7 @@ public class MockVmManagerImpl extends ManagerBase implements MockVmManager {
 
             vm = _mockVmDao.findByVmName(vmName);
             txn.commit();
-        } catch (Exception ex) {
+        } catch (final Exception ex) {
             txn.rollback();
             throw new CloudRuntimeException("Unable to start VM " + vmName, ex);
         } finally {
@@ -139,9 +138,10 @@ public class MockVmManagerImpl extends ManagerBase implements MockVmManager {
         }
 
         if (vm == null) {
-            int vncPort = 0;
-            if (vncPort < 0)
+            final int vncPort = 0;
+            if (vncPort < 0) {
                 return "Unable to allocate VNC port";
+            }
             vm = new MockVMVO();
             vm.setCpu(cpuHz);
             vm.setMemory(ramSize);
@@ -164,7 +164,7 @@ public class MockVmManagerImpl extends ManagerBase implements MockVmManager {
                 txn.start();
                 vm = _mockVmDao.persist((MockVMVO)vm);
                 txn.commit();
-            } catch (Exception ex) {
+            } catch (final Exception ex) {
                 txn.rollback();
                 throw new CloudRuntimeException("unable to save vm to db " + vm.getName(), ex);
             } finally {
@@ -180,7 +180,7 @@ public class MockVmManagerImpl extends ManagerBase implements MockVmManager {
                     txn.start();
                     _mockVmDao.update(vm.getId(), (MockVMVO)vm);
                     txn.commit();
-                } catch (Exception ex) {
+                } catch (final Exception ex) {
                     txn.rollback();
                     throw new CloudRuntimeException("unable to update vm " + vm.getName(), ex);
                 } finally {
@@ -196,7 +196,7 @@ public class MockVmManagerImpl extends ManagerBase implements MockVmManager {
             String prvMac = null;
             String prvNetMask = null;
 
-            for (NicTO nic : nics) {
+            for (final NicTO nic : nics) {
                 if (nic.getType() == TrafficType.Management) {
                     prvIp = nic.getIp();
                     prvMac = nic.getMac();
@@ -208,9 +208,9 @@ public class MockVmManagerImpl extends ManagerBase implements MockVmManager {
             String name = null;
             String vmType = null;
             String url = null;
-            String[] args = bootArgs.trim().split(" ");
-            for (String arg : args) {
-                String[] params = arg.split("=");
+            final String[] args = bootArgs.trim().split(" ");
+            for (final String arg : args) {
+                final String[] params = arg.split("=");
                 if (params.length < 1) {
                     continue;
                 }
@@ -235,18 +235,18 @@ public class MockVmManagerImpl extends ManagerBase implements MockVmManager {
     }
 
     @Override
-    public Map<String, MockVMVO> getVms(String hostGuid) {
+    public Map<String, MockVMVO> getVms(final String hostGuid) {
         TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.SIMULATOR_DB);
         try {
             txn.start();
-            List<MockVMVO> vms = _mockVmDao.findByHostGuid(hostGuid);
-            Map<String, MockVMVO> vmMap = new HashMap<String, MockVMVO>();
-            for (MockVMVO vm : vms) {
+            final List<MockVMVO> vms = _mockVmDao.findByHostGuid(hostGuid);
+            final Map<String, MockVMVO> vmMap = new HashMap<String, MockVMVO>();
+            for (final MockVMVO vm : vms) {
                 vmMap.put(vm.getName(), vm);
             }
             txn.commit();
             return vmMap;
-        } catch (Exception ex) {
+        } catch (final Exception ex) {
             txn.rollback();
             throw new CloudRuntimeException("unable to fetch vms  from host " + hostGuid, ex);
         } finally {
@@ -257,52 +257,40 @@ public class MockVmManagerImpl extends ManagerBase implements MockVmManager {
     }
 
     @Override
-    public CheckRouterAnswer checkRouter(CheckRouterCommand cmd) {
-        String router_name = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME);
-        MockVm vm = _mockVmDao.findByVmName(router_name);
-        String args = vm.getBootargs();
+    public CheckRouterAnswer checkRouter(final CheckRouterCommand cmd) {
+        final String router_name = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME);
+        final MockVm vm = _mockVmDao.findByVmName(router_name);
+        final String args = vm.getBootargs();
         if (args.indexOf("router_pr=100") > 0) {
             s_logger.debug("Router priority is for MASTER");
-            CheckRouterAnswer ans = new CheckRouterAnswer(cmd, "Status: MASTER & Bumped: NO", true);
+            final CheckRouterAnswer ans = new CheckRouterAnswer(cmd, "Status: MASTER", true);
             ans.setState(VirtualRouter.RedundantState.MASTER);
             return ans;
         } else {
             s_logger.debug("Router priority is for BACKUP");
-            CheckRouterAnswer ans = new CheckRouterAnswer(cmd, "Status: BACKUP & Bumped: NO", true);
+            final CheckRouterAnswer ans = new CheckRouterAnswer(cmd, "Status: BACKUP", true);
             ans.setState(VirtualRouter.RedundantState.BACKUP);
             return ans;
         }
     }
 
     @Override
-    public Answer bumpPriority(BumpUpPriorityCommand cmd) {
-        String router_name = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME);
-        MockVm vm = _mockVmDao.findByVmName(router_name);
-        String args = vm.getBootargs();
-        if (args.indexOf("router_pr=100") > 0) {
-            return new Answer(cmd, true, "Status: BACKUP & Bumped: YES");
-        } else {
-            return new Answer(cmd, true, "Status: MASTER & Bumped: YES");
-        }
-    }
-
-    @Override
-    public Map<String, PowerState> getVmStates(String hostGuid) {
+    public Map<String, PowerState> getVmStates(final String hostGuid) {
         TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.SIMULATOR_DB);
         try {
             txn.start();
-            Map<String, PowerState> states = new HashMap<String, PowerState>();
-            List<MockVMVO> vms = _mockVmDao.findByHostGuid(hostGuid);
+            final Map<String, PowerState> states = new HashMap<String, PowerState>();
+            final List<MockVMVO> vms = _mockVmDao.findByHostGuid(hostGuid);
             if (vms.isEmpty()) {
                 txn.commit();
                 return states;
             }
-            for (MockVm vm : vms) {
+            for (final MockVm vm : vms) {
                 states.put(vm.getName(), vm.getPowerState());
             }
             txn.commit();
             return states;
-        } catch (Exception ex) {
+        } catch (final Exception ex) {
             txn.rollback();
             throw new CloudRuntimeException("unable to fetch vms  from host " + hostGuid, ex);
         } finally {
@@ -328,11 +316,11 @@ public class MockVmManagerImpl extends ManagerBase implements MockVmManager {
     }
 
     @Override
-    public Answer getVmStats(GetVmStatsCommand cmd) {
-        HashMap<String, VmStatsEntry> vmStatsNameMap = new HashMap<String, VmStatsEntry>();
-        List<String> vmNames = cmd.getVmNames();
-        for (String vmName : vmNames) {
-            VmStatsEntry entry = new VmStatsEntry(0, 0, 0, 0, "vm");
+    public Answer getVmStats(final GetVmStatsCommand cmd) {
+        final HashMap<String, VmStatsEntry> vmStatsNameMap = new HashMap<String, VmStatsEntry>();
+        final List<String> vmNames = cmd.getVmNames();
+        for (final String vmName : vmNames) {
+            final VmStatsEntry entry = new VmStatsEntry(0, 0, 0, 0, "vm");
             entry.setNetworkReadKBs(32768); // default values 256 KBps
             entry.setNetworkWriteKBs(16384);
             entry.setCPUUtilization(10);
@@ -343,18 +331,18 @@ public class MockVmManagerImpl extends ManagerBase implements MockVmManager {
     }
 
     @Override
-    public CheckVirtualMachineAnswer checkVmState(CheckVirtualMachineCommand cmd) {
+    public CheckVirtualMachineAnswer checkVmState(final CheckVirtualMachineCommand cmd) {
         TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.SIMULATOR_DB);
         try {
             txn.start();
-            MockVMVO vm = _mockVmDao.findByVmName(cmd.getVmName());
+            final MockVMVO vm = _mockVmDao.findByVmName(cmd.getVmName());
             if (vm == null) {
                 return new CheckVirtualMachineAnswer(cmd, "can't find vm:" + cmd.getVmName());
             }
 
             txn.commit();
             return new CheckVirtualMachineAnswer(cmd, vm.getPowerState(), vm.getVncPort());
-        } catch (Exception ex) {
+        } catch (final Exception ex) {
             txn.rollback();
             throw new CloudRuntimeException("unable to fetch vm state " + cmd.getVmName(), ex);
         } finally {
@@ -365,9 +353,9 @@ public class MockVmManagerImpl extends ManagerBase implements MockVmManager {
     }
 
     @Override
-    public StartAnswer startVM(StartCommand cmd, SimulatorInfo info) {
-        VirtualMachineTO vm = cmd.getVirtualMachine();
-        String result = startVM(vm.getName(), vm.getNics(), vm.getCpus() * vm.getMaxSpeed(), vm.getMaxRam(), vm.getBootArgs(), info.getHostUuid());
+    public StartAnswer startVM(final StartCommand cmd, final SimulatorInfo info) {
+        final VirtualMachineTO vm = cmd.getVirtualMachine();
+        final String result = startVM(vm.getName(), vm.getNics(), vm.getCpus() * vm.getMaxSpeed(), vm.getMaxRam(), vm.getBootArgs(), info.getHostUuid());
         if (result != null) {
             return new StartAnswer(cmd, result);
         } else {
@@ -376,23 +364,23 @@ public class MockVmManagerImpl extends ManagerBase implements MockVmManager {
     }
 
     @Override
-    public CheckSshAnswer checkSshCommand(CheckSshCommand cmd) {
+    public CheckSshAnswer checkSshCommand(final CheckSshCommand cmd) {
         return new CheckSshAnswer(cmd);
     }
 
     @Override
-    public MigrateAnswer Migrate(MigrateCommand cmd, SimulatorInfo info) {
+    public MigrateAnswer Migrate(final MigrateCommand cmd, final SimulatorInfo info) {
         TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.SIMULATOR_DB);
         try {
             txn.start();
-            String vmName = cmd.getVmName();
-            String destGuid = cmd.getHostGuid();
-            MockVMVO vm = _mockVmDao.findByVmNameAndHost(vmName, info.getHostUuid());
+            final String vmName = cmd.getVmName();
+            final String destGuid = cmd.getHostGuid();
+            final MockVMVO vm = _mockVmDao.findByVmNameAndHost(vmName, info.getHostUuid());
             if (vm == null) {
                 return new MigrateAnswer(cmd, false, "can't find vm:" + vmName + " on host:" + info.getHostUuid(), null);
             }
 
-            MockHost destHost = _mockHostDao.findByGuid(destGuid);
+            final MockHost destHost = _mockHostDao.findByGuid(destGuid);
             if (destHost == null) {
                 return new MigrateAnswer(cmd, false, "can;t find host:" + info.getHostUuid(), null);
             }
@@ -400,7 +388,7 @@ public class MockVmManagerImpl extends ManagerBase implements MockVmManager {
             _mockVmDao.update(vm.getId(), vm);
             txn.commit();
             return new MigrateAnswer(cmd, true, null, 0);
-        } catch (Exception ex) {
+        } catch (final Exception ex) {
             txn.rollback();
             throw new CloudRuntimeException("unable to migrate vm " + cmd.getVmName(), ex);
         } finally {
@@ -411,15 +399,15 @@ public class MockVmManagerImpl extends ManagerBase implements MockVmManager {
     }
 
     @Override
-    public PrepareForMigrationAnswer prepareForMigrate(PrepareForMigrationCommand cmd) {
+    public PrepareForMigrationAnswer prepareForMigrate(final PrepareForMigrationCommand cmd) {
         TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.SIMULATOR_DB);
-        VirtualMachineTO vmTo = cmd.getVirtualMachine();
+        final VirtualMachineTO vmTo = cmd.getVirtualMachine();
         try {
             txn.start();
-            MockVMVO vm = _mockVmDao.findById(vmTo.getId());
+            final MockVMVO vm = _mockVmDao.findById(vmTo.getId());
             _mockVmDao.update(vm.getId(), vm);
             txn.commit();
-        } catch (Exception ex) {
+        } catch (final Exception ex) {
             txn.rollback();
             throw new CloudRuntimeException("unable to find vm " + vmTo.getName(), ex);
         } finally {
@@ -431,25 +419,25 @@ public class MockVmManagerImpl extends ManagerBase implements MockVmManager {
     }
 
     @Override
-    public Answer setVmData(VmDataCommand cmd) {
+    public Answer setVmData(final VmDataCommand cmd) {
         return new Answer(cmd);
     }
 
     @Override
-    public Answer CleanupNetworkRules(CleanupNetworkRulesCmd cmd, SimulatorInfo info) {
+    public Answer CleanupNetworkRules(final CleanupNetworkRulesCmd cmd, final SimulatorInfo info) {
         TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.SIMULATOR_DB);
         try {
             txn.start();
-            List<MockSecurityRulesVO> rules = _mockSecurityDao.findByHost(info.getHostUuid());
-            for (MockSecurityRulesVO rule : rules) {
-                MockVMVO vm = _mockVmDao.findByVmNameAndHost(rule.getVmName(), info.getHostUuid());
+            final List<MockSecurityRulesVO> rules = _mockSecurityDao.findByHost(info.getHostUuid());
+            for (final MockSecurityRulesVO rule : rules) {
+                final MockVMVO vm = _mockVmDao.findByVmNameAndHost(rule.getVmName(), info.getHostUuid());
                 if (vm == null) {
                     _mockSecurityDao.remove(rule.getId());
                 }
             }
             txn.commit();
             return new Answer(cmd);
-        } catch (Exception ex) {
+        } catch (final Exception ex) {
             txn.rollback();
             throw new CloudRuntimeException("unable to clean up rules", ex);
         } finally {
@@ -460,28 +448,28 @@ public class MockVmManagerImpl extends ManagerBase implements MockVmManager {
     }
 
     @Override
-    public Answer scaleVm(ScaleVmCommand cmd) {
+    public Answer scaleVm(final ScaleVmCommand cmd) {
         return null;  //To change body of implemented methods use File | Settings | File Templates.
     }
 
     @Override
-    public Answer plugSecondaryIp(NetworkRulesVmSecondaryIpCommand cmd) {
+    public Answer plugSecondaryIp(final NetworkRulesVmSecondaryIpCommand cmd) {
         return null;  //To change body of implemented methods use File | Settings | File Templates.
     }
 
     @Override
-    public Answer createVmSnapshot(CreateVMSnapshotCommand cmd) {
-        String vmName = cmd.getVmName();
-        String vmSnapshotName = cmd.getTarget().getSnapshotName();
+    public Answer createVmSnapshot(final CreateVMSnapshotCommand cmd) {
+        final String vmName = cmd.getVmName();
+        final String vmSnapshotName = cmd.getTarget().getSnapshotName();
 
         s_logger.debug("Created snapshot " + vmSnapshotName + " for vm " + vmName);
         return new CreateVMSnapshotAnswer(cmd, cmd.getTarget(), cmd.getVolumeTOs());
     }
 
     @Override
-    public Answer deleteVmSnapshot(DeleteVMSnapshotCommand cmd) {
-        String vm = cmd.getVmName();
-        String snapshotName = cmd.getTarget().getSnapshotName();
+    public Answer deleteVmSnapshot(final DeleteVMSnapshotCommand cmd) {
+        final String vm = cmd.getVmName();
+        final String snapshotName = cmd.getTarget().getSnapshotName();
         if (_mockVmDao.findByVmName(cmd.getVmName()) == null) {
             return new DeleteVMSnapshotAnswer(cmd, false, "No VM by name " + cmd.getVmName());
         }
@@ -490,10 +478,10 @@ public class MockVmManagerImpl extends ManagerBase implements MockVmManager {
     }
 
     @Override
-    public Answer revertVmSnapshot(RevertToVMSnapshotCommand cmd) {
-        String vm = cmd.getVmName();
-        String snapshot = cmd.getTarget().getSnapshotName();
-        MockVMVO vmVo = _mockVmDao.findByVmName(cmd.getVmName());
+    public Answer revertVmSnapshot(final RevertToVMSnapshotCommand cmd) {
+        final String vm = cmd.getVmName();
+        final String snapshot = cmd.getTarget().getSnapshotName();
+        final MockVMVO vmVo = _mockVmDao.findByVmName(cmd.getVmName());
         if (vmVo == null) {
             return new RevertToVMSnapshotAnswer(cmd, false, "No VM by name " + cmd.getVmName());
         }
@@ -502,12 +490,12 @@ public class MockVmManagerImpl extends ManagerBase implements MockVmManager {
     }
 
     @Override
-    public StopAnswer stopVM(StopCommand cmd) {
+    public StopAnswer stopVM(final StopCommand cmd) {
         TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.SIMULATOR_DB);
         try {
             txn.start();
-            String vmName = cmd.getVmName();
-            MockVm vm = _mockVmDao.findByVmName(vmName);
+            final String vmName = cmd.getVmName();
+            final MockVm vm = _mockVmDao.findByVmName(vmName);
             if (vm != null) {
                 vm.setPowerState(PowerState.PowerOff);
                 _mockVmDao.update(vm.getId(), (MockVMVO)vm);
@@ -518,7 +506,7 @@ public class MockVmManagerImpl extends ManagerBase implements MockVmManager {
             }
             txn.commit();
             return new StopAnswer(cmd, null, true);
-        } catch (Exception ex) {
+        } catch (final Exception ex) {
             txn.rollback();
             throw new CloudRuntimeException("unable to stop vm " + cmd.getVmName(), ex);
         } finally {
@@ -529,33 +517,33 @@ public class MockVmManagerImpl extends ManagerBase implements MockVmManager {
     }
 
     @Override
-    public RebootAnswer rebootVM(RebootCommand cmd) {
+    public RebootAnswer rebootVM(final RebootCommand cmd) {
         return new RebootAnswer(cmd, "Rebooted " + cmd.getVmName(), true);
     }
 
     @Override
-    public Answer getVncPort(GetVncPortCommand cmd) {
+    public Answer getVncPort(final GetVncPortCommand cmd) {
         return new GetVncPortAnswer(cmd, 0);
     }
 
     @Override
-    public Answer CheckConsoleProxyLoad(CheckConsoleProxyLoadCommand cmd) {
+    public Answer CheckConsoleProxyLoad(final CheckConsoleProxyLoadCommand cmd) {
         return Answer.createUnsupportedCommandAnswer(cmd);
     }
 
     @Override
-    public Answer WatchConsoleProxyLoad(WatchConsoleProxyLoadCommand cmd) {
+    public Answer WatchConsoleProxyLoad(final WatchConsoleProxyLoadCommand cmd) {
         return Answer.createUnsupportedCommandAnswer(cmd);
     }
 
     @Override
-    public GetDomRVersionAnswer getDomRVersion(GetDomRVersionCmd cmd) {
-        String template_version = "CloudStack Release "+ NetworkOrchestrationService.MinVRVersion.defaultValue();
+    public GetDomRVersionAnswer getDomRVersion(final GetDomRVersionCmd cmd) {
+        final String template_version = "CloudStack Release "+ NetworkOrchestrationService.MinVRVersion.defaultValue();
         return new GetDomRVersionAnswer(cmd, null, template_version, UUID.randomUUID().toString());
     }
 
     @Override
-    public SecurityGroupRuleAnswer AddSecurityGroupRules(SecurityGroupRulesCmd cmd, SimulatorInfo info) {
+    public SecurityGroupRuleAnswer AddSecurityGroupRules(final SecurityGroupRulesCmd cmd, final SimulatorInfo info) {
         if (!info.isEnabled()) {
             return new SecurityGroupRuleAnswer(cmd, false, "Disabled", SecurityGroupRuleAnswer.FailureReason.CANNOT_BRIDGE_FIREWALL);
         }
@@ -575,11 +563,11 @@ public class MockVmManagerImpl extends ManagerBase implements MockVmManager {
         return new SecurityGroupRuleAnswer(cmd);
     }
 
-    private boolean logSecurityGroupAction(SecurityGroupRulesCmd cmd, Ternary<String, Long, Long> rule) {
+    private boolean logSecurityGroupAction(final SecurityGroupRulesCmd cmd, final Ternary<String, Long, Long> rule) {
         String action = ", do nothing";
         String reason = ", reason=";
-        Long currSeqnum = rule == null ? null : rule.third();
-        String currSig = rule == null ? null : rule.first();
+        final Long currSeqnum = rule == null ? null : rule.third();
+        final String currSig = rule == null ? null : rule.first();
         boolean updateSeqnoAndSig = false;
         if (currSeqnum != null) {
             if (cmd.getSeqNum() > currSeqnum) {
@@ -587,7 +575,7 @@ public class MockVmManagerImpl extends ManagerBase implements MockVmManager {
                 updateSeqnoAndSig = true;
                 if (!cmd.getSignature().equals(currSig)) {
                     s_logger.info("New seqno received: " + cmd.getSeqNum() + " curr=" + currSeqnum + " new signature received:" + cmd.getSignature() + " curr=" +
-                        currSig + ", updated iptables");
+                            currSig + ", updated iptables");
                     action = ", updated iptables";
                     reason = reason + "seqno_increased_sig_changed";
                 } else {
@@ -600,13 +588,13 @@ public class MockVmManagerImpl extends ManagerBase implements MockVmManager {
             } else {
                 if (!cmd.getSignature().equals(currSig)) {
                     s_logger.info("Identical seqno received: " + cmd.getSeqNum() + " new signature received:" + cmd.getSignature() + " curr=" + currSig +
-                        ", updated iptables");
+                            ", updated iptables");
                     action = ", updated iptables";
                     reason = reason + "seqno_same_sig_changed";
                     updateSeqnoAndSig = true;
                 } else {
                     s_logger.info("Identical seqno received: " + cmd.getSeqNum() + " curr=" + currSeqnum + " no change in signature:" + cmd.getSignature() +
-                        ", do nothing");
+                            ", do nothing");
                     reason = reason + "seqno_same_sig_same";
                 }
             }
@@ -617,32 +605,32 @@ public class MockVmManagerImpl extends ManagerBase implements MockVmManager {
             reason = ", seqno_new";
         }
         s_logger.info("Programmed network rules for vm " + cmd.getVmName() + " seqno=" + cmd.getSeqNum() + " signature=" + cmd.getSignature() + " guestIp=" +
-            cmd.getGuestIp() + ", numIngressRules=" + cmd.getIngressRuleSet().length + ", numEgressRules=" + cmd.getEgressRuleSet().length + " total cidrs=" +
-            cmd.getTotalNumCidrs() + action + reason);
+                cmd.getGuestIp() + ", numIngressRules=" + cmd.getIngressRuleSet().length + ", numEgressRules=" + cmd.getEgressRuleSet().length + " total cidrs=" +
+                cmd.getTotalNumCidrs() + action + reason);
         return updateSeqnoAndSig;
     }
 
     @Override
-    public Answer SavePassword(SavePasswordCommand cmd) {
+    public Answer SavePassword(final SavePasswordCommand cmd) {
         return new Answer(cmd);
     }
 
     @Override
-    public HashMap<String, Pair<Long, Long>> syncNetworkGroups(SimulatorInfo info) {
-        HashMap<String, Pair<Long, Long>> maps = new HashMap<String, Pair<Long, Long>>();
+    public HashMap<String, Pair<Long, Long>> syncNetworkGroups(final SimulatorInfo info) {
+        final HashMap<String, Pair<Long, Long>> maps = new HashMap<String, Pair<Long, Long>>();
 
-        Map<String, Ternary<String, Long, Long>> rules = _securityRules.get(info.getHostUuid());
+        final Map<String, Ternary<String, Long, Long>> rules = _securityRules.get(info.getHostUuid());
         if (rules == null) {
             return maps;
         }
-        for (Map.Entry<String, Ternary<String, Long, Long>> rule : rules.entrySet()) {
+        for (final Map.Entry<String, Ternary<String, Long, Long>> rule : rules.entrySet()) {
             maps.put(rule.getKey(), new Pair<Long, Long>(rule.getValue().second(), rule.getValue().third()));
         }
         return maps;
     }
 
     @Override
-    public Answer fence(FenceCommand cmd) {
-       return new FenceAnswer(cmd);
+    public Answer fence(final FenceCommand cmd) {
+        return new FenceAnswer(cmd);
     }
 }


Mime
View raw message