Signed-off-by: Isaku Yamahata <[email protected]>
---
 ryu/{lib/dpid.py => app/wsgi_path.py} |   16 ++--------------
 ryu/lib/dpid.py                       |    4 +++-
 ryu/lib/mac.py                        |    2 ++
 3 files changed, 7 insertions(+), 15 deletions(-)
 copy ryu/{lib/dpid.py => app/wsgi_path.py} (69%)

diff --git a/ryu/lib/dpid.py b/ryu/app/wsgi_path.py
similarity index 69%
copy from ryu/lib/dpid.py
copy to ryu/app/wsgi_path.py
index 8c8bf75..1e88c1b 100644
--- a/ryu/lib/dpid.py
+++ b/ryu/app/wsgi_path.py
@@ -14,17 +14,5 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# Internal representation of datapath id is quad int
-# string representation is in hex without '0x'
-
-_DPID_LEN = 16
-_DPID_FMT = '%0' + str(_DPID_LEN) + 'x'
-
-
-def dpid_to_str(dpid):
-    return _DPID_FMT % dpid
-
-
-def str_to_dpid(dpid_str):
-    assert len(dpid_str) == _DPID_LEN
-    return int(dpid_str, 16)
+HEX_PATTERN = r'0x[0-9a-z]+'
+DIGIT_PATTERN = r'[1-9][0-9]*'
diff --git a/ryu/lib/dpid.py b/ryu/lib/dpid.py
index 8c8bf75..1224ae0 100644
--- a/ryu/lib/dpid.py
+++ b/ryu/lib/dpid.py
@@ -18,7 +18,9 @@
 # string representation is in hex without '0x'
 
 _DPID_LEN = 16
-_DPID_FMT = '%0' + str(_DPID_LEN) + 'x'
+_DPID_LEN_STR = str(_DPID_LEN)
+_DPID_FMT = '%0' + _DPID_LEN_STR + 'x'
+DPID_PATTERN = r'[0-9a-f]{%d}' % _DPID_LEN
 
 
 def dpid_to_str(dpid):
diff --git a/ryu/lib/mac.py b/ryu/lib/mac.py
index 2082643..3cb2df3 100644
--- a/ryu/lib/mac.py
+++ b/ryu/lib/mac.py
@@ -16,6 +16,8 @@
 
 import itertools
 
+# string representation
+HADDR_PATTERN = r'([0-9a-f]{2}:){5}[0-9a-f]{2}'
 
 # Internal representation of mac address is string[6]
 _HADDR_LEN = 6
-- 
1.7.10.4


------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to