summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorIsaku Yamahata <yamahata@valinux.co.jp>2012-10-26 05:51:25 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2012-11-03 15:57:05 +0900
commitd347dce3c4050a40a1c36411ab2762c835b348b2 (patch)
tree4c44334c739f0a900cab1c2dda26c9f7f90d38a3
parent4b90f751cab018b88bd7015355ca0266cadf2067 (diff)
wsgi/routes: add regex pattern for each REST component
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/app/wsgi.py4
-rw-r--r--ryu/lib/dpid.py4
-rw-r--r--ryu/lib/mac.py2
3 files changed, 9 insertions, 1 deletions
diff --git a/ryu/app/wsgi.py b/ryu/app/wsgi.py
index e21a5cb8..38809922 100644
--- a/ryu/app/wsgi.py
+++ b/ryu/app/wsgi.py
@@ -29,6 +29,10 @@ gflags.DEFINE_string('wsapi_host', '', 'webapp listen host')
gflags.DEFINE_integer('wsapi_port', 8080, 'webapp listen port')
+HEX_PATTERN = r'0x[0-9a-z]+'
+DIGIT_PATTERN = r'[1-9][0-9]*'
+
+
class ControllerBase(object):
special_vars = ['action', 'controller']
diff --git a/ryu/lib/dpid.py b/ryu/lib/dpid.py
index 8c8bf759..1224ae0e 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 20826435..3cb2df39 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