@@ -0,0 +1,3254 @@
+package org.opendaylight.controller.sal.compability;%0A%0Aimport org.opendaylight.controller.sal.core.*;%0Aimport org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector;%0Aimport org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures;%0Aimport org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector;%0A%0Apublic class ToSalPropertyClassUtils %7B%0A    public static Bandwidth salAdvertisedBandwidthFrom(NodeConnector nodeConnector) %7B%0A        FlowCapableNodeConnector flowCapNodeConn = nodeConnector.getAugmentation(FlowCapableNodeConnector.class);        %0A        PortFeatures portFeatures = flowCapNodeConn.getAdvertisedFeatures();%0A        return new AdvertisedBandwidth(resolveBandwidth(portFeatures));%0A    %7D%0A%0A    public static Bandwidth salPeerBandwidthFrom(NodeConnector nodeConnector) %7B%0A        FlowCapableNodeConnector flowCapNodeConn = nodeConnector.getAugmentation(FlowCapableNodeConnector.class);        %0A        PortFeatures portFeatures = flowCapNodeConn.getPeerFeatures();%0A        return new PeerBandwidth(resolveBandwidth(portFeatures));%0A    %7D%0A%0A    public static Bandwidth salSupportedBandwidthFrom(NodeConnector nodeConnector) %7B%0A        FlowCapableNodeConnector flowCapNodeConn = nodeConnector.getAugmentation(FlowCapableNodeConnector.class);        %0A        PortFeatures portFeatures = flowCapNodeConn.getSupported();%0A        return new SupportedBandwidth(resolveBandwidth(portFeatures));%0A    %7D%0A%0A    public static MacAddress salMacAddressFrom(NodeConnector nodeConnector) %7B%0A        FlowCapableNodeConnector flowCapNodeConn = nodeConnector.getAugmentation(FlowCapableNodeConnector.class);        %0A        String hwAddress = flowCapNodeConn.getHardwareAddress().getValue();%0A        return new MacAddress(bytesFrom(hwAddress));        %0A    %7D%0A    %0A    %0A    public static Name salNameFrom(NodeConnector nodeConnector) %7B%0A        FlowCapableNodeConnector flowCapNodeConn = nodeConnector.getAugmentation(FlowCapableNodeConnector.class);        %0A        return new Name(flowCapNodeConn.getName());%0A    %7D%0A    %0A    %0A%0A    private static byte%5B%5D bytesFrom(String hwAddress) %7B%0A        String%5B%5D mac = hwAddress.split(%22:%22);%0A        byte%5B%5D macAddress = new byte%5B6%5D; // mac.length == 6 bytes%0A        for (int i = 0; i %3C mac.length; i++) %7B%0A            macAddress%5Bi%5D = Integer.decode(%220x%22 + mac%5Bi%5D).byteValue();%0A        %7D%0A        return macAddress;%0A    %7D%0A%0A    private static long resolveBandwidth(PortFeatures portFeatures) %7B%0A        if (portFeatures.is_1tbFd()) %7B%0A            return Bandwidth.BW1Tbps;%0A        %7D else if (portFeatures.is_100gbFd()) %7B%0A            return Bandwidth.BW100Gbps;%0A        %7D else if (portFeatures.is_40gbFd()) %7B%0A            return Bandwidth.BW40Gbps;%0A        %7D else if (portFeatures.is_10gbFd()) %7B%0A            return Bandwidth.BW10Gbps;%0A        %7D else if (portFeatures.is_1gbHd() %7C%7C portFeatures.is_1gbFd()) %7B%0A            return Bandwidth.BW1Gbps;%0A        %7D else if (portFeatures.is_100mbHd() %7C%7C portFeatures.is_100mbFd()) %7B%0A            return Bandwidth.BW100Mbps;%0A        %7D else if (portFeatures.is_10mbHd() %7C%7C portFeatures.is_10mbFd()) %7B%0A            return Bandwidth.BW10Mbps;%0A        %7D else %7B%0A            return Bandwidth.BWUNK;%0A        %7D%0A    %7D%0A%0A%7D%0A

Convert to SAL Property instances.