def str_to_dpid(s):
 if s.lower().startswith('0x'):
  s = s[2:]
 s = s.replace('-', '').split('|', 2)
 a = int(s[0], 16)
 if (a > 281474976710655):
  b = (a >> 48)
  a &= 281474976710655
 else:
  b = 0
 if (len(s) == 2):
  b = int(s[1])
 return (a | (b << 48))

def str_to_dpid ( s ) : if s . lower ( ) . startswith ( '0x' ) : s = s [ 2 : ] s = s . replace ( '-' , '' ) . split ( '|' , 2 ) a = int ( s [ 0 ] , 16 ) if ( a > 281474976710655 ) : b = ( a >> 48 ) a &= 281474976710655 else : b = 0 if ( len ( s ) == 2 ) : b = int ( s [ 1 ] ) return ( a | ( b << 48 ) )
convert a dpid in the canonical string form into a long int .