diff options
author | Yusuke Iwase <iwase.yusuke0@gmail.com> | 2015-07-29 17:34:18 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-07-31 08:30:38 +0900 |
commit | 81535104460c4e1312e344676baafcbcf70a3654 (patch) | |
tree | 5f5c70924d85eda6e580b883290d97530c452463 | |
parent | aa198d6900e2044ad940f4a1e89b3e7e0174c8c1 (diff) |
ofproto_v1_[2345]_parser: Add items method to OFPMatch/OFPStats
iteritems() was renamed as items() to support Python3.
In accordance with this change, this patch adds items() into
OFPMatch/OFPStats class for convenience.
Reported-by: Ed Kiefer <ehk8@cornell.edu>
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | ryu/ofproto/ofproto_v1_2_parser.py | 3 | ||||
-rw-r--r-- | ryu/ofproto/ofproto_v1_3_parser.py | 3 | ||||
-rw-r--r-- | ryu/ofproto/ofproto_v1_4_parser.py | 3 | ||||
-rw-r--r-- | ryu/ofproto/ofproto_v1_5_parser.py | 6 |
4 files changed, 15 insertions, 0 deletions
diff --git a/ryu/ofproto/ofproto_v1_2_parser.py b/ryu/ofproto/ofproto_v1_2_parser.py index 60b5dedf..cd67a9b3 100644 --- a/ryu/ofproto/ofproto_v1_2_parser.py +++ b/ryu/ofproto/ofproto_v1_2_parser.py @@ -3415,6 +3415,9 @@ class OFPMatch(StringifyMixin): def iteritems(self): return iter(dict(self._fields2).items()) + def items(self): + return self._fields2 + def get(self, key, default=None): return dict(self._fields2).get(key, default) diff --git a/ryu/ofproto/ofproto_v1_3_parser.py b/ryu/ofproto/ofproto_v1_3_parser.py index 85b80298..663344cf 100644 --- a/ryu/ofproto/ofproto_v1_3_parser.py +++ b/ryu/ofproto/ofproto_v1_3_parser.py @@ -848,6 +848,9 @@ class OFPMatch(StringifyMixin): def iteritems(self): return iter(dict(self._fields2).items()) + def items(self): + return self._fields2 + def get(self, key, default=None): return dict(self._fields2).get(key, default) diff --git a/ryu/ofproto/ofproto_v1_4_parser.py b/ryu/ofproto/ofproto_v1_4_parser.py index 9d2a513c..9b2ec6b5 100644 --- a/ryu/ofproto/ofproto_v1_4_parser.py +++ b/ryu/ofproto/ofproto_v1_4_parser.py @@ -783,6 +783,9 @@ class OFPMatch(StringifyMixin): def iteritems(self): return iter(dict(self._fields2).items()) + def items(self): + return self._fields2 + def get(self, key, default=None): return dict(self._fields2).get(key, default) diff --git a/ryu/ofproto/ofproto_v1_5_parser.py b/ryu/ofproto/ofproto_v1_5_parser.py index 07b1ae09..c7d3fde5 100644 --- a/ryu/ofproto/ofproto_v1_5_parser.py +++ b/ryu/ofproto/ofproto_v1_5_parser.py @@ -784,6 +784,9 @@ class OFPMatch(StringifyMixin): def iteritems(self): return iter(dict(self._fields2).items()) + def items(self): + return self._fields2 + def get(self, key, default=None): return dict(self._fields2).get(key, default) @@ -925,6 +928,9 @@ class OFPStats(StringifyMixin): def iteritems(self): return dict(self.fields).items() + def items(self): + return self.fields + def get(self, key, default=None): return dict(self.fields).get(key, default) |