From 29988c8b1d9c1501252f23bbabcabe4110c677ba Mon Sep 17 00:00:00 2001
From: Bob Lantz <rlantz@cs.stanford.edu>
Date: Wed, 29 Jan 2014 16:35:30 -0800
Subject: [PATCH] Canonicalize dpid by removing colons and padding with zeros
 closes #268

---
 mininet/node.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mininet/node.py b/mininet/node.py
index 2af68a69..b197a5ba 100644
--- a/mininet/node.py
+++ b/mininet/node.py
@@ -756,7 +756,8 @@ def __init__( self, name, dpid=None, opts='', listenPort=None, **params):
            opts: additional switch options
            listenPort: port to listen on for dpctl connections"""
         Node.__init__( self, name, **params )
-        self.dpid = dpid if dpid else self.defaultDpid()
+        self.dpid = ( ( '0' * self.dpidLen + dpid.translate( None, ':' ) )
+                      [ -self.dpidLen: ] if dpid else self.defaultDpid() )
         self.opts = opts
         self.listenPort = listenPort
         if not self.inNamespace:
-- 
GitLab