[MediaWiki-commits] [Gerrit] Add BGP MED support - change (operations...pybal)
Mark Bergsma has uploaded a new change for review. https://gerrit.wikimedia.org/r/267251 Change subject: Add BGP MED support .. Add BGP MED support Adds a global pybal.conf configuration option 'bgp-med' which sets a BGP MED attribute on all NLRI if non-zero. This can be used e.g. for BGP failover between multiple PyBal instances where the router selects the routes for the the PyBal instance with the lowest MED value as sent by PyBal. Change-Id: I589be24c275cc73a5c04312e68bdf509e8c2533f --- M pybal/pybal.py 1 file changed, 6 insertions(+), 7 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/debs/pybal refs/changes/51/267251/1 diff --git a/pybal/pybal.py b/pybal/pybal.py index cbffd3a..dd439e1 100755 --- a/pybal/pybal.py +++ b/pybal/pybal.py @@ -467,21 +467,20 @@ peerAddr=self.globalConfig.get('bgp-peer-address')) asPath = [int(asn) for asn in self.globalConfig.get('bgp-as-path', str(self.bgpPeering.myASN)).split()] -attributes = {} +med = self.globalConfig.getint('bgp-med', 0) +baseAttrs = [bgp.OriginAttribute(), bgp.ASPathAttribute(asPath)] +if med: baseAttrs.append(bgp.MEDAttribute(med)) +attributes = {} try: -attributes[(bgp.AFI_INET, bgp.SAFI_UNICAST)] = bgp.FrozenAttributeDict([ -bgp.OriginAttribute(), -bgp.ASPathAttribute(asPath), +attributes[(bgp.AFI_INET, bgp.SAFI_UNICAST)] = bgp.FrozenAttributeDict(baseAttrs + [ bgp.NextHopAttribute(self.globalConfig['bgp-nexthop-ipv4'])]) except KeyError: if (bgp.AFI_INET, bgp.SAFI_UNICAST) in BGPFailover.prefixes: raise ValueError("IPv4 BGP NextHop (global configuration variable 'bgp-nexthop-ipv4') not set") try: -attributes[(bgp.AFI_INET6, bgp.SAFI_UNICAST)] = bgp.FrozenAttributeDict([ -bgp.OriginAttribute(), -bgp.ASPathAttribute(asPath), +attributes[(bgp.AFI_INET6, bgp.SAFI_UNICAST)] = bgp.FrozenAttributeDict(baseAttrs + [ bgp.MPReachNLRIAttribute((bgp.AFI_INET6, bgp.SAFI_UNICAST, bgp.IPv6IP(self.globalConfig['bgp-nexthop-ipv6']), []))]) except KeyError: -- To view, visit https://gerrit.wikimedia.org/r/267251 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I589be24c275cc73a5c04312e68bdf509e8c2533f Gerrit-PatchSet: 1 Gerrit-Project: operations/debs/pybal Gerrit-Branch: master Gerrit-Owner: Mark Bergsma___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add BGP MED support - change (operations...pybal)
Mark Bergsma has submitted this change and it was merged. Change subject: Add BGP MED support .. Add BGP MED support Adds a global pybal.conf configuration option 'bgp-med' which sets a BGP MED attribute on all NLRI if non-zero. This can be used e.g. for BGP failover between multiple PyBal instances where the router selects the routes for the the PyBal instance with the lowest MED value as sent by PyBal. Change-Id: I589be24c275cc73a5c04312e68bdf509e8c2533f --- M pybal/pybal.py 1 file changed, 6 insertions(+), 7 deletions(-) Approvals: Mark Bergsma: Looks good to me, approved jenkins-bot: Verified diff --git a/pybal/pybal.py b/pybal/pybal.py index cbffd3a..dd439e1 100755 --- a/pybal/pybal.py +++ b/pybal/pybal.py @@ -467,21 +467,20 @@ peerAddr=self.globalConfig.get('bgp-peer-address')) asPath = [int(asn) for asn in self.globalConfig.get('bgp-as-path', str(self.bgpPeering.myASN)).split()] -attributes = {} +med = self.globalConfig.getint('bgp-med', 0) +baseAttrs = [bgp.OriginAttribute(), bgp.ASPathAttribute(asPath)] +if med: baseAttrs.append(bgp.MEDAttribute(med)) +attributes = {} try: -attributes[(bgp.AFI_INET, bgp.SAFI_UNICAST)] = bgp.FrozenAttributeDict([ -bgp.OriginAttribute(), -bgp.ASPathAttribute(asPath), +attributes[(bgp.AFI_INET, bgp.SAFI_UNICAST)] = bgp.FrozenAttributeDict(baseAttrs + [ bgp.NextHopAttribute(self.globalConfig['bgp-nexthop-ipv4'])]) except KeyError: if (bgp.AFI_INET, bgp.SAFI_UNICAST) in BGPFailover.prefixes: raise ValueError("IPv4 BGP NextHop (global configuration variable 'bgp-nexthop-ipv4') not set") try: -attributes[(bgp.AFI_INET6, bgp.SAFI_UNICAST)] = bgp.FrozenAttributeDict([ -bgp.OriginAttribute(), -bgp.ASPathAttribute(asPath), +attributes[(bgp.AFI_INET6, bgp.SAFI_UNICAST)] = bgp.FrozenAttributeDict(baseAttrs + [ bgp.MPReachNLRIAttribute((bgp.AFI_INET6, bgp.SAFI_UNICAST, bgp.IPv6IP(self.globalConfig['bgp-nexthop-ipv6']), []))]) except KeyError: -- To view, visit https://gerrit.wikimedia.org/r/267251 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I589be24c275cc73a5c04312e68bdf509e8c2533f Gerrit-PatchSet: 1 Gerrit-Project: operations/debs/pybal Gerrit-Branch: master Gerrit-Owner: Mark BergsmaGerrit-Reviewer: Mark Bergsma Gerrit-Reviewer: jenkins-bot <> ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add BGP MED support - change (operations...pybal)
Mark Bergsma has submitted this change and it was merged. Change subject: Add BGP MED support .. Add BGP MED support Adds a global pybal.conf configuration option 'bgp-med' which sets a BGP MED attribute on all NLRI if non-zero. This can be used e.g. for BGP failover between multiple PyBal instances where the router selects the routes for the the PyBal instance with the lowest MED value as sent by PyBal. Change-Id: I589be24c275cc73a5c04312e68bdf509e8c2533f --- M pybal/pybal.py 1 file changed, 6 insertions(+), 7 deletions(-) Approvals: Mark Bergsma: Looks good to me, approved Faidon Liambotis: Looks good to me, but someone else must approve jenkins-bot: Verified diff --git a/pybal/pybal.py b/pybal/pybal.py index 4f7863b..31d6ee4 100755 --- a/pybal/pybal.py +++ b/pybal/pybal.py @@ -472,21 +472,20 @@ peerAddr=self.globalConfig.get('bgp-peer-address')) asPath = [int(asn) for asn in self.globalConfig.get('bgp-as-path', str(self.bgpPeering.myASN)).split()] -attributes = {} +med = self.globalConfig.getint('bgp-med', 0) +baseAttrs = [bgp.OriginAttribute(), bgp.ASPathAttribute(asPath)] +if med: baseAttrs.append(bgp.MEDAttribute(med)) +attributes = {} try: -attributes[(bgp.AFI_INET, bgp.SAFI_UNICAST)] = bgp.FrozenAttributeDict([ -bgp.OriginAttribute(), -bgp.ASPathAttribute(asPath), +attributes[(bgp.AFI_INET, bgp.SAFI_UNICAST)] = bgp.FrozenAttributeDict(baseAttrs + [ bgp.NextHopAttribute(self.globalConfig['bgp-nexthop-ipv4'])]) except KeyError: if (bgp.AFI_INET, bgp.SAFI_UNICAST) in BGPFailover.prefixes: raise ValueError("IPv4 BGP NextHop (global configuration variable 'bgp-nexthop-ipv4') not set") try: -attributes[(bgp.AFI_INET6, bgp.SAFI_UNICAST)] = bgp.FrozenAttributeDict([ -bgp.OriginAttribute(), -bgp.ASPathAttribute(asPath), +attributes[(bgp.AFI_INET6, bgp.SAFI_UNICAST)] = bgp.FrozenAttributeDict(baseAttrs + [ bgp.MPReachNLRIAttribute((bgp.AFI_INET6, bgp.SAFI_UNICAST, bgp.IPv6IP(self.globalConfig['bgp-nexthop-ipv6']), []))]) except KeyError: -- To view, visit https://gerrit.wikimedia.org/r/255544 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I589be24c275cc73a5c04312e68bdf509e8c2533f Gerrit-PatchSet: 2 Gerrit-Project: operations/debs/pybal Gerrit-Branch: bgp-med Gerrit-Owner: Mark BergsmaGerrit-Reviewer: BBlack Gerrit-Reviewer: Faidon Liambotis Gerrit-Reviewer: Giuseppe Lavagetto Gerrit-Reviewer: Mark Bergsma Gerrit-Reviewer: Ori.livneh Gerrit-Reviewer: jenkins-bot <> ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add BGP MED support - change (operations...pybal)
Mark Bergsma has uploaded a new change for review. https://gerrit.wikimedia.org/r/255544 Change subject: Add BGP MED support .. Add BGP MED support Adds a global pybal.conf configuration option 'bgp-med' which sets a BGP MED attribute on all NLRI if non-zero. This can be used e.g. for BGP failover between multiple PyBal instances where the router selects the routes for the the PyBal instance with the lowest MED value as sent by PyBal. Change-Id: I589be24c275cc73a5c04312e68bdf509e8c2533f --- M pybal/pybal.py 1 file changed, 6 insertions(+), 7 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/debs/pybal refs/changes/44/255544/1 diff --git a/pybal/pybal.py b/pybal/pybal.py index e34bc66..b4ac395 100755 --- a/pybal/pybal.py +++ b/pybal/pybal.py @@ -469,21 +469,20 @@ peerAddr=self.globalConfig.get('bgp-peer-address')) asPath = [int(asn) for asn in self.globalConfig.get('bgp-as-path', str(self.bgpPeering.myASN)).split()] -attributes = {} +med = self.globalConfig.getint('bgp-med', 0) +baseAttrs = [bgp.OriginAttribute(), bgp.ASPathAttribute(asPath)] +if med: baseAttrs.append(bgp.MEDAttribute(med)) +attributes = {} try: -attributes[(bgp.AFI_INET, bgp.SAFI_UNICAST)] = bgp.FrozenAttributeDict([ -bgp.OriginAttribute(), -bgp.ASPathAttribute(asPath), +attributes[(bgp.AFI_INET, bgp.SAFI_UNICAST)] = bgp.FrozenAttributeDict(baseAttrs + [ bgp.NextHopAttribute(self.globalConfig['bgp-nexthop-ipv4'])]) except KeyError: if (bgp.AFI_INET, bgp.SAFI_UNICAST) in BGPFailover.prefixes: raise ValueError("IPv4 BGP NextHop (global configuration variable 'bgp-nexthop-ipv4') not set") try: -attributes[(bgp.AFI_INET6, bgp.SAFI_UNICAST)] = bgp.FrozenAttributeDict([ -bgp.OriginAttribute(), -bgp.ASPathAttribute(asPath), +attributes[(bgp.AFI_INET6, bgp.SAFI_UNICAST)] = bgp.FrozenAttributeDict(baseAttrs + [ bgp.MPReachNLRIAttribute((bgp.AFI_INET6, bgp.SAFI_UNICAST, bgp.IPv6IP(self.globalConfig['bgp-nexthop-ipv6']), []))]) except KeyError: -- To view, visit https://gerrit.wikimedia.org/r/255544 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I589be24c275cc73a5c04312e68bdf509e8c2533f Gerrit-PatchSet: 1 Gerrit-Project: operations/debs/pybal Gerrit-Branch: bgp-med Gerrit-Owner: Mark Bergsma___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits