You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2013/11/18 19:24:56 UTC

[5/6] Checkstyle adjustments in code and configuration

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java
index 3e9e16a..7ce9190 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java
@@ -129,48 +129,52 @@ import com.cloud.vm.dao.NicDao;
         SourceNatServiceProvider.class, StaticNatServiceProvider.class,
         PortForwardingServiceProvider.class, IpDeployer.class} )
 public class NiciraNvpElement extends AdapterBase implements
-ConnectivityProvider, SourceNatServiceProvider,
-PortForwardingServiceProvider, StaticNatServiceProvider,
-NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
+        ConnectivityProvider, SourceNatServiceProvider,
+        PortForwardingServiceProvider, StaticNatServiceProvider,
+        NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
+
+    private static final int MAX_PORT = 65535;
+    private static final int MIN_PORT = 0;
+
     private static final Logger s_logger = Logger
             .getLogger(NiciraNvpElement.class);
 
     private static final Map<Service, Map<Capability, String>> capabilities = setCapabilities();
 
     @Inject
-    NicDao _nicDao;
+    protected NicDao nicDao;
     @Inject
-    ResourceManager _resourceMgr;
+    protected ResourceManager resourceMgr;
     @Inject
-    PhysicalNetworkDao _physicalNetworkDao;
+    protected PhysicalNetworkDao physicalNetworkDao;
     @Inject
-    PhysicalNetworkServiceProviderDao _physicalNetworkServiceProviderDao;
+    protected PhysicalNetworkServiceProviderDao physicalNetworkServiceProviderDao;
     @Inject
-    NiciraNvpDao _niciraNvpDao;
+    protected NiciraNvpDao niciraNvpDao;
     @Inject
-    HostDetailsDao _hostDetailsDao;
+    protected HostDetailsDao hostDetailsDao;
     @Inject
-    HostDao _hostDao;
+    protected HostDao hostDao;
     @Inject
-    AgentManager _agentMgr;
+    protected AgentManager agentMgr;
     @Inject
-    NiciraNvpNicMappingDao _niciraNvpNicMappingDao;
+    protected NiciraNvpNicMappingDao niciraNvpNicMappingDao;
     @Inject
-    NiciraNvpRouterMappingDao _niciraNvpRouterMappingDao;
+    protected NiciraNvpRouterMappingDao niciraNvpRouterMappingDao;
     @Inject
-    NetworkDao _networkDao;
+    protected NetworkDao networkDao;
     @Inject
-    NetworkOrchestrationService _networkManager;
+    protected NetworkOrchestrationService networkManager;
     @Inject
-    NetworkModel _networkModel;
+    protected NetworkModel networkModel;
     @Inject
-    ConfigurationManager _configMgr;
+    protected ConfigurationManager configMgr;
     @Inject
-    NetworkServiceMapDao _ntwkSrvcDao;
+    protected NetworkServiceMapDao ntwkSrvcDao;
     @Inject
-    VlanDao _vlanDao;
+    protected VlanDao vlanDao;
     @Inject
-    IpAddressManager _ipAddrMgr;
+    protected IpAddressManager ipAddrMgr;
 
     @Override
     public Map<Service, Map<Capability, String>> getCapabilities() {
@@ -189,14 +193,14 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
             return false;
         }
 
-        if (!_networkModel.isProviderForNetwork(getProvider(),
+        if (!networkModel.isProviderForNetwork(getProvider(),
                 network.getId())) {
             s_logger.debug("NiciraNvpElement is not a provider for network "
                     + network.getDisplayText());
             return false;
         }
 
-        if (!_ntwkSrvcDao.canProviderSupportServiceInNetwork(network.getId(),
+        if (!ntwkSrvcDao.canProviderSupportServiceInNetwork(network.getId(),
                 service, Network.Provider.NiciraNvp)) {
             s_logger.debug("NiciraNvpElement can't provide the "
                     + service.getName() + " service on network "
@@ -211,15 +215,15 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
     public boolean configure(String name, Map<String, Object> params)
             throws ConfigurationException {
         super.configure(name, params);
-        _resourceMgr.registerResourceStateAdapter(name, this);
+        resourceMgr.registerResourceStateAdapter(name, this);
         return true;
     }
 
     @Override
     public boolean implement(Network network, NetworkOffering offering,
             DeployDestination dest, ReservationContext context)
-                    throws ConcurrentOperationException, ResourceUnavailableException,
-                    InsufficientCapacityException {
+            throws ConcurrentOperationException, ResourceUnavailableException,
+            InsufficientCapacityException {
         s_logger.debug("entering NiciraNvpElement implement function for network "
                 + network.getDisplayText()
                 + " (state "
@@ -235,7 +239,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
             return false;
         }
 
-        List<NiciraNvpDeviceVO> devices = _niciraNvpDao
+        List<NiciraNvpDeviceVO> devices = niciraNvpDao
                 .listByPhysicalNetwork(network.getPhysicalNetworkId());
         if (devices.isEmpty()) {
             s_logger.error("No NiciraNvp Controller on physical network "
@@ -243,17 +247,22 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
             return false;
         }
         NiciraNvpDeviceVO niciraNvpDevice = devices.get(0);
-        HostVO niciraNvpHost = _hostDao.findById(niciraNvpDevice.getHostId());
-        _hostDao.loadDetails(niciraNvpHost);
+        HostVO niciraNvpHost = hostDao.findById(niciraNvpDevice.getHostId());
+        hostDao.loadDetails(niciraNvpHost);
 
         Account owner = context.getAccount();
 
+        /*
+         * TODO Shouldn't we lock the network as we might need to do
+         * multiple operations that should be done only once.
+         */
+
         // Implement SourceNat immediately as we have al the info already
-        if (_networkModel.isProviderSupportServiceInNetwork(
+        if (networkModel.isProviderSupportServiceInNetwork(
                 network.getId(), Service.SourceNat, Provider.NiciraNvp)) {
             s_logger.debug("Apparently we are supposed to provide SourceNat on this network");
 
-            PublicIp sourceNatIp = _ipAddrMgr
+            PublicIp sourceNatIp = ipAddrMgr
                     .assignSourceNatIpAddressToGuestNetwork(owner, network);
             String publicCidr = sourceNatIp.getAddress().addr() + "/"
                     + NetUtils.getCidrSize(sourceNatIp.getVlanNetmask());
@@ -267,10 +276,10 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
                     BroadcastDomainType.getValue(network.getBroadcastUri()),
                     "router-" + network.getDisplayText(), publicCidr,
                     sourceNatIp.getGateway(), internalCidr, context
-                    .getDomain().getName()
-                    + "-"
-                    + context.getAccount().getAccountName());
-            CreateLogicalRouterAnswer answer = (CreateLogicalRouterAnswer)_agentMgr
+                            .getDomain().getName()
+                            + "-"
+                            + context.getAccount().getAccountName());
+            CreateLogicalRouterAnswer answer = (CreateLogicalRouterAnswer)agentMgr
                     .easySend(niciraNvpHost.getId(), cmd);
             if (answer.getResult() == false) {
                 s_logger.error("Failed to create Logical Router for network "
@@ -281,7 +290,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
             // Store the uuid so we can easily find it during cleanup
             NiciraNvpRouterMappingVO routermapping =
                     new NiciraNvpRouterMappingVO(answer.getLogicalRouterUuid(), network.getId());
-            _niciraNvpRouterMappingDao.persist(routermapping);
+            niciraNvpRouterMappingDao.persist(routermapping);
         }
 
         return true;
@@ -303,9 +312,9 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
             return false;
         }
 
-        NicVO nicVO = _nicDao.findById(nic.getId());
+        NicVO nicVO = nicDao.findById(nic.getId());
 
-        List<NiciraNvpDeviceVO> devices = _niciraNvpDao
+        List<NiciraNvpDeviceVO> devices = niciraNvpDao
                 .listByPhysicalNetwork(network.getPhysicalNetworkId());
         if (devices.isEmpty()) {
             s_logger.error("No NiciraNvp Controller on physical network "
@@ -313,15 +322,15 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
             return false;
         }
         NiciraNvpDeviceVO niciraNvpDevice = devices.get(0);
-        HostVO niciraNvpHost = _hostDao.findById(niciraNvpDevice.getHostId());
+        HostVO niciraNvpHost = hostDao.findById(niciraNvpDevice.getHostId());
 
-        NiciraNvpNicMappingVO existingNicMap = _niciraNvpNicMappingDao
+        NiciraNvpNicMappingVO existingNicMap = niciraNvpNicMappingDao
                 .findByNicUuid(nicVO.getUuid());
         if (existingNicMap != null) {
             FindLogicalSwitchPortCommand findCmd = new FindLogicalSwitchPortCommand(
                     existingNicMap.getLogicalSwitchUuid(),
                     existingNicMap.getLogicalSwitchPortUuid());
-            FindLogicalSwitchPortAnswer answer = (FindLogicalSwitchPortAnswer)_agentMgr
+            FindLogicalSwitchPortAnswer answer = (FindLogicalSwitchPortAnswer)agentMgr
                     .easySend(niciraNvpHost.getId(), findCmd);
 
             if (answer.getResult()) {
@@ -333,14 +342,14 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
                         BroadcastDomainType.getValue(network.getBroadcastUri()),
                         nicVO.getUuid(), context.getDomain().getName() + "-"
                                 + context.getAccount().getAccountName(),
-                                nic.getName());
-                _agentMgr.easySend(niciraNvpHost.getId(), cmd);
+                        nic.getName());
+                agentMgr.easySend(niciraNvpHost.getId(), cmd);
                 return true;
             } else {
                 s_logger.error("Stale entry found for nic " + nic.getName()
                         + " with logical switchport uuid "
                         + existingNicMap.getLogicalSwitchPortUuid());
-                _niciraNvpNicMappingDao.remove(existingNicMap.getId());
+                niciraNvpNicMappingDao.remove(existingNicMap.getId());
             }
         }
 
@@ -348,7 +357,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
                 BroadcastDomainType.getValue(network.getBroadcastUri()),
                 nicVO.getUuid(), context.getDomain().getName() + "-"
                         + context.getAccount().getAccountName(), nic.getName());
-        CreateLogicalSwitchPortAnswer answer = (CreateLogicalSwitchPortAnswer)_agentMgr
+        CreateLogicalSwitchPortAnswer answer = (CreateLogicalSwitchPortAnswer)agentMgr
                 .easySend(niciraNvpHost.getId(), cmd);
 
         if (answer == null || !answer.getResult()) {
@@ -358,7 +367,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
 
         NiciraNvpNicMappingVO nicMap = new NiciraNvpNicMappingVO(BroadcastDomainType.getValue(network.getBroadcastUri()),
                 answer.getLogicalSwitchPortUuid(), nicVO.getUuid());
-        _niciraNvpNicMappingDao.persist(nicMap);
+        niciraNvpNicMappingDao.persist(nicMap);
 
         return true;
     }
@@ -378,9 +387,9 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
             return false;
         }
 
-        NicVO nicVO = _nicDao.findById(nic.getId());
+        NicVO nicVO = nicDao.findById(nic.getId());
 
-        List<NiciraNvpDeviceVO> devices = _niciraNvpDao
+        List<NiciraNvpDeviceVO> devices = niciraNvpDao
                 .listByPhysicalNetwork(network.getPhysicalNetworkId());
         if (devices.isEmpty()) {
             s_logger.error("No NiciraNvp Controller on physical network "
@@ -388,9 +397,9 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
             return false;
         }
         NiciraNvpDeviceVO niciraNvpDevice = devices.get(0);
-        HostVO niciraNvpHost = _hostDao.findById(niciraNvpDevice.getHostId());
+        HostVO niciraNvpHost = hostDao.findById(niciraNvpDevice.getHostId());
 
-        NiciraNvpNicMappingVO nicMap = _niciraNvpNicMappingDao
+        NiciraNvpNicMappingVO nicMap = niciraNvpNicMappingDao
                 .findByNicUuid(nicVO.getUuid());
         if (nicMap == null) {
             s_logger.error("No mapping for nic " + nic.getName());
@@ -400,7 +409,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
         DeleteLogicalSwitchPortCommand cmd = new DeleteLogicalSwitchPortCommand(
                 nicMap.getLogicalSwitchUuid(),
                 nicMap.getLogicalSwitchPortUuid());
-        DeleteLogicalSwitchPortAnswer answer = (DeleteLogicalSwitchPortAnswer)_agentMgr
+        DeleteLogicalSwitchPortAnswer answer = (DeleteLogicalSwitchPortAnswer)agentMgr
                 .easySend(niciraNvpHost.getId(), cmd);
 
         if (answer == null || !answer.getResult()) {
@@ -408,7 +417,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
             return false;
         }
 
-        _niciraNvpNicMappingDao.remove(nicMap.getId());
+        niciraNvpNicMappingDao.remove(nicMap.getId());
 
         return true;
     }
@@ -421,7 +430,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
             return false;
         }
 
-        List<NiciraNvpDeviceVO> devices = _niciraNvpDao
+        List<NiciraNvpDeviceVO> devices = niciraNvpDao
                 .listByPhysicalNetwork(network.getPhysicalNetworkId());
         if (devices.isEmpty()) {
             s_logger.error("No NiciraNvp Controller on physical network "
@@ -429,15 +438,15 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
             return false;
         }
         NiciraNvpDeviceVO niciraNvpDevice = devices.get(0);
-        HostVO niciraNvpHost = _hostDao.findById(niciraNvpDevice.getHostId());
+        HostVO niciraNvpHost = hostDao.findById(niciraNvpDevice.getHostId());
 
-        if (_networkModel.isProviderSupportServiceInNetwork(network.getId(),
+        if (networkModel.isProviderSupportServiceInNetwork(network.getId(),
                 Service.SourceNat, Provider.NiciraNvp)) {
             s_logger.debug("Apparently we were providing SourceNat on this network");
 
             // Deleting the LogicalRouter will also take care of all provisioned
             // nat rules.
-            NiciraNvpRouterMappingVO routermapping = _niciraNvpRouterMappingDao
+            NiciraNvpRouterMappingVO routermapping = niciraNvpRouterMappingDao
                     .findByNetworkId(network.getId());
             if (routermapping == null) {
                 s_logger.warn("No logical router uuid found for network "
@@ -448,14 +457,14 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
 
             DeleteLogicalRouterCommand cmd = new DeleteLogicalRouterCommand(routermapping.getLogicalRouterUuid());
             DeleteLogicalRouterAnswer answer =
-                    (DeleteLogicalRouterAnswer)_agentMgr.easySend(niciraNvpHost.getId(), cmd);
+                    (DeleteLogicalRouterAnswer)agentMgr.easySend(niciraNvpHost.getId(), cmd);
             if (answer.getResult() == false) {
                 s_logger.error("Failed to delete LogicalRouter for network "
                         + network.getDisplayText());
                 return false;
             }
 
-            _niciraNvpRouterMappingDao.remove(routermapping.getId());
+            niciraNvpRouterMappingDao.remove(routermapping.getId());
         }
 
         return true;
@@ -479,7 +488,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
     @Override
     public boolean shutdownProviderInstances(
             PhysicalNetworkServiceProvider provider, ReservationContext context)
-                    throws ConcurrentOperationException, ResourceUnavailableException {
+            throws ConcurrentOperationException, ResourceUnavailableException {
         // Nothing to do here.
         return true;
     }
@@ -547,7 +556,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
         NetworkDevice networkDevice = NetworkDevice
                 .getNetworkDevice(deviceName);
         final Long physicalNetworkId = cmd.getPhysicalNetworkId();
-        PhysicalNetworkVO physicalNetwork = _physicalNetworkDao
+        PhysicalNetworkVO physicalNetwork = physicalNetworkDao
                 .findById(physicalNetworkId);
         if (physicalNetwork == null) {
             throw new InvalidParameterValueException(
@@ -556,7 +565,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
         }
         long zoneId = physicalNetwork.getDataCenterId();
 
-        final PhysicalNetworkServiceProviderVO ntwkSvcProvider = _physicalNetworkServiceProviderDao
+        final PhysicalNetworkServiceProviderVO ntwkSvcProvider = physicalNetworkServiceProviderDao
                 .findByServiceProvider(physicalNetwork.getId(),
                         networkDevice.getNetworkServiceProvder());
         if (ntwkSvcProvider == null) {
@@ -571,7 +580,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
                     + physicalNetworkId + "to add this device");
         }
 
-        if (_niciraNvpDao.listByPhysicalNetwork(physicalNetworkId).size() != 0) {
+        if (niciraNvpDao.listByPhysicalNetwork(physicalNetworkId).size() != 0) {
             throw new CloudRuntimeException(
                     "A NiciraNvp device is already configured on this physical network");
         }
@@ -598,7 +607,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
         try {
             resource.configure(cmd.getHost(), hostdetails);
 
-            final Host host = _resourceMgr.addHost(zoneId, resource,
+            final Host host = resourceMgr.addHost(zoneId, resource,
                     Host.Type.L2Networking, params);
             if (host != null) {
                 return Transaction.execute(new TransactionCallback<NiciraNvpDeviceVO>() {
@@ -607,12 +616,12 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
                         NiciraNvpDeviceVO niciraNvpDevice = new NiciraNvpDeviceVO(host.getId(),
                                 physicalNetworkId, ntwkSvcProvider.getProviderName(),
                                 deviceName);
-                        _niciraNvpDao.persist(niciraNvpDevice);
+                        niciraNvpDao.persist(niciraNvpDevice);
 
                         DetailVO detail = new DetailVO(host.getId(),
                                 "niciranvpdeviceid", String.valueOf(niciraNvpDevice
                                         .getId()));
-                        _hostDetailsDao.persist(detail);
+                        hostDetailsDao.persist(detail);
 
                         return niciraNvpDevice;
                     }
@@ -629,8 +638,8 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
     @Override
     public NiciraNvpDeviceResponse createNiciraNvpDeviceResponse(
             NiciraNvpDeviceVO niciraNvpDeviceVO) {
-        HostVO niciraNvpHost = _hostDao.findById(niciraNvpDeviceVO.getHostId());
-        _hostDao.loadDetails(niciraNvpHost);
+        HostVO niciraNvpHost = hostDao.findById(niciraNvpDeviceVO.getHostId());
+        hostDao.loadDetails(niciraNvpHost);
 
         NiciraNvpDeviceResponse response = new NiciraNvpDeviceResponse();
         response.setDeviceName(niciraNvpDeviceVO.getDeviceName());
@@ -650,7 +659,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
     @Override
     public boolean deleteNiciraNvpDevice(DeleteNiciraNvpDeviceCmd cmd) {
         Long niciraDeviceId = cmd.getNiciraNvpDeviceId();
-        NiciraNvpDeviceVO niciraNvpDevice = _niciraNvpDao
+        NiciraNvpDeviceVO niciraNvpDevice = niciraNvpDao
                 .findById(niciraDeviceId);
         if (niciraNvpDevice == null) {
             throw new InvalidParameterValueException(
@@ -659,12 +668,12 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
 
         // Find the physical network we work for
         Long physicalNetworkId = niciraNvpDevice.getPhysicalNetworkId();
-        PhysicalNetworkVO physicalNetwork = _physicalNetworkDao
+        PhysicalNetworkVO physicalNetwork = physicalNetworkDao
                 .findById(physicalNetworkId);
         if (physicalNetwork != null) {
             // Lets see if there are networks that use us
             // Find the nicira networks on this physical network
-            List<NetworkVO> networkList = _networkDao
+            List<NetworkVO> networkList = networkDao
                     .listByPhysicalNetwork(physicalNetworkId);
 
             // Networks with broadcast type lswitch are ours
@@ -679,14 +688,14 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
             }
         }
 
-        HostVO niciraHost = _hostDao.findById(niciraNvpDevice.getHostId());
+        HostVO niciraHost = hostDao.findById(niciraNvpDevice.getHostId());
         Long hostId = niciraHost.getId();
 
         niciraHost.setResourceState(ResourceState.Maintenance);
-        _hostDao.update(hostId, niciraHost);
-        _resourceMgr.deleteHost(hostId, false, false);
+        hostDao.update(hostId, niciraHost);
+        resourceMgr.deleteHost(hostId, false, false);
 
-        _niciraNvpDao.remove(niciraDeviceId);
+        niciraNvpDao.remove(niciraDeviceId);
         return true;
     }
 
@@ -703,7 +712,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
         }
 
         if (niciraNvpDeviceId != null) {
-            NiciraNvpDeviceVO niciraNvpDevice = _niciraNvpDao
+            NiciraNvpDeviceVO niciraNvpDevice = niciraNvpDao
                     .findById(niciraNvpDeviceId);
             if (niciraNvpDevice == null) {
                 throw new InvalidParameterValueException(
@@ -712,14 +721,14 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
             }
             responseList.add(niciraNvpDevice);
         } else {
-            PhysicalNetworkVO physicalNetwork = _physicalNetworkDao
+            PhysicalNetworkVO physicalNetwork = physicalNetworkDao
                     .findById(physicalNetworkId);
             if (physicalNetwork == null) {
                 throw new InvalidParameterValueException(
                         "Could not find a physical network with id: "
                                 + physicalNetworkId);
             }
-            responseList = _niciraNvpDao
+            responseList = niciraNvpDao
                     .listByPhysicalNetwork(physicalNetworkId);
         }
 
@@ -730,7 +739,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
     public List<? extends Network> listNiciraNvpDeviceNetworks(
             ListNiciraNvpDeviceNetworksCmd cmd) {
         Long niciraDeviceId = cmd.getNiciraNvpDeviceId();
-        NiciraNvpDeviceVO niciraNvpDevice = _niciraNvpDao
+        NiciraNvpDeviceVO niciraNvpDevice = niciraNvpDao
                 .findById(niciraDeviceId);
         if (niciraNvpDevice == null) {
             throw new InvalidParameterValueException(
@@ -739,7 +748,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
 
         // Find the physical network we work for
         Long physicalNetworkId = niciraNvpDevice.getPhysicalNetworkId();
-        PhysicalNetworkVO physicalNetwork = _physicalNetworkDao
+        PhysicalNetworkVO physicalNetwork = physicalNetworkDao
                 .findById(physicalNetworkId);
         if (physicalNetwork == null) {
             // No such physical network, so no provisioned networks
@@ -747,7 +756,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
         }
 
         // Find the nicira networks on this physical network
-        List<NetworkVO> networkList = _networkDao
+        List<NetworkVO> networkList = networkDao
                 .listByPhysicalNetwork(physicalNetworkId);
 
         // Networks with broadcast type lswitch are ours
@@ -808,11 +817,11 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
     @Override
     public boolean applyIps(Network network,
             List<? extends PublicIpAddress> ipAddress, Set<Service> services)
-                    throws ResourceUnavailableException {
+            throws ResourceUnavailableException {
         if (services.contains(Service.SourceNat)) {
             // Only if we need to provide SourceNat we need to configure the logical router
             // SourceNat is required for StaticNat and PortForwarding
-            List<NiciraNvpDeviceVO> devices = _niciraNvpDao
+            List<NiciraNvpDeviceVO> devices = niciraNvpDao
                     .listByPhysicalNetwork(network.getPhysicalNetworkId());
             if (devices.isEmpty()) {
                 s_logger.error("No NiciraNvp Controller on physical network "
@@ -820,10 +829,10 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
                 return false;
             }
             NiciraNvpDeviceVO niciraNvpDevice = devices.get(0);
-            HostVO niciraNvpHost = _hostDao.findById(niciraNvpDevice.getHostId());
-            _hostDao.loadDetails(niciraNvpHost);
+            HostVO niciraNvpHost = hostDao.findById(niciraNvpDevice.getHostId());
+            hostDao.loadDetails(niciraNvpHost);
 
-            NiciraNvpRouterMappingVO routermapping = _niciraNvpRouterMappingDao
+            NiciraNvpRouterMappingVO routermapping = niciraNvpRouterMappingDao
                     .findByNetworkId(network.getId());
             if (routermapping == null) {
                 s_logger.error("No logical router uuid found for network "
@@ -842,11 +851,10 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
             }
             ConfigurePublicIpsOnLogicalRouterCommand cmd = new ConfigurePublicIpsOnLogicalRouterCommand(routermapping.getLogicalRouterUuid(),
                     niciraNvpHost.getDetail("l3gatewayserviceuuid"), cidrs);
-            ConfigurePublicIpsOnLogicalRouterAnswer answer = (ConfigurePublicIpsOnLogicalRouterAnswer)_agentMgr.easySend(niciraNvpHost.getId(), cmd);
+            ConfigurePublicIpsOnLogicalRouterAnswer answer = (ConfigurePublicIpsOnLogicalRouterAnswer)agentMgr.easySend(niciraNvpHost.getId(), cmd);
             //FIXME answer can be null if the host is down
             return answer.getResult();
-        }
-        else {
+        } else {
             s_logger.debug("No need to provision ip addresses as we are not providing L3 services.");
         }
 
@@ -859,12 +867,12 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
     @Override
     public boolean applyStaticNats(Network network,
             List<? extends StaticNat> rules)
-                    throws ResourceUnavailableException {
+            throws ResourceUnavailableException {
         if (!canHandle(network, Service.StaticNat)) {
             return false;
         }
 
-        List<NiciraNvpDeviceVO> devices = _niciraNvpDao
+        List<NiciraNvpDeviceVO> devices = niciraNvpDao
                 .listByPhysicalNetwork(network.getPhysicalNetworkId());
         if (devices.isEmpty()) {
             s_logger.error("No NiciraNvp Controller on physical network "
@@ -872,9 +880,9 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
             return false;
         }
         NiciraNvpDeviceVO niciraNvpDevice = devices.get(0);
-        HostVO niciraNvpHost = _hostDao.findById(niciraNvpDevice.getHostId());
+        HostVO niciraNvpHost = hostDao.findById(niciraNvpDevice.getHostId());
 
-        NiciraNvpRouterMappingVO routermapping = _niciraNvpRouterMappingDao
+        NiciraNvpRouterMappingVO routermapping = niciraNvpRouterMappingDao
                 .findByNetworkId(network.getId());
         if (routermapping == null) {
             s_logger.error("No logical router uuid found for network "
@@ -884,20 +892,20 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
 
         List<StaticNatRuleTO> staticNatRules = new ArrayList<StaticNatRuleTO>();
         for (StaticNat rule : rules) {
-            IpAddress sourceIp = _networkModel.getIp(rule.getSourceIpAddressId());
+            IpAddress sourceIp = networkModel.getIp(rule.getSourceIpAddressId());
             // Force the nat rule into the StaticNatRuleTO, no use making a new TO object
             // we only need the source and destination ip. Unfortunately no mention if a rule
             // is new.
             StaticNatRuleTO ruleTO = new StaticNatRuleTO(1,
-                    sourceIp.getAddress().addr(), 0, 65535,
-                    rule.getDestIpAddress(), 0, 65535,
+                    sourceIp.getAddress().addr(), MIN_PORT, MAX_PORT,
+                    rule.getDestIpAddress(), MIN_PORT, MAX_PORT,
                     "any", rule.isForRevoke(), false);
             staticNatRules.add(ruleTO);
         }
 
         ConfigureStaticNatRulesOnLogicalRouterCommand cmd =
                 new ConfigureStaticNatRulesOnLogicalRouterCommand(routermapping.getLogicalRouterUuid(), staticNatRules);
-        ConfigureStaticNatRulesOnLogicalRouterAnswer answer = (ConfigureStaticNatRulesOnLogicalRouterAnswer)_agentMgr.easySend(niciraNvpHost.getId(), cmd);
+        ConfigureStaticNatRulesOnLogicalRouterAnswer answer = (ConfigureStaticNatRulesOnLogicalRouterAnswer)agentMgr.easySend(niciraNvpHost.getId(), cmd);
 
         return answer.getResult();
     }
@@ -912,7 +920,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
             return false;
         }
 
-        List<NiciraNvpDeviceVO> devices = _niciraNvpDao
+        List<NiciraNvpDeviceVO> devices = niciraNvpDao
                 .listByPhysicalNetwork(network.getPhysicalNetworkId());
         if (devices.isEmpty()) {
             s_logger.error("No NiciraNvp Controller on physical network "
@@ -920,9 +928,9 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
             return false;
         }
         NiciraNvpDeviceVO niciraNvpDevice = devices.get(0);
-        HostVO niciraNvpHost = _hostDao.findById(niciraNvpDevice.getHostId());
+        HostVO niciraNvpHost = hostDao.findById(niciraNvpDevice.getHostId());
 
-        NiciraNvpRouterMappingVO routermapping = _niciraNvpRouterMappingDao
+        NiciraNvpRouterMappingVO routermapping = niciraNvpRouterMappingDao
                 .findByNetworkId(network.getId());
         if (routermapping == null) {
             s_logger.error("No logical router uuid found for network "
@@ -932,15 +940,15 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
 
         List<PortForwardingRuleTO> portForwardingRules = new ArrayList<PortForwardingRuleTO>();
         for (PortForwardingRule rule : rules) {
-            IpAddress sourceIp = _networkModel.getIp(rule.getSourceIpAddressId());
-            Vlan vlan = _vlanDao.findById(sourceIp.getVlanId());
+            IpAddress sourceIp = networkModel.getIp(rule.getSourceIpAddressId());
+            Vlan vlan = vlanDao.findById(sourceIp.getVlanId());
             PortForwardingRuleTO ruleTO = new PortForwardingRuleTO(rule, vlan.getVlanTag(), sourceIp.getAddress().addr());
             portForwardingRules.add(ruleTO);
         }
 
         ConfigurePortForwardingRulesOnLogicalRouterCommand cmd =
                 new ConfigurePortForwardingRulesOnLogicalRouterCommand(routermapping.getLogicalRouterUuid(), portForwardingRules);
-        ConfigurePortForwardingRulesOnLogicalRouterAnswer answer = (ConfigurePortForwardingRulesOnLogicalRouterAnswer)_agentMgr.easySend(niciraNvpHost.getId(), cmd);
+        ConfigurePortForwardingRulesOnLogicalRouterAnswer answer = (ConfigurePortForwardingRulesOnLogicalRouterAnswer)agentMgr.easySend(niciraNvpHost.getId(), cmd);
 
         return answer.getResult();
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java
index 7057915..15c4bb7 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java
@@ -66,30 +66,32 @@ import com.cloud.vm.VirtualMachineProfile;
 
 @Local(value = NetworkGuru.class)
 public class NiciraNvpGuestNetworkGuru extends GuestNetworkGuru {
+    private static final int MAX_NAME_LENGTH = 40;
+
     private static final Logger s_logger = Logger.getLogger(NiciraNvpGuestNetworkGuru.class);
 
     @Inject
-    NetworkModel _networkModel;
+    protected NetworkModel networkModel;
     @Inject
-    NetworkDao _networkDao;
+    protected NetworkDao networkDao;
     @Inject
-    DataCenterDao _zoneDao;
+    protected DataCenterDao zoneDao;
     @Inject
-    PhysicalNetworkDao _physicalNetworkDao;
+    protected PhysicalNetworkDao physicalNetworkDao;
     @Inject
-    AccountDao _accountDao;
+    protected AccountDao accountDao;
     @Inject
-    NiciraNvpDao _niciraNvpDao;
+    protected NiciraNvpDao niciraNvpDao;
     @Inject
-    HostDao _hostDao;
+    protected HostDao hostDao;
     @Inject
-    ResourceManager _resourceMgr;
+    protected ResourceManager resourceMgr;
     @Inject
-    AgentManager _agentMgr;
+    protected AgentManager agentMgr;
     @Inject
-    HostDetailsDao _hostDetailsDao;
+    protected HostDetailsDao hostDetailsDao;
     @Inject
-    NetworkOfferingServiceMapDao _ntwkOfferingSrvcDao;
+    protected NetworkOfferingServiceMapDao ntwkOfferingSrvcDao;
 
     public NiciraNvpGuestNetworkGuru() {
         super();
@@ -97,13 +99,13 @@ public class NiciraNvpGuestNetworkGuru extends GuestNetworkGuru {
     }
 
     @Override
-    protected boolean canHandle(NetworkOffering offering, final NetworkType networkType, final PhysicalNetwork physicalNetwork) {
+    protected boolean canHandle(final NetworkOffering offering, final NetworkType networkType, final PhysicalNetwork physicalNetwork) {
         // This guru handles only Guest Isolated network that supports Source nat service
         if (networkType == NetworkType.Advanced
                 && isMyTrafficType(offering.getTrafficType())
                 && offering.getGuestType() == Network.GuestType.Isolated
                 && isMyIsolationMethod(physicalNetwork)
-                && _ntwkOfferingSrvcDao.areServicesSupportedByNetworkOffering(offering.getId(), Service.Connectivity)) {
+                && ntwkOfferingSrvcDao.areServicesSupportedByNetworkOffering(offering.getId(), Service.Connectivity)) {
             return true;
         } else {
             s_logger.trace("We only take care of Guest networks of type   " + GuestType.Isolated + " in zone of type " + NetworkType.Advanced);
@@ -112,17 +114,17 @@ public class NiciraNvpGuestNetworkGuru extends GuestNetworkGuru {
     }
 
     @Override
-    public Network design(NetworkOffering offering, DeploymentPlan plan,
-            Network userSpecified, Account owner) {
+    public Network design(final NetworkOffering offering, final DeploymentPlan plan,
+            final Network userSpecified, final Account owner) {
         // Check of the isolation type of the related physical network is STT
-        PhysicalNetworkVO physnet = _physicalNetworkDao.findById(plan.getPhysicalNetworkId());
+        PhysicalNetworkVO physnet = physicalNetworkDao.findById(plan.getPhysicalNetworkId());
         DataCenter dc = _dcDao.findById(plan.getDataCenterId());
         if (!canHandle(offering, dc.getNetworkType(), physnet)) {
             s_logger.debug("Refusing to design this network");
             return null;
         }
 
-        List<NiciraNvpDeviceVO> devices = _niciraNvpDao.listByPhysicalNetwork(physnet.getId());
+        List<NiciraNvpDeviceVO> devices = niciraNvpDao.listByPhysicalNetwork(physnet.getId());
         if (devices.isEmpty()) {
             s_logger.error("No NiciraNvp Controller on physical network " + physnet.getName());
             return null;
@@ -141,8 +143,8 @@ public class NiciraNvpGuestNetworkGuru extends GuestNetworkGuru {
     }
 
     @Override
-    public Network implement(Network network, NetworkOffering offering,
-            DeployDestination dest, ReservationContext context)
+    public Network implement(final Network network, final NetworkOffering offering,
+            final DeployDestination dest, final ReservationContext context)
             throws InsufficientVirtualNetworkCapcityException {
         assert (network.getState() == State.Implementing) : "Why are we implementing " + network;
 
@@ -153,7 +155,7 @@ public class NiciraNvpGuestNetworkGuru extends GuestNetworkGuru {
 
         // physical network id can be null in Guest Network in Basic zone, so locate the physical network
         if (physicalNetworkId == null) {
-            physicalNetworkId = _networkModel.findPhysicalNetworkId(dcId, offering.getTags(), offering.getTrafficType());
+            physicalNetworkId = networkModel.findPhysicalNetworkId(dcId, offering.getTags(), offering.getTrafficType());
         }
 
         NetworkVO implemented = new NetworkVO(network.getTrafficType(), network.getMode(), network.getBroadcastDomainType(), network.getNetworkOfferingId(), State.Allocated,
@@ -172,24 +174,24 @@ public class NiciraNvpGuestNetworkGuru extends GuestNetworkGuru {
         if (name == null || name.isEmpty()) {
             name = ((NetworkVO)network).getUuid();
         }
-        if (name.length() > 40) {
-            name = name.substring(0, 39); // max length 40
+        if (name.length() > MAX_NAME_LENGTH) {
+            name = name.substring(0, MAX_NAME_LENGTH - 1); // max length 40
         }
 
-        List<NiciraNvpDeviceVO> devices = _niciraNvpDao.listByPhysicalNetwork(physicalNetworkId);
+        List<NiciraNvpDeviceVO> devices = niciraNvpDao.listByPhysicalNetwork(physicalNetworkId);
         if (devices.isEmpty()) {
             s_logger.error("No NiciraNvp Controller on physical network " + physicalNetworkId);
             return null;
         }
         NiciraNvpDeviceVO niciraNvpDevice = devices.get(0);
-        HostVO niciraNvpHost = _hostDao.findById(niciraNvpDevice.getHostId());
-        _hostDao.loadDetails(niciraNvpHost);
+        HostVO niciraNvpHost = hostDao.findById(niciraNvpDevice.getHostId());
+        hostDao.loadDetails(niciraNvpHost);
         String transportzoneuuid = niciraNvpHost.getDetail("transportzoneuuid");
         String transportzoneisotype = niciraNvpHost.getDetail("transportzoneisotype");
 
         CreateLogicalSwitchCommand cmd = new CreateLogicalSwitchCommand(transportzoneuuid, transportzoneisotype, name,
                 context.getDomain().getName() + "-" + context.getAccount().getAccountName());
-        CreateLogicalSwitchAnswer answer = (CreateLogicalSwitchAnswer)_agentMgr.easySend(niciraNvpHost.getId(), cmd);
+        CreateLogicalSwitchAnswer answer = (CreateLogicalSwitchAnswer)agentMgr.easySend(niciraNvpHost.getId(), cmd);
 
         if (answer == null || !answer.getResult()) {
             s_logger.error("CreateLogicalSwitchCommand failed");
@@ -209,9 +211,8 @@ public class NiciraNvpGuestNetworkGuru extends GuestNetworkGuru {
     }
 
     @Override
-    public void reserve(NicProfile nic, Network network,
-            VirtualMachineProfile vm,
-            DeployDestination dest, ReservationContext context)
+    public void reserve(final NicProfile nic, final Network network, final VirtualMachineProfile vm,
+            final DeployDestination dest, final ReservationContext context)
             throws InsufficientVirtualNetworkCapcityException,
             InsufficientAddressCapacityException {
         // TODO Auto-generated method stub
@@ -219,32 +220,30 @@ public class NiciraNvpGuestNetworkGuru extends GuestNetworkGuru {
     }
 
     @Override
-    public boolean release(NicProfile nic,
-            VirtualMachineProfile vm,
-            String reservationId) {
+    public boolean release(final NicProfile nic, final VirtualMachineProfile vm, final String reservationId) {
         // TODO Auto-generated method stub
         return super.release(nic, vm, reservationId);
     }
 
     @Override
-    public void shutdown(NetworkProfile profile, NetworkOffering offering) {
-        NetworkVO networkObject = _networkDao.findById(profile.getId());
+    public void shutdown(final NetworkProfile profile, final NetworkOffering offering) {
+        NetworkVO networkObject = networkDao.findById(profile.getId());
         if (networkObject.getBroadcastDomainType() != BroadcastDomainType.Lswitch ||
                 networkObject.getBroadcastUri() == null) {
             s_logger.warn("BroadcastUri is empty or incorrect for guestnetwork " + networkObject.getDisplayText());
             return;
         }
 
-        List<NiciraNvpDeviceVO> devices = _niciraNvpDao.listByPhysicalNetwork(networkObject.getPhysicalNetworkId());
+        List<NiciraNvpDeviceVO> devices = niciraNvpDao.listByPhysicalNetwork(networkObject.getPhysicalNetworkId());
         if (devices.isEmpty()) {
             s_logger.error("No NiciraNvp Controller on physical network " + networkObject.getPhysicalNetworkId());
             return;
         }
         NiciraNvpDeviceVO niciraNvpDevice = devices.get(0);
-        HostVO niciraNvpHost = _hostDao.findById(niciraNvpDevice.getHostId());
+        HostVO niciraNvpHost = hostDao.findById(niciraNvpDevice.getHostId());
 
         DeleteLogicalSwitchCommand cmd = new DeleteLogicalSwitchCommand(BroadcastDomainType.getValue(networkObject.getBroadcastUri()));
-        DeleteLogicalSwitchAnswer answer = (DeleteLogicalSwitchAnswer) _agentMgr.easySend(niciraNvpHost.getId(), cmd);
+        DeleteLogicalSwitchAnswer answer = (DeleteLogicalSwitchAnswer) agentMgr.easySend(niciraNvpHost.getId(), cmd);
 
         if (answer == null || !answer.getResult()) {
             s_logger.error("DeleteLogicalSwitchCommand failed");
@@ -254,7 +253,7 @@ public class NiciraNvpGuestNetworkGuru extends GuestNetworkGuru {
     }
 
     @Override
-    public boolean trash(Network network, NetworkOffering offering) {
+    public boolean trash(final Network network, final NetworkOffering offering) {
         return super.trash(network, offering);
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/ControlClusterStatus.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/ControlClusterStatus.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/ControlClusterStatus.java
index 2914d35..457f161 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/ControlClusterStatus.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/ControlClusterStatus.java
@@ -17,67 +17,65 @@
 package com.cloud.network.nicira;
 
 public class ControlClusterStatus {
-    private String cluster_status;
-    private Stats node_stats;
-    private Stats lqueue_stats;
-    private Stats lport_stats;
-    private Stats lrouterport_stats;
-    private Stats lswitch_stats;
-    private Stats zone_stats;
-    private Stats lrouter_stats;
-    private Stats security_profile_stats;
+    private String clusterStatus;
+    private Stats nodeStats;
+    private Stats queueStats;
+    private Stats portStats;
+    private Stats routerportStats;
+    private Stats switchStats;
+    private Stats zoneStats;
+    private Stats routerStats;
+    private Stats securityProfileStats;
 
     public String getClusterStatus() {
-        return cluster_status;
+        return clusterStatus;
     }
 
     public Stats getNodeStats() {
-        return node_stats;
+        return nodeStats;
     }
 
     public Stats getLqueueStats() {
-        return lqueue_stats;
+        return queueStats;
     }
 
     public Stats getLportStats() {
-        return lport_stats;
+        return portStats;
     }
 
     public Stats getLrouterportStats() {
-        return lrouterport_stats;
+        return routerportStats;
     }
 
     public Stats getLswitchStats() {
-        return lswitch_stats;
+        return switchStats;
     }
 
     public Stats getZoneStats() {
-        return zone_stats;
+        return zoneStats;
     }
 
     public Stats getLrouterStats() {
-        return lrouter_stats;
+        return routerStats;
     }
 
     public Stats getSecurityProfileStats() {
-        return security_profile_stats;
+        return securityProfileStats;
     }
 
     public class Stats {
-        private int error_state_count;
-        private int registered_count;
-        private int active_count;
+        private int errorStateCount;
+        private int registeredCount;
+        private int activeCount;
 
         public int getErrorStateCount() {
-            return error_state_count;
+            return errorStateCount;
         }
-
         public int getRegisteredCount() {
-            return registered_count;
+            return registeredCount;
         }
-
         public int getActiveCount() {
-            return active_count;
+            return activeCount;
         }
 
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/DestinationNatRule.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/DestinationNatRule.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/DestinationNatRule.java
index d149c4b..2a31dd5 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/DestinationNatRule.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/DestinationNatRule.java
@@ -28,15 +28,18 @@ public class DestinationNatRule extends NatRule {
         return toDestinationIpAddress;
     }
 
-    public void setToDestinationIpAddress(String toDestinationIpAddress) {
+
+    public void setToDestinationIpAddress(final String toDestinationIpAddress) {
         this.toDestinationIpAddress = toDestinationIpAddress;
     }
 
+
     public Integer getToDestinationPort() {
         return toDestinationPort;
     }
 
-    public void setToDestinationPort(Integer toDestinationPort) {
+
+    public void setToDestinationPort(final Integer toDestinationPort) {
         this.toDestinationPort = toDestinationPort;
     }
 
@@ -57,45 +60,59 @@ public class DestinationNatRule extends NatRule {
 
     @Override
     public boolean equals(Object obj) {
-        if (this == obj)
+        if (this == obj) {
             return true;
-        if (!super.equals(obj))
+        }
+        if (!super.equals(obj)) {
             return false;
-        if (getClass() != obj.getClass())
+        }
+        if (getClass() != obj.getClass()) {
             return false;
+        }
         DestinationNatRule other = (DestinationNatRule) obj;
         if (toDestinationIpAddress == null) {
-            if (other.toDestinationIpAddress != null)
+            if (other.toDestinationIpAddress != null) {
                 return false;
-        } else if (!toDestinationIpAddress.equals(other.toDestinationIpAddress))
+            }
+        } else if (!toDestinationIpAddress.equals(other.toDestinationIpAddress)) {
             return false;
+        }
         if (toDestinationPort == null) {
-            if (other.toDestinationPort != null)
+            if (other.toDestinationPort != null) {
                 return false;
-        } else if (!toDestinationPort.equals(other.toDestinationPort))
+            }
+        } else if (!toDestinationPort.equals(other.toDestinationPort)) {
             return false;
+        }
         return true;
     }
 
     @Override
     public boolean equalsIgnoreUuid(Object obj) {
-        if (this == obj)
+        if (this == obj) {
             return true;
-        if (!super.equalsIgnoreUuid(obj))
+        }
+        if (!super.equalsIgnoreUuid(obj)) {
             return false;
-        if (getClass() != obj.getClass())
+        }
+        if (getClass() != obj.getClass()) {
             return false;
+        }
         DestinationNatRule other = (DestinationNatRule) obj;
         if (toDestinationIpAddress == null) {
-            if (other.toDestinationIpAddress != null)
+            if (other.toDestinationIpAddress != null) {
                 return false;
-        } else if (!toDestinationIpAddress.equals(other.toDestinationIpAddress))
+            }
+        } else if (!toDestinationIpAddress.equals(other.toDestinationIpAddress)) {
             return false;
+        }
         if (toDestinationPort == null) {
-            if (other.toDestinationPort != null)
+            if (other.toDestinationPort != null) {
                 return false;
-        } else if (!toDestinationPort.equals(other.toDestinationPort))
+            }
+        } else if (!toDestinationPort.equals(other.toDestinationPort)) {
             return false;
+        }
         return true;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/L3GatewayAttachment.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/L3GatewayAttachment.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/L3GatewayAttachment.java
index 96d1991..515a751 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/L3GatewayAttachment.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/L3GatewayAttachment.java
@@ -20,33 +20,33 @@ package com.cloud.network.nicira;
  *
  */
 public class L3GatewayAttachment extends Attachment {
-    private String l3_gateway_service_uuid;
-    private String type = "L3GatewayAttachment";
-    private Long vlan_id;
+    private String l3GatewayServiceUuid;
+    private final String type = "L3GatewayAttachment";
+    private Long vlanId;
 
-    public L3GatewayAttachment(String l3_gateway_service_uuid) {
-        this.l3_gateway_service_uuid = l3_gateway_service_uuid;
+    public L3GatewayAttachment(String l3GatewayServiceUuid) {
+        this.l3GatewayServiceUuid = l3GatewayServiceUuid;
     }
 
-    public L3GatewayAttachment(String l3_gateway_service_uuid, long vlan_id) {
-        this.l3_gateway_service_uuid = l3_gateway_service_uuid;
-        this.vlan_id = vlan_id;
+    public L3GatewayAttachment(final String l3GatewayServiceUuid, final long vlanId) {
+        this.l3GatewayServiceUuid = l3GatewayServiceUuid;
+        this.vlanId = vlanId;
     }
 
     public String getL3GatewayServiceUuid() {
-        return l3_gateway_service_uuid;
+        return l3GatewayServiceUuid;
     }
 
-    public void setL3GatewayServiceUuid(String l3_gateway_service_uuid) {
-        this.l3_gateway_service_uuid = l3_gateway_service_uuid;
+    public void setL3GatewayServiceUuid(final String l3GatewayServiceUuid) {
+        this.l3GatewayServiceUuid = l3GatewayServiceUuid;
     }
 
     public long getVlanId() {
-        return vlan_id;
+        return vlanId;
     }
 
-    public void setVlanId(long vlan_id) {
-        this.vlan_id = vlan_id;
+    public void setVlanId(long vlanId) {
+        this.vlanId = vlanId;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalRouterConfig.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalRouterConfig.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalRouterConfig.java
index 088cefc..5c99e15 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalRouterConfig.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalRouterConfig.java
@@ -22,26 +22,26 @@ import java.util.List;
  *
  */
 public class LogicalRouterConfig {
-    private String display_name;
-    private RoutingConfig routing_config;
-    private String type = "LogicalRouterConfig";
+    private String displayName;
+    private RoutingConfig routingConfig;
+    private final String type = "LogicalRouterConfig";
     private String uuid;
     private List<NiciraNvpTag> tags;
 
     public RoutingConfig getRoutingConfig() {
-        return routing_config;
+        return routingConfig;
     }
 
-    public void setRoutingConfig(RoutingConfig routing_config) {
-        this.routing_config = routing_config;
+    public void setRoutingConfig(RoutingConfig routingConfig) {
+        this.routingConfig = routingConfig;
     }
 
     public String getDisplayName() {
-        return display_name;
+        return displayName;
     }
 
-    public void setDisplayName(String display_name) {
-        this.display_name = display_name;
+    public void setDisplayName(String displayName) {
+        this.displayName = displayName;
     }
 
     public String getUuid() {
@@ -59,5 +59,4 @@ public class LogicalRouterConfig {
     public void setTags(List<NiciraNvpTag> tags) {
         this.tags = tags;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalRouterPort.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalRouterPort.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalRouterPort.java
index 112825d..ed1b8da 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalRouterPort.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalRouterPort.java
@@ -22,13 +22,13 @@ import java.util.List;
  *
  */
 public class LogicalRouterPort {
-    private String display_name;
+    private String displayName;
     private List<NiciraNvpTag> tags;
     private Integer portno;
-    private boolean admin_status_enabled;
-    private List<String> ip_addresses;
-    private String mac_address;
-    private String type = "LogicalRouterPortConfig";
+    private boolean adminStatusEnabled;
+    private List<String> ipAddresses;
+    private String macAddress;
+    private final String type = "LogicalRouterPortConfig";
     private String uuid;
 
     public int getPortno() {
@@ -40,35 +40,35 @@ public class LogicalRouterPort {
     }
 
     public boolean isAdminStatusEnabled() {
-        return admin_status_enabled;
+        return adminStatusEnabled;
     }
 
-    public void setAdminStatusEnabled(boolean admin_status_enabled) {
-        this.admin_status_enabled = admin_status_enabled;
+    public void setAdminStatusEnabled(boolean adminStatusEnabled) {
+        this.adminStatusEnabled = adminStatusEnabled;
     }
 
     public List<String> getIpAddresses() {
-        return ip_addresses;
+        return ipAddresses;
     }
 
-    public void setIpAddresses(List<String> ip_addresses) {
-        this.ip_addresses = ip_addresses;
+    public void setIpAddresses(List<String> ipAddresses) {
+        this.ipAddresses = ipAddresses;
     }
 
     public String getMacAddress() {
-        return mac_address;
+        return macAddress;
     }
 
-    public void setMacAddress(String mac_address) {
-        this.mac_address = mac_address;
+    public void setMacAddress(String macAddress) {
+        this.macAddress = macAddress;
     }
 
     public String getDisplayName() {
-        return display_name;
+        return displayName;
     }
 
-    public void setDisplayName(String display_name) {
-        this.display_name = display_name;
+    public void setDisplayName(String displayName) {
+        this.displayName = displayName;
     }
 
     public List<NiciraNvpTag> getTags() {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalSwitch.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalSwitch.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalSwitch.java
index f022ff7..c2d75a7 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalSwitch.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalSwitch.java
@@ -19,31 +19,29 @@ package com.cloud.network.nicira;
 import java.util.List;
 
 public class LogicalSwitch {
-    private String display_name;
-    private boolean port_isolation_enabled;
+    private String displayName;
+    private boolean portIsolationEnabled;
     private List<NiciraNvpTag> tags;
-    private List<TransportZoneBinding> transport_zones;
+    private List<TransportZoneBinding> transportZones;
     private String type;
     private String uuid;
-    private String _href;
-    //private RequestQueryParameters _query;
-    //private LogicalSwitchRelations _relations;
-    private String _schema;
+    private String href;
+    private String schema;
 
-    public String getDisplay_name() {
-        return display_name;
+    public String getDisplayName() {
+        return displayName;
     }
 
-    public void setDisplay_name(String display_name) {
-        this.display_name = display_name;
+    public void setDisplayName(String displayName) {
+        this.displayName = displayName;
     }
 
-    public boolean isPort_isolation_enabled() {
-        return port_isolation_enabled;
+    public boolean isPortIsolationEnabled() {
+        return portIsolationEnabled;
     }
 
-    public void setPort_isolation_enabled(boolean port_isolation_enabled) {
-        this.port_isolation_enabled = port_isolation_enabled;
+    public void setPortIsolationEnabled(boolean portIsolationEnabled) {
+        this.portIsolationEnabled = portIsolationEnabled;
     }
 
     public String getType() {
@@ -62,20 +60,20 @@ public class LogicalSwitch {
         this.uuid = uuid;
     }
 
-    public String get_href() {
-        return _href;
+    public String getHref() {
+        return href;
     }
 
-    public void set_href(String _href) {
-        this._href = _href;
+    public void setHref(String href) {
+        this.href = href;
     }
 
-    public String get_schema() {
-        return _schema;
+    public String getSchema() {
+        return schema;
     }
 
-    public void set_schema(String _schema) {
-        this._schema = _schema;
+    public void setSchema(String schema) {
+        this.schema = schema;
     }
 
     public List<NiciraNvpTag> getTags() {
@@ -86,13 +84,12 @@ public class LogicalSwitch {
         this.tags = tags;
     }
 
-    public List<TransportZoneBinding> getTransport_zones() {
-        return transport_zones;
+    public List<TransportZoneBinding> getTransportZones() {
+        return transportZones;
     }
 
-    public void setTransport_zones(List<TransportZoneBinding> transport_zones) {
-        this.transport_zones = transport_zones;
+    public void setTransportZones(List<TransportZoneBinding> transportZones) {
+        this.transportZones = transportZones;
     }
 
-
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalSwitchPort.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalSwitchPort.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalSwitchPort.java
index aaf5494..fb21e93 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalSwitchPort.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/LogicalSwitchPort.java
@@ -19,14 +19,13 @@ package com.cloud.network.nicira;
 import java.util.List;
 
 public class LogicalSwitchPort {
-    private String display_name;
+    private String displayName;
     private List<NiciraNvpTag> tags;
     private Integer portno;
-    private boolean admin_status_enabled;
-    //private List<AddressPairs> allowed_address_pairs;
-    private String queue_uuid;
-    private List<String> security_profiles;
-    private List<String> mirror_targets;
+    private boolean adminStatusEnabled;
+    private String queueUuid;
+    private List<String> securityProfiles;
+    private List<String> mirrorTargets;
     private String type;
     private String uuid;
 
@@ -34,20 +33,20 @@ public class LogicalSwitchPort {
         super();
     }
 
-    public LogicalSwitchPort(String display_name, List<NiciraNvpTag> tags,
-            boolean admin_status_enabled) {
+    public LogicalSwitchPort(final String displayName, final List<NiciraNvpTag> tags,
+            final boolean adminStatusEnabled) {
         super();
-        this.display_name = display_name;
+        this.displayName = displayName;
         this.tags = tags;
-        this.admin_status_enabled = admin_status_enabled;
+        this.adminStatusEnabled = adminStatusEnabled;
     }
 
-    public String getDisplay_name() {
-        return display_name;
+    public String getDisplayName() {
+        return displayName;
     }
 
-    public void setDisplay_name(String display_name) {
-        this.display_name = display_name;
+    public void setDisplayName(String displayName) {
+        this.displayName = displayName;
     }
 
     public List<NiciraNvpTag> getTags() {
@@ -66,36 +65,36 @@ public class LogicalSwitchPort {
         this.portno = portno;
     }
 
-    public boolean isAdmin_status_enabled() {
-        return admin_status_enabled;
+    public boolean isAdminStatusEnabled() {
+        return adminStatusEnabled;
     }
 
-    public void setAdmin_status_enabled(boolean admin_status_enabled) {
-        this.admin_status_enabled = admin_status_enabled;
+    public void setAdminStatusEnabled(boolean adminStatusEnabled) {
+        this.adminStatusEnabled = adminStatusEnabled;
     }
 
-    public String getQueue_uuid() {
-        return queue_uuid;
+    public String getQueueUuid() {
+        return queueUuid;
     }
 
-    public void setQueue_uuid(String queue_uuid) {
-        this.queue_uuid = queue_uuid;
+    public void setQueueUuid(String queueUuid) {
+        this.queueUuid = queueUuid;
     }
 
-    public List<String> getSecurity_profiles() {
-        return security_profiles;
+    public List<String> getSecurityProfiles() {
+        return securityProfiles;
     }
 
-    public void setSecurity_profiles(List<String> security_profiles) {
-        this.security_profiles = security_profiles;
+    public void setSecurityProfiles(List<String> securityProfiles) {
+        this.securityProfiles = securityProfiles;
     }
 
-    public List<String> getMirror_targets() {
-        return mirror_targets;
+    public List<String> getMirrorTargets() {
+        return mirrorTargets;
     }
 
-    public void setMirror_targets(List<String> mirror_targets) {
-        this.mirror_targets = mirror_targets;
+    public void setMirrorTargets(List<String> mirrorTargets) {
+        this.mirrorTargets = mirrorTargets;
     }
 
     public String getType() {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/Match.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/Match.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/Match.java
index e437344..85c83a6 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/Match.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/Match.java
@@ -21,112 +21,134 @@ package com.cloud.network.nicira;
  */
 public class Match {
     private Integer protocol;
-    private String source_ip_addresses;
-    private String destination_ip_addresses;
-    private Integer source_port;
-    private Integer destination_port;
+    private String sourceIpAddresses;
+    private String destinationIpAddresses;
+    private Integer sourcePort;
+    private Integer destinationPort;
     private String ethertype = "IPv4";
 
     public Integer getProtocol() {
         return protocol;
     }
 
-    public void setProtocol(Integer protocol) {
+    public void setProtocol(final Integer protocol) {
         this.protocol = protocol;
     }
 
     public Integer getSourcePort() {
-        return source_port;
+        return sourcePort;
     }
 
-    public void setSourcePort(Integer source_port) {
-        this.source_port = source_port;
+    public void setSourcePort(final Integer sourcePort) {
+        this.sourcePort = sourcePort;
     }
 
     public Integer getDestinationPort() {
-        return destination_port;
+        return destinationPort;
     }
 
-    public void setDestinationPort(Integer destination_port) {
-        this.destination_port = destination_port;
+    public void setDestinationPort(final Integer destinationPort) {
+        this.destinationPort = destinationPort;
     }
 
     public String getEthertype() {
         return ethertype;
     }
 
-    public void setEthertype(String ethertype) {
+    public void setEthertype(final String ethertype) {
         this.ethertype = ethertype;
     }
 
     public String getSourceIpAddresses() {
-        return source_ip_addresses;
+        return sourceIpAddresses;
     }
 
-    public void setSourceIpAddresses(String source_ip_addresses) {
-        this.source_ip_addresses = source_ip_addresses;
+    public void setSourceIpAddresses(final String sourceIpAddresses) {
+        this.sourceIpAddresses = sourceIpAddresses;
     }
 
     public String getDestinationIpAddresses() {
-        return destination_ip_addresses;
+        return destinationIpAddresses;
     }
 
-    public void setDestinationIpAddresses(String destination_ip_addresses) {
-        this.destination_ip_addresses = destination_ip_addresses;
+    public void setDestinationIpAddresses(final String destinationIpAddresses) {
+        this.destinationIpAddresses = destinationIpAddresses;
     }
 
     @Override
     public int hashCode() {
         final int prime = 31;
         int result = 1;
-        result = prime * result + ((destination_ip_addresses == null) ? 0 : destination_ip_addresses.hashCode());
-        result = prime * result + ((destination_port == null) ? 0 : destination_port.hashCode());
-        result = prime * result + ((ethertype == null) ? 0 : ethertype.hashCode());
-        result = prime * result + ((protocol == null) ? 0 : protocol.hashCode());
-        result = prime * result + ((source_ip_addresses == null) ? 0 : source_ip_addresses.hashCode());
-        result = prime * result + ((source_port == null) ? 0 : source_port.hashCode());
+        result = prime
+                * result
+                + ((destinationIpAddresses == null) ? 0
+                        : destinationIpAddresses.hashCode());
+        result = prime
+                * result
+                + ((destinationPort == null) ? 0 : destinationPort
+                        .hashCode());
+        result = prime * result
+                + ((ethertype == null) ? 0 : ethertype.hashCode());
+        result = prime * result
+                + ((protocol == null) ? 0 : protocol.hashCode());
+        result = prime
+                * result
+                + ((sourceIpAddresses == null) ? 0 : sourceIpAddresses
+                        .hashCode());
+        result = prime * result
+                + ((sourcePort == null) ? 0 : sourcePort.hashCode());
         return result;
     }
 
     @Override
-    public boolean equals(Object obj) {
-        if (this == obj)
+    public boolean equals(final Object obj) {
+        if (this == obj) {
             return true;
-        if (obj == null)
+        }
+        if (obj == null) {
             return false;
-        if (getClass() != obj.getClass())
+        }
+        if (getClass() != obj.getClass()) {
             return false;
+        }
         Match other = (Match) obj;
-        if (destination_ip_addresses == null) {
-            if (other.destination_ip_addresses != null)
+        if (destinationIpAddresses == null) {
+            if (other.destinationIpAddresses != null)
                 return false;
-        } else if (!destination_ip_addresses.equals(other.destination_ip_addresses))
+        } else if (!destinationIpAddresses.equals(other.destinationIpAddresses)) {
             return false;
-        if (destination_port == null) {
-            if (other.destination_port != null)
+        }
+        if (destinationPort == null) {
+            if (other.destinationPort != null) {
                 return false;
-        } else if (!destination_port.equals(other.destination_port))
+            }
+        } else if (!destinationPort.equals(other.destinationPort)) {
             return false;
+        }
         if (ethertype == null) {
             if (other.ethertype != null)
                 return false;
-        } else if (!ethertype.equals(other.ethertype))
+        } else if (!ethertype.equals(other.ethertype)) {
             return false;
+        }
         if (protocol == null) {
             if (other.protocol != null)
                 return false;
-        } else if (!protocol.equals(other.protocol))
+        } else if (!protocol.equals(other.protocol)) {
             return false;
-        if (source_ip_addresses == null) {
-            if (other.source_ip_addresses != null)
+        }
+        if (sourceIpAddresses == null) {
+            if (other.sourceIpAddresses != null)
                 return false;
-        } else if (!source_ip_addresses.equals(other.source_ip_addresses))
+        } else if (!sourceIpAddresses.equals(other.sourceIpAddresses)) {
             return false;
-        if (source_port == null) {
-            if (other.source_port != null)
+        }
+        if (sourcePort == null) {
+            if (other.sourcePort != null)
                 return false;
-        } else if (!source_port.equals(other.source_port))
+        } else if (!sourcePort.equals(other.sourcePort)) {
             return false;
+        }
         return true;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NatRule.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NatRule.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NatRule.java
index f33f249..dd5720d 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NatRule.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NatRule.java
@@ -34,7 +34,7 @@ public abstract class NatRule {
         return match;
     }
 
-    public void setMatch(Match match) {
+    public void setMatch(final Match match) {
         this.match = match;
     }
 
@@ -42,7 +42,7 @@ public abstract class NatRule {
         return uuid;
     }
 
-    public void setUuid(UUID uuid) {
+    public void setUuid(final UUID uuid) {
         this.uuid = uuid;
     }
 
@@ -50,7 +50,7 @@ public abstract class NatRule {
         return type;
     }
 
-    public void setType(String type) {
+    public void setType(final String type) {
         this.type = type;
     }
 
@@ -58,7 +58,7 @@ public abstract class NatRule {
         return order;
     }
 
-    public void setOrder(int order) {
+    public void setOrder(final int order) {
         this.order = order;
     }
 
@@ -74,7 +74,7 @@ public abstract class NatRule {
     }
 
     @Override
-    public boolean equals(Object obj) {
+    public boolean equals(final Object obj) {
         if (this == obj)
             return true;
         if (obj == null)
@@ -102,7 +102,7 @@ public abstract class NatRule {
         return true;
     }
 
-    public boolean equalsIgnoreUuid(Object obj) {
+    public boolean equalsIgnoreUuid(final Object obj) {
         if (this == obj)
             return true;
         if (obj == null)
@@ -124,6 +124,4 @@ public abstract class NatRule {
             return false;
         return true;
     }
-
-
 }