to be used for the following ofproto json changes
Signed-off-by: YAMAMOTO Takashi <[email protected]>
---
ryu/lib/addrconv.py | 25 +++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/ryu/lib/addrconv.py b/ryu/lib/addrconv.py
index 7641750..bac6da1 100644
--- a/ryu/lib/addrconv.py
+++ b/ryu/lib/addrconv.py
@@ -18,6 +18,10 @@ import netaddr
class AddressConverter(object):
+ pass
+
+
+class NetAddrWrapper(AddressConverter):
def __init__(self, addr, strat, **kwargs):
self._addr = addr
self._strat = strat
@@ -30,11 +34,24 @@ class AddressConverter(object):
return str(self._addr(self._strat.packed_to_int(bin),
**self._addr_kwargs))
-ipv4 = AddressConverter(netaddr.IPAddress, netaddr.strategy.ipv4, version=4)
-ipv6 = AddressConverter(netaddr.IPAddress, netaddr.strategy.ipv6, version=6)
+ipv4 = NetAddrWrapper(netaddr.IPAddress, netaddr.strategy.ipv4, version=4)
+ipv6 = NetAddrWrapper(netaddr.IPAddress, netaddr.strategy.ipv6, version=6)
class mac_mydialect(netaddr.mac_unix):
word_fmt = '%.2x'
-mac = AddressConverter(netaddr.EUI, netaddr.strategy.eui48, version=48,
- dialect=mac_mydialect)
+mac = NetAddrWrapper(netaddr.EUI, netaddr.strategy.eui48, version=48,
+ dialect=mac_mydialect)
+
+
+class NoopConverter(AddressConverter):
+ @staticmethod
+ def text_to_bin(text):
+ return text
+
+ @staticmethod
+ def bin_to_text(bin):
+ return bin
+
+
+plain_text = NoopConverter()
--
1.8.3.1
------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel