BGPSpeaker: Suppress RD in EVPN VRF on SSH console
Because the NLRI_CLASS of the VRF EVPN Table is the same as the
NLRI_CLASS of the Global EVPN Table, the str representation can not
be distinguished with 'formatted_nlri_str' format.
So, 'show vrf' commands on the SSH console returns the str outputs
with Route Distinguisher (RD) even if the route on the VRF Table
can be identified without RD value.
This patch implements the str representation properties to output
BGP routes on SSH console.
Current: RD '65001:100' is duplicated
bgpd> show vrf all
VPN: ('65001:100', 'evpn')
*> 65001💯multicast_etag(ethernet_tag_id:300,ip_addr:10.10.1.0) None 0.0.0.0 Only Path ?
With this patch:
bgpd> show vrf all
VPN: ('65001:100', 'evpn')
*> multicast_etag(ethernet_tag_id:300,ip_addr:10.10.1.0) None 0.0.0.0 Only Path ?
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
c2c421bddd
commit
37df91f7f4
@ -336,6 +336,10 @@ class Destination(object):
|
|||||||
def nlri(self):
|
def nlri(self):
|
||||||
return self._nlri
|
return self._nlri
|
||||||
|
|
||||||
|
@property
|
||||||
|
def nlri_str(self):
|
||||||
|
return self._nlri.formatted_nlri_str
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def best_path(self):
|
def best_path(self):
|
||||||
return self._best_path
|
return self._best_path
|
||||||
@ -777,6 +781,10 @@ class Path(object):
|
|||||||
def nlri(self):
|
def nlri(self):
|
||||||
return self._nlri
|
return self._nlri
|
||||||
|
|
||||||
|
@property
|
||||||
|
def nlri_str(self):
|
||||||
|
return self._nlri.formatted_nlri_str
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_withdraw(self):
|
def is_withdraw(self):
|
||||||
return self._is_withdraw
|
return self._is_withdraw
|
||||||
|
@ -299,6 +299,13 @@ class VrfDest(Destination):
|
|||||||
super(VrfDest, self).__init__(table, nlri)
|
super(VrfDest, self).__init__(table, nlri)
|
||||||
self._route_dist = self._table.vrf_conf.route_dist
|
self._route_dist = self._table.vrf_conf.route_dist
|
||||||
|
|
||||||
|
@property
|
||||||
|
def nlri_str(self):
|
||||||
|
# Returns `prefix` without the route distinguisher value, because
|
||||||
|
# a destination in VRF space can be identified without the route
|
||||||
|
# distinguisher.
|
||||||
|
return self._nlri.prefix
|
||||||
|
|
||||||
def _best_path_lost(self):
|
def _best_path_lost(self):
|
||||||
# Have to send update messages for withdraw of best-path to Network
|
# Have to send update messages for withdraw of best-path to Network
|
||||||
# controller or Global table.
|
# controller or Global table.
|
||||||
@ -483,6 +490,13 @@ class VrfPath(Path):
|
|||||||
def label_list(self):
|
def label_list(self):
|
||||||
return self._label_list[:]
|
return self._label_list[:]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def nlri_str(self):
|
||||||
|
# Returns `prefix` without the route distinguisher value, because
|
||||||
|
# a destination in VRF space can be identified without the route
|
||||||
|
# distinguisher.
|
||||||
|
return self._nlri.prefix
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def create_puid(route_dist, ip_prefix):
|
def create_puid(route_dist, ip_prefix):
|
||||||
assert route_dist and ip_prefix
|
assert route_dist and ip_prefix
|
||||||
|
@ -101,7 +101,7 @@ class InternalApi(object):
|
|||||||
|
|
||||||
def _dst_to_dict(self, dst):
|
def _dst_to_dict(self, dst):
|
||||||
ret = {'paths': [],
|
ret = {'paths': [],
|
||||||
'prefix': dst.nlri.formatted_nlri_str}
|
'prefix': dst.nlri_str}
|
||||||
|
|
||||||
def _path_to_dict(dst, path):
|
def _path_to_dict(dst, path):
|
||||||
|
|
||||||
@ -143,7 +143,7 @@ class InternalApi(object):
|
|||||||
|
|
||||||
return {'best': (path == dst.best_path),
|
return {'best': (path == dst.best_path),
|
||||||
'bpr': bpr,
|
'bpr': bpr,
|
||||||
'prefix': path.nlri.formatted_nlri_str,
|
'prefix': path.nlri_str,
|
||||||
'labels': labels,
|
'labels': labels,
|
||||||
'nexthop': nexthop,
|
'nexthop': nexthop,
|
||||||
'metric': med,
|
'metric': med,
|
||||||
|
Loading…
Reference in New Issue
Block a user