sonic-buildimage/dockers/docker-fpm-quagga/unisolate.j2
pavel-shirshov 7af546908f
[bgp]: Fix isolate/unisolate command for ipv6 peers (#3183)
* Fix isolate/unisolate command for ipv6 peers
2019-07-18 16:34:26 -07:00

27 lines
749 B
Django/Jinja
Executable File

#!/bin/bash
## vtysh only accepts script in stdin, so cannot be directly used in shebang
## Cut the tail of this script and feed vtysh stdin
sed -n -e '9,$p' < "$0" | vtysh "$@"
## Exit with vtysh return code
exit $?
## vtysh script start from next line, which line number MUST equal in 'sed' command above
configure terminal
router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
{% for neighbor_ip in BGP_NEIGHBOR %}
{% if neighbor_ip | ipv4 %}
no neighbor {{ neighbor_ip }} route-map ISOLATE out
{% else %}
address-family ipv6
no neighbor {{ neighbor_ip }} route-map ISOLATE out
exit-address-family
{% endif %}
{% endfor %}
exit
exit
{% for neighbor_ip in BGP_NEIGHBOR %}
clear ip bgp {{ neighbor_ip }} soft out
{% endfor %}