Class OpenflowPortsUtil


  • public final class OpenflowPortsUtil
    extends Object
    Class which integrates the port constants defined and used by MDSAL and the ports defined in openflow java This class is responsible for converting MDSAL given logical names to port numbers and back. Any newer version of openflow can have a similar mapping or can/should be extended.
    • Method Detail

      • getPortLogicalName

        public static String getPortLogicalName​(org.opendaylight.yangtools.yang.common.Uint8 ofVersion,
                                                Long portNumber)
      • getPortLogicalName

        public static String getPortLogicalName​(org.opendaylight.yangtools.yang.common.Uint8 ofVersion,
                                                org.opendaylight.yangtools.yang.common.Uint32 portNumber)
      • getPortLogicalName

        public static String getPortLogicalName​(OpenflowVersion ofVersion,
                                                org.opendaylight.yangtools.yang.common.Uint32 portNumber)
      • getProtocolAgnosticPort

        public static PortNumberUni getProtocolAgnosticPort​(OpenflowVersion ofVersion,
                                                            org.opendaylight.yangtools.yang.common.Uint32 portNumber)
      • getProtocolPortNumber

        public static org.opendaylight.yangtools.yang.common.Uint32 getProtocolPortNumber​(OpenflowVersion ofVersion,
                                                                                          PortNumberUni port)
      • getMaxPortForVersion

        public static org.opendaylight.yangtools.yang.common.Uint32 getMaxPortForVersion​(OpenflowVersion ofVersion)
      • isPortReserved

        public static boolean isPortReserved​(OpenflowVersion ofVersion,
                                             org.opendaylight.yangtools.yang.common.Uint32 portNumber)
      • checkPortValidity

        public static boolean checkPortValidity​(OpenflowVersion ofVersion,
                                                org.opendaylight.yangtools.yang.common.Uint32 portNumber)
        Checks port validity.
        Parameters:
        ofVersion - OpenFlow version of the switch
        portNumber - port number
        Returns:
        true if port number is valid for given protocol version
      • portNumberToString

        public static String portNumberToString​(PortNumberUni portNumber)
        Converts a port number to a string.
        Parameters:
        portNumber - port number
        Returns:
        string containing number or logical name
      • getProtocolAgnosticPortUri

        public static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri getProtocolAgnosticPortUri​(org.opendaylight.yangtools.yang.common.Uint8 version,
                                                                                                                                        long portNumber)
        Converts port number to Uri.
        Parameters:
        version - openflow version
        portNumber - port number
        Returns:
        port number uri
      • getProtocolAgnosticPortUri

        public static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri getProtocolAgnosticPortUri​(org.opendaylight.yangtools.yang.common.Uint8 version,
                                                                                                                                        org.opendaylight.yangtools.yang.common.Uint32 portNumber)
        Converts port number to Uri.
        Parameters:
        version - openflow version
        portNumber - port number
        Returns:
        port number uri