Signed-off-by: Jason Kölker <[email protected]>
---
ryu/ofproto/nx_match.py | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/ryu/ofproto/nx_match.py b/ryu/ofproto/nx_match.py
index 2364780..dae24b6 100644
--- a/ryu/ofproto/nx_match.py
+++ b/ryu/ofproto/nx_match.py
@@ -118,10 +118,26 @@ class FlowWildcards(ofproto_parser.StringifyMixin):
class ClsRule(ofproto_parser.StringifyMixin):
"""describe a matching rule for OF 1.0 OFPMatch (and NX).
"""
- def __init__(self):
+ def __init__(self, **kwargs):
self.wc = FlowWildcards()
self.flow = Flow()
+ for key, value in kwargs.items():
+ if key[:3] == 'reg':
+ register = int(key[3:] or -1)
+ self.set_reg(register, value)
+ continue
+
+ setter = getattr(self, 'set_' + key, None)
+ if not setter:
+ LOG.error('Invalid kwarg specified to ClsRule (%s)', key)
+ continue
+
+ if not isinstance(value, (tuple, list)):
+ value = (value, )
+
+ setter(*value)
+
def set_in_port(self, port):
self.wc.wildcards &= ~FWW_IN_PORT
self.flow.in_port = port
--
2.4.3
------------------------------------------------------------------------------
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel