In Python 3, the key objects of dict must be hashable,
but RouteFamily class does not have '__hash__' method.
This patch adds this method.

Signed-off-by: IWASE Yusuke <[email protected]>
---
 ryu/lib/packet/bgp.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ryu/lib/packet/bgp.py b/ryu/lib/packet/bgp.py
index 2b8e42c..2fb51e8 100644
--- a/ryu/lib/packet/bgp.py
+++ b/ryu/lib/packet/bgp.py
@@ -579,6 +579,9 @@ class RouteFamily(StringifyMixin):
     def __eq__(self, other):
         return (self.afi, self.safi) == (other.afi, other.safi)
 
+    def __hash__(self):
+        return hash((self.afi, self.safi))
+
 # Route Family Singleton
 RF_IPv4_UC = RouteFamily(addr_family.IP, subaddr_family.UNICAST)
 RF_IPv6_UC = RouteFamily(addr_family.IP6, subaddr_family.UNICAST)
-- 
2.7.4


------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to