diff options
author | Shinpei Muraoka <shinpei.muraoka@gmail.com> | 2017-03-21 09:50:46 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-03-28 09:55:52 +0900 |
commit | 271961ecb1b7eea779fb760c3c83aaa42418013d (patch) | |
tree | e0a07dc5ee8c49c36a0140b4ee865c69dfbfd148 | |
parent | 66a5bddaf0fe036cca298a6ffbe4fae540083916 (diff) |
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>
-rw-r--r-- | ryu/lib/packet/bgp.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/ryu/lib/packet/bgp.py b/ryu/lib/packet/bgp.py index d22bb0ed..794e0456 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): |