On Sun, 10 Aug 2014 16:47:52 +0900
Toshiki Tsuboi <[email protected]> wrote:

> The field of 'Labels' has not displayed in properly because of extracting 
> 'label_list' in python slicing tuples.
> 
> INFO:bgpspeaker.api.base:API method operator.show called with args: 
> {'params': ['rib', 'all'], 'format': 'cli'}
> Status codes: * valid, > best
>     Network                          Labels   Next Hop             Reason     
>      Metric LocPrf Path/Origin
> Family: rtfilter
> *>  64512:64511:101                  None     0.0.0.0              Only Path  
>                    2
> Family: vpnv6
> Family: vpnv4
> *>  64511:101:10.10.0.1/32           ([17],)  192.168.100.100      Only Path  
>      0             64511 2
> *>  64511:101:10.20.2.0/24           ([100],) 0.0.0.0              Only Path  
>                    2
> *>  64511:101:10.20.1.0/24           ([100],) 0.0.0.0              Only Path  
>                    2
> *>  64511:101:10.20.3.0/24           ([100],) 0.0.0.0              Only Path  
>                    2
> Family: ipv4
> Family: ipv6
> 
> Signed-off-by: Toshiki Tsuboi <[email protected]>
> ---
> ryu/lib/packet/bgp.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/ryu/lib/packet/bgp.py b/ryu/lib/packet/bgp.py
> index 3cace68..147705c 100644
> --- a/ryu/lib/packet/bgp.py
> +++ b/ryu/lib/packet/bgp.py
> @@ -932,7 +932,7 @@ class LabelledVPNIPAddrPrefix(_LabelledAddrPrefix, 
> _VPNAddrPrefix,
> 
>     @property
>     def label_list(self):
> -        return self.addr[:-2]
> +        return "%s" % (self.addr[:-2])

Can we simply use self.addr[0] like the following?

diff --git a/ryu/lib/packet/bgp.py b/ryu/lib/packet/bgp.py
index 3cace68..7c716b4 100644
--- a/ryu/lib/packet/bgp.py
+++ b/ryu/lib/packet/bgp.py
@@ -932,7 +932,7 @@ class LabelledVPNIPAddrPrefix(_LabelledAddrPrefix, 
_VPNAddrPrefix,
 
     @property
     def label_list(self):
-        return self.addr[:-2]
+        return self.addr[0]
 
     @property
     def formatted_nlri_str(self):
@@ -955,7 +955,7 @@ class LabelledVPNIP6AddrPrefix(_LabelledAddrPrefix, 
_VPNAddrPrefix,
 
     @property
     def label_list(self):
-        return self.addr[:-2]
+        return self.addr[0]
 
     @property
     def formatted_nlri_str(self):


------------------------------------------------------------------------------
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to