packet/bgp: Add the address converter for Flow Specification

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 <shinpei.muraoka@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
Shinpei Muraoka 2017-03-21 09:50:46 +09:00 committed by FUJITA Tomonori
parent 66a5bddaf0
commit 271961ecb1

View File

@ -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):