Fix sonar issue: multiple if statements 89/57089/13
authormatthieu <mcauffiez@inocybe.com>
Mon, 15 May 2017 17:25:50 +0000 (13:25 -0400)
committermatthieu <mcauffiez@inocybe.com>
Tue, 23 May 2017 17:48:36 +0000 (13:48 -0400)
Change multiple if statements on string with a
switch case, It can also be changed with an enum.
This is solving some sonar complexity code issues,
giving a cleaner and maybe faster code.
Add warn log for ignored fields

Change-Id: I1cc717e4d0935a9c3c4c74307fbf2c0696e1648e
Signed-off-by: matthieu <mcauffiez@inocybe.com>
36 files changed:
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronAdminAttributes.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronBaseAttributes.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronBgpvpn.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronFirewall.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronFirewallPolicy.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronFirewallRule.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronFloatingIp.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronL2gateway.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronL2gatewayConnection.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronLoadBalancer.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronLoadBalancerHealthMonitor.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronLoadBalancerListener.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronLoadBalancerPool.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronLoadBalancerPoolMember.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronMeteringLabel.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronMeteringLabelRule.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronNetwork.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronObject.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronPort.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronQosBandwidthRule.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronQosDscpMarkingRule.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronQosPolicy.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronRouter.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronRouterInterface.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronSFCFlowClassifier.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronSFCPortChain.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronSFCPortPair.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronSFCPortPairGroup.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronSecurityGroup.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronSecurityRule.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronSubnet.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronTrunk.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronVpnIkePolicy.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronVpnIpSecPolicy.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronVpnIpSecSiteConnection.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronVpnService.java

index ef28c1db02af40cd7dd116cfa53af33ef4237e60..34cd5ce4f4ab63950a5141fb60fed2cc6afd11c3 100644 (file)
@@ -58,13 +58,16 @@ public abstract class NeutronAdminAttributes<T extends NeutronAdminAttributes> e
     }
 
     @Override
-    protected void extractField(String field, T ans) {
-        super.extractField(field, ans);
-        if (field.equals("admin_state_up")) {
-            ans.setAdminStateUp(this.getAdminStateUp());
-        }
-        if (field.equals("status")) {
-            ans.setStatus(this.getStatus());
+    protected boolean extractField(String field, T ans) {
+        switch (field) {
+            case "admin_state_up":
+                ans.setAdminStateUp(this.getAdminStateUp());
+                return true;
+            case "status":
+                ans.setStatus(this.getStatus());
+                return true;
+            default:
+                return super.extractField(field, ans);
         }
     }
 }
index 9dd115fa03da1e49275e385f502d13949bed4cc1..f38121543681a98b25264cc286662491b2204af6 100644 (file)
@@ -39,10 +39,13 @@ public abstract class NeutronBaseAttributes<T extends NeutronBaseAttributes> ext
     }
 
     @Override
-    protected void extractField(String field, T ans) {
-        super.extractField(field, ans);
-        if (field.equals("name")) {
-            ans.setName(this.getName());
+    protected boolean extractField(String field, T ans) {
+        switch (field) {
+            case "name":
+                ans.setName(this.getName());
+                return true;
+            default:
+                return super.extractField(field, ans);
         }
     }
 }
index 8d6aff68bd770cb40810a2d5e19f7fc8aa32c8a3..28057dda2bbae8f74d0dbfdb9e90aaf2df038f47 100644 (file)
@@ -14,10 +14,13 @@ import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 @XmlRootElement(name = "bgpvpn")
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronBgpvpn extends NeutronAdminAttributes<NeutronBgpvpn> implements Serializable {
+    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronBgpvpn.class);
     // See OpenStack Network API v2.0 Reference for description of
     // annotated attributes
 
@@ -219,36 +222,43 @@ public final class NeutronBgpvpn extends NeutronAdminAttributes<NeutronBgpvpn> i
     public NeutronBgpvpn extractFields(List<String> fields) {
         NeutronBgpvpn ans = new NeutronBgpvpn();
         for (String s : fields) {
-            extractField(s, ans);
-            if (s.equals("type")) {
-                ans.setType(this.getType());
+            if (extractField(s, ans)) {
+                continue;
             }
-            if (s.equals("technique")) {
-                ans.setTechnique(this.getTechnique());
-            }
-            if (s.equals("route_targets")) {
-                ans.setRouteTargets(this.getRouteTargets());
-            }
-            if (s.equals("import_targets")) {
-                ans.setImportTargets(this.getImportTargets());
-            }
-            if (s.equals("export_targets")) {
-                ans.setExportTargets(this.getExportTargets());
-            }
-            if (s.equals("route_distinguishers")) {
-                ans.setRouteDistinguishers(this.getRouteDistinguishers());
-            }
-            if (s.equals("routers")) {
-                ans.setRouters(this.getRouters());
-            }
-            if (s.equals("networks")) {
-                ans.setNetworks(this.getNetworks());
-            }
-            if (s.equals("vnid")) {
-                ans.setVnid(this.getVnid());
-            }
-            if (s.equals("auto_aggregate")) {
-                ans.setAutoAggregate(this.getAutoAggregate());
+            switch (s) {
+                case "type":
+                    ans.setType(this.getType());
+                    break;
+                case "technique":
+                    ans.setTechnique(this.getTechnique());
+                    break;
+                case "route_targets":
+                    ans.setRouteTargets(this.getRouteTargets());
+                    break;
+                case "import_targets":
+                    ans.setImportTargets(this.getImportTargets());
+                    break;
+                case "export_targets":
+                    ans.setExportTargets(this.getExportTargets());
+                    break;
+                case "route_distinguishe":
+                    ans.setRouteDistinguishers(this.getRouteDistinguishers());
+                    break;
+                case "routers":
+                    ans.setRouters(this.getRouters());
+                    break;
+                case "networks":
+                    ans.setNetworks(this.getNetworks());
+                    break;
+                case "vnid":
+                    ans.setVnid(this.getVnid());
+                    break;
+                case "auto_aggregate":
+                    ans.setAutoAggregate(this.getAutoAggregate());
+                    break;
+                default:
+                    LOGGER.warn("{} is not a NeutronBgpvpn suitable field.", s);
+                    break;
             }
         }
         return ans;
index 13e33f829b767b9b6c98a9dad79147925f978b9a..8ab85b7229812eb5750e49542973fac7b4727b98 100644 (file)
@@ -14,6 +14,8 @@ import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * OpenStack Neutron v2.0 Firewall as a service
@@ -35,6 +37,7 @@ import javax.xml.bind.annotation.XmlRootElement;
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronFirewall extends NeutronBaseAttributes<NeutronFirewall> implements Serializable {
+    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronFirewall.class);
     private static final long serialVersionUID = 1L;
 
     @XmlElement(defaultValue = "true", name = "admin_state_up")
@@ -73,15 +76,22 @@ public final class NeutronFirewall extends NeutronBaseAttributes<NeutronFirewall
     public NeutronFirewall extractFields(List<String> fields) {
         NeutronFirewall ans = new NeutronFirewall();
         for (String s : fields) {
-            extractField(s, ans);
-            if (s.equals("admin_state_up")) {
-                ans.setFirewallAdminStateIsUp(firewallAdminStateIsUp);
+            if (extractField(s, ans)) {
+                continue;
             }
-            if (s.equals("shared")) {
-                ans.setFirewallIsShared(firewallIsShared);
-            }
-            if (s.equals("firewall_policy_id")) {
-                ans.setFirewallPolicyID(this.getFirewallPolicyID());
+            switch (s) {
+                case "admin_state_up":
+                    ans.setFirewallAdminStateIsUp(firewallAdminStateIsUp);
+                    break;
+                case "shared":
+                    ans.setFirewallIsShared(firewallIsShared);
+                    break;
+                case "firewall_policy_id":
+                    ans.setFirewallPolicyID(this.getFirewallPolicyID());
+                    break;
+                default:
+                    LOGGER.warn("{} is not a NeutronBgpvpn suitable field.", s);
+                    break;
             }
         }
         return ans;
index 12628a3dcbef49b4bc6f38cffc2f00df968b7fc7..8d81e9f62535f209b4745272987defbd4919eea2 100644 (file)
@@ -14,6 +14,8 @@ import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * OpenStack Neutron v2.0 Firewall as a service
@@ -34,6 +36,7 @@ import javax.xml.bind.annotation.XmlRootElement;
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronFirewallPolicy extends NeutronBaseAttributes<NeutronFirewallPolicy> implements Serializable {
+    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronFirewallPolicy.class);
     private static final long serialVersionUID = 1L;
 
     @XmlElement(defaultValue = "false", name = "shared")
@@ -61,12 +64,19 @@ public final class NeutronFirewallPolicy extends NeutronBaseAttributes<NeutronFi
     public NeutronFirewallPolicy extractFields(List<String> fields) {
         NeutronFirewallPolicy ans = new NeutronFirewallPolicy();
         for (String s : fields) {
-            extractField(s, ans);
-            if (s.equals("shared")) {
-                ans.setFirewallPolicyIsShared(firewallPolicyIsShared);
+            if (extractField(s, ans)) {
+                continue;
             }
-            if (s.equals("audited")) {
-                ans.setFirewallPolicyIsAudited(firewallPolicyIsAudited);
+            switch (s) {
+                case "shared":
+                    ans.setFirewallPolicyIsShared(firewallPolicyIsShared);
+                    break;
+                case "audited":
+                    ans.setFirewallPolicyIsAudited(firewallPolicyIsAudited);
+                    break;
+                default:
+                    LOGGER.warn("{} is not an NeutronFirewallPolicy suitable field.", s);
+                    break;
             }
         }
         return ans;
index 6951b84c7e2ffbce4e81ce3ba68b57a2a6a6ab90..8802bfc0aaab7bfdd1628d7ecb8843195c1fa1cf 100644 (file)
@@ -14,6 +14,8 @@ import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * OpenStack Neutron v2.0 Firewall as a service
@@ -46,6 +48,8 @@ import javax.xml.bind.annotation.XmlRootElement;
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronFirewallRule extends NeutronBaseAttributes<NeutronFirewallRule> implements Serializable {
+    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronFirewallRule.class);
+
     private static final long serialVersionUID = 1L;
 
     @XmlElement(defaultValue = "false", name = "shared")
@@ -194,44 +198,50 @@ public final class NeutronFirewallRule extends NeutronBaseAttributes<NeutronFire
     public NeutronFirewallRule extractFields(List<String> fields) {
         NeutronFirewallRule ans = new NeutronFirewallRule();
         for (String s : fields) {
-            extractField(s, ans);
-            if (s.equals("shared")) {
-                ans.setFirewallRuleIsShared(firewallRuleIsShared);
-            }
-            if (s.equals("firewall_policy_id")) {
-                ans.setFirewallRulePolicyID(this.getFirewallRulePolicyID());
-            }
-            if (s.equals("protocol")) {
-                ans.setFirewallRuleProtocol(this.getFirewallRuleProtocol());
-            }
-            if (s.equals("source_ip_address")) {
-                ans.setFirewallRuleSrcIpAddr(this.getFirewallRuleSrcIpAddr());
-            }
-            if (s.equals("destination_ip_address")) {
-                ans.setFirewallRuleDstIpAddr(this.getFirewallRuleDstIpAddr());
-            }
-            if (s.equals("source_port_range_min")) {
-                ans.setFirewallRuleSrcPortRangeMin(this.getFirewallRuleSrcPortRangeMin());
+            if (extractField(s, ans)) {
+                continue;
             }
-            if (s.equals("source_port_range_max")) {
-                ans.setFirewallRuleSrcPortRangeMax(this.getFirewallRuleSrcPortRangeMax());
+            switch (s) {
+                case "shared":
+                    ans.setFirewallRuleIsShared(firewallRuleIsShared);
+                    break;
+                case "firewall_policy_id":
+                    ans.setFirewallRulePolicyID(this.getFirewallRulePolicyID());
+                    break;
+                case "protocol":
+                    ans.setFirewallRuleProtocol(this.getFirewallRuleProtocol());
+                    break;
+                case "source_ip_address":
+                    ans.setFirewallRuleSrcIpAddr(this.getFirewallRuleSrcIpAddr());
+                    break;
+                case "destination_ip_address":
+                    ans.setFirewallRuleDstIpAddr(this.getFirewallRuleDstIpAddr());
+                    break;
+                case "source_port_range_min":
+                    ans.setFirewallRuleSrcPortRangeMin(this.getFirewallRuleSrcPortRangeMin());
+                    break;
+                case "source_port_range_max":
+                    ans.setFirewallRuleSrcPortRangeMax(this.getFirewallRuleSrcPortRangeMax());
+                    break;
+                case "destination_port_range_min":
+                    ans.setFirewallRuleDstPortRangeMin(this.getFirewallRuleDstPortRangeMin());
+                    break;
+                case "destination_port_range_max":
+                    ans.setFirewallRuleDstPortRangeMax(this.getFirewallRuleDstPortRangeMax());
+                    break;
+                case "position":
+                    ans.setFirewallRulePosition(this.getFirewallRulePosition());
+                    break;
+                case "action":
+                    ans.setFirewallRuleAction(this.getFirewallRuleAction());
+                    break;
+                case "enabled":
+                    ans.setFirewallRuleIsEnabled(firewallRuleIsEnabled);
+                    break;
+                default:
+                    LOGGER.warn("Unknown firewall rule {}.", s);
+                    break;
             }
-            if (s.equals("destination_port_range_min")) {
-                ans.setFirewallRuleDstPortRangeMin(this.getFirewallRuleDstPortRangeMin());
-            }
-            if (s.equals("destination_port_range_max")) {
-                ans.setFirewallRuleDstPortRangeMax(this.getFirewallRuleDstPortRangeMax());
-            }
-            if (s.equals("position")) {
-                ans.setFirewallRulePosition(this.getFirewallRulePosition());
-            }
-            if (s.equals("action")) {
-                ans.setFirewallRuleAction(this.getFirewallRuleAction());
-            }
-            if (s.equals("enabled")) {
-                ans.setFirewallRuleIsEnabled(firewallRuleIsEnabled);
-            }
-
         }
         return ans;
     }
index 2b5427d34c0e93e18f53b9ae7d9f7ec900143ffb..a846c8b39c2b5de04db61b603b9e778ef4df4255 100644 (file)
@@ -14,11 +14,14 @@ import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronFloatingIp
         extends NeutronObject<NeutronFloatingIp> implements Serializable, INeutronObject<NeutronFloatingIp> {
+    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronFloatingIp.class);
     private static final long serialVersionUID = 1L;
 
     // See OpenStack Network API v2.0 Reference for description of
@@ -106,24 +109,31 @@ public final class NeutronFloatingIp
     public NeutronFloatingIp extractFields(List<String> fields) {
         NeutronFloatingIp ans = new NeutronFloatingIp();
         for (String s : fields) {
-            extractField(s, ans);
-            if (s.equals("floating_network_id")) {
-                ans.setFloatingNetworkUUID(this.getFloatingNetworkUUID());
+            if (extractField(s, ans)) {
+                continue;
             }
-            if (s.equals("port_id")) {
-                ans.setPortUUID(this.getPortUUID());
-            }
-            if (s.equals("fixed_ip_address")) {
-                ans.setFixedIpAddress(this.getFixedIpAddress());
-            }
-            if (s.equals("floating_ip_address")) {
-                ans.setFloatingIpAddress(this.getFloatingIpAddress());
-            }
-            if (s.equals("router_id")) {
-                ans.setRouterUUID(this.getRouterUUID());
-            }
-            if (s.equals("status")) {
-                ans.setStatus(this.getStatus());
+            switch (s) {
+                case "floating_network_id":
+                    ans.setFloatingNetworkUUID(this.getFloatingNetworkUUID());
+                    break;
+                case "port_id":
+                    ans.setPortUUID(this.getPortUUID());
+                    break;
+                case "fixed_ip_address":
+                    ans.setFixedIpAddress(this.getFixedIpAddress());
+                    break;
+                case "floating_ip_address":
+                    ans.setFloatingIpAddress(this.getFloatingIpAddress());
+                    break;
+                case "router_id":
+                    ans.setRouterUUID(this.getRouterUUID());
+                    break;
+                case "status":
+                    ans.setStatus(this.getStatus());
+                    break;
+                default:
+                    LOGGER.warn("{} is not a NeutronFloatingIp suitable field.", s);
+                    break;
             }
         }
         return ans;
index 8da9e9d2241c82d7cbf83a14e24603710a13deb1..d8f0140ae927e8bf7b42371309ee8e9825d41e54 100644 (file)
@@ -13,10 +13,13 @@ import java.util.ArrayList;
 import java.util.List;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 @XmlRootElement(name = "l2gateway")
 public final class NeutronL2gateway extends NeutronBaseAttributes<NeutronL2gateway>
         implements Serializable {
+    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronL2gateway.class);
     private static final long serialVersionUID = 1L;
 
     @XmlElement(name = "devices")
@@ -33,11 +36,18 @@ public final class NeutronL2gateway extends NeutronBaseAttributes<NeutronL2gatew
     public NeutronL2gateway extractFields(List<String> fields) {
         NeutronL2gateway ans = new NeutronL2gateway();
         for (String s : fields) {
-            extractField(s, ans);
-            if (s.equals("devices")) {
-                List<NeutronL2gatewayDevice> devices = new ArrayList<NeutronL2gatewayDevice>();
-                devices.addAll(this.getNeutronL2gatewayDevices());
-                ans.setNeutronL2gatewayDevices(devices);
+            if (extractField(s, ans)) {
+                continue;
+            }
+            switch (s) {
+                case "devices":
+                    List<NeutronL2gatewayDevice> devices = new ArrayList<NeutronL2gatewayDevice>();
+                    devices.addAll(this.getNeutronL2gatewayDevices());
+                    ans.setNeutronL2gatewayDevices(devices);
+                    break;
+                default:
+                    LOGGER.warn("{} is not a NeutronL2gateway suitable field.", s);
+                    break;
             }
         }
         return ans;
index 32135825d7ad78dd861dcc52719d588e1766eac6..c3cd2012580bd641e55443472beee8eedf7bfdad 100644 (file)
@@ -14,11 +14,14 @@ import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 @XmlRootElement(name = "l2gatewayConnection")
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronL2gatewayConnection extends NeutronObject<NeutronL2gatewayConnection>
         implements Serializable, INeutronObject<NeutronL2gatewayConnection> {
+    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronL2gatewayConnection.class);
     private static final long serialVersionUID = 1L;
 
     @XmlElement(name = "gateway_id")
@@ -68,21 +71,28 @@ public final class NeutronL2gatewayConnection extends NeutronObject<NeutronL2gat
     public NeutronL2gatewayConnection extractFields(List<String> fields) {
         NeutronL2gatewayConnection ans = new NeutronL2gatewayConnection();
         for (String s : fields) {
-            extractField(s, ans);
-            if (s.equals("connection_id")) {
-                ans.setID(this.getID());
+            if (extractField(s, ans)) {
+                continue;
             }
-            if (s.equals("gateway_id")) {
-                ans.setL2gatewayID(this.getL2gatewayID());
-            }
-            if (s.equals("network_id")) {
-                ans.setNetworkID(this.getNetworkID());
-            }
-            if (s.equals("segmentation_id")) {
-                ans.setSegmentID(this.getSegmentID());
-            }
-            if (s.equals("port_id")) {
-                ans.setPortID(this.getPortID());
+            switch (s) {
+                case "connection_id":
+                    ans.setID(this.getID());
+                    break;
+                case "gateway_id":
+                    ans.setL2gatewayID(this.getL2gatewayID());
+                    break;
+                case "network_id":
+                    ans.setNetworkID(this.getNetworkID());
+                    break;
+                case "segmentation_id":
+                    ans.setSegmentID(this.getSegmentID());
+                    break;
+                case "port_id":
+                    ans.setPortID(this.getPortID());
+                    break;
+                default:
+                    LOGGER.warn("{} is not a NeutronL2gatewayConnection suitable field.", s);
+                    break;
             }
         }
         return ans;
index 0c94ad73fb8f3cb82af9974b48688b22ed3d9d3f..3a4cb18121f1fe872e42b9817318c4f7eac75e17 100644 (file)
@@ -14,6 +14,8 @@ import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * OpenStack Neutron v2.0 Load Balancer as a service
@@ -34,6 +36,7 @@ import javax.xml.bind.annotation.XmlRootElement;
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronLoadBalancer extends NeutronAdminAttributes<NeutronLoadBalancer> implements Serializable {
+    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronLoadBalancer.class);
     private static final long serialVersionUID = 1L;
 
     @XmlElement(name = "vip_address")
@@ -61,12 +64,19 @@ public final class NeutronLoadBalancer extends NeutronAdminAttributes<NeutronLoa
     public NeutronLoadBalancer extractFields(List<String> fields) {
         NeutronLoadBalancer ans = new NeutronLoadBalancer();
         for (String s : fields) {
-            extractField(s, ans);
-            if (s.equals("vip_address")) {
-                ans.setLoadBalancerVipAddress(this.getLoadBalancerVipAddress());
+            if (extractField(s, ans)) {
+                continue;
             }
-            if (s.equals("vip_subnet_id")) {
-                ans.setLoadBalancerVipSubnetID(this.getLoadBalancerVipSubnetID());
+            switch (s) {
+                case "vip_address":
+                    ans.setLoadBalancerVipAddress(this.getLoadBalancerVipAddress());
+                    break;
+                case "vip_subnet_id":
+                    ans.setLoadBalancerVipSubnetID(this.getLoadBalancerVipSubnetID());
+                    break;
+                default:
+                    LOGGER.warn("{} is not a NeutronLoadBalancer suitable field.", s);
+                    break;
             }
         }
         return ans;
index f1bc7caa76d0a56e3846b54a32e457dec79e7829..7a6c01614458f3ec2a920e3018d4dc678eb78016 100644 (file)
@@ -14,6 +14,8 @@ import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * OpenStack Neutron v2.0 Load Balancer as a service
@@ -40,6 +42,8 @@ import javax.xml.bind.annotation.XmlRootElement;
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronLoadBalancerHealthMonitor extends NeutronObject<NeutronLoadBalancerHealthMonitor>
         implements Serializable, INeutronObject<NeutronLoadBalancerHealthMonitor> {
+    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronLoadBalancerHealthMonitor.class);
+
     private static final long serialVersionUID = 1L;
 
     @XmlElement(name = "type")
@@ -144,30 +148,37 @@ public final class NeutronLoadBalancerHealthMonitor extends NeutronObject<Neutro
     public NeutronLoadBalancerHealthMonitor extractFields(List<String> fields) {
         NeutronLoadBalancerHealthMonitor ans = new NeutronLoadBalancerHealthMonitor();
         for (String s : fields) {
-            extractField(s, ans);
-            if (s.equals("type")) {
-                ans.setLoadBalancerHealthMonitorType(this.getLoadBalancerHealthMonitorType());
-            }
-            if (s.equals("delay")) {
-                ans.setLoadBalancerHealthMonitorDelay(this.getLoadBalancerHealthMonitorDelay());
-            }
-            if (s.equals("timeout")) {
-                ans.setLoadBalancerHealthMonitorTimeout(this.getLoadBalancerHealthMonitorTimeout());
-            }
-            if (s.equals("max_retries")) {
-                ans.setLoadBalancerHealthMonitorMaxRetries(this.getLoadBalancerHealthMonitorMaxRetries());
-            }
-            if (s.equals("http_method")) {
-                ans.setLoadBalancerHealthMonitorHttpMethod(this.getLoadBalancerHealthMonitorHttpMethod());
-            }
-            if (s.equals("url_path")) {
-                ans.setLoadBalancerHealthMonitorUrlPath(this.getLoadBalancerHealthMonitorUrlPath());
-            }
-            if (s.equals("expected_codes")) {
-                ans.setLoadBalancerHealthMonitorExpectedCodes(this.getLoadBalancerHealthMonitorExpectedCodes());
+            if (extractField(s, ans)) {
+                continue;
             }
-            if (s.equals("admin_state_up")) {
-                ans.setLoadBalancerHealthMonitorAdminStateIsUp(loadBalancerHealthMonitorAdminStateIsUp);
+            switch (s) {
+                case "type":
+                    ans.setLoadBalancerHealthMonitorType(this.getLoadBalancerHealthMonitorType());
+                    break;
+                case "delay":
+                    ans.setLoadBalancerHealthMonitorDelay(this.getLoadBalancerHealthMonitorDelay());
+                    break;
+                case "timeout":
+                    ans.setLoadBalancerHealthMonitorTimeout(this.getLoadBalancerHealthMonitorTimeout());
+                    break;
+                case "max_retries":
+                    ans.setLoadBalancerHealthMonitorMaxRetries(this.getLoadBalancerHealthMonitorMaxRetries());
+                    break;
+                case "http_method":
+                    ans.setLoadBalancerHealthMonitorHttpMethod(this.getLoadBalancerHealthMonitorHttpMethod());
+                    break;
+                case "url_path":
+                    ans.setLoadBalancerHealthMonitorUrlPath(this.getLoadBalancerHealthMonitorUrlPath());
+                    break;
+                case "expected_codes":
+                    ans.setLoadBalancerHealthMonitorExpectedCodes(this.getLoadBalancerHealthMonitorExpectedCodes());
+                    break;
+                case "admin_state_up":
+                    ans.setLoadBalancerHealthMonitorAdminStateIsUp(loadBalancerHealthMonitorAdminStateIsUp);
+                    break;
+                default:
+                    LOGGER.warn("{} is not a NeutronLoadBalancerHealthMonitor suitable field.", s);
+                    break;
             }
         }
         return ans;
index 6c2c7453f40ddf2394fb3957e3525881704a143f..108f9d4c7352413624124a76db902d16bf093965 100644 (file)
@@ -14,6 +14,8 @@ import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * OpenStack Neutron v2.0 Load Balancer as a service
@@ -41,6 +43,7 @@ import javax.xml.bind.annotation.XmlRootElement;
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronLoadBalancerListener extends NeutronBaseAttributes<NeutronLoadBalancerListener>
         implements Serializable {
+    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronLoadBalancerListener.class);
     private static final long serialVersionUID = 1L;
 
     @XmlElement(name = "default_pool_id")
@@ -113,18 +116,25 @@ public final class NeutronLoadBalancerListener extends NeutronBaseAttributes<Neu
     public NeutronLoadBalancerListener extractFields(List<String> fields) {
         NeutronLoadBalancerListener ans = new NeutronLoadBalancerListener();
         for (String s : fields) {
-            extractField(s, ans);
-            if (s.equals("default_pool_id")) {
-                ans.setNeutronLoadBalancerListenerDefaultPoolID(this.getNeutronLoadBalancerListenerDefaultPoolID());
+            if (extractField(s, ans)) {
+                continue;
             }
-            if (s.equals("protocol")) {
-                ans.setNeutronLoadBalancerListenerProtocol(this.getNeutronLoadBalancerListenerProtocol());
-            }
-            if (s.equals("protocol_port")) {
-                ans.setNeutronLoadBalancerListenerProtocolPort(this.getNeutronLoadBalancerListenerProtocolPort());
-            }
-            if (s.equals("admin_state_up")) {
-                ans.setLoadBalancerListenerAdminStateIsUp(loadBalancerListenerAdminStateIsUp);
+            switch (s) {
+                case "default_pool_id":
+                    ans.setNeutronLoadBalancerListenerDefaultPoolID(this.getNeutronLoadBalancerListenerDefaultPoolID());
+                    break;
+                case "protocol":
+                    ans.setNeutronLoadBalancerListenerProtocol(this.getNeutronLoadBalancerListenerProtocol());
+                    break;
+                case "protocol_port":
+                    ans.setNeutronLoadBalancerListenerProtocolPort(this.getNeutronLoadBalancerListenerProtocolPort());
+                    break;
+                case "admin_state_up":
+                    ans.setLoadBalancerListenerAdminStateIsUp(loadBalancerListenerAdminStateIsUp);
+                    break;
+                default:
+                    LOGGER.warn("{} is not a NeutronLoadBalancerListener suitable field.", s);
+                    break;
             }
         }
         return ans;
index ae481f36be8e37d77eeabba53e5a2469b0493465..b0389789b718439552cff88ce4f002430379d424 100644 (file)
@@ -15,6 +15,8 @@ import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * OpenStack Neutron v2.0 Load Balancer as a service
@@ -39,6 +41,7 @@ import javax.xml.bind.annotation.XmlRootElement;
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronLoadBalancerPool extends NeutronBaseAttributes<NeutronLoadBalancerPool>
         implements Serializable {
+    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronLoadBalancerPool.class);
     private static final long serialVersionUID = 1L;
 
     @XmlElement(name = "protocol")
@@ -153,21 +156,28 @@ public final class NeutronLoadBalancerPool extends NeutronBaseAttributes<Neutron
     public NeutronLoadBalancerPool extractFields(List<String> fields) {
         NeutronLoadBalancerPool ans = new NeutronLoadBalancerPool();
         for (String s : fields) {
-            extractField(s, ans);
-            if (s.equals("protocol")) {
-                ans.setLoadBalancerPoolProtocol(this.getLoadBalancerPoolProtocol());
+            if (extractField(s, ans)) {
+                continue;
             }
-            if (s.equals("lb_algorithm")) {
-                ans.setLoadBalancerPoolLbAlgorithm(this.getLoadBalancerPoolLbAlgorithm());
-            }
-            if (s.equals("healthmonitor_id")) {
-                ans.setLoadBalancerPoolHealthMonitorID(this.getLoadBalancerPoolHealthMonitorID());
-            }
-            if (s.equals("admin_state_up")) {
-                ans.setLoadBalancerPoolAdminStateIsUp(loadBalancerPoolAdminStateIsUp);
-            }
-            if (s.equals("members")) {
-                ans.setLoadBalancerPoolMembers(getLoadBalancerPoolMembers());
+            switch (s) {
+                case "protocol":
+                    ans.setLoadBalancerPoolProtocol(this.getLoadBalancerPoolProtocol());
+                    break;
+                case "lb_algorithm":
+                    ans.setLoadBalancerPoolLbAlgorithm(this.getLoadBalancerPoolLbAlgorithm());
+                    break;
+                case "healthmonitor_id":
+                    ans.setLoadBalancerPoolHealthMonitorID(this.getLoadBalancerPoolHealthMonitorID());
+                    break;
+                case "admin_state_up":
+                    ans.setLoadBalancerPoolAdminStateIsUp(loadBalancerPoolAdminStateIsUp);
+                    break;
+                case "members":
+                    ans.setLoadBalancerPoolMembers(getLoadBalancerPoolMembers());
+                    break;
+                default:
+                    LOGGER.warn("{} is not a NeutronLoadBalancerPool suitable field.", s);
+                    break;
             }
         }
         return ans;
index a1d05154eb3406c06c80dd60dd77755790318ded..22e296dc5939bfe0702f2c8389ec77a309fcec2a 100644 (file)
@@ -15,12 +15,14 @@ import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlTransient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronLoadBalancerPoolMember extends NeutronObject<NeutronLoadBalancerPoolMember>
         implements Serializable, INeutronObject<NeutronLoadBalancerPoolMember> {
-
+    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronLoadBalancerPoolMember.class);
     private static final long serialVersionUID = 1L;
 
     /**
@@ -98,24 +100,31 @@ public final class NeutronLoadBalancerPoolMember extends NeutronObject<NeutronLo
     public NeutronLoadBalancerPoolMember extractFields(List<String> fields) {
         NeutronLoadBalancerPoolMember ans = new NeutronLoadBalancerPoolMember();
         for (String s : fields) {
-            extractField(s, ans);
-            if (s.equals("pool_id")) {
-                ans.setPoolID(this.getPoolID());
-            }
-            if (s.equals("address")) {
-                ans.setPoolMemberAddress(this.getPoolMemberAddress());
-            }
-            if (s.equals("protocol_port")) {
-                ans.setPoolMemberProtoPort(this.getPoolMemberProtoPort());
-            }
-            if (s.equals("admin_state_up")) {
-                ans.setPoolMemberAdminStateIsUp(poolMemberAdminStateIsUp);
-            }
-            if (s.equals("weight")) {
-                ans.setPoolMemberWeight(this.getPoolMemberWeight());
+            if (extractField(s, ans)) {
+                continue;
             }
-            if (s.equals("subnet_id")) {
-                ans.setPoolMemberSubnetID(this.getPoolMemberSubnetID());
+            switch (s) {
+                case "pool_id":
+                    ans.setPoolID(this.getPoolID());
+                    break;
+                case "address":
+                    ans.setPoolMemberAddress(this.getPoolMemberAddress());
+                    break;
+                case "protocol_port":
+                    ans.setPoolMemberProtoPort(this.getPoolMemberProtoPort());
+                    break;
+                case "admin_state_up":
+                    ans.setPoolMemberAdminStateIsUp(poolMemberAdminStateIsUp);
+                    break;
+                case "weight":
+                    ans.setPoolMemberWeight(this.getPoolMemberWeight());
+                    break;
+                case "subnet_id":
+                    ans.setPoolMemberSubnetID(this.getPoolMemberSubnetID());
+                    break;
+                default:
+                    LOGGER.warn("{} is not a NeutronLoadBalancerPoolMember suitable field.", s);
+                    break;
             }
         }
         return ans;
index 1fe3bd1de985af6310fdffaca6499653dcc1e8cd..f4319d9950b45cb0b83c3b3579960592cbf20963 100644 (file)
@@ -14,10 +14,13 @@ import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronMeteringLabel extends NeutronBaseAttributes<NeutronMeteringLabel> implements Serializable {
+    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronLoadBalancerPoolMember.class);
     private static final long serialVersionUID = 1L;
 
     @XmlElement(defaultValue = "false", name = "shared")
@@ -59,9 +62,16 @@ public final class NeutronMeteringLabel extends NeutronBaseAttributes<NeutronMet
     public NeutronMeteringLabel extractFields(List<String> fields) {
         NeutronMeteringLabel ans = new NeutronMeteringLabel();
         for (String s : fields) {
-            extractField(s, ans);
-            if (s.equals("shared")) {
-                ans.setMeteringLabelShared(this.getMeteringLabelShared());
+            if (extractField(s, ans)) {
+                continue;
+            }
+            switch (s) {
+                case "shared":
+                    ans.setMeteringLabelShared(this.getMeteringLabelShared());
+                    break;
+                default:
+                    LOGGER.warn("{} is not a NeutronMeteringLabel suitable field.", s);
+                    break;
             }
         }
         return ans;
index 0c8836ef53915b97a8c538776f18c7d71896a95f..81c2598f46e296d9c0c5d398e8ae1c55b3dbc403 100644 (file)
@@ -14,11 +14,14 @@ import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronMeteringLabelRule extends NeutronObject<NeutronMeteringLabelRule>
         implements Serializable, INeutronObject<NeutronMeteringLabelRule> {
+    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronMeteringLabelRule.class);
     private static final long serialVersionUID = 1L;
 
     @XmlElement(name = "direction")
@@ -94,18 +97,25 @@ public final class NeutronMeteringLabelRule extends NeutronObject<NeutronMeterin
     public NeutronMeteringLabelRule extractFields(List<String> fields) {
         NeutronMeteringLabelRule ans = new NeutronMeteringLabelRule();
         for (String s : fields) {
-            extractField(s, ans);
-            if (s.equals("direction")) {
-                ans.setMeteringLabelRuleDirection(this.getMeteringLabelRuleDirection());
+            if (extractField(s, ans)) {
+                continue;
             }
-            if (s.equals("excluded")) {
-                ans.setMeteringLabelRuleExcluded(this.getMeteringLabelRuleExcluded());
-            }
-            if (s.equals("remote_ip_prefix")) {
-                ans.setMeteringLabelRuleRemoteIpPrefix(this.getMeteringLabelRuleRemoteIpPrefix());
-            }
-            if (s.equals("metering_label_id")) {
-                ans.setMeteringLabelRuleLabelID(this.getMeteringLabelRuleLabelID());
+            switch (s) {
+                case "direction":
+                    ans.setMeteringLabelRuleDirection(this.getMeteringLabelRuleDirection());
+                    break;
+                case "excluded":
+                    ans.setMeteringLabelRuleExcluded(this.getMeteringLabelRuleExcluded());
+                    break;
+                case "remote_ip_prefix":
+                    ans.setMeteringLabelRuleRemoteIpPrefix(this.getMeteringLabelRuleRemoteIpPrefix());
+                    break;
+                case "metering_label_id":
+                    ans.setMeteringLabelRuleLabelID(this.getMeteringLabelRuleLabelID());
+                    break;
+                default:
+                    LOGGER.warn("{} is not a NeutronMeteringLabelRule suitable field.", s);
+                    break;
             }
         }
         return ans;
index c333a256e6a35d03b92e355e33c0110e5f80d40c..63f1be24b9cc0adee9d788698f12e4dc1b74bb9b 100644 (file)
@@ -14,10 +14,13 @@ import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 @XmlRootElement(name = "network")
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronNetwork extends NeutronAdminAttributes<NeutronNetwork> implements Serializable {
+    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronNetwork.class);
     // See OpenStack Network API v2.0 Reference for description of
     // annotated attributes
 
@@ -172,26 +175,32 @@ public final class NeutronNetwork extends NeutronAdminAttributes<NeutronNetwork>
     public NeutronNetwork extractFields(List<String> fields) {
         NeutronNetwork ans = new NeutronNetwork();
         for (String s : fields) {
-            extractField(s, ans);
-            if (s.equals("shared")) {
-                ans.setShared(shared);
+            if (extractField(s, ans)) {
+                continue;
             }
-            if (s.equals("external")) {
-                ans.setRouterExternal(this.getRouterExternal());
+            switch (s) {
+                case "shared":
+                    ans.setShared(shared);
+                    break;
+                case "external":
+                    ans.setRouterExternal(this.getRouterExternal());
+                    break;
+                case "segmentation_id":
+                    ans.setProviderSegmentationID(this.getProviderSegmentationID());
+                    break;
+                case "physical_network":
+                    ans.setProviderPhysicalNetwork(this.getProviderPhysicalNetwork());
+                    break;
+                case "network_type":
+                    ans.setProviderNetworkType(this.getProviderNetworkType());
+                    break;
+                case "qos_policy_id":
+                    ans.setQosPolicyId(this.getQosPolicyId());
+                    break;
+                default:
+                    LOGGER.warn("{} is not a NeutronNetwork suitable field.", s);
+                    break;
             }
-            if (s.equals("segmentation_id")) {
-                ans.setProviderSegmentationID(this.getProviderSegmentationID());
-            }
-            if (s.equals("physical_network")) {
-                ans.setProviderPhysicalNetwork(this.getProviderPhysicalNetwork());
-            }
-            if (s.equals("network_type")) {
-                ans.setProviderNetworkType(this.getProviderNetworkType());
-            }
-            if (s.equals("qos_policy_id")) {
-                ans.setQosPolicyId(this.getQosPolicyId());
-            }
-
         }
         return ans;
     }
index 61e9b030b1a19683606afb41c84032b98ff01663..7e3f74e2129a3c19b893daba264a558452cb0a35 100644 (file)
@@ -96,18 +96,22 @@ public abstract class NeutronObject<T extends NeutronObject> extends NeutronID
     @Override
     public abstract T extractFields(List<String> fields);
 
-    protected void extractField(String field, T ans) {
-        if (field.equals("id")) {
-            ans.setID(this.getID());
-        }
-        if (field.equals("tenant_id")) {
-            ans.setTenantID(this.getTenantID());
-        }
-        if (field.equals("project_id")) {
-            ans.setProjectID(this.getProjectID());
-        }
-        if (field.equals("revision_number")) {
-            ans.setRevisionNumber(this.getRevisionNumber());
+    protected boolean extractField(String field, T ans) {
+        switch (field) {
+            case "id":
+                ans.setID(this.getID());
+                return true;
+            case "tenant_id":
+                ans.setTenantID(this.getTenantID());
+                return true;
+            case "project_id":
+                ans.setProjectID(this.getProjectID());
+                return true;
+            case "revision_number":
+                ans.setRevisionNumber(this.getRevisionNumber());
+                return true;
+            default:
+                return false;
         }
     }
 }
index b53492bb165b1919fd22b10bccaeb6e07552dc26..4da69d56e8c00ca04ae76ba7881b3e1193bceb65 100644 (file)
@@ -18,10 +18,13 @@ import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronPort extends NeutronAdminAttributes<NeutronPort> implements Serializable {
+    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronPort.class);
     private static final long serialVersionUID = 1L;
 
     // See OpenStack Network API v2.0 Reference for description of
@@ -212,50 +215,57 @@ public final class NeutronPort extends NeutronAdminAttributes<NeutronPort> imple
 
     public NeutronPort extractFields(List<String> fields) {
         NeutronPort ans = new NeutronPort();
-        for (String field : fields) {
-            extractField(field, ans);
-            if ("network_id".equals(field)) {
-                ans.setNetworkUUID(this.getNetworkUUID());
+        for (String s : fields) {
+            if (extractField(s, ans)) {
+                continue;
             }
-            if ("mac_address".equals(field)) {
-                ans.setMacAddress(this.getMacAddress());
-            }
-            if ("fixed_ips".equals(field)) {
-                ans.setFixedIps(new ArrayList<NeutronIps>(this.getFixedIps()));
-            }
-            if ("device_id".equals(field)) {
-                ans.setDeviceID(this.getDeviceID());
-            }
-            if ("device_owner".equals(field)) {
-                ans.setDeviceOwner(this.getDeviceOwner());
-            }
-            if ("security_groups".equals(field)) {
-                ans.setSecurityGroups(new ArrayList<NeutronSecurityGroup>(this.getSecurityGroups()));
-            }
-            if ("allowed_address_pairs".equals(field)) {
-                ans.setAllowedAddressPairs(
-                        new ArrayList<NeutronPortAllowedAddressPairs>(this.getAllowedAddressPairs()));
-            }
-            if ("binding:host_id".equals(field)) {
-                ans.setBindinghostID(this.getBindinghostID());
-            }
-            if ("binding:vnic_type".equals(field)) {
-                ans.setBindingvnicType(this.getBindingvnicType());
-            }
-            if ("binding:vif_type".equals(field)) {
-                ans.setBindingvifType(this.getBindingvifType());
-            }
-            if ("binding:vif_details".equals(field)) {
-                ans.setVIFDetails(new HashMap<String, String>(this.getVIFDetails()));
-            }
-            if ("extra_dhcp_opts".equals(field)) {
-                ans.setExtraDHCPOptions(new ArrayList<NeutronPortExtraDHCPOption>(this.getExtraDHCPOptions()));
-            }
-            if ("port_security_enabled".equals(field)) {
-                ans.setPortSecurityEnabled(this.getPortSecurityEnabled());
-            }
-            if ("qos_policy_id".equals(field)) {
-                ans.setQosPolicyId(this.getQosPolicyId());
+            switch (s) {
+                case "network_id":
+                    ans.setNetworkUUID(this.getNetworkUUID());
+                    break;
+                case "mac_address":
+                    ans.setMacAddress(this.getMacAddress());
+                    break;
+                case "fixed_ips":
+                    ans.setFixedIps(new ArrayList<NeutronIps>(this.getFixedIps()));
+                    break;
+                case "device_id":
+                    ans.setDeviceID(this.getDeviceID());
+                    break;
+                case "device_owner":
+                    ans.setDeviceOwner(this.getDeviceOwner());
+                    break;
+                case "security_groups":
+                    ans.setSecurityGroups(new ArrayList<NeutronSecurityGroup>(this.getSecurityGroups()));
+                    break;
+                case "allowed_address_pairs":
+                    ans.setAllowedAddressPairs(
+                            new ArrayList<NeutronPortAllowedAddressPairs>(this.getAllowedAddressPairs()));
+                    break;
+                case "binding:host_id":
+                    ans.setBindinghostID(this.getBindinghostID());
+                    break;
+                case "binding:vnic_type":
+                    ans.setBindingvnicType(this.getBindingvnicType());
+                    break;
+                case "binding:vif_type":
+                    ans.setBindingvifType(this.getBindingvifType());
+                    break;
+                case "binding:vif_details":
+                    ans.setVIFDetails(new HashMap<String, String>(this.getVIFDetails()));
+                    break;
+                case "extra_dhcp_opts":
+                    ans.setExtraDHCPOptions(new ArrayList<NeutronPortExtraDHCPOption>(this.getExtraDHCPOptions()));
+                    break;
+                case "port_security_enabled":
+                    ans.setPortSecurityEnabled(this.getPortSecurityEnabled());
+                    break;
+                case "qos_policy_id":
+                    ans.setQosPolicyId(this.getQosPolicyId());
+                    break;
+                default:
+                    LOGGER.warn("{} is not a NeutronPort suitable field.", s);
+                    break;
             }
         }
         return ans;
index f11d8bb06a96dd1bc9fda5998dd1f5ed421dc01c..15f755f2dbfdb6686abd74ab82bc18a293760ff3 100644 (file)
@@ -15,11 +15,14 @@ import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronQosBandwidthRule extends NeutronObject<NeutronQosBandwidthRule>
         implements Serializable, INeutronObject<NeutronQosBandwidthRule> {
+    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronQosBandwidthRule.class);
     private static final long serialVersionUID = 1L;
 
     @XmlElement(name = "max_kbps")
@@ -47,12 +50,19 @@ public final class NeutronQosBandwidthRule extends NeutronObject<NeutronQosBandw
     public NeutronQosBandwidthRule extractFields(List<String> fields) {
         NeutronQosBandwidthRule ans = new NeutronQosBandwidthRule();
         for (String s : fields) {
-            extractField(s, ans);
-            if (s.equals("max_kbps")) {
-                ans.setMaxKbps(this.getMaxKbps());
+            if (extractField(s, ans)) {
+                continue;
             }
-            if (s.equals("max_burst_kbps")) {
-                ans.setMaxBurstKbps(this.getMaxBurstKbps());
+            switch (s) {
+                case "max_kbps":
+                    ans.setMaxKbps(this.getMaxKbps());
+                    break;
+                case "max_burst_kbps":
+                    ans.setMaxBurstKbps(this.getMaxBurstKbps());
+                    break;
+                default:
+                    LOGGER.warn("{} is not a NeutronQosBandwidthRule suitable field.", s);
+                    break;
             }
         }
         return ans;
index 543fae81dd83b15dafaadf121965aa087c557a54..5ecf1de35c2e0620180326cac36489453c973f30 100644 (file)
@@ -14,11 +14,14 @@ import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronQosDscpMarkingRule extends NeutronObject<NeutronQosDscpMarkingRule>
         implements Serializable, INeutronObject<NeutronQosDscpMarkingRule> {
+    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronQosDscpMarkingRule.class);
     private static final long serialVersionUID = 1L;
 
     @XmlElement(name = "dscp_mark")
@@ -35,9 +38,16 @@ public final class NeutronQosDscpMarkingRule extends NeutronObject<NeutronQosDsc
     public NeutronQosDscpMarkingRule extractFields(List<String> fields) {
         NeutronQosDscpMarkingRule ans = new NeutronQosDscpMarkingRule();
         for (String s : fields) {
-            extractField(s, ans);
-            if (s.equals("dscp_mark")) {
-                ans.setDscpMark(this.getDscpMark());
+            if (extractField(s, ans)) {
+                continue;
+            }
+            switch (s) {
+                case "dscp_mark":
+                    ans.setDscpMark(this.getDscpMark());
+                    break;
+                default:
+                    LOGGER.warn("{} is not a NeutronQosDscpMarkingRule suitable field.", s);
+                    break;
             }
         }
         return ans;
index 51c96ce069f4361e8b90d6a481edf8ccf8951c9e..28aaad7feaa7ec9a9489a7f6652859c7233235e8 100644 (file)
@@ -15,10 +15,13 @@ import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronQosPolicy extends NeutronBaseAttributes<NeutronQosPolicy> implements Serializable {
+    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronQosPolicy.class);
     private static final long serialVersionUID = 1L;
 
     @XmlElement(defaultValue = "false", name = "shared")
@@ -57,19 +60,26 @@ public final class NeutronQosPolicy extends NeutronBaseAttributes<NeutronQosPoli
     public NeutronQosPolicy extractFields(List<String> fields) {
         NeutronQosPolicy ans = new NeutronQosPolicy();
         for (String s : fields) {
-            extractField(s, ans);
-            if (s.equals("shared")) {
-                ans.setPolicyIsShared(this.getPolicyIsShared());
+            if (extractField(s, ans)) {
+                continue;
             }
-            if (s.equals("bandwidth_limit_rules")) {
-                List<NeutronQosBandwidthRule> qosBwRuleList = new ArrayList<>();
-                qosBwRuleList.addAll(this.getBwLimitRules());
-                ans.setQosBwLimitRules(qosBwRuleList);
-            }
-            if (s.equals("dscp_marking_rules")) {
-                List<NeutronQosDscpMarkingRule> qosDscpRuleList = new ArrayList<>();
-                qosDscpRuleList.addAll(this.getDscpRules());
-                ans.setDscpRules(qosDscpRuleList);
+            switch (s) {
+                case "shared":
+                    ans.setPolicyIsShared(this.getPolicyIsShared());
+                    break;
+                case "bandwidth_limit_rules":
+                    List<NeutronQosBandwidthRule> qosBwRuleList = new ArrayList<>();
+                    qosBwRuleList.addAll(this.getBwLimitRules());
+                    ans.setQosBwLimitRules(qosBwRuleList);
+                    break;
+                case "dscp_marking_rules":
+                    List<NeutronQosDscpMarkingRule> qosDscpRuleList = new ArrayList<>();
+                    qosDscpRuleList.addAll(this.getDscpRules());
+                    ans.setDscpRules(qosDscpRuleList);
+                    break;
+                default:
+                    LOGGER.warn("{} is not a NeutronQosPolicy suitable field.", s);
+                    break;
             }
         }
         return ans;
index 983b0a9b354f8c3f5894bfd56645afd416d764a3..536aab55289d4348fa2cac01b4c8a58ba828ccd6 100644 (file)
@@ -14,11 +14,14 @@ import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronRouter extends NeutronAdminAttributes<NeutronRouter>
         implements Serializable {
+    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronRouter.class);
     private static final long serialVersionUID = 1L;
 
     // See OpenStack Network API v2.0 Reference for description of
@@ -89,18 +92,25 @@ public final class NeutronRouter extends NeutronAdminAttributes<NeutronRouter>
     public NeutronRouter extractFields(List<String> fields) {
         NeutronRouter ans = new NeutronRouter();
         for (String s : fields) {
-            extractField(s, ans);
-            if (s.equals("external_gateway_info")) {
-                ans.setExternalGatewayInfo(this.getExternalGatewayInfo());
+            if (extractField(s, ans)) {
+                continue;
             }
-            if (s.equals("distributed")) {
-                ans.setDistributed(this.getDistributed());
-            }
-            if (s.equals("gw_port_id")) {
-                ans.setGatewayPortId(this.getGatewayPortId());
-            }
-            if (s.equals("routes")) {
-                ans.setRoutes(this.getRoutes());
+            switch (s) {
+                case "external_gateway_info":
+                    ans.setExternalGatewayInfo(this.getExternalGatewayInfo());
+                    break;
+                case "distributed":
+                    ans.setDistributed(this.getDistributed());
+                    break;
+                case "gw_port_id":
+                    ans.setGatewayPortId(this.getGatewayPortId());
+                    break;
+                case "routes":
+                    ans.setRoutes(this.getRoutes());
+                    break;
+                default:
+                    LOGGER.warn("{} is not a NeutronRouter suitable field.", s);
+                    break;
             }
         }
         return ans;
index 3a9d584164e425d4a9cec65f066bc4bc7bd0e81b..b8e28ccec796da4e0282eca77e00e8da538b6d24 100644 (file)
@@ -14,11 +14,14 @@ import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronRouterInterface extends NeutronObject<NeutronRouterInterface>
         implements Serializable, INeutronObject<NeutronRouterInterface> {
+    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronRouterInterface.class);
     private static final long serialVersionUID = 1L;
 
     // See OpenStack Network API v2.0 Reference for description of
@@ -58,12 +61,19 @@ public final class NeutronRouterInterface extends NeutronObject<NeutronRouterInt
     public NeutronRouterInterface extractFields(List<String> fields) {
         NeutronRouterInterface ans = new NeutronRouterInterface();
         for (String s : fields) {
-            extractField(s, ans);
-            if (s.equals("subnet_id")) {
-                ans.setSubnetUUID(this.getSubnetUUID());
+            if (extractField(s, ans)) {
+                continue;
             }
-            if (s.equals("port_id")) {
-                ans.setPortUUID(this.getPortUUID());
+            switch (s) {
+                case "subnet_id":
+                    ans.setSubnetUUID(this.getSubnetUUID());
+                    break;
+                case "port_id":
+                    ans.setPortUUID(this.getPortUUID());
+                    break;
+                default:
+                    LOGGER.warn("{} is not a NeutronRouterInterface suitable field.", s);
+                    break;
             }
         }
         return ans;
index b0a34714a26e3fb3014396fd6ea0dd21cb514034..7eb3a2af9b52c0909922ebea940b8bc32bd79792 100644 (file)
@@ -16,11 +16,14 @@ import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronSFCFlowClassifier extends NeutronBaseAttributes<NeutronSFCFlowClassifier>
         implements Serializable {
+    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronSFCFlowClassifier.class);
     private static final long serialVersionUID = 1L;
 
     // See OpenStack Networking SFC (networking-sfc) API v1.0 Reference for description of
@@ -162,36 +165,43 @@ public final class NeutronSFCFlowClassifier extends NeutronBaseAttributes<Neutro
     public NeutronSFCFlowClassifier extractFields(List<String> fields) {
         NeutronSFCFlowClassifier ans = new NeutronSFCFlowClassifier();
         for (String s : fields) {
-            extractField(s, ans);
-            if (s.equals("ethertype")) {
-                ans.setEthertype(this.getEthertype());
+            if (extractField(s, ans)) {
+                continue;
             }
-            if (s.equals("source_port_range_min")) {
-                ans.setSourcePortRangeMin(this.getSourcePortRangeMin());
-            }
-            if (s.equals("source_port_range_max")) {
-                ans.setSourcePortRangeMax(this.getSourcePortRangeMax());
-            }
-            if (s.equals("destination_port_range_min")) {
-                ans.setDestinationPortRangeMin(this.getDestinationPortRangeMin());
-            }
-            if (s.equals("destination_port_range_max")) {
-                ans.setDestinationPortRangeMax(this.getDestinationPortRangeMax());
-            }
-            if (s.equals("source_ip_prefix")) {
-                ans.setSourceIpPrefix(this.getSourceIpPrefix());
-            }
-            if (s.equals("destination_ip_prefix")) {
-                ans.setDestinationIpPrefix(this.getDestinationIpPrefix());
-            }
-            if (s.equals("logical_source_port")) {
-                ans.setLogicalDestinationPortUUID(this.getLogicalDestinationPortUUID());
-            }
-            if (s.equals("logical_destination_port")) {
-                ans.setLogicalDestinationPortUUID(this.getLogicalDestinationPortUUID());
-            }
-            if (s.equals("l7_parameters")) {
-                ans.setL7Parameters(new HashMap<String, String>(this.getL7Parameters()));
+            switch (s) {
+                case "ethertype":
+                    ans.setEthertype(this.getEthertype());
+                    break;
+                case "source_port_range_min":
+                    ans.setSourcePortRangeMin(this.getSourcePortRangeMin());
+                    break;
+                case "source_port_range_max":
+                    ans.setSourcePortRangeMax(this.getSourcePortRangeMax());
+                    break;
+                case "destination_port_range_min":
+                    ans.setDestinationPortRangeMin(this.getDestinationPortRangeMin());
+                    break;
+                case "destination_port_range_max":
+                    ans.setDestinationPortRangeMax(this.getDestinationPortRangeMax());
+                    break;
+                case "source_ip_prefix":
+                    ans.setSourceIpPrefix(this.getSourceIpPrefix());
+                    break;
+                case "destination_ip_prefix":
+                    ans.setDestinationIpPrefix(this.getDestinationIpPrefix());
+                    break;
+                case "logical_source_port":
+                    ans.setLogicalDestinationPortUUID(this.getLogicalDestinationPortUUID());
+                    break;
+                case "logical_destination_port":
+                    ans.setLogicalDestinationPortUUID(this.getLogicalDestinationPortUUID());
+                    break;
+                case "l7_parameters":
+                    ans.setL7Parameters(new HashMap<String, String>(this.getL7Parameters()));
+                    break;
+                default:
+                    LOGGER.warn("{} is not a NeutronSFCFlowClassifier suitable field.", s);
+                    break;
             }
         }
         return ans;
index b621f20b9dcd32915d9132e39209a5521928344a..b59468877164d6d26fc82e7f6b656831150f56a2 100644 (file)
@@ -15,11 +15,13 @@ import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronSFCPortChain extends NeutronBaseAttributes<NeutronSFCPortChain> implements Serializable {
-
+    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronSFCPortChain.class);
     private static final long serialVersionUID = 1L;
 
     // See OpenStack Networking SFC (networking-sfc) Port Chain API v1.0 Reference
@@ -74,15 +76,22 @@ public final class NeutronSFCPortChain extends NeutronBaseAttributes<NeutronSFCP
     public NeutronSFCPortChain extractFields(List<String> fields) {
         NeutronSFCPortChain ans = new NeutronSFCPortChain();
         for (String s : fields) {
-            extractField(s, ans);
-            if (s.equals("port_pair_groups")) {
-                ans.setPortPairGroupsUUID(this.getPortPairGroupsUUID());
-            }
-            if (s.equals("flow_classifiers")) {
-                ans.setFlowClassifiersUUID(this.getFlowClassifiersUUID());
+            if (extractField(s, ans)) {
+                continue;
             }
-            if (s.equals("chain_parameters")) {
-                ans.setChainParameters(this.getChainParameters());
+            switch (s) {
+                case "port_pair_groups":
+                    ans.setPortPairGroupsUUID(this.getPortPairGroupsUUID());
+                    break;
+                case "flow_classifiers":
+                    ans.setFlowClassifiersUUID(this.getFlowClassifiersUUID());
+                    break;
+                case "chain_parameters":
+                    ans.setChainParameters(this.getChainParameters());
+                    break;
+                default:
+                    LOGGER.warn("{} is not a NeutronSFCPortChain suitable field.", s);
+                    break;
             }
         }
         return ans;
index 32f0fc6e21ef7d913f6e18f70ab9cb25f4dd55f1..13d1c2a246162f06d8ab7f43344756923782e62d 100644 (file)
@@ -16,11 +16,13 @@ import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronSFCPortPair extends NeutronBaseAttributes<NeutronSFCPortPair> implements Serializable {
-
+    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronSFCPortPair.class);
     private static final long serialVersionUID = 1L;
 
     // See OpenStack Networking SFC (networking-sfc) Port Pair API v1.0 Reference
@@ -74,15 +76,22 @@ public final class NeutronSFCPortPair extends NeutronBaseAttributes<NeutronSFCPo
     public NeutronSFCPortPair extractFields(List<String> fields) {
         NeutronSFCPortPair ans = new NeutronSFCPortPair();
         for (String s : fields) {
-            extractField(s, ans);
-            if (s.equals("ingress")) {
-                ans.setIngressPortUUID(this.getIngressPortUUID());
-            }
-            if (s.equals("egress")) {
-                ans.setEgressPortUUID(this.getEgressPortUUID());
+            if (extractField(s, ans)) {
+                continue;
             }
-            if (s.equals("service_function_parameters")) {
-                ans.setServiceFunctionParameters(new HashMap<String, String>(this.getServiceFunctionParameters()));
+            switch (s) {
+                case "ingress":
+                    ans.setIngressPortUUID(this.getIngressPortUUID());
+                    break;
+                case "egress":
+                    ans.setEgressPortUUID(this.getEgressPortUUID());
+                    break;
+                case "service_function_parameters":
+                    ans.setServiceFunctionParameters(new HashMap<String, String>(this.getServiceFunctionParameters()));
+                    break;
+                default:
+                    LOGGER.warn("{} is not a NeutronSFCPortPair suitable field.", s);
+                    break;
             }
         }
         return ans;
index a976f4065dbfc88d40eca6308e6e1a8c5c444bf8..a1e7d9daf14b46daa2279d7245f3272e3f7a5d9b 100644 (file)
@@ -13,11 +13,14 @@ import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronSFCPortPairGroup extends NeutronBaseAttributes<NeutronSFCPortPairGroup>
         implements Serializable {
+    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronSFCPortPairGroup.class);
     private static final long serialVersionUID = 1L;
 
     // See OpenStack Networking SFC (networking-sfc) Port Pair Group API v1.0
@@ -49,9 +52,16 @@ public final class NeutronSFCPortPairGroup extends NeutronBaseAttributes<Neutron
     public NeutronSFCPortPairGroup extractFields(List<String> fields) {
         NeutronSFCPortPairGroup ans = new NeutronSFCPortPairGroup();
         for (String s : fields) {
-            extractField(s, ans);
-            if (s.equals("port_pairs")) {
-                ans.setPortPairs(this.getPortPairs());
+            if (extractField(s, ans)) {
+                continue;
+            }
+            switch (s) {
+                case "port_pairs":
+                    ans.setPortPairs(this.getPortPairs());
+                    break;
+                default:
+                    LOGGER.warn("{} is not a NeutronSFCPortPairGroup suitable field.", s);
+                    break;
             }
         }
         return ans;
index b0634aff0bc40e6bdabfa716bb6a5e6699345c47..ca927c55e4d575e6ca14659b032462a9469d7313 100644 (file)
@@ -13,6 +13,8 @@ import java.util.List;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlRootElement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * OpenStack Neutron v2.0 Security Group bindings.
@@ -28,6 +30,7 @@ import javax.xml.bind.annotation.XmlRootElement;
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronSecurityGroup extends NeutronBaseAttributes<NeutronSecurityGroup> implements Serializable {
+    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronSecurityGroup.class);
     private static final long serialVersionUID = 1L;
 
     public NeutronSecurityGroup() {
@@ -36,7 +39,10 @@ public final class NeutronSecurityGroup extends NeutronBaseAttributes<NeutronSec
     public NeutronSecurityGroup extractFields(List<String> fields) {
         NeutronSecurityGroup ans = new NeutronSecurityGroup();
         for (String s : fields) {
-            extractField(s, ans);
+            if (extractField(s, ans)) {
+                continue;
+            }
+            LOGGER.warn("{} is not a NeutronSecurityGroup suitable field.", s);
         }
         return ans;
     }
index 2a48fc95bcf2912226101f49bcf9cdb0deb964b5..00363e16b660f446e8dcb5124632f20bea56f407 100644 (file)
@@ -14,6 +14,8 @@ import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * See OpenStack Network API v2.0 Reference for description of
@@ -36,6 +38,7 @@ import javax.xml.bind.annotation.XmlRootElement;
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronSecurityRule extends NeutronObject<NeutronSecurityRule>
         implements Serializable, INeutronObject<NeutronSecurityRule> {
+    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronSecurityRule.class);
     private static final long serialVersionUID = 1L;
 
     @XmlElement(name = "direction")
@@ -132,30 +135,37 @@ public final class NeutronSecurityRule extends NeutronObject<NeutronSecurityRule
     public NeutronSecurityRule extractFields(List<String> fields) {
         NeutronSecurityRule ans = new NeutronSecurityRule();
         for (String s : fields) {
-            extractField(s, ans);
-            if (s.equals("direction")) {
-                ans.setSecurityRuleDirection(this.getSecurityRuleDirection());
+            if (extractField(s, ans)) {
+                continue;
             }
-            if (s.equals("protocol")) {
-                ans.setSecurityRuleProtocol(this.getSecurityRuleProtocol());
-            }
-            if (s.equals("port_range_min")) {
-                ans.setSecurityRulePortMin(this.getSecurityRulePortMin());
-            }
-            if (s.equals("port_range_max")) {
-                ans.setSecurityRulePortMax(this.getSecurityRulePortMax());
-            }
-            if (s.equals("ethertype")) {
-                ans.setSecurityRuleEthertype(this.getSecurityRuleEthertype());
-            }
-            if (s.equals("remote_ip_prefix")) {
-                ans.setSecurityRuleRemoteIpPrefix(this.getSecurityRuleRemoteIpPrefix());
-            }
-            if (s.equals("remote_group_id")) {
-                ans.setSecurityRemoteGroupID(this.getSecurityRemoteGroupID());
-            }
-            if (s.equals("security_group_id")) {
-                ans.setSecurityRuleGroupID(this.getSecurityRuleGroupID());
+            switch (s) {
+                case "direction":
+                    ans.setSecurityRuleDirection(this.getSecurityRuleDirection());
+                    break;
+                case "protocol":
+                    ans.setSecurityRuleProtocol(this.getSecurityRuleProtocol());
+                    break;
+                case "port_range_min":
+                    ans.setSecurityRulePortMin(this.getSecurityRulePortMin());
+                    break;
+                case "port_range_max":
+                    ans.setSecurityRulePortMax(this.getSecurityRulePortMax());
+                    break;
+                case "ethertype":
+                    ans.setSecurityRuleEthertype(this.getSecurityRuleEthertype());
+                    break;
+                case "remote_ip_prefix":
+                    ans.setSecurityRuleRemoteIpPrefix(this.getSecurityRuleRemoteIpPrefix());
+                    break;
+                case "remote_group_id":
+                    ans.setSecurityRemoteGroupID(this.getSecurityRemoteGroupID());
+                    break;
+                case "security_group_id":
+                    ans.setSecurityRuleGroupID(this.getSecurityRuleGroupID());
+                    break;
+                default:
+                    LOGGER.warn("{} is not a NeutronSecurityRule suitable field.", s);
+                    break;
             }
         }
         return ans;
index a3f38c85b3576de990e5d11a6139e69552061291..2ff8957c9d531d6fae4b0105652cd000ad3be9a1 100644 (file)
@@ -169,42 +169,49 @@ public final class NeutronSubnet extends NeutronBaseAttributes<NeutronSubnet> im
     public NeutronSubnet extractFields(List<String> fields) {
         NeutronSubnet ans = new NeutronSubnet();
         for (String s : fields) {
-            extractField(s, ans);
-            if (s.equals("network_id")) {
-                ans.setNetworkUUID(this.getNetworkUUID());
+            if (extractField(s, ans)) {
+                continue;
             }
-            if (s.equals("ip_version")) {
-                ans.setIpVersion(this.getIpVersion());
-            }
-            if (s.equals("cidr")) {
-                ans.setCidr(this.getCidr());
-            }
-            if (s.equals("gateway_ip")) {
-                ans.setGatewayIp(this.getGatewayIp());
-            }
-            if (s.equals("dns_nameservers")) {
-                List<String> nsList = new ArrayList<String>();
-                nsList.addAll(this.getDnsNameservers());
-                ans.setDnsNameservers(nsList);
-            }
-            if (s.equals("allocation_pools")) {
-                List<NeutronSubnetIpAllocationPool> pools = new ArrayList<NeutronSubnetIpAllocationPool>();
-                pools.addAll(this.getAllocationPools());
-                ans.setAllocationPools(pools);
-            }
-            if (s.equals("host_routes")) {
-                List<NeutronRoute> hostRoutes = new ArrayList<NeutronRoute>();
-                hostRoutes.addAll(this.getHostRoutes());
-                ans.setHostRoutes(hostRoutes);
-            }
-            if (s.equals("enable_dhcp")) {
-                ans.setEnableDHCP(this.getEnableDHCP());
-            }
-            if (s.equals("ipv6_address_mode")) {
-                ans.setIpV6AddressMode(this.getIpV6AddressMode());
-            }
-            if (s.equals("ipv6_ra_mode")) {
-                ans.setIpV6RaMode(this.getIpV6RaMode());
+            switch (s) {
+                case "network_id":
+                    ans.setNetworkUUID(this.getNetworkUUID());
+                    break;
+                case "ip_version":
+                    ans.setIpVersion(this.getIpVersion());
+                    break;
+                case "cidr":
+                    ans.setCidr(this.getCidr());
+                    break;
+                case "gateway_ip":
+                    ans.setGatewayIp(this.getGatewayIp());
+                    break;
+                case "dns_nameservers":
+                    List<String> nsList = new ArrayList<String>();
+                    nsList.addAll(this.getDnsNameservers());
+                    ans.setDnsNameservers(nsList);
+                    break;
+                case "allocation_pools":
+                    List<NeutronSubnetIpAllocationPool> pools = new ArrayList<NeutronSubnetIpAllocationPool>();
+                    pools.addAll(this.getAllocationPools());
+                    ans.setAllocationPools(pools);
+                    break;
+                case "host_routes":
+                    List<NeutronRoute> hostRoutes = new ArrayList<NeutronRoute>();
+                    hostRoutes.addAll(this.getHostRoutes());
+                    ans.setHostRoutes(hostRoutes);
+                    break;
+                case "enable_dhcp":
+                    ans.setEnableDHCP(this.getEnableDHCP());
+                    break;
+                case "ipv6_address_mode":
+                    ans.setIpV6AddressMode(this.getIpV6AddressMode());
+                    break;
+                case "ipv6_ra_mode":
+                    ans.setIpV6RaMode(this.getIpV6RaMode());
+                    break;
+                default:
+                    LOGGER.warn("{} is not an OpenStackSubnet suitable field.", s);
+                    break;
             }
         }
         return ans;
index 8beae46abfaacd89ee27007f6c028df31f6f8278..70706af8e96edffafb934fe522f8e31b9dd9f65e 100644 (file)
@@ -15,11 +15,13 @@ import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 @XmlRootElement(name = "trunk")
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronTrunk extends NeutronAdminAttributes<NeutronTrunk> implements Serializable {
-
+    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronTrunk.class);
     private static final long serialVersionUID = 1L;
 
     @XmlElement(name = "port_id")
@@ -76,14 +78,21 @@ public final class NeutronTrunk extends NeutronAdminAttributes<NeutronTrunk> imp
     public NeutronTrunk extractFields(List<String> fields) {
         NeutronTrunk ans = new NeutronTrunk();
         for (String s : fields) {
-            extractField(s, ans);
-            if ("port_id".equals(s)) {
-                ans.setPortId(this.getPortId());
+            if (extractField(s, ans)) {
+                continue;
             }
-            if ("sub_ports".equals(s)) {
-                List<NeutronTrunkSubPort> subPortList = new ArrayList<>();
-                subPortList.addAll(this.getSubPorts());
-                ans.setSubPorts(subPortList);
+            switch (s) {
+                case "port_id":
+                    ans.setPortId(this.getPortId());
+                    break;
+                case "sub_ports":
+                    List<NeutronTrunkSubPort> subPortList = new ArrayList<>();
+                    subPortList.addAll(this.getSubPorts());
+                    ans.setSubPorts(subPortList);
+                    break;
+                default:
+                    LOGGER.warn("{} is not an NeutronTrunk suitable field.", s);
+                    break;
             }
         }
         return ans;
index 8bf05b85ca215d89ce1c7c1101b127760b286320..b8131428af156b86bab3625a763069dfd33144d8 100644 (file)
@@ -14,10 +14,13 @@ import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronVpnIkePolicy extends NeutronBaseAttributes<NeutronVpnIkePolicy> implements Serializable {
+    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronVpnIkePolicy.class);
     private static final long serialVersionUID = 1L;
 
     // See OpenStack Network API v2.0 Reference for description of
@@ -104,21 +107,28 @@ public final class NeutronVpnIkePolicy extends NeutronBaseAttributes<NeutronVpnI
     public NeutronVpnIkePolicy extractFields(List<String> fields) {
         NeutronVpnIkePolicy ans = new NeutronVpnIkePolicy();
         for (String s : fields) {
-            extractField(s, ans);
-            if (s.equals("auth_algorithm")) {
-                ans.setAuthAlgorithm(this.getAuthAlgorithm());
+            if (extractField(s, ans)) {
+                continue;
             }
-            if (s.equals("encryption_algorithm")) {
-                ans.setEncryptionAlgorithm(this.getEncryptionAlgorithm());
-            }
-            if (s.equals("phase1_negotiation_mode")) {
-                ans.setPhase1NegotiationMode(this.getPhase1NegotiationMode());
-            }
-            if (s.equals("pfs")) {
-                ans.setPerfectForwardSecrecy(this.getPerfectForwardSecrecy());
-            }
-            if (s.equals("ike_version")) {
-                ans.setIkeVersion(this.getIkeVersion());
+            switch (s) {
+                case "auth_algorithm":
+                    ans.setAuthAlgorithm(this.getAuthAlgorithm());
+                    break;
+                case "encryption_algorithm":
+                    ans.setEncryptionAlgorithm(this.getEncryptionAlgorithm());
+                    break;
+                case "phase1_negotiation_mode":
+                    ans.setPhase1NegotiationMode(this.getPhase1NegotiationMode());
+                    break;
+                case "pfs":
+                    ans.setPerfectForwardSecrecy(this.getPerfectForwardSecrecy());
+                    break;
+                case "ike_version":
+                    ans.setIkeVersion(this.getIkeVersion());
+                    break;
+                default:
+                    LOGGER.warn("{} is not an NeutronVpnIkePolicy suitable field.", s);
+                    break;
             }
         }
         return ans;
index fb507e92617d0cae0dbd695d838619b68bddf892..739ccb2a4ccfadea91ad26d900faef5e04ee41a2 100644 (file)
@@ -14,10 +14,13 @@ import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronVpnIpSecPolicy extends NeutronBaseAttributes<NeutronVpnIpSecPolicy> implements Serializable {
+    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronVpnIpSecPolicy.class);
     private static final long serialVersionUID = 1L;
 
     // See OpenStack Network API v2.0 Reference for description of
@@ -104,21 +107,28 @@ public final class NeutronVpnIpSecPolicy extends NeutronBaseAttributes<NeutronVp
     public NeutronVpnIpSecPolicy extractFields(List<String> fields) {
         NeutronVpnIpSecPolicy ans = new NeutronVpnIpSecPolicy();
         for (String s : fields) {
-            extractField(s, ans);
-            if (s.equals("transform_protocol")) {
-                ans.setTransformProtocol(this.getTransformProtocol());
+            if (extractField(s, ans)) {
+                continue;
             }
-            if (s.equals("encapsulation_mode")) {
-                ans.setEncapsulationMode(this.getEncapsulationMode());
-            }
-            if (s.equals("auth_algorithm")) {
-                ans.setAuthAlgorithm(this.getAuthAlgorithm());
-            }
-            if (s.equals("encryption_algorithm")) {
-                ans.setEncryptionAlgorithm(this.getEncryptionAlgorithm());
-            }
-            if (s.equals("pfs")) {
-                ans.setPerfectForwardSecrecy(this.getPerfectForwardSecrecy());
+            switch (s) {
+                case "transform_protocol":
+                    ans.setTransformProtocol(this.getTransformProtocol());
+                    break;
+                case "encapsulation_mode":
+                    ans.setEncapsulationMode(this.getEncapsulationMode());
+                    break;
+                case "auth_algorithm":
+                    ans.setAuthAlgorithm(this.getAuthAlgorithm());
+                    break;
+                case "encryption_algorithm":
+                    ans.setEncryptionAlgorithm(this.getEncryptionAlgorithm());
+                    break;
+                case "pfs":
+                    ans.setPerfectForwardSecrecy(this.getPerfectForwardSecrecy());
+                    break;
+                default:
+                    LOGGER.warn("{} is not an NeutronVpnIpSecPolicy suitable field.", s);
+                    break;
             }
         }
         return ans;
index 067c590ce74fdc70ae7966915d5efa6f2d94ec07..a1928b0345778b87c85bdfdc412694cab92d6555 100644 (file)
@@ -14,11 +14,14 @@ import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronVpnIpSecSiteConnection extends NeutronAdminAttributes<NeutronVpnIpSecSiteConnection>
         implements Serializable {
+    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronVpnIpSecSiteConnection.class);
     private static final long serialVersionUID = 1L;
 
     // See OpenStack Network API v2.0 Reference for description of
@@ -172,36 +175,43 @@ public final class NeutronVpnIpSecSiteConnection extends NeutronAdminAttributes<
     public NeutronVpnIpSecSiteConnection extractFields(List<String> fields) {
         NeutronVpnIpSecSiteConnection ans = new NeutronVpnIpSecSiteConnection();
         for (String s : fields) {
-            extractField(s, ans);
-            if (s.equals("peer_address")) {
-                ans.setPeerAddress(this.getPeerAddress());
+            if (extractField(s, ans)) {
+                continue;
             }
-            if (s.equals("peer_id")) {
-                ans.setPeerID(this.getPeerID());
-            }
-            if (s.equals("route_mode")) {
-                ans.setRouteMode(this.getRouteMode());
-            }
-            if (s.equals("mtu")) {
-                ans.setMtu(this.getMtu());
-            }
-            if (s.equals("auth_mode")) {
-                ans.setAuthMode(this.getAuthMode());
-            }
-            if (s.equals("psk")) {
-                ans.setPreSharedKey(this.getPreSharedKey());
-            }
-            if (s.equals("initiator")) {
-                ans.setInitiator(this.getInitiator());
-            }
-            if (s.equals("ikepolicy_id")) {
-                ans.setIkePolicyID(this.getIkePolicyID());
-            }
-            if (s.equals("ipsecpolicy_id")) {
-                ans.setIpsecPolicyID(this.getIpsecPolicyID());
-            }
-            if (s.equals("vpnservice_id")) {
-                ans.setVpnServiceID(this.getVpnServiceID());
+            switch (s) {
+                case "peer_address":
+                    ans.setPeerAddress(this.getPeerAddress());
+                    break;
+                case "peer_id":
+                    ans.setPeerID(this.getPeerID());
+                    break;
+                case "route_mode":
+                    ans.setRouteMode(this.getRouteMode());
+                    break;
+                case "mtu":
+                    ans.setMtu(this.getMtu());
+                    break;
+                case "auth_mode":
+                    ans.setAuthMode(this.getAuthMode());
+                    break;
+                case "psk":
+                    ans.setPreSharedKey(this.getPreSharedKey());
+                    break;
+                case "initiator":
+                    ans.setInitiator(this.getInitiator());
+                    break;
+                case "ikepolicy_id":
+                    ans.setIkePolicyID(this.getIkePolicyID());
+                    break;
+                case "ipsecpolicy_id":
+                    ans.setIpsecPolicyID(this.getIpsecPolicyID());
+                    break;
+                case "vpnservice_id":
+                    ans.setVpnServiceID(this.getVpnServiceID());
+                    break;
+                default:
+                    LOGGER.warn("{} is not an NeutronVpnIpSecSiteConnection suitable field.", s);
+                    break;
             }
         }
         return ans;
index 983913f0aec6ce344b0067ce9f2c0815c4889daa..580593b0e96429649b7c83b7abc062f89025fb44 100644 (file)
@@ -14,10 +14,13 @@ import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronVpnService extends NeutronAdminAttributes<NeutronVpnService> implements Serializable {
+    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronVpnService.class);
     private static final long serialVersionUID = 1L;
 
     // See OpenStack Network API v2.0 Reference for description of
@@ -51,12 +54,19 @@ public final class NeutronVpnService extends NeutronAdminAttributes<NeutronVpnSe
     public NeutronVpnService extractFields(List<String> fields) {
         NeutronVpnService ans = new NeutronVpnService();
         for (String s : fields) {
-            extractField(s, ans);
-            if (s.equals("router_id")) {
-                ans.setRouterUUID(this.getRouterUUID());
+            if (extractField(s, ans)) {
+                continue;
             }
-            if (s.equals("subnet_id")) {
-                ans.setSubnetUUID(this.getSubnetUUID());
+            switch (s) {
+                case "router_id":
+                    ans.setRouterUUID(this.getRouterUUID());
+                    break;
+                case "subnet_id":
+                    ans.setSubnetUUID(this.getSubnetUUID());
+                    break;
+                default:
+                    LOGGER.warn("{} is not an NeutronVpnService suitable field.", s);
+                    break;
             }
         }
         return ans;