Merge "Walk the tables directly"
[controller.git] / opendaylight / md-sal / compatibility / sal-compatibility / src / main / java / org / opendaylight / controller / sal / compatibility / NodeMapping.xtend
index 4ad91c26779dcdfdb451200636c958ca3d4ae027..debcbac2ebad9dd889df5e84c726e398d6b2081c 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * 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.controller.sal.compatibility
 
 import org.opendaylight.controller.sal.core.Node
@@ -48,6 +55,7 @@ import java.util.Date
 import org.opendaylight.controller.sal.core.TimeStamp
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowNodeConnector
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowNode
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector
 
 public class NodeMapping {
 
@@ -171,6 +179,14 @@ public class NodeMapping {
         return new HashSet<org.opendaylight.controller.sal.core.Property>();
     }
 
+    public static def toADNodeConnectorProperties(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector nc) {
+        val fcnc = nc.getAugmentation(FlowCapableNodeConnector)
+        if (fcnc != null) {
+            return fcnc.toADNodeConnectorProperties
+        }
+        return new HashSet<org.opendaylight.controller.sal.core.Property>();
+    }
+
     public static def toADNodeConnectorProperties(FlowNodeConnector fcncu) {
         val props = new HashSet<org.opendaylight.controller.sal.core.Property>();
         if (fcncu != null) {
@@ -225,21 +241,21 @@ public class NodeMapping {
 
     public static def toAdBandwidth(PortFeatures pf) {
         var Bandwidth bw = null
-        if (pf.is_10mbHd || pf.is_10mbFd) {
+        if (pf.isTenMbHd || pf.isTenMbFd) {
             bw = new Bandwidth(Bandwidth.BW10Mbps)
-        } else if (pf.is_100mbHd || pf.is_100mbFd) {
+        } else if (pf.isHundredMbHd || pf.isHundredMbFd) {
             bw = new Bandwidth(Bandwidth.BW100Mbps)
-        } else if (pf.is_1gbHd || pf.is_1gbFd) {
+        } else if (pf.isOneGbHd || pf.isOneGbFd) {
             bw = new Bandwidth(Bandwidth.BW1Gbps)
-        } else if (pf.is_1gbFd) {
+        } else if (pf.isOneGbFd) {
             bw = new Bandwidth(Bandwidth.BW10Gbps)
-        } else if (pf.is_10gbFd) {
+        } else if (pf.isTenGbFd) {
             bw = new Bandwidth(Bandwidth.BW10Gbps)
-        } else if (pf.is_40gbFd) {
+        } else if (pf.isFortyGbFd) {
             bw = new Bandwidth(Bandwidth.BW40Gbps)
-        } else if (pf.is_100gbFd) {
+        } else if (pf.isHundredGbFd) {
             bw = new Bandwidth(Bandwidth.BW100Gbps)
-        } else if (pf.is_1tbFd) {
+        } else if (pf.isOneTbFd) {
             bw = new Bandwidth(Bandwidth.BW1Tbps)
         }
         return bw;