mirror of
https://github.com/faucetsdn/ryu.git
synced 2026-05-08 22:06:10 +02:00
BGP: Make RouteFamily class hashable
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 <iwase.yusuke0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
13ae023f2d
commit
a20b9e1fcd
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user