Argument "addr" of "_FlowSpecPrefixBase" must be
specified in the network address.
If argument "addr" specified in the host address,
this patch converts the given address into the network address.

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

diff --git a/ryu/lib/packet/bgp.py b/ryu/lib/packet/bgp.py
index d22bb0e..794e045 100644
--- a/ryu/lib/packet/bgp.py
+++ b/ryu/lib/packet/bgp.py
@@ -2332,7 +2332,8 @@ class _FlowSpecPrefixBase(_FlowSpecComponentBase, 
IPAddrPrefix):
     def __init__(self, length, addr, type_=None):
         super(_FlowSpecPrefixBase, self).__init__(type_)
         self.length = length
-        self.addr = addr
+        prefix = "%s/%s" % (addr, length)
+        self.addr = str(netaddr.ip.IPNetwork(prefix).network)
 
     @classmethod
     def parse_body(cls, buf):
-- 
2.7.4


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to