Revision 0d94548a mininet/node.py

View differences:

mininet/node.py
725 725
       an OpenFlow switch."""
726 726

  
727 727
    portBase = 1  # Switches start with port 1 in OpenFlow
728
    dpidLen = 16  # digits in dpid passed to switch
728 729

  
729 730
    def __init__( self, name, dpid=None, opts='', listenPort=None, **params):
730 731
        """dpid: dpid for switch (or None to derive from name, e.g. s1 -> 1)
......
742 743
        try:
743 744
            dpid = int( re.findall( '\d+', self.name )[ 0 ] )
744 745
            dpid = hex( dpid )[ 2: ]
745
            dpid = '0' * ( 16 - len( dpid ) ) + dpid
746
            dpid = '0' * ( self.dpidLen - len( dpid ) ) + dpid
746 747
            return dpid
747 748
        except IndexError:
748 749
            raise Exception( 'Unable to derive default datapath ID - '
......
776 777
class UserSwitch( Switch ):
777 778
    "User-space switch."
778 779

  
780
    dpidLen = 12
781

  
779 782
    def __init__( self, name, **kwargs ):
780 783
        """Init.
781 784
           name: name for the switch"""

Also available in: Unified diff