@@ -237,7 +237,7 @@ public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm
237237 // get arguments for CreateBcfAttachmentCommand
238238 // determine whether this is VPC network or stand-alone network
239239 Vpc vpc = null ;
240- if (network .getVpcId ()!= null ){
240+ if (network .getVpcId () != null ) {
241241 vpc = _vpcDao .acquireInLockTable (network .getVpcId ());
242242 }
243243
@@ -264,7 +264,7 @@ public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm
264264 String vmwareVswitchLabel = _networkModel .getDefaultGuestTrafficLabel (zoneId , HypervisorType .VMware );
265265 String [] labelArray = null ;
266266 String vswitchName = null ;
267- if (vmwareVswitchLabel != null ){
267+ if (vmwareVswitchLabel != null ) {
268268 labelArray =vmwareVswitchLabel .split ("," );
269269 vswitchName = labelArray [0 ];
270270 }
@@ -273,9 +273,9 @@ public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm
273273 // kvm: ivs port name
274274 // vmware: specific portgroup naming convention
275275 String pgName = "" ;
276- if (dest .getHost ().getHypervisorType () == HypervisorType .KVM ){
276+ if (dest .getHost ().getHypervisorType () == HypervisorType .KVM ) {
277277 pgName = hostname ;
278- } else if (dest .getHost ().getHypervisorType () == HypervisorType .VMware ){
278+ } else if (dest .getHost ().getHypervisorType () == HypervisorType .VMware ) {
279279 pgName = hostname + "-" + vswitchName ;
280280 }
281281
@@ -306,7 +306,7 @@ public boolean release(Network network, NicProfile nic, VirtualMachineProfile vm
306306 String nicId = nic .getUuid ();
307307
308308 String tenantId ;
309- if (network .getVpcId ()!= null ) {
309+ if (network .getVpcId () != null ) {
310310 tenantId = network .getNetworkDomain ();
311311 } else {
312312 tenantId = networkId ;
@@ -439,16 +439,16 @@ public BigSwitchBcfDeviceVO addBigSwitchBcfDevice(AddBigSwitchBcfDeviceCmd cmd)
439439
440440 DataCenterVO zone = _zoneDao .findById (physicalNetwork .getDataCenterId ());
441441 String zoneName ;
442- if (zone != null ){
442+ if (zone != null ) {
443443 zoneName = zone .getName ();
444444 } else {
445445 zoneName = String .valueOf (zoneId );
446446 }
447447
448448 Boolean natNow = _bcfUtils .isNatEnabled ();
449- if (!nat && natNow ){
449+ if (!nat && natNow ) {
450450 throw new CloudRuntimeException ("NAT is enabled in existing controller. Enable NAT for new controller or remove existing controller first." );
451- } else if (nat && !natNow ){
451+ } else if (nat && !natNow ) {
452452 throw new CloudRuntimeException ("NAT is disabled in existing controller. Disable NAT for new controller or remove existing controller first." );
453453 }
454454
@@ -582,7 +582,7 @@ public HostVO createHostVOForDirectConnectAgent(HostVO host, StartupCommand[] st
582582 BigSwitchBcfResource bcfResource = (BigSwitchBcfResource ) resource ;
583583 bcfUtilsInit ();
584584
585- if (_bcfUtils .getTopology ()!= null ){
585+ if (_bcfUtils .getTopology () != null ) {
586586 bcfResource .setTopology (_bcfUtils .getTopology ());
587587 }
588588
@@ -621,7 +621,7 @@ public boolean applyStaticNats(Network network,
621621 _bcfUtils .listACLbyNetwork (network );
622622
623623 Vpc vpc = null ;
624- if (network .getVpcId ()!= null ){
624+ if (network .getVpcId () != null ) {
625625 vpc = _vpcDao .acquireInLockTable (network .getVpcId ());
626626 }
627627
@@ -635,11 +635,11 @@ public boolean applyStaticNats(Network network,
635635 tenantId = network .getUuid ();
636636 }
637637
638- for (StaticNat rule : rules ){
638+ for (StaticNat rule : rules ) {
639639 String srcIp = _ipAddressDao .findById (rule .getSourceIpAddressId ()).getAddress ().addr ();
640640 String dstIp = rule .getDestIpAddress ();
641641 String mac = rule .getSourceMacAddress ();
642- if (!rule .isForRevoke ()) {
642+ if (!rule .isForRevoke ()) {
643643 logger .debug ("BCF enables static NAT for public IP: " + srcIp + " private IP " + dstIp
644644 + " mac " + mac );
645645 CreateBcfStaticNatCommand cmd = new CreateBcfStaticNatCommand (
@@ -671,13 +671,13 @@ public boolean applyNetworkACLs(Network network,
671671 SubnetUtils utils ;
672672 String cidr = null ;
673673 List <String > cidrList ;
674- for (NetworkACLItem r : rules ){
675- if (r .getState ()== NetworkACLItem .State .Revoke ){
674+ for (NetworkACLItem r : rules ) {
675+ if (r .getState () == NetworkACLItem .State .Revoke ) {
676676 continue ;
677677 }
678678 cidrList = r .getSourceCidrList ();
679- if (cidrList != null ){
680- if (cidrList .size ()> 1 || !r .getSourcePortEnd ().equals (r .getSourcePortStart ())){
679+ if (cidrList != null ) {
680+ if (cidrList .size () > 1 || !r .getSourcePortEnd ().equals (r .getSourcePortStart ())) {
681681 throw new ResourceUnavailableException ("One CIDR and one port only please." ,
682682 Network .class , network .getId ());
683683 } else {
@@ -688,7 +688,7 @@ public boolean applyNetworkACLs(Network network,
688688 cidr = "" ;
689689 } else {
690690 utils = new SubnetUtils (cidr );
691- if (!utils .getInfo ().getNetworkAddress ().equals (utils .getInfo ().getAddress ())){
691+ if (!utils .getInfo ().getNetworkAddress ().equals (utils .getInfo ().getAddress ())) {
692692 throw new ResourceUnavailableException ("Invalid CIDR in Network ACL rule." ,
693693 Network .class , network .getId ());
694694 }
@@ -710,13 +710,13 @@ public boolean applyFWRules(Network network,
710710 SubnetUtils utils ;
711711 String cidr = null ;
712712 List <String > cidrList ;
713- for (FirewallRule r : rules ){
714- if (r .getState ()== FirewallRule .State .Revoke ){
713+ for (FirewallRule r : rules ) {
714+ if (r .getState () == FirewallRule .State .Revoke ) {
715715 continue ;
716716 }
717717 cidrList = r .getSourceCidrList ();
718- if (cidrList != null ){
719- if (cidrList .size ()>1 || !r .getSourcePortEnd ().equals (r .getSourcePortStart ())){
718+ if (cidrList != null ) {
719+ if (cidrList .size ()>1 || !r .getSourcePortEnd ().equals (r .getSourcePortStart ())) {
720720 throw new ResourceUnavailableException ("One CIDR and one port only please." ,
721721 Network .class , network .getId ());
722722 } else {
@@ -727,7 +727,7 @@ public boolean applyFWRules(Network network,
727727 cidr = "" ;
728728 } else {
729729 utils = new SubnetUtils (cidr );
730- if (!utils .getInfo ().getNetworkAddress ().equals (utils .getInfo ().getAddress ())){
730+ if (!utils .getInfo ().getNetworkAddress ().equals (utils .getInfo ().getAddress ())) {
731731 throw new ResourceUnavailableException ("Invalid CIDR in Firewall rule." ,
732732 Network .class , network .getId ());
733733 }
@@ -741,7 +741,7 @@ private void updateBcfRouter(Network network) throws IllegalArgumentException{
741741 bcfUtilsInit ();
742742
743743 Vpc vpc = null ;
744- if (network .getVpcId ()!= null ){
744+ if (network .getVpcId () != null ) {
745745 vpc = _vpcDao .acquireInLockTable (network .getVpcId ());
746746 }
747747
@@ -756,23 +756,23 @@ private void updateBcfRouter(Network network) throws IllegalArgumentException{
756756 UpdateBcfRouterCommand cmd = new UpdateBcfRouterCommand (tenantId );
757757
758758 List <AclData > aclList = _bcfUtils .listACLbyNetwork (network );
759- for (AclData acl : aclList ){
759+ for (AclData acl : aclList ) {
760760 cmd .addAcl (acl );
761761 }
762762
763- if (vpc != null ){
763+ if (vpc != null ) {
764764 cmd .setPublicIp (_bcfUtils .getPublicIpByVpc (vpc ));
765765 } else {
766766 cmd .setPublicIp (_bcfUtils .getPublicIpByNetwork (network ));
767767 }
768768
769769 BcfAnswer answer = _bcfUtils .sendBcfCommandWithNetworkSyncCheck (cmd , network );
770- if (answer != null && !answer .getResult ()){
770+ if (answer != null && !answer .getResult ()) {
771771 throw new IllegalArgumentException ("Illegal router update arguments" );
772772 }
773773 }
774774
775- private void bcfUtilsInit (){
775+ private void bcfUtilsInit () {
776776 if (_bcfUtils == null ) {
777777 _bcfUtils = new BigSwitchBcfUtils (_networkDao , _nicDao ,
778778 _vmDao , _hostDao , _vpcDao , _bigswitchBcfDao ,
0 commit comments