External api proposal
[openflowplugin.git] / openflowplugin / src / main / java / org / opendaylight / openflowplugin / openflow / md / core / sal / SwitchFeaturesUtil.java
index 45030be42fb6cf68f41d61e6b1f96e2db7429e2b..f35f71c58d1742bc62a35d0e1fbe17ba096f11e1 100644 (file)
@@ -4,12 +4,16 @@
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
- */                                                     
+ */
 package org.opendaylight.openflowplugin.openflow.md.core.sal;
 
+import static org.opendaylight.openflowplugin.api.OFConstants.OFP_VERSION_1_0;
+import static org.opendaylight.openflowplugin.api.OFConstants.OFP_VERSION_1_3;
+
 import java.util.HashMap;
 import java.util.Map;
 
+import org.opendaylight.openflowplugin.api.openflow.md.core.sal.BuildSwitchFeatures;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.flow.node.SwitchFeatures;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;
 import org.slf4j.Logger;
@@ -19,17 +23,17 @@ import org.slf4j.LoggerFactory;
  * @author jsebin
  *
  */
-public class SwitchFeaturesUtil {
+public final class SwitchFeaturesUtil {
 
-    protected static final Logger LOG = LoggerFactory.getLogger(SwitchFeaturesUtil.class);
+    private static final Logger LOG = LoggerFactory.getLogger(SwitchFeaturesUtil.class);
     
     private static SwitchFeaturesUtil instance = new SwitchFeaturesUtil();
     private Map<Short, BuildSwitchFeatures> swFeaturesBuilders;
     
     private SwitchFeaturesUtil() {
         swFeaturesBuilders = new HashMap<>();
-        swFeaturesBuilders.put((short) 1, BuildSwitchCapabilitiesOF10.getInstance());
-        swFeaturesBuilders.put((short) 4, BuildSwitchCapabilitiesOF13.getInstance());
+        swFeaturesBuilders.put(OFP_VERSION_1_0, BuildSwitchCapabilitiesOF10.getInstance());
+        swFeaturesBuilders.put(OFP_VERSION_1_3, BuildSwitchCapabilitiesOF13.getInstance());
     }
     
     /**
@@ -47,8 +51,8 @@ public class SwitchFeaturesUtil {
      */
     public SwitchFeatures buildSwitchFeatures(GetFeaturesOutput features) {
 
-        if(swFeaturesBuilders.containsKey(features.getVersion()) == true) {
-            LOG.info("map contains version {}", features.getVersion());
+        if(swFeaturesBuilders.containsKey(features.getVersion())) {
+            LOG.debug("map contains version {}", features.getVersion());
             try {
                 return swFeaturesBuilders.get(features.getVersion()).build(features);
             } catch (NullPointerException e) {