findbugs and PMD fixes This closes #168
Signed-off-by: Rajani Karuturi <rajanikarut...@gmail.com> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/581f3b79 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/581f3b79 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/581f3b79 Branch: refs/heads/master Commit: 581f3b79a362fde39c9c83cd72baef39a3f0c7a3 Parents: 9836ccd Author: KC Wang <kuangching.w...@gmail.com> Authored: Fri Sep 26 14:09:30 2014 -0700 Committer: Rajani Karuturi <rajanikarut...@gmail.com> Committed: Wed Apr 15 11:30:04 2015 +0530 ---------------------------------------------------------------------- .../src/com/cloud/agent/api/BcfAnswer.java | 6 +- .../src/com/cloud/agent/api/BcfCommand.java | 14 +- .../agent/api/CacheBcfTopologyCommand.java | 8 +- .../agent/api/CreateBcfAttachmentCommand.java | 22 +-- .../cloud/agent/api/CreateBcfRouterCommand.java | 4 +- .../api/CreateBcfRouterInterfaceCommand.java | 14 +- .../agent/api/CreateBcfSegmentCommand.java | 16 +- .../agent/api/CreateBcfStaticNatCommand.java | 14 +- .../agent/api/DeleteBcfAttachmentCommand.java | 10 +- .../agent/api/DeleteBcfSegmentCommand.java | 10 +- .../agent/api/DeleteBcfStaticNatCommand.java | 8 +- .../agent/api/GetControllerDataAnswer.java | 25 +-- .../agent/api/GetControllerDataCommand.java | 2 - .../agent/api/GetControllerHostsAnswer.java | 4 +- .../agent/api/GetControllerHostsCommand.java | 4 +- .../cloud/agent/api/SyncBcfTopologyCommand.java | 14 +- .../agent/api/UpdateBcfAttachmentCommand.java | 11 +- .../cloud/agent/api/UpdateBcfRouterCommand.java | 10 +- .../api/commands/AddBigSwitchBcfDeviceCmd.java | 25 ++- .../com/cloud/api/commands/BcfConstants.java | 8 +- .../commands/DeleteBigSwitchBcfDeviceCmd.java | 16 +- .../commands/ListBigSwitchBcfDevicesCmd.java | 22 +-- .../response/BigSwitchBcfDeviceResponse.java | 16 +- .../com/cloud/network/BigSwitchBcfDeviceVO.java | 10 +- .../com/cloud/network/bigswitch/AclData.java | 28 +-- .../cloud/network/bigswitch/AttachmentData.java | 31 ++-- .../network/bigswitch/BigSwitchBcfApi.java | 170 ++++++++++--------- .../network/bigswitch/BigSwitchBcfUtils.java | 14 +- .../network/element/BigSwitchBcfElement.java | 17 +- .../network/resource/BigSwitchBcfResource.java | 64 +++---- scripts/util/qemu-ivs-ifup | 8 +- 31 files changed, 314 insertions(+), 311 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/agent/api/BcfAnswer.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/BcfAnswer.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/BcfAnswer.java index d144386..45bb024 100644 --- a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/BcfAnswer.java +++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/BcfAnswer.java @@ -22,17 +22,17 @@ package com.cloud.agent.api; public class BcfAnswer extends Answer{ private final String hash; - public BcfAnswer(Command command, boolean success, String details) { + public BcfAnswer(final Command command, final boolean success, final String details) { super(command, success, details); this.hash = ""; } - public BcfAnswer(Command command, boolean success, String details, String hash) { + public BcfAnswer(final Command command, final boolean success, final String details, final String hash) { super(command, success, details); this.hash = hash; } - public BcfAnswer(Command command, Exception e) { + public BcfAnswer(final Command command, final Exception e) { super(command, e); this.hash = ""; } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/agent/api/BcfCommand.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/BcfCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/BcfCommand.java index b245945..6e08dad 100644 --- a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/BcfCommand.java +++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/BcfCommand.java @@ -22,8 +22,8 @@ package com.cloud.agent.api; import com.cloud.network.bigswitch.TopologyData; public class BcfCommand extends Command { - private TopologyData topology = null; - private boolean _topologySyncRequested = false; + private TopologyData topology; + private boolean topologySyncRequested; @Override public boolean executeInSequence() { @@ -34,15 +34,15 @@ public class BcfCommand extends Command { return topology; } - public void setTopology(TopologyData topology) { + public void setTopology(final TopologyData topology) { this.topology = topology; } - public boolean is_topologySyncRequested() { - return _topologySyncRequested; + public boolean isTopologySyncRequested() { + return topologySyncRequested; } - public void set_topologySyncRequested(boolean requested) { - this._topologySyncRequested = requested; + public void setTopologySyncRequested(final boolean requested) { + this.topologySyncRequested = requested; } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CacheBcfTopologyCommand.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CacheBcfTopologyCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CacheBcfTopologyCommand.java index 39e7b66..1ab22a5 100644 --- a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CacheBcfTopologyCommand.java +++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CacheBcfTopologyCommand.java @@ -22,10 +22,10 @@ package com.cloud.agent.api; import com.cloud.network.bigswitch.TopologyData; public class CacheBcfTopologyCommand extends Command{ - private final TopologyData topology; + private final TopologyData _topology; - public CacheBcfTopologyCommand(TopologyData topology){ - this.topology = topology; + public CacheBcfTopologyCommand(final TopologyData topology){ + this._topology = topology; } @Override @@ -34,6 +34,6 @@ public class CacheBcfTopologyCommand extends Command{ } public TopologyData getTopology() { - return topology; + return _topology; } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfAttachmentCommand.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfAttachmentCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfAttachmentCommand.java index 97d56a5..74e1215 100644 --- a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfAttachmentCommand.java +++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfAttachmentCommand.java @@ -20,18 +20,18 @@ package com.cloud.agent.api; public class CreateBcfAttachmentCommand extends BcfCommand { - private String _tenantId; - private String _tenantName; - private String _networkId; - private String _portId; - private String _nicId; - private Integer _vlan; - private String _ipv4; - private String _mac; + private final String _tenantId; + private final String _tenantName; + private final String _networkId; + private final String _portId; + private final String _nicId; + private final Integer _vlan; + private final String _ipv4; + private final String _mac; - public CreateBcfAttachmentCommand(String tenantId, String tenantName, - String networkId, String portId, String nicId, - Integer vlan, String ipv4, String mac) { + public CreateBcfAttachmentCommand(final String tenantId, final String tenantName, + final String networkId, final String portId, final String nicId, + final Integer vlan, final String ipv4, final String mac) { this._tenantId = tenantId; this._tenantName = tenantName; this._networkId = networkId; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfRouterCommand.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfRouterCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfRouterCommand.java index 4379ed4..8fcab6b 100644 --- a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfRouterCommand.java +++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfRouterCommand.java @@ -22,11 +22,11 @@ package com.cloud.agent.api; public class CreateBcfRouterCommand extends BcfCommand { private final String _tenantId; - public CreateBcfRouterCommand(String tenantId){ + public CreateBcfRouterCommand(final String tenantId){ this._tenantId = tenantId; } - public String get_tenantId() { + public String getTenantId() { return _tenantId; } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfRouterInterfaceCommand.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfRouterInterfaceCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfRouterInterfaceCommand.java index 4b8d227..66ad1a0 100644 --- a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfRouterInterfaceCommand.java +++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfRouterInterfaceCommand.java @@ -26,8 +26,8 @@ public class CreateBcfRouterInterfaceCommand extends BcfCommand{ private final String _gateway; private final String _networkName; - public CreateBcfRouterInterfaceCommand(String tenantId, String networkId, String cidr, - String gateway, String networkName){ + public CreateBcfRouterInterfaceCommand(final String tenantId, final String networkId, + final String cidr, final String gateway, final String networkName){ this._tenantId = tenantId; this._networkId = networkId; this._networkName = networkName; @@ -35,23 +35,23 @@ public class CreateBcfRouterInterfaceCommand extends BcfCommand{ this._gateway = gateway; } - public String get_tenantId() { + public String getTenantId() { return _tenantId; } - public String get_networkId() { + public String getNetworkId() { return _networkId; } - public String get_networkName() { + public String getNetworkName() { return _networkName; } - public String get_cidr() { + public String getCidr() { return _cidr; } - public String get_gateway() { + public String getGateway() { return _gateway; } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfSegmentCommand.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfSegmentCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfSegmentCommand.java index d54dac6..9bb75fe 100644 --- a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfSegmentCommand.java +++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfSegmentCommand.java @@ -20,14 +20,14 @@ package com.cloud.agent.api; public class CreateBcfSegmentCommand extends BcfCommand { - private String _tenantId; - private String _tenantName; - private String _networkId; - private String _networkName; - private Integer _vlan; - - public CreateBcfSegmentCommand(String tenantId, String tenantName, - String networkId, String networkName, Integer vlan) { + private final String _tenantId; + private final String _tenantName; + private final String _networkId; + private final String _networkName; + private final Integer _vlan; + + public CreateBcfSegmentCommand(final String tenantId, final String tenantName, + final String networkId, final String networkName, final Integer vlan) { this._tenantId = tenantId; this._tenantName = tenantName; this._networkId = networkId; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfStaticNatCommand.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfStaticNatCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfStaticNatCommand.java index 917f480..3db96f1 100644 --- a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfStaticNatCommand.java +++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/CreateBcfStaticNatCommand.java @@ -26,8 +26,8 @@ public class CreateBcfStaticNatCommand extends BcfCommand { private final String _publicIp; private final String _mac; - public CreateBcfStaticNatCommand(String tenantId, String networkId, - String privateIp, String publicIp, String mac){ + public CreateBcfStaticNatCommand(final String tenantId, final String networkId, + final String privateIp, final String publicIp, final String mac){ this._tenantId = tenantId; this._networkId = networkId; this._privateIp = privateIp; @@ -35,23 +35,23 @@ public class CreateBcfStaticNatCommand extends BcfCommand { this._mac = mac; } - public String get_tenantId() { + public String getTenantId() { return _tenantId; } - public String get_networkId() { + public String getNetworkId() { return _networkId; } - public String get_privateIp() { + public String getPrivateIp() { return _privateIp; } - public String get_publicIp() { + public String getPublicIp() { return _publicIp; } - public String get_mac() { + public String getMac() { return _mac; } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfAttachmentCommand.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfAttachmentCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfAttachmentCommand.java index d5cf13f..fc9f05f 100644 --- a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfAttachmentCommand.java +++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfAttachmentCommand.java @@ -20,12 +20,12 @@ package com.cloud.agent.api; public class DeleteBcfAttachmentCommand extends BcfCommand { - private String _tenantId; - private String _networkId; - private String _attachmentId; + private final String _tenantId; + private final String _networkId; + private final String _attachmentId; - public DeleteBcfAttachmentCommand(String tenantId, - String networkId, String attachmentId) { + public DeleteBcfAttachmentCommand(final String tenantId, + final String networkId, final String attachmentId) { this._tenantId = tenantId; this._networkId = networkId; this._attachmentId = attachmentId; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfSegmentCommand.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfSegmentCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfSegmentCommand.java index a6987a5..6c133a3 100644 --- a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfSegmentCommand.java +++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfSegmentCommand.java @@ -21,19 +21,19 @@ package com.cloud.agent.api; public class DeleteBcfSegmentCommand extends BcfCommand { - private String _tenantUuid; - private String _networkUuid; + private final String _tenantUuid; + private final String _networkUuid; - public DeleteBcfSegmentCommand(String tenantUuid, String networkUuid) { + public DeleteBcfSegmentCommand(final String tenantUuid, final String networkUuid) { this._tenantUuid = tenantUuid; this._networkUuid = networkUuid; } - public String get_tenantUuid() { + public String getTenantUuid() { return _tenantUuid; } public String getNetworkUuid() { return _networkUuid; } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfStaticNatCommand.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfStaticNatCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfStaticNatCommand.java index 7861bfb..e476565 100644 --- a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfStaticNatCommand.java +++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/DeleteBcfStaticNatCommand.java @@ -24,21 +24,21 @@ public class DeleteBcfStaticNatCommand extends BcfCommand { private final String _publicIp; private final String _floatingIpId; - public DeleteBcfStaticNatCommand(String tenantId, String publicIp){ + public DeleteBcfStaticNatCommand(final String tenantId, final String publicIp){ this._tenantId = tenantId; this._publicIp = publicIp; this._floatingIpId = publicIp.replace(".", "-"); } - public String get_tenantId() { + public String getTenantId() { return _tenantId; } - public String get_publicIp() { + public String getPublicIp() { return _publicIp; } - public String get_floatingIpId() { + public String getFloatingIpId() { return _floatingIpId; } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerDataAnswer.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerDataAnswer.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerDataAnswer.java index e32bfb0..9f200d8 100644 --- a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerDataAnswer.java +++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerDataAnswer.java @@ -20,26 +20,27 @@ package com.cloud.agent.api; public class GetControllerDataAnswer extends Answer { - private final String ipAddress; - private final boolean isMaster; + private final String _ipAddress; + private final boolean _isMaster; - public GetControllerDataAnswer(GetControllerDataCommand cmd, - String ipAddress, boolean isMaster){ - this.ipAddress = ipAddress; - this.isMaster = isMaster; + public GetControllerDataAnswer(final GetControllerDataCommand cmd, + final String ipAddress, final boolean isMaster){ + super(cmd); + this._ipAddress = ipAddress; + this._isMaster = isMaster; } - public GetControllerDataAnswer(Command command, Exception e) { + public GetControllerDataAnswer(final Command command, final Exception e) { super(command, e); - this.ipAddress = null; - this.isMaster = false; + this._ipAddress = null; + this._isMaster = false; } public String getIpAddress() { - return ipAddress; + return _ipAddress; } public boolean isMaster() { - return isMaster; + return _isMaster; } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerDataCommand.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerDataCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerDataCommand.java index 661ad16..96ad119 100644 --- a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerDataCommand.java +++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerDataCommand.java @@ -20,6 +20,4 @@ package com.cloud.agent.api; public class GetControllerDataCommand extends BcfCommand { - public GetControllerDataCommand() { - } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerHostsAnswer.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerHostsAnswer.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerHostsAnswer.java index 413e83e..e4c889c 100644 --- a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerHostsAnswer.java +++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerHostsAnswer.java @@ -28,13 +28,13 @@ public class GetControllerHostsAnswer { public HostVO getMaster() { return master; } - public void setMaster(HostVO master) { + public void setMaster(final HostVO master) { this.master = master; } public HostVO getSlave() { return slave; } - public void setSlave(HostVO slave) { + public void setSlave(final HostVO slave) { this.slave = slave; } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerHostsCommand.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerHostsCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerHostsCommand.java index 253c8e2..c984b28 100644 --- a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerHostsCommand.java +++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/GetControllerHostsCommand.java @@ -20,6 +20,4 @@ package com.cloud.agent.api; public class GetControllerHostsCommand extends BcfCommand { - public GetControllerHostsCommand() { - } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/agent/api/SyncBcfTopologyCommand.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/SyncBcfTopologyCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/SyncBcfTopologyCommand.java index 660151c..89c3e1c 100644 --- a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/SyncBcfTopologyCommand.java +++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/SyncBcfTopologyCommand.java @@ -20,19 +20,19 @@ package com.cloud.agent.api; public class SyncBcfTopologyCommand extends BcfCommand { - private final boolean networkIncluded; - private final boolean routerIncluded; + private final boolean _networkIncluded; + private final boolean _routerIncluded; - public SyncBcfTopologyCommand(boolean networkIncluded, boolean routerIncluded) { - this.networkIncluded = networkIncluded; - this.routerIncluded = routerIncluded; + public SyncBcfTopologyCommand(final boolean networkIncluded, final boolean routerIncluded) { + this._networkIncluded = networkIncluded; + this._routerIncluded = routerIncluded; } public boolean isNetworkIncluded() { - return networkIncluded; + return _networkIncluded; } public boolean isRouterIncluded() { - return routerIncluded; + return _routerIncluded; } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/agent/api/UpdateBcfAttachmentCommand.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/UpdateBcfAttachmentCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/UpdateBcfAttachmentCommand.java index 412ee21..4e054f0 100644 --- a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/UpdateBcfAttachmentCommand.java +++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/UpdateBcfAttachmentCommand.java @@ -20,12 +20,13 @@ package com.cloud.agent.api; public class UpdateBcfAttachmentCommand extends BcfCommand { - private String _networkId; - private String _attachmentId; - private String _tenantId; - private String _attachmentName; + private final String _networkId; + private final String _attachmentId; + private final String _tenantId; + private final String _attachmentName; - public UpdateBcfAttachmentCommand(String networkId, String attachmentId, String tenantId, String attachmentName) { + public UpdateBcfAttachmentCommand(final String networkId, final String attachmentId, + final String tenantId, final String attachmentName) { this._networkId = networkId; this._attachmentId = attachmentId; this._tenantId = tenantId; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/agent/api/UpdateBcfRouterCommand.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/UpdateBcfRouterCommand.java b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/UpdateBcfRouterCommand.java index 675a1ee..47a9356 100644 --- a/plugins/network-elements/bigswitch/src/com/cloud/agent/api/UpdateBcfRouterCommand.java +++ b/plugins/network-elements/bigswitch/src/com/cloud/agent/api/UpdateBcfRouterCommand.java @@ -27,9 +27,9 @@ import com.cloud.network.bigswitch.AclData; public class UpdateBcfRouterCommand extends BcfCommand { private String tenantId; private String publicIp; - private List<AclData> acls; + private final List<AclData> acls; - public UpdateBcfRouterCommand(String tenantId){ + public UpdateBcfRouterCommand(final String tenantId){ this.tenantId = tenantId; this.publicIp = null; this.acls = new ArrayList<AclData>(); @@ -39,7 +39,7 @@ public class UpdateBcfRouterCommand extends BcfCommand { return tenantId; } - public void setTenantId(String tenantId) { + public void setTenantId(final String tenantId) { this.tenantId = tenantId; } @@ -47,7 +47,7 @@ public class UpdateBcfRouterCommand extends BcfCommand { return publicIp; } - public void setPublicIp(String publicIp) { + public void setPublicIp(final String publicIp) { this.publicIp = publicIp; } @@ -55,7 +55,7 @@ public class UpdateBcfRouterCommand extends BcfCommand { return acls; } - public void addAcl(AclData acl){ + public void addAcl(final AclData acl){ this.acls.add(acl); } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/api/commands/AddBigSwitchBcfDeviceCmd.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/bigswitch/src/com/cloud/api/commands/AddBigSwitchBcfDeviceCmd.java b/plugins/network-elements/bigswitch/src/com/cloud/api/commands/AddBigSwitchBcfDeviceCmd.java index 24334ea..8231484 100644 --- a/plugins/network-elements/bigswitch/src/com/cloud/api/commands/AddBigSwitchBcfDeviceCmd.java +++ b/plugins/network-elements/bigswitch/src/com/cloud/api/commands/AddBigSwitchBcfDeviceCmd.java @@ -43,9 +43,9 @@ import com.cloud.utils.exception.CloudRuntimeException; @APICommand(name = "addBigSwitchBcfDevice", responseObject = BigSwitchBcfDeviceResponse.class, description = "Adds a BigSwitch BCF Controller device", since = "4.6.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class AddBigSwitchBcfDeviceCmd extends BaseAsyncCmd { - private static final String s_name = "addbigswitchbcfdeviceresponse"; + private static final String S_NAME = "addbigswitchbcfdeviceresponse"; @Inject - BigSwitchBcfElementService _bigswitchBcfElementService; + private BigSwitchBcfElementService bcfElementService; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// @@ -105,25 +105,24 @@ public class AddBigSwitchBcfDeviceCmd extends BaseAsyncCmd { public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException { try { - BigSwitchBcfDeviceVO bigswitchBcfDeviceVO = _bigswitchBcfElementService.addBigSwitchBcfDevice(this); - if (bigswitchBcfDeviceVO != null) { - BigSwitchBcfDeviceResponse response = _bigswitchBcfElementService.createBigSwitchBcfDeviceResponse(bigswitchBcfDeviceVO); - response.setObjectName("bigswitchbcfdevice"); - response.setResponseName(getCommandName()); - this.setResponseObject(response); - } else { + final BigSwitchBcfDeviceVO bigswitchBcfDeviceVO = bcfElementService.addBigSwitchBcfDevice(this); + if (bigswitchBcfDeviceVO == null) { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add BigSwitch BCF Controller device due to internal error."); } + final BigSwitchBcfDeviceResponse response = bcfElementService.createBigSwitchBcfDeviceResponse(bigswitchBcfDeviceVO); + response.setObjectName("bigswitchbcfdevice"); + response.setResponseName(getCommandName()); + this.setResponseObject(response); } catch (InvalidParameterValueException invalidParamExcp) { - throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage(), invalidParamExcp); } catch (CloudRuntimeException runtimeExcp) { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage(), runtimeExcp); } } @Override public String getCommandName() { - return s_name; + return S_NAME; } @Override @@ -133,7 +132,7 @@ public class AddBigSwitchBcfDeviceCmd extends BaseAsyncCmd { @Override public String getEventType() { - return BcfConstants.EVENT_EXTERNAL_BCF_CONTROLLER_ADD; + return BcfConstants.EVENT_BCF_CONTROLLER_ADD; } @Override http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/api/commands/BcfConstants.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/bigswitch/src/com/cloud/api/commands/BcfConstants.java b/plugins/network-elements/bigswitch/src/com/cloud/api/commands/BcfConstants.java index 4b6cc3a..157d9a3 100644 --- a/plugins/network-elements/bigswitch/src/com/cloud/api/commands/BcfConstants.java +++ b/plugins/network-elements/bigswitch/src/com/cloud/api/commands/BcfConstants.java @@ -27,11 +27,11 @@ public class BcfConstants { public static final String BIGSWITCH_BCF_DEVICE_ID = "bcfdeviceid"; public static final String BIGSWITCH_BCF_DEVICE_NAME = "bigswitchdevicename"; public static final String BIGSWITCH_BCF_DEVICE_NAT = "nat"; - public static final String EVENT_EXTERNAL_BCF_CONTROLLER_ADD = "PHYSICAL.BCFCONTROLLER.ADD"; - public static final String EVENT_EXTERNAL_BCF_CONTROLLER_DELETE = "PHYSICAL.BCFCONTROLLER.DELETE"; + public static final String EVENT_BCF_CONTROLLER_ADD = "PHYSICAL.BCFCONTROLLER.ADD"; + public static final String EVENT_BCF_CONTROLLER_DELETE = "PHYSICAL.BCFCONTROLLER.DELETE"; - public static final Provider BigSwitchBcf = new Provider("BigSwitchBcf", true); + public static final Provider BIG_SWITCH_BCF = new Provider("BigSwitchBcf", true); - public static final NetworkDevice BigSwitchBcfDevice = new NetworkDevice("BigSwitchBcf", BigSwitchBcf.getName()); + public static final NetworkDevice BIG_SWITCH_BCF_DEVICE = new NetworkDevice("BigSwitchBcf", BIG_SWITCH_BCF.getName()); } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/api/commands/DeleteBigSwitchBcfDeviceCmd.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/bigswitch/src/com/cloud/api/commands/DeleteBigSwitchBcfDeviceCmd.java b/plugins/network-elements/bigswitch/src/com/cloud/api/commands/DeleteBigSwitchBcfDeviceCmd.java index 520be8d..f558562 100644 --- a/plugins/network-elements/bigswitch/src/com/cloud/api/commands/DeleteBigSwitchBcfDeviceCmd.java +++ b/plugins/network-elements/bigswitch/src/com/cloud/api/commands/DeleteBigSwitchBcfDeviceCmd.java @@ -41,9 +41,9 @@ import com.cloud.utils.exception.CloudRuntimeException; @APICommand(name = "deleteBigSwitchBcfDevice", responseObject = SuccessResponse.class, description = " delete a BigSwitch BCF Controller device", since = "4.6.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteBigSwitchBcfDeviceCmd extends BaseAsyncCmd { - private static final String s_name = "deletebigswitchbcfdeviceresponse"; + private static final String S_NAME = "deletebigswitchbcfdeviceresponse"; @Inject - BigSwitchBcfElementService _bigswitchBcfElementService; + private BigSwitchBcfElementService bigswitchBcfElementService; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// @@ -72,24 +72,24 @@ public class DeleteBigSwitchBcfDeviceCmd extends BaseAsyncCmd { public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException { try { - boolean result = _bigswitchBcfElementService.deleteBigSwitchBcfDevice(this); + final boolean result = bigswitchBcfElementService.deleteBigSwitchBcfDevice(this); if (result) { - SuccessResponse response = new SuccessResponse(getCommandName()); + final SuccessResponse response = new SuccessResponse(getCommandName()); response.setResponseName(getCommandName()); this.setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete BigSwitch device."); } } catch (InvalidParameterValueException invalidParamExcp) { - throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage(), invalidParamExcp); } catch (CloudRuntimeException runtimeExcp) { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage(), runtimeExcp); } } @Override public String getCommandName() { - return s_name; + return S_NAME; } @Override @@ -99,7 +99,7 @@ public class DeleteBigSwitchBcfDeviceCmd extends BaseAsyncCmd { @Override public String getEventType() { - return BcfConstants.EVENT_EXTERNAL_BCF_CONTROLLER_DELETE; + return BcfConstants.EVENT_BCF_CONTROLLER_DELETE; } @Override http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/api/commands/ListBigSwitchBcfDevicesCmd.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/bigswitch/src/com/cloud/api/commands/ListBigSwitchBcfDevicesCmd.java b/plugins/network-elements/bigswitch/src/com/cloud/api/commands/ListBigSwitchBcfDevicesCmd.java index 25c6752..3e25848 100644 --- a/plugins/network-elements/bigswitch/src/com/cloud/api/commands/ListBigSwitchBcfDevicesCmd.java +++ b/plugins/network-elements/bigswitch/src/com/cloud/api/commands/ListBigSwitchBcfDevicesCmd.java @@ -48,10 +48,10 @@ import com.cloud.utils.exception.CloudRuntimeException; @APICommand(name = "listBigSwitchBcfDevices", responseObject = BigSwitchBcfDeviceResponse.class, description = "Lists BigSwitch BCF Controller devices", since = "4.6.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListBigSwitchBcfDevicesCmd extends BaseListCmd { - public static final Logger s_logger = Logger.getLogger(ListBigSwitchBcfDevicesCmd.class.getName()); - private static final String s_name = "listbigswitchbcfdeviceresponse"; + public static final Logger S_LOGGER = Logger.getLogger(ListBigSwitchBcfDevicesCmd.class.getName()); + private static final String S_NAME = "listbigswitchbcfdeviceresponse"; @Inject - BigSwitchBcfElementService _bigswitchBcfElementService; + private BigSwitchBcfElementService bigswitchBcfElementService; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// @@ -86,13 +86,13 @@ public class ListBigSwitchBcfDevicesCmd extends BaseListCmd { public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException { try { - List<BigSwitchBcfDeviceVO> bigswitchDevices = _bigswitchBcfElementService.listBigSwitchBcfDevices(this); - ListResponse<BigSwitchBcfDeviceResponse> response = new ListResponse<BigSwitchBcfDeviceResponse>(); - List<BigSwitchBcfDeviceResponse> bigswitchDevicesResponse = new ArrayList<BigSwitchBcfDeviceResponse>(); + final List<BigSwitchBcfDeviceVO> bigswitchDevices = bigswitchBcfElementService.listBigSwitchBcfDevices(this); + final ListResponse<BigSwitchBcfDeviceResponse> response = new ListResponse<BigSwitchBcfDeviceResponse>(); + final List<BigSwitchBcfDeviceResponse> bigswitchDevicesResponse = new ArrayList<BigSwitchBcfDeviceResponse>(); if (bigswitchDevices != null && !bigswitchDevices.isEmpty()) { - for (BigSwitchBcfDeviceVO bigswitchDeviceVO : bigswitchDevices) { - BigSwitchBcfDeviceResponse bigswitchDeviceResponse = _bigswitchBcfElementService.createBigSwitchBcfDeviceResponse(bigswitchDeviceVO); + for (final BigSwitchBcfDeviceVO bigswitchDeviceVO : bigswitchDevices) { + final BigSwitchBcfDeviceResponse bigswitchDeviceResponse = bigswitchBcfElementService.createBigSwitchBcfDeviceResponse(bigswitchDeviceVO); bigswitchDevicesResponse.add(bigswitchDeviceResponse); } } @@ -101,14 +101,14 @@ public class ListBigSwitchBcfDevicesCmd extends BaseListCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } catch (InvalidParameterValueException invalidParamExcp) { - throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage(), invalidParamExcp); } catch (CloudRuntimeException runtimeExcp) { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage(), runtimeExcp); } } @Override public String getCommandName() { - return s_name; + return S_NAME; } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/api/response/BigSwitchBcfDeviceResponse.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/bigswitch/src/com/cloud/api/response/BigSwitchBcfDeviceResponse.java b/plugins/network-elements/bigswitch/src/com/cloud/api/response/BigSwitchBcfDeviceResponse.java index 37906a5..1d1fe44 100644 --- a/plugins/network-elements/bigswitch/src/com/cloud/api/response/BigSwitchBcfDeviceResponse.java +++ b/plugins/network-elements/bigswitch/src/com/cloud/api/response/BigSwitchBcfDeviceResponse.java @@ -65,35 +65,35 @@ public class BigSwitchBcfDeviceResponse extends BaseResponse { return this.id; } - public void setId(String bcfDeviceId) { + public void setId(final String bcfDeviceId) { this.id = bcfDeviceId; } - public void setPhysicalNetworkId(String physicalNetworkId) { + public void setPhysicalNetworkId(final String physicalNetworkId) { this.physicalNetworkId = physicalNetworkId; } - public void setProviderName(String providerName) { + public void setProviderName(final String providerName) { this.providerName = providerName; } - public void setDeviceName(String deviceName) { + public void setDeviceName(final String deviceName) { this.deviceName = deviceName; } - public void setHostName(String hostName) { + public void setHostName(final String hostName) { this.hostName = hostName; } - public void setUserName(String username) { + public void setUserName(final String username) { this.username = username; } - public void setPassword(String password) { + public void setPassword(final String password) { this.password = password; } - public void setNat(Boolean nat) { + public void setNat(final Boolean nat) { this.nat = nat; } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/network/BigSwitchBcfDeviceVO.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/BigSwitchBcfDeviceVO.java b/plugins/network-elements/bigswitch/src/com/cloud/network/BigSwitchBcfDeviceVO.java index 8c7269e..1338eeb 100644 --- a/plugins/network-elements/bigswitch/src/com/cloud/network/BigSwitchBcfDeviceVO.java +++ b/plugins/network-elements/bigswitch/src/com/cloud/network/BigSwitchBcfDeviceVO.java @@ -73,8 +73,10 @@ public class BigSwitchBcfDeviceVO implements InternalIdentity { this.uuid = UUID.randomUUID().toString(); } - public BigSwitchBcfDeviceVO(long hostId, long physicalNetworkId, String providerName, String deviceName, - String hostName, String username, String password, Boolean nat, String hash) { + public BigSwitchBcfDeviceVO(final long hostId, final long physicalNetworkId, + final String providerName, final String deviceName,final String hostName, + final String username, final String password, final Boolean nat, + final String hash) { super(); this.hostId = hostId; this.physicalNetworkId = physicalNetworkId; @@ -97,7 +99,7 @@ public class BigSwitchBcfDeviceVO implements InternalIdentity { return uuid; } - public void setUuid(String uuid) { + public void setUuid(final String uuid) { this.uuid = uuid; } @@ -121,7 +123,7 @@ public class BigSwitchBcfDeviceVO implements InternalIdentity { return hash; } - public void setHash(String h) { + public void setHash(final String h) { hash = h; } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/AclData.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/AclData.java b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/AclData.java index 72b0cc9..150bc61 100644 --- a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/AclData.java +++ b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/AclData.java @@ -19,6 +19,8 @@ package com.cloud.network.bigswitch; +import java.util.Locale; + import com.cloud.network.vpc.NetworkACLItem; import com.google.gson.annotations.SerializedName; @@ -41,19 +43,19 @@ public class AclData { this.action = null; this.ipProto = null; this.source = new AclNetwork(); - this.destination = new AclNetwork();; + this.destination = new AclNetwork(); } public class AclNetwork{ - @SerializedName("cidr") private String cidr; - @SerializedName("port") private Integer port; + @SerializedName("cidr") final private String cidr; + @SerializedName("port") final private Integer port; public AclNetwork(){ this.cidr = null; this.port = null; } - public AclNetwork(String cidr, Integer port){ + public AclNetwork(final String cidr, final Integer port){ this.cidr = cidr; this.port = port; } @@ -62,19 +64,19 @@ public class AclData { public String getId() { return id; } - public void setId(String id) { + public void setId(final String id) { this.id = id; } public int getPriority() { return priority; } - public void setPriority(int priority) { + public void setPriority(final int priority) { this.priority = priority; } public String getAction() { return action; } - public void setAction(String action) { + public void setAction(final String action) { if(action.equalsIgnoreCase(NetworkACLItem.Action.Allow.name())){ this.action = "permit"; } else { @@ -84,9 +86,9 @@ public class AclData { public String getIpProto() { return ipProto; } - public void setIpProto(String ipProto) { - if (!ipProto.equalsIgnoreCase("all")){ - switch(ipProto.toLowerCase()){ + public void setIpProto(final String ipProto) { + if (ipProto != null && !ipProto.equalsIgnoreCase("all")){ + switch(ipProto.toLowerCase(Locale.ENGLISH)){ case "tcp": this.ipProto = "6"; break; @@ -96,19 +98,21 @@ public class AclData { case "icmp": this.ipProto = "1"; break; + default: + throw new IllegalArgumentException("Protocol in ACL rule not supported"); } } } public AclNetwork getSource() { return source; } - public void setSource(AclNetwork source) { + public void setSource(final AclNetwork source) { this.source = source; } public AclNetwork getDestination() { return destination; } - public void setDestination(AclNetwork destination) { + public void setDestination(final AclNetwork destination) { this.destination = destination; } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/AttachmentData.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/AttachmentData.java b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/AttachmentData.java index 649f704..40d99e3 100644 --- a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/AttachmentData.java +++ b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/AttachmentData.java @@ -20,6 +20,7 @@ package com.cloud.network.bigswitch; import java.util.ArrayList; +import java.util.List; import com.google.gson.annotations.SerializedName; @@ -28,7 +29,7 @@ import com.google.gson.annotations.SerializedName; * in CreateBcfAttachmentCommand */ public class AttachmentData { - @SerializedName("port") private Attachment attachment; + @SerializedName("port") final private Attachment attachment; public Attachment getAttachment() { return this.attachment; @@ -42,9 +43,9 @@ public class AttachmentData { @SerializedName("id") private String id; @SerializedName("tenant_name") private String tenantName; @SerializedName("vlan") private Integer vlan; - @SerializedName("fixed_ips") private ArrayList<IpAddress> fixedIps; + @SerializedName("fixed_ips") final private List<IpAddress> fixedIps; @SerializedName("mac_address") private String macAddress; - @SerializedName("bound_segment") private BoundSegment boundSegment; + @SerializedName("bound_segment") final private BoundSegment boundSegment; @SerializedName("binding:host_id") private String hostId; public Attachment(){ @@ -65,14 +66,14 @@ public class AttachmentData { } public class IpAddress { - @SerializedName("ip_address") private String ipAddress; + @SerializedName("ip_address") private String address; - public IpAddress(String ipAddr) { - this.ipAddress = ipAddr; + public IpAddress(final String ipAddr) { + this.address = ipAddr; } public String getIpAddress(){ - return ipAddress; + return address; } } @@ -82,7 +83,7 @@ public class AttachmentData { return tenantName; } - public void setTenantName(String tenantName) { + public void setTenantName(final String tenantName) { this.tenantName = tenantName; } @@ -90,7 +91,7 @@ public class AttachmentData { return id; } - public void setId(String id) { + public void setId(final String id) { this.id = id; } @@ -98,7 +99,7 @@ public class AttachmentData { return hostId; } - public void setHostId(String hostId) { + public void setHostId(final String hostId) { this.hostId = hostId; } @@ -106,16 +107,16 @@ public class AttachmentData { return vlan; } - public void setVlan(Integer vlan) { + public void setVlan(final Integer vlan) { this.vlan = vlan; this.boundSegment.setSegmentationId(vlan); } - public ArrayList<IpAddress> getIpv4List() { + public List<IpAddress> getIpv4List() { return fixedIps; } - public void addIpv4(String ipv4) { + public void addIpv4(final String ipv4) { this.fixedIps.add(new IpAddress(ipv4)); } @@ -123,7 +124,7 @@ public class AttachmentData { return macAddress; } - public void setMac(String mac) { + public void setMac(final String mac) { this.macAddress = mac; } @@ -135,7 +136,7 @@ public class AttachmentData { return state; } - public void setState(String state) { + public void setState(final String state) { this.state = state; } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfApi.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfApi.java b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfApi.java index 5c1efb0..16cb3f7 100644 --- a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfApi.java +++ b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfApi.java @@ -53,25 +53,25 @@ import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; public class BigSwitchBcfApi { - private static final Logger s_logger = Logger.getLogger(BigSwitchBcfApi.class); - private final static String s_protocol = "https"; - private final static String s_nsBaseUri = "/networkService/v1.1"; + private static final Logger S_LOGGER = Logger.getLogger(BigSwitchBcfApi.class); + private final static String S_PROTOCOL = "https"; + private final static String S_NS_BASE_URL = "/networkService/v1.1"; private final static String CONTENT_TYPE = "Content-type"; private final static String ACCEPT = "Accept"; private final static String CONTENT_JSON = "application/json"; private final static String HTTP_HEADER_INSTANCE_ID = "Instance-ID"; private final static String CLOUDSTACK_INSTANCE_ID = "cloudstack"; private final static String HASH_MATCH = "X-BSN-BVS-HASH-MATCH"; - private final static MultiThreadedHttpConnectionManager s_httpClientManager = new MultiThreadedHttpConnectionManager(); + private final static MultiThreadedHttpConnectionManager S_HTTP_CLIENT_MANAGER = new MultiThreadedHttpConnectionManager(); - private String _host; - private String _username; - private String _password; - private String _hash; - private String _zoneId; - private Boolean _nat; + private String host; + private String username; + private String password; + private String hash; + private String zoneId; + private Boolean nat; - private boolean _isMaster = false; + private boolean isMaster; private int _port = 8000; @@ -85,15 +85,15 @@ public class BigSwitchBcfApi { * in the unittests. */ protected HttpClient createHttpClient() { - return new HttpClient(s_httpClientManager); + return new HttpClient(S_HTTP_CLIENT_MANAGER); } - protected HttpMethod createMethod(String type, String uri, int port) throws BigSwitchBcfApiException { + protected HttpMethod createMethod(final String type, final String uri, final int port) throws BigSwitchBcfApiException { String url; try { - url = new URL(s_protocol, _host, port, uri).toString(); + url = new URL(S_PROTOCOL, host, port, uri).toString(); } catch (MalformedURLException e) { - s_logger.error("Unable to build Big Switch API URL", e); + S_LOGGER.error("Unable to build Big Switch API URL", e); throw new BigSwitchBcfApiException("Unable to build Big Switch API URL", e); } @@ -118,7 +118,7 @@ public class BigSwitchBcfApi { // Cast to ProtocolSocketFactory to avoid the deprecated constructor with the SecureProtocolSocketFactory parameter Protocol.registerProtocol("https", new Protocol("https", (ProtocolSocketFactory) new TrustingProtocolSocketFactory(), _port)); } catch (IOException e) { - s_logger.warn("Failed to register the TrustingProtocolSocketFactory, falling back to default SSLSocketFactory", e); + S_LOGGER.warn("Failed to register the TrustingProtocolSocketFactory, falling back to default SSLSocketFactory", e); } } @@ -126,99 +126,99 @@ public class BigSwitchBcfApi { * Setter used by UI to set BSN controller address * @param address */ - public void setControllerAddress(String address) { - this._host = address; + public void setControllerAddress(final String address) { + this.host = address; } /** * Setter used by UI to set BSN controller user name * @param username */ - public void setControllerUsername(String username) { - this._username = username; + public void setControllerUsername(final String username) { + this.username = username; } /** * Setter used by UI to set BSN controller password * @param password */ - public void setControllerPassword(String password) { - this._password = password; + public void setControllerPassword(final String password) { + this.password = password; } /** * Setter used by UI to set BSN controller NAT mode * @param nat */ - public void setControllerNat(Boolean nat) { - this._nat = nat; + public void setControllerNat(final Boolean nat) { + this.nat = nat; } public boolean isNatEnabled() { - return this._nat; + return this.nat; } - /** - * Setter used by UI to set BSN controller password - * @param password - */ - public void setZoneId(String zoneId) { - this._zoneId = zoneId; + public void setZoneId(final String zoneId) { + this.zoneId = zoneId; } - public String createNetwork(NetworkData network) throws BigSwitchBcfApiException { - String uri = s_nsBaseUri + "/tenants/" + network.getNetwork().getTenantId() + "/networks"; + public String createNetwork(final NetworkData network) throws BigSwitchBcfApiException { + String uri = S_NS_BASE_URL + "/tenants/" + network.getNetwork().getTenantId() + "/networks"; return executeCreateObject(network, uri, Collections.<String, String> emptyMap()); } - public String deleteNetwork(String tenantId, String networkId) throws BigSwitchBcfApiException { - String uri = s_nsBaseUri + "/tenants/" + tenantId + "/networks/" + networkId; + public String deleteNetwork(final String tenantId, final String networkId) throws BigSwitchBcfApiException { + String uri = S_NS_BASE_URL + "/tenants/" + tenantId + "/networks/" + networkId; return executeDeleteObject(uri); } - public String createAttachment(String tenantId, String networkId, AttachmentData attachment) throws BigSwitchBcfApiException { - String uri = s_nsBaseUri + "/tenants/" + tenantId + "/networks/" + networkId + "/ports/" + attachment.getAttachment().getId() + "/attachment"; + public String createAttachment(final String tenantId, final String networkId, + final AttachmentData attachment) throws BigSwitchBcfApiException { + String uri = S_NS_BASE_URL + "/tenants/" + tenantId + "/networks/" + networkId + "/ports/" + attachment.getAttachment().getId() + "/attachment"; return executeCreateObject(attachment, uri, Collections.<String, String> emptyMap()); } - public String modifyAttachment(String tenantId, String networkId, AttachmentData attachment) throws BigSwitchBcfApiException { - String uri = s_nsBaseUri + "/tenants/" + tenantId + "/networks/" + networkId + "/ports/" + attachment.getAttachment().getId() + "/attachment"; + public String modifyAttachment(final String tenantId, final String networkId, + final AttachmentData attachment) throws BigSwitchBcfApiException { + String uri = S_NS_BASE_URL + "/tenants/" + tenantId + "/networks/" + networkId + "/ports/" + attachment.getAttachment().getId() + "/attachment"; return executeUpdateObject(attachment, uri, Collections.<String, String> emptyMap()); } - public String deleteAttachment(String tenantId, String networkId, String attachmentId) throws BigSwitchBcfApiException { - String uri = s_nsBaseUri + "/tenants/" + tenantId + "/networks/" + networkId + "/ports/" + attachmentId + "/attachment"; + public String deleteAttachment(final String tenantId, final String networkId, + final String attachmentId) throws BigSwitchBcfApiException { + String uri = S_NS_BASE_URL + "/tenants/" + tenantId + "/networks/" + networkId + "/ports/" + attachmentId + "/attachment"; return executeDeleteObject(uri); } - public String createRouter(String tenantId, RouterData router) throws BigSwitchBcfApiException { - String uri = s_nsBaseUri + "/tenants/" + tenantId + "/routers"; + public String createRouter(final String tenantId, final RouterData router) throws BigSwitchBcfApiException { + String uri = S_NS_BASE_URL + "/tenants/" + tenantId + "/routers"; return executeCreateObject(router, uri, Collections.<String, String> emptyMap()); } - public String modifyRouter(String tenantId, RouterData router) throws BigSwitchBcfApiException, + public String modifyRouter(final String tenantId, final RouterData router) throws BigSwitchBcfApiException, IllegalArgumentException{ - String uri = s_nsBaseUri + "/tenants/" + tenantId + "/routers"; + String uri = S_NS_BASE_URL + "/tenants/" + tenantId + "/routers"; return executeCreateObject(router, uri, Collections.<String, String> emptyMap()); } - public String createRouterInterface(String tenantId, String routerId, RouterInterfaceData routerInterface) throws BigSwitchBcfApiException { - String uri = s_nsBaseUri + "/tenants/" + tenantId + "/routers/" + routerId + "/interfaces"; + public String createRouterInterface(final String tenantId, final String routerId, + final RouterInterfaceData routerInterface) throws BigSwitchBcfApiException { + String uri = S_NS_BASE_URL + "/tenants/" + tenantId + "/routers/" + routerId + "/interfaces"; return executeCreateObject(routerInterface, uri, Collections.<String, String> emptyMap()); } - public String createFloatingIp(String tenantId, FloatingIpData fip) throws BigSwitchBcfApiException { - String uri = s_nsBaseUri + "/tenants/" + tenantId + "/floatingips"; + public String createFloatingIp(final String tenantId, final FloatingIpData fip) throws BigSwitchBcfApiException { + String uri = S_NS_BASE_URL + "/tenants/" + tenantId + "/floatingips"; return executeCreateObject(fip, uri, Collections.<String, String> emptyMap()); } - public String deleteFloatingIp(String tenantId, String fipId) throws BigSwitchBcfApiException { - String uri = s_nsBaseUri + "/tenants/" + tenantId + "/floatingips/" + fipId; + public String deleteFloatingIp(final String tenantId, final String fipId) throws BigSwitchBcfApiException { + String uri = S_NS_BASE_URL + "/tenants/" + tenantId + "/floatingips/" + fipId; return executeDeleteObject(uri); } public ControlClusterStatus getControlClusterStatus() throws BigSwitchBcfApiException { - String uri = s_nsBaseUri + "/health"; + String uri = S_NS_BASE_URL + "/health"; ControlClusterStatus ccs = executeRetrieveObject(new TypeToken<ControlClusterStatus>() { }.getType(), uri, null); ccs.setStatus(true); @@ -226,7 +226,7 @@ public class BigSwitchBcfApi { } public Capabilities getCapabilities() throws BigSwitchBcfApiException { - String uri = s_nsBaseUri + "/capabilities"; + String uri = S_NS_BASE_URL + "/capabilities"; List<String> capslist = executeRetrieveObject(new TypeToken<List<String>>() { }.getType(), uri, null); Capabilities caps = new Capabilities(); @@ -234,28 +234,28 @@ public class BigSwitchBcfApi { return caps; } - public String syncTopology(TopologyData topo) throws BigSwitchBcfApiException { - String uri = s_nsBaseUri + "/topology"; + public String syncTopology(final TopologyData topo) throws BigSwitchBcfApiException { + String uri = S_NS_BASE_URL + "/topology"; return executeCreateObject(topo, uri, Collections.<String, String> emptyMap()); } public ControllerData getControllerData() { - return new ControllerData(_host, _isMaster); + return new ControllerData(host, isMaster); } private void checkInvariants() throws BigSwitchBcfApiException{ - if (_host == null || _host.isEmpty()) { + if (host == null || host.isEmpty()) { throw new BigSwitchBcfApiException("Hostname is null or empty"); } - if (_username == null || _username.isEmpty()){ + if (username == null || username.isEmpty()){ throw new BigSwitchBcfApiException("Username is null or empty"); } - if (_password == null || _password.isEmpty()){ + if (password == null || password.isEmpty()){ throw new BigSwitchBcfApiException("Password is null or empty"); } } - private String checkResponse(HttpMethodBase m, String errorMessageBase) throws BigSwitchBcfApiException, + private String checkResponse(final HttpMethodBase m, final String errorMessageBase) throws BigSwitchBcfApiException, IllegalArgumentException{ String customErrorMsg = null; if (m.getStatusCode() == HttpStatus.SC_OK) { @@ -273,7 +273,7 @@ public class BigSwitchBcfApi { throw new BigSwitchBcfApiException("BCF topology sync required", true); } if (m.getStatusCode() == HttpStatus.SC_SEE_OTHER) { - _isMaster = false; + isMaster = false; set_hash(HASH_IGNORE); return HASH_IGNORE; } @@ -288,24 +288,25 @@ public class BigSwitchBcfApi { } String errorMessage = responseToErrorMessage(m); m.releaseConnection(); - s_logger.error(errorMessageBase + errorMessage); + S_LOGGER.error(errorMessageBase + errorMessage); throw new BigSwitchBcfApiException(errorMessageBase + errorMessage + customErrorMsg); } - private void setHttpHeader(HttpMethodBase m) { + private void setHttpHeader(final HttpMethodBase m) { m.setRequestHeader(CONTENT_TYPE, CONTENT_JSON); m.setRequestHeader(ACCEPT, CONTENT_JSON); - m.setRequestHeader(HTTP_HEADER_INSTANCE_ID, CLOUDSTACK_INSTANCE_ID + "-" + _zoneId); - if (_hash != "" ) { - m.setRequestHeader(HASH_MATCH, _hash); + m.setRequestHeader(HTTP_HEADER_INSTANCE_ID, CLOUDSTACK_INSTANCE_ID + "-" + zoneId); + if (hash != "" ) { + m.setRequestHeader(HASH_MATCH, hash); } - String authString = _username + ":" + _password; + String authString = username + ":" + password; String encodedAuthString = "Basic " + Base64.encodeBase64String(authString.getBytes(Charset.forName("UTF-8"))); m.setRequestHeader("Authorization", encodedAuthString); } - protected <T> String executeUpdateObject(T newObject, String uri, Map<String, String> parameters) throws BigSwitchBcfApiException, + protected <T> String executeUpdateObject(final T newObject, final String uri, + final Map<String, String> parameters) throws BigSwitchBcfApiException, IllegalArgumentException{ checkInvariants(); @@ -328,7 +329,8 @@ public class BigSwitchBcfApi { return hash; } - protected <T> String executeCreateObject(T newObject, String uri, Map<String, String> parameters) throws BigSwitchBcfApiException { + protected <T> String executeCreateObject(final T newObject, final String uri, + final Map<String, String> parameters) throws BigSwitchBcfApiException { checkInvariants(); PostMethod pm = (PostMethod)createMethod("post", uri, _port); @@ -350,7 +352,7 @@ public class BigSwitchBcfApi { return hash; } - protected String executeDeleteObject(String uri) throws BigSwitchBcfApiException { + protected String executeDeleteObject(final String uri) throws BigSwitchBcfApiException { checkInvariants(); DeleteMethod dm = (DeleteMethod)createMethod("delete", uri, _port); @@ -367,8 +369,8 @@ public class BigSwitchBcfApi { } @SuppressWarnings("unchecked") - protected <T> T executeRetrieveObject(Type returnObjectType, - String uri, Map<String, String> parameters) throws BigSwitchBcfApiException { + protected <T> T executeRetrieveObject(final Type returnObjectType, + final String uri, final Map<String, String> parameters) throws BigSwitchBcfApiException { checkInvariants(); GetMethod gm = (GetMethod)createMethod("get", uri, _port); @@ -392,41 +394,41 @@ public class BigSwitchBcfApi { // CAUTIOUS: Safety margin of 2048 characters - extend if needed. returnValue = (T)gson.fromJson(gm.getResponseBodyAsString(2048), returnObjectType); } catch (IOException e) { - s_logger.error("IOException while retrieving response body", e); + S_LOGGER.error("IOException while retrieving response body", e); throw new BigSwitchBcfApiException(e); } finally { gm.releaseConnection(); } if(returnValue instanceof ControlClusterStatus) { if(hash == HASH_CONFLICT) { - _isMaster = true; + isMaster = true; ((ControlClusterStatus) returnValue).setTopologySyncRequested(true); - } else if (hash != HASH_IGNORE && !_isMaster) { - _isMaster = true; + } else if (hash != HASH_IGNORE && !isMaster) { + isMaster = true; ((ControlClusterStatus) returnValue).setTopologySyncRequested(true); } } return returnValue; } - protected void executeMethod(HttpMethodBase method) throws BigSwitchBcfApiException { + protected void executeMethod(final HttpMethodBase method) throws BigSwitchBcfApiException { try { _client.executeMethod(method); if (method.getStatusCode() == HttpStatus.SC_UNAUTHORIZED) { method.releaseConnection(); } } catch (HttpException e) { - s_logger.error("HttpException caught while trying to connect to the BigSwitch Controller", e); + S_LOGGER.error("HttpException caught while trying to connect to the BigSwitch Controller", e); method.releaseConnection(); throw new BigSwitchBcfApiException("API call to BigSwitch Controller Failed", e); } catch (IOException e) { - s_logger.error("IOException caught while trying to connect to the BigSwitch Controller", e); + S_LOGGER.error("IOException caught while trying to connect to the BigSwitch Controller", e); method.releaseConnection(); throw new BigSwitchBcfApiException("API call to BigSwitch Controller Failed", e); } } - private String responseToErrorMessage(HttpMethodBase method) { + private String responseToErrorMessage(final HttpMethodBase method) { assert method.isRequestSent() : "no use getting an error message unless the request is sent"; if ("text/html".equals(method.getResponseHeader(CONTENT_TYPE).getValue())) { @@ -436,7 +438,7 @@ public class BigSwitchBcfApi { try { return method.getResponseBodyAsString(2048); } catch (IOException e) { - s_logger.debug("Error while loading response body", e); + S_LOGGER.debug("Error while loading response body", e); } } @@ -449,11 +451,11 @@ public class BigSwitchBcfApi { } public String get_hash() { - return _hash; + return hash; } - public void set_hash(String hash) { - this._hash = hash; + public void set_hash(final String hash) { + this.hash = hash; } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfUtils.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfUtils.java b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfUtils.java index 242089f..61f3d48 100644 --- a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfUtils.java +++ b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfUtils.java @@ -177,7 +177,7 @@ public class BigSwitchBcfUtils { // handle external network first, only if NAT service is enabled if(networks != null) { - if (!(networks.isEmpty()) && isNatEnabled()) { + if(!(networks.isEmpty()) && isNatEnabled()){ // get public net info - needed to set up source nat gateway NetworkVO pubNet = getPublicNetwork(physicalNetworkId); @@ -380,7 +380,7 @@ public class BigSwitchBcfUtils { Integer port = rule.getSourcePortStart(); fwCidrList = _fwCidrsDao.listByFirewallRuleId(rule.getId()); if(fwCidrList != null){ - if (fwCidrList.size() > 1 || !rule.getSourcePortEnd().equals(port)) { + if(fwCidrList.size()>1 || !rule.getSourcePortEnd().equals(port)){ continue; } else { cidr = fwCidrList.get(0).getCidr(); @@ -414,7 +414,7 @@ public class BigSwitchBcfUtils { Integer port = item.getSourcePortStart(); // currently BCF supports single port policy aclCidrList = _aclItemCidrsDao.listByNetworkACLItemId(item.getId()); if(aclCidrList != null){ - if (aclCidrList.size() > 1 || !item.getSourcePortEnd().equals(port)) { + if(aclCidrList.size()>1 || !item.getSourcePortEnd().equals(port)){ continue; } else { cidr = aclCidrList.get(0).getCidr(); @@ -440,7 +440,7 @@ public class BigSwitchBcfUtils { public String syncTopologyToBcfHost(HostVO bigswitchBcfHost){ SyncBcfTopologyCommand syncCmd; - if (isNatEnabled()) { + if(isNatEnabled()){ syncCmd = new SyncBcfTopologyCommand(true, true); } else { syncCmd = new SyncBcfTopologyCommand(true, false); @@ -486,7 +486,7 @@ public class BigSwitchBcfUtils { } String newHash = answer.getHash(); - if (cmd.is_topologySyncRequested()) { + if (cmd.isTopologySyncRequested()) { newHash = syncTopologyToBcfHost(cluster.getMaster()); } if(newHash != null){ @@ -519,7 +519,7 @@ public class BigSwitchBcfUtils { }); } - public boolean isNatEnabled() { + public Boolean isNatEnabled(){ List<BigSwitchBcfDeviceVO> devices = _bigswitchBcfDao.listAll(); if(devices != null && !devices.isEmpty()){ return devices.get(0).getNat(); @@ -528,8 +528,6 @@ public class BigSwitchBcfUtils { } } - // returns null: should throw something^%*%#& - // Integer -> int public Integer getSubnetMaskLength(String maskString){ if(!IPAddress.isValidIPv4(maskString)){ return null; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/581f3b79/plugins/network-elements/bigswitch/src/com/cloud/network/element/BigSwitchBcfElement.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/element/BigSwitchBcfElement.java b/plugins/network-elements/bigswitch/src/com/cloud/network/element/BigSwitchBcfElement.java index 1dbf62d..3c69f3b 100644 --- a/plugins/network-elements/bigswitch/src/com/cloud/network/element/BigSwitchBcfElement.java +++ b/plugins/network-elements/bigswitch/src/com/cloud/network/element/BigSwitchBcfElement.java @@ -30,26 +30,25 @@ import javax.ejb.Local; import javax.inject.Inject; import javax.naming.ConfigurationException; -import org.apache.commons.net.util.SubnetUtils; import org.apache.log4j.Logger; import org.springframework.stereotype.Component; - import org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice; +import org.apache.commons.net.util.SubnetUtils; import com.cloud.agent.AgentManager; import com.cloud.agent.api.BcfAnswer; +import com.cloud.agent.api.UpdateBcfRouterCommand; import com.cloud.agent.api.CreateBcfAttachmentCommand; import com.cloud.agent.api.CreateBcfStaticNatCommand; import com.cloud.agent.api.DeleteBcfAttachmentCommand; import com.cloud.agent.api.DeleteBcfStaticNatCommand; import com.cloud.agent.api.StartupBigSwitchBcfCommand; import com.cloud.agent.api.StartupCommand; -import com.cloud.agent.api.UpdateBcfRouterCommand; import com.cloud.api.ApiDBUtils; import com.cloud.api.commands.AddBigSwitchBcfDeviceCmd; -import com.cloud.api.commands.BcfConstants; import com.cloud.api.commands.DeleteBigSwitchBcfDeviceCmd; import com.cloud.api.commands.ListBigSwitchBcfDevicesCmd; +import com.cloud.api.commands.BcfConstants; import com.cloud.api.response.BigSwitchBcfDeviceResponse; import com.cloud.configuration.ConfigurationManager; import com.cloud.dc.DataCenterVO; @@ -209,7 +208,7 @@ NetworkACLServiceProvider, FirewallServiceProvider, ResourceStateAdapter { return false; } - if (!_ntwkSrvcDao.canProviderSupportServiceInNetwork(network.getId(), service, BcfConstants.BigSwitchBcf)) { + if (!_ntwkSrvcDao.canProviderSupportServiceInNetwork(network.getId(), service, BcfConstants.BIG_SWITCH_BCF)) { s_logger.debug("BigSwitchBcfElement can't provide the " + service.getName() + " service on network " + network.getDisplayText()); return false; } @@ -411,7 +410,7 @@ NetworkACLServiceProvider, FirewallServiceProvider, ResourceStateAdapter { ServerResource resource = new BigSwitchBcfResource(); - final String deviceName = BcfConstants.BigSwitchBcf.getName(); + final String deviceName = BcfConstants.BIG_SWITCH_BCF.getName(); NetworkDevice networkDevice = NetworkDevice.getNetworkDevice(deviceName); final Long physicalNetworkId = cmd.getPhysicalNetworkId(); final String hostname = cmd.getHost(); @@ -452,7 +451,7 @@ NetworkACLServiceProvider, FirewallServiceProvider, ResourceStateAdapter { zoneName = String.valueOf(zoneId); } - boolean natNow = _bcfUtils.isNatEnabled(); + Boolean natNow = _bcfUtils.isNatEnabled(); if (!nat && natNow){ throw new CloudRuntimeException("NAT is enabled in existing controller. Enable NAT for new controller or remove existing controller first."); } else if (nat && !natNow){ @@ -684,7 +683,7 @@ NetworkACLServiceProvider, FirewallServiceProvider, ResourceStateAdapter { } cidrList = r.getSourceCidrList(); if(cidrList != null){ - if (cidrList.size() > 1 || !r.getSourcePortEnd().equals(r.getSourcePortStart())) { + if(cidrList.size()>1 || !r.getSourcePortEnd().equals(r.getSourcePortStart())){ throw new ResourceUnavailableException("One CIDR and one port only please.", Network.class, network.getId()); } else { @@ -718,7 +717,7 @@ NetworkACLServiceProvider, FirewallServiceProvider, ResourceStateAdapter { } cidrList = r.getSourceCidrList(); if(cidrList != null){ - if (cidrList.size() > 1 || !r.getSourcePortEnd().equals(r.getSourcePortStart())) { + if(cidrList.size()>1 || !r.getSourcePortEnd().equals(r.getSourcePortStart())){ throw new ResourceUnavailableException("One CIDR and one port only please.", Network.class, network.getId()); } else {