Reverts Azure/sonic-buildimage#7476 It remove bgpd.conf.j2 and zebra.conf.j2, which is still used by sonic-config-engine unit test.
This commit is contained in:
parent
710563f83d
commit
658ed4fd37
4
.gitmodules
vendored
4
.gitmodules
vendored
@ -16,6 +16,10 @@
|
||||
[submodule "src/p4-hlir/p4-hlir"]
|
||||
path = platform/p4/p4-hlir/p4-hlir
|
||||
url = https://github.com/p4lang/p4-hlir
|
||||
[submodule "quagga"]
|
||||
path = src/sonic-quagga
|
||||
url = https://github.com/Azure/sonic-quagga
|
||||
branch = debian/0.99.24.1
|
||||
[submodule "sonic-dbsyncd"]
|
||||
path = src/sonic-dbsyncd
|
||||
url = https://github.com/Azure/sonic-dbsyncd
|
||||
|
39
dockers/docker-fpm-quagga/Dockerfile.j2
Normal file
39
dockers/docker-fpm-quagga/Dockerfile.j2
Normal file
@ -0,0 +1,39 @@
|
||||
FROM docker-config-engine
|
||||
|
||||
ARG docker_container_name
|
||||
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf
|
||||
|
||||
# Make apt-get non-interactive
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# Update apt's cache of available packages
|
||||
RUN apt-get update
|
||||
|
||||
# Install required packages
|
||||
RUN apt-get install -y libdbus-1-3 libdaemon0 libjansson4 libpython2.7
|
||||
|
||||
{% if docker_fpm_quagga_debs.strip() -%}
|
||||
# Copy locally-built Debian package dependencies
|
||||
{%- for deb in docker_fpm_quagga_debs.split(' ') %}
|
||||
COPY debs/{{ deb }} /debs/
|
||||
{%- endfor %}
|
||||
|
||||
# Install locally-built Debian packages and implicitly install their dependencies
|
||||
{%- for deb in docker_fpm_quagga_debs.split(' ') %}
|
||||
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /debs/{{ deb }}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
|
||||
# Clean up
|
||||
RUN apt-get clean -y
|
||||
RUN apt-get autoclean -y
|
||||
RUN apt-get autoremove -y
|
||||
RUN rm -rf /debs ~/.cache
|
||||
|
||||
COPY ["bgpcfgd", "start.sh", "/usr/bin/"]
|
||||
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
|
||||
COPY ["*.j2", "/usr/share/sonic/templates/"]
|
||||
COPY ["files/supervisor-proc-exit-listener", "/usr/bin"]
|
||||
COPY ["critical_processes", "/etc/supervisor"]
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/supervisord"]
|
1
dockers/docker-fpm-quagga/base_image_files/rvtysh
Symbolic link
1
dockers/docker-fpm-quagga/base_image_files/rvtysh
Symbolic link
@ -0,0 +1 @@
|
||||
../../docker-fpm-frr/base_image_files/rvtysh
|
16
dockers/docker-fpm-quagga/base_image_files/vtysh
Executable file
16
dockers/docker-fpm-quagga/base_image_files/vtysh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Determine whether stdout is on a terminal
|
||||
if [ -t 1 ] ; then
|
||||
# Prepare a function to send HUP signal to vtysh in the container
|
||||
# we mark the new instance of vtysh with the current tty as a tag
|
||||
TTY=$(tty)
|
||||
function cleanup
|
||||
{
|
||||
docker exec -i bgp pkill -HUP -f "vtysh $TTY"
|
||||
}
|
||||
trap cleanup HUP
|
||||
docker exec -ti bgp vtysh "$TTY" "$@"
|
||||
else
|
||||
docker exec -i bgp vtysh "$@"
|
||||
fi
|
71
dockers/docker-fpm-quagga/bgpcfgd
Executable file
71
dockers/docker-fpm-quagga/bgpcfgd
Executable file
@ -0,0 +1,71 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import redis
|
||||
import subprocess
|
||||
import syslog
|
||||
from swsssdk import ConfigDBConnector
|
||||
|
||||
|
||||
class BGPConfigDaemon:
|
||||
|
||||
def __init__(self):
|
||||
self.config_db = ConfigDBConnector()
|
||||
self.config_db.connect()
|
||||
self.bgp_asn = self.config_db.get_entry('DEVICE_METADATA', 'localhost')['bgp_asn']
|
||||
self.bgp_neighbor = self.config_db.get_table('BGP_NEIGHBOR')
|
||||
|
||||
def __run_command(self, command):
|
||||
p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)
|
||||
stdout = p.communicate()[0]
|
||||
p.wait()
|
||||
if p.returncode != 0:
|
||||
syslog.syslog(syslog.LOG_ERR, '[bgp cfgd] command execution returned {}. Command: "{}", stdout: "{}"'.format(
|
||||
p.returncode, command, stdout))
|
||||
|
||||
def metadata_handler(self, key, data):
|
||||
if key == 'localhost' and data.has_key('bgp_asn'):
|
||||
if data['bgp_asn'] != self.bgp_asn:
|
||||
syslog.syslog(syslog.LOG_INFO, '[bgp cfgd] ASN changed to {} from {}, restart BGP...'.format(
|
||||
data['bgp_asn'], self.bgp_asn))
|
||||
self.__run_command("supervisorctl restart start.sh")
|
||||
self.__run_command("service quagga restart")
|
||||
self.bgp_asn = data['bgp_asn']
|
||||
|
||||
def bgp_handler(self, key, data):
|
||||
syslog.syslog(syslog.LOG_INFO, '[bgp cfgd] value for {} changed to {}'.format(key, data))
|
||||
if not data:
|
||||
# Neighbor is deleted
|
||||
command = "vtysh -c 'configure terminal' -c 'router bgp {}' -c 'no neighbor {}'".format(self.bgp_asn, key)
|
||||
self.__run_command(command)
|
||||
self.bgp_neighbor.pop(key)
|
||||
else:
|
||||
command = "vtysh -c 'configure terminal' -c 'router bgp {}' -c 'neighbor {} remote-as {}'".format(
|
||||
self.bgp_asn, key, data['asn'])
|
||||
self.__run_command(command)
|
||||
if data.has_key('name'):
|
||||
command = "vtysh -c 'configure terminal' -c 'router bgp {}' -c 'neighbor {} description {}'".format(
|
||||
self.bgp_asn, key, data['name'])
|
||||
self.__run_command(command)
|
||||
if data.has_key('admin_status'):
|
||||
command_mod = 'no ' if data['admin_status'] == 'up' else ''
|
||||
command = "vtysh -c 'configure terminal' -c 'router bgp {}' -c '{}neighbor {} shutdown'".format(
|
||||
self.bgp_asn, command_mod, key)
|
||||
self.__run_command(command)
|
||||
self.bgp_neighbor[key] = data
|
||||
|
||||
def start(self):
|
||||
self.config_db.subscribe('BGP_NEIGHBOR',
|
||||
lambda table, key, data: self.bgp_handler(key, data))
|
||||
self.config_db.subscribe('DEVICE_METADATA',
|
||||
lambda table, key, data: self.metadata_handler(key, data))
|
||||
self.config_db.listen()
|
||||
|
||||
|
||||
def main():
|
||||
daemon = BGPConfigDaemon()
|
||||
daemon.start()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
140
dockers/docker-fpm-quagga/bgpd.conf.j2
Normal file
140
dockers/docker-fpm-quagga/bgpd.conf.j2
Normal file
@ -0,0 +1,140 @@
|
||||
!
|
||||
{% block banner %}
|
||||
! =========== Managed by sonic-cfggen DO NOT edit manually! ====================
|
||||
! generated by templates/quagga/bgpd.conf.j2 with config DB data
|
||||
! file: bgpd.conf
|
||||
!
|
||||
{% endblock banner %}
|
||||
!
|
||||
{% block system_init %}
|
||||
hostname {{ DEVICE_METADATA['localhost']['hostname'] }}
|
||||
password zebra
|
||||
log syslog informational
|
||||
log facility local4
|
||||
! enable password {# {{ en_passwd }} TODO: param needed #}
|
||||
{% endblock system_init %}
|
||||
!
|
||||
{% if 'bgp_asn' in DEVICE_METADATA['localhost'] %}
|
||||
{% block bgp_init %}
|
||||
!
|
||||
! bgp multiple-instance
|
||||
!
|
||||
route-map FROM_BGP_SPEAKER_V4 permit 10
|
||||
!
|
||||
route-map TO_BGP_SPEAKER_V4 deny 10
|
||||
!
|
||||
router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
|
||||
bgp log-neighbor-changes
|
||||
bgp bestpath as-path multipath-relax
|
||||
no bgp default ipv4-unicast
|
||||
bgp graceful-restart restart-time 240
|
||||
bgp graceful-restart
|
||||
{% for (name, prefix) in LOOPBACK_INTERFACE|pfx_filter %}
|
||||
{% if prefix | ipv4 and name == 'Loopback0' %}
|
||||
bgp router-id {{ prefix | ip }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{# advertise loopback #}
|
||||
{% for (name, prefix) in LOOPBACK_INTERFACE|pfx_filter %}
|
||||
{% if prefix | ipv4 and name == 'Loopback0' %}
|
||||
network {{ prefix | ip }}/32
|
||||
{% elif prefix | ipv6 and name == 'Loopback0' %}
|
||||
address-family ipv6
|
||||
network {{ prefix | ip }}/64
|
||||
exit-address-family
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endblock bgp_init %}
|
||||
{% endif %}
|
||||
{% block vlan_advertisement %}
|
||||
{% for (name, prefix) in VLAN_INTERFACE|pfx_filter %}
|
||||
{% if prefix | ipv4 %}
|
||||
network {{ prefix }}
|
||||
{% elif prefix | ipv6 %}
|
||||
address-family ipv6
|
||||
network {{ prefix }}
|
||||
exit-address-family
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endblock vlan_advertisement %}
|
||||
{% block bgp_sessions %}
|
||||
{% for neighbor_addr, bgp_session in BGP_NEIGHBOR.items() %}
|
||||
{% if bgp_session['asn'] | int != 0 %}
|
||||
neighbor {{ neighbor_addr }} remote-as {{ bgp_session['asn'] }}
|
||||
neighbor {{ neighbor_addr }} description {{ bgp_session['name'] }}
|
||||
{# set the bgp neighbor timers if they have not default values #}
|
||||
{% if (bgp_session['keepalive'] is defined and bgp_session['keepalive'] | int != 60)
|
||||
or (bgp_session['holdtime'] is defined and bgp_session['holdtime'] | int != 180) %}
|
||||
neighbor {{ neighbor_addr }} timers {{ bgp_session['keepalive'] }} {{ bgp_session['holdtime'] }}
|
||||
{% endif %}
|
||||
{% if 'admin_status' in bgp_session and bgp_session['admin_status'] == 'down' or 'admin_status' not in bgp_session and 'default_bgp_status' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['default_bgp_status'] == 'down' %}
|
||||
neighbor {{ neighbor_addr }} shutdown
|
||||
{% endif %}
|
||||
{% if neighbor_addr | ipv4 %}
|
||||
address-family ipv4
|
||||
{% if DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %}
|
||||
neighbor {{ neighbor_addr }} allowas-in 1
|
||||
{% endif %}
|
||||
neighbor {{ neighbor_addr }} activate
|
||||
neighbor {{ neighbor_addr }} soft-reconfiguration inbound
|
||||
maximum-paths 64
|
||||
exit-address-family
|
||||
{% endif %}
|
||||
{% if neighbor_addr | ipv6 %}
|
||||
address-family ipv6
|
||||
{% if DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %}
|
||||
neighbor {{ neighbor_addr }} allowas-in 1
|
||||
{% endif %}
|
||||
neighbor {{ neighbor_addr }} activate
|
||||
neighbor {{ neighbor_addr }} soft-reconfiguration inbound
|
||||
maximum-paths 64
|
||||
exit-address-family
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endblock bgp_sessions %}
|
||||
{% block bgp_peers_with_range %}
|
||||
{% if BGP_PEER_RANGE %}
|
||||
{% for bgp_peer in BGP_PEER_RANGE.values() %}
|
||||
neighbor {{ bgp_peer['name'] }} peer-group
|
||||
neighbor {{ bgp_peer['name'] }} passive
|
||||
{% if bgp_peer['peer_asn'] is defined %}
|
||||
neighbor {{ bgp_peer['name'] }} remote-as {{ bgp_peer['peer_asn'] }}
|
||||
{% else %}
|
||||
neighbor {{ bgp_peer['name'] }} remote-as {{ constants.deployment_id_asn_map[DEVICE_METADATA['localhost']['deployment_id']] }}
|
||||
{% endif %}
|
||||
neighbor {{ bgp_peer['name'] }} ebgp-multihop 255
|
||||
neighbor {{ bgp_peer['name'] }} soft-reconfiguration inbound
|
||||
{% if bgp_peer['src_address'] is defined %}
|
||||
neighbor {{ bgp_peer['name'] }} update-source {{ bgp_peer['src_address'] | ip }}
|
||||
{% else %}
|
||||
{% for (name, prefix) in LOOPBACK_INTERFACE|pfx_filter %}
|
||||
{% if name == 'Loopback1' %}
|
||||
neighbor {{ bgp_peer['name'] }} update-source {{ prefix | ip }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
neighbor {{ bgp_peer['name'] }} route-map FROM_BGP_SPEAKER_V4 in
|
||||
neighbor {{ bgp_peer['name'] }} route-map TO_BGP_SPEAKER_V4 out
|
||||
{% for ip_range in bgp_peer['ip_range'] %}
|
||||
bgp listen range {{ip_range}} peer-group {{ bgp_peer['name'] }}
|
||||
{% endfor %}
|
||||
address-family ipv4
|
||||
neighbor {{ bgp_peer['name'] }} activate
|
||||
maximum-paths 64
|
||||
exit-address-family
|
||||
address-family ipv6
|
||||
neighbor {{ bgp_peer['name'] }} activate
|
||||
maximum-paths 64
|
||||
exit-address-family
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endblock bgp_peers_with_range %}
|
||||
!
|
||||
{% if 'bgp_asn' in DEVICE_METADATA['localhost'] %}
|
||||
maximum-paths 64
|
||||
!
|
||||
route-map ISOLATE permit 10
|
||||
set as-path prepend {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
|
||||
{% endif %}
|
||||
!
|
4
dockers/docker-fpm-quagga/critical_processes
Normal file
4
dockers/docker-fpm-quagga/critical_processes
Normal file
@ -0,0 +1,4 @@
|
||||
program:zebra
|
||||
program:bgpd
|
||||
program:fpmsyncd
|
||||
program:bgpcfgd
|
26
dockers/docker-fpm-quagga/isolate.j2
Executable file
26
dockers/docker-fpm-quagga/isolate.j2
Executable file
@ -0,0 +1,26 @@
|
||||
#!/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_addr in BGP_NEIGHBOR %}
|
||||
{% if neighbor_addr | ipv4 %}
|
||||
neighbor {{ neighbor_addr }} route-map ISOLATE out
|
||||
{% else %}
|
||||
address-family ipv6
|
||||
neighbor {{ neighbor_addr }} route-map ISOLATE out
|
||||
exit-address-family
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
exit
|
||||
exit
|
||||
|
||||
{% for neighbor_addr in BGP_NEIGHBOR %}
|
||||
clear ip bgp {{ neighbor_addr }} soft out
|
||||
{% endfor %}
|
34
dockers/docker-fpm-quagga/start.sh
Executable file
34
dockers/docker-fpm-quagga/start.sh
Executable file
@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
mkdir -p /etc/quagga
|
||||
|
||||
CFGGEN_PARAMS=" \
|
||||
-d \
|
||||
-y /etc/sonic/constants.yml \
|
||||
-t /usr/share/sonic/templates/bgpd.conf.j2,/etc/quagga/bgpd.conf \
|
||||
-t /usr/share/sonic/templates/zebra.conf.j2,/etc/quagga/zebra.conf \
|
||||
-t /usr/share/sonic/templates/isolate.j2,/usr/sbin/bgp-isolate \
|
||||
-t /usr/share/sonic/templates/unisolate.j2,/usr/sbin/bgp-unisolate \
|
||||
"
|
||||
sonic-cfggen $CFGGEN_PARAMS
|
||||
|
||||
chown root:root /usr/sbin/bgp-isolate
|
||||
chmod 0755 /usr/sbin/bgp-isolate
|
||||
|
||||
chown root:root /usr/sbin/bgp-unisolate
|
||||
chmod 0755 /usr/sbin/bgp-unisolate
|
||||
|
||||
mkdir -p /var/sonic
|
||||
echo "# Config files managed by sonic-config-engine" > /var/sonic/config_status
|
||||
|
||||
rm -f /var/run/rsyslogd.pid
|
||||
|
||||
supervisorctl start bgpcfgd
|
||||
|
||||
supervisorctl start rsyslogd
|
||||
|
||||
# Start Quagga processes
|
||||
supervisorctl start zebra
|
||||
supervisorctl start bgpd
|
||||
|
||||
supervisorctl start fpmsyncd
|
66
dockers/docker-fpm-quagga/supervisord.conf
Normal file
66
dockers/docker-fpm-quagga/supervisord.conf
Normal file
@ -0,0 +1,66 @@
|
||||
[supervisord]
|
||||
logfile_maxbytes=1MB
|
||||
logfile_backups=2
|
||||
nodaemon=true
|
||||
|
||||
[eventlistener:supervisor-proc-exit-listener]
|
||||
command=/usr/bin/supervisor-proc-exit-listener --container-name bgp
|
||||
events=PROCESS_STATE_EXITED,PROCESS_STATE_RUNNING
|
||||
autostart=true
|
||||
autorestart=unexpected
|
||||
buffer_size=1024
|
||||
|
||||
[program:start.sh]
|
||||
command=/usr/bin/start.sh
|
||||
priority=1
|
||||
autostart=true
|
||||
autorestart=false
|
||||
startsecs=0
|
||||
stdout_logfile=syslog
|
||||
stderr_logfile=syslog
|
||||
|
||||
[program:bgpcfgd]
|
||||
command=/usr/bin/bgpcfgd
|
||||
priority=2
|
||||
autostart=false
|
||||
autorestart=false
|
||||
startsecs=0
|
||||
stdout_logfile=syslog
|
||||
stderr_logfile=syslog
|
||||
|
||||
[program:rsyslogd]
|
||||
command=/usr/sbin/rsyslogd -n
|
||||
priority=3
|
||||
autostart=false
|
||||
autorestart=unexpected
|
||||
startsecs=0
|
||||
stdout_logfile=syslog
|
||||
stderr_logfile=syslog
|
||||
|
||||
[program:zebra]
|
||||
command=/usr/lib/quagga/zebra -A 127.0.0.1
|
||||
priority=4
|
||||
autostart=false
|
||||
autorestart=false
|
||||
startsecs=0
|
||||
stdout_logfile=syslog
|
||||
stderr_logfile=syslog
|
||||
|
||||
[program:bgpd]
|
||||
command=/usr/lib/quagga/bgpd -A 127.0.0.1 -F
|
||||
priority=5
|
||||
stopsignal=KILL
|
||||
autostart=false
|
||||
autorestart=false
|
||||
startsecs=0
|
||||
stdout_logfile=syslog
|
||||
stderr_logfile=syslog
|
||||
|
||||
[program:fpmsyncd]
|
||||
command=fpmsyncd
|
||||
priority=6
|
||||
autostart=false
|
||||
autorestart=false
|
||||
startsecs=0
|
||||
stdout_logfile=syslog
|
||||
stderr_logfile=syslog
|
26
dockers/docker-fpm-quagga/unisolate.j2
Executable file
26
dockers/docker-fpm-quagga/unisolate.j2
Executable file
@ -0,0 +1,26 @@
|
||||
#!/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 %}
|
78
dockers/docker-fpm-quagga/zebra.conf.j2
Normal file
78
dockers/docker-fpm-quagga/zebra.conf.j2
Normal file
@ -0,0 +1,78 @@
|
||||
!
|
||||
{% block banner %}
|
||||
! =========== Managed by sonic-cfggen DO NOT edit manually! ====================
|
||||
! generated by templates/quagga/zebra.conf.j2 using config DB data
|
||||
! file: zebra.conf
|
||||
!
|
||||
{% endblock banner %}
|
||||
!
|
||||
{% block sys_init %}
|
||||
hostname {{ DEVICE_METADATA['localhost']['hostname'] }}
|
||||
password zebra
|
||||
enable password zebra
|
||||
{% endblock sys_init %}
|
||||
!
|
||||
{% block interfaces %}
|
||||
! Enable link-detect (default disabled)
|
||||
{% for (name, prefix) in INTERFACE|pfx_filter %}
|
||||
interface {{ name }}
|
||||
link-detect
|
||||
!
|
||||
{% endfor %}
|
||||
{% for pc in PORTCHANNEL %}
|
||||
interface {{ pc }}
|
||||
link-detect
|
||||
!
|
||||
{% endfor %}
|
||||
{% endblock interfaces %}
|
||||
!
|
||||
{% block default_route %}
|
||||
! set static default route to mgmt gateway as a backup to learned default
|
||||
{% for (name, prefix) in MGMT_INTERFACE|pfx_filter %}
|
||||
{% if prefix | ipv4 %}
|
||||
ip route 0.0.0.0/0 {{ MGMT_INTERFACE[(name, prefix)]['gwaddr'] }} 200
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endblock default_route %}
|
||||
!
|
||||
{% block source_loopback %}
|
||||
{% set lo_ipv4_addrs = [] %}
|
||||
{% set lo_ipv6_addrs = [] %}
|
||||
{% if LOOPBACK_INTERFACE %}
|
||||
{% for (name, prefix) in LOOPBACK_INTERFACE|pfx_filter %}
|
||||
{% if name == 'Loopback0' %}
|
||||
{% if prefix | ipv6 %}
|
||||
{% if lo_ipv6_addrs.append(prefix) %}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if lo_ipv4_addrs.append(prefix) %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
! Set ip source to loopback for bgp learned routes
|
||||
{% if lo_ipv4_addrs|length > 0 -%}
|
||||
route-map RM_SET_SRC permit 10
|
||||
set src {{ lo_ipv4_addrs[0] | ip }}
|
||||
!
|
||||
{% endif %}
|
||||
{% if lo_ipv6_addrs|length > 0 %}
|
||||
route-map RM_SET_SRC6 permit 10
|
||||
set src {{ lo_ipv6_addrs[0] | ip }}
|
||||
!
|
||||
{% endif %}
|
||||
ip protocol bgp route-map RM_SET_SRC
|
||||
!
|
||||
{% if lo_ipv6_addrs|length > 0 %}
|
||||
ipv6 protocol bgp route-map RM_SET_SRC6
|
||||
!
|
||||
{% endif %}
|
||||
{% endblock source_loopback %}
|
||||
!
|
||||
{% block logging %}
|
||||
log syslog informational
|
||||
log facility local4
|
||||
{% endblock logging %}
|
||||
!
|
||||
|
@ -34,7 +34,9 @@ $(DOCKER_SONIC_VS)_DEPENDS += $(SWSS_DBG) \
|
||||
$(SYNCD_VS_DBG)
|
||||
endif
|
||||
|
||||
ifeq ($(SONIC_ROUTING_STACK), frr)
|
||||
ifeq ($(SONIC_ROUTING_STACK), quagga)
|
||||
$(DOCKER_SONIC_VS)_DEPENDS += $(QUAGGA)
|
||||
else ifeq ($(SONIC_ROUTING_STACK), frr)
|
||||
$(DOCKER_SONIC_VS)_DEPENDS += $(FRR)
|
||||
else
|
||||
$(DOCKER_SONIC_VS)_DEPENDS += $(GOBGP)
|
||||
|
@ -69,7 +69,7 @@ SONIC_USE_PDDF_FRAMEWORK = y
|
||||
|
||||
# SONIC_ROUTING_STACK - specify the routing-stack being elected to drive SONiC's control-plane.
|
||||
# Supported routing stacks on SONiC are:
|
||||
# routing-stacks: frr.
|
||||
# routing-stacks: quagga, frr.
|
||||
SONIC_ROUTING_STACK = frr
|
||||
|
||||
# ENABLE_SYNCD_RPC - build docker-syncd with rpc packages for testing purposes.
|
||||
|
10
rules/docker-fpm-gobgp.dep
Normal file
10
rules/docker-fpm-gobgp.dep
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
DPATH := $($(DOCKER_FPM_GOBGP)_PATH)
|
||||
DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/docker-fpm-gobgp.mk rules/docker-fpm-gobgp.dep
|
||||
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
|
||||
DEP_FILES += $(shell git ls-files $(DPATH))
|
||||
|
||||
$(DOCKER_FPM_GOBGP)_CACHE_MODE := GIT_CONTENT_SHA
|
||||
$(DOCKER_FPM_GOBGP)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)
|
||||
$(DOCKER_FPM_GOBGP)_DEP_FILES := $(DEP_FILES)
|
||||
|
16
rules/docker-fpm-gobgp.mk
Normal file
16
rules/docker-fpm-gobgp.mk
Normal file
@ -0,0 +1,16 @@
|
||||
# docker image for fpm-gobgp
|
||||
|
||||
DOCKER_FPM_GOBGP = docker-fpm-gobgp.gz
|
||||
$(DOCKER_FPM_GOBGP)_PATH = $(DOCKERS_PATH)/docker-fpm-gobgp
|
||||
$(DOCKER_FPM_GOBGP)_DEPENDS += $(GOBGP)
|
||||
$(DOCKER_FPM_GOBGP)_LOAD_DOCKERS += $(DOCKER_FPM_QUAGGA)
|
||||
|
||||
$(DOCKER_FPM_GOBGP)_VERSION = 1.0.0
|
||||
$(DOCKER_FPM_GOBGP)_PACKAGE_NAME = fpm-gobgp
|
||||
|
||||
SONIC_DOCKER_IMAGES += $(DOCKER_FPM_GOBGP)
|
||||
|
||||
$(DOCKER_FPM_GOBGP)_CONTAINER_NAME = bgp
|
||||
$(DOCKER_FPM_GOBGP)_RUN_OPT += --privileged -t
|
||||
$(DOCKER_FPM_GOBGP)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
|
||||
$(DOCKER_FPM_GOBPG)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT)
|
10
rules/docker-fpm-quagga.dep
Normal file
10
rules/docker-fpm-quagga.dep
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
DPATH := $($(DOCKER_FPM_QUAGGA)_PATH)
|
||||
DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/docker-fpm-quagga.mk rules/docker-fpm-quagga.dep
|
||||
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
|
||||
DEP_FILES += $(shell git ls-files $(DPATH))
|
||||
|
||||
$(DOCKER_FPM_QUAGGA)_CACHE_MODE := GIT_CONTENT_SHA
|
||||
$(DOCKER_FPM_QUAGGA)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)
|
||||
$(DOCKER_FPM_QUAGGA)_DEP_FILES := $(DEP_FILES)
|
||||
|
20
rules/docker-fpm-quagga.mk
Normal file
20
rules/docker-fpm-quagga.mk
Normal file
@ -0,0 +1,20 @@
|
||||
# docker image for fpm-quagga
|
||||
|
||||
DOCKER_FPM_QUAGGA = docker-fpm-quagga.gz
|
||||
$(DOCKER_FPM_QUAGGA)_PATH = $(DOCKERS_PATH)/docker-fpm-quagga
|
||||
$(DOCKER_FPM_QUAGGA)_DEPENDS += $(QUAGGA) $(SWSS)
|
||||
$(DOCKER_FPM_QUAGGA)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE)
|
||||
|
||||
$(DOCKER_FPM_QUAGGA)_VERSION = 1.0.0
|
||||
$(DOCKER_FPM_QUAGGA)_PACKAGE_NAME = fpm-quagga
|
||||
|
||||
SONIC_DOCKER_IMAGES += $(DOCKER_FPM_QUAGGA)
|
||||
|
||||
$(DOCKER_FPM_QUAGGA)_CONTAINER_NAME = bgp
|
||||
$(DOCKER_FPM_QUAGGA)_RUN_OPT += --privileged -t
|
||||
$(DOCKER_FPM_QUAGGA)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
|
||||
|
||||
$(DOCKER_FPM_QUAGGA)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT)
|
||||
|
||||
$(DOCKER_FPM_QUAGGA)_BASE_IMAGE_FILES += vtysh:/usr/bin/vtysh
|
||||
$(DOCKER_FPM_QUAGGA)_BASE_IMAGE_FILES += rvtysh:/usr/bin/rvtysh
|
@ -1,6 +1,8 @@
|
||||
# Docker-fpm rule-file is simply a wrapper containing routing-stack selection logic.
|
||||
|
||||
ifeq ($(SONIC_ROUTING_STACK), frr)
|
||||
ifeq ($(SONIC_ROUTING_STACK), quagga)
|
||||
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_FPM_QUAGGA)
|
||||
else ifeq ($(SONIC_ROUTING_STACK), frr)
|
||||
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_FPM_FRR)
|
||||
SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_FPM_FRR_DBG)
|
||||
else
|
||||
|
13
rules/quagga.dep
Normal file
13
rules/quagga.dep
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
SPATH := $($(QUAGGA)_SRC_PATH)
|
||||
DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/quagga.mk rules/quagga.dep
|
||||
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
|
||||
SMDEP_FILES := $(addprefix $(SPATH)/,$(shell cd $(SPATH) && git ls-files))
|
||||
|
||||
#DPKG_FRK
|
||||
$(QUAGGA)_CACHE_MODE := GIT_CONTENT_SHA
|
||||
$(QUAGGA)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)
|
||||
$(QUAGGA)_DEP_FILES := $(DEP_FILES)
|
||||
$(QUAGGA)_SMDEP_FILES := $(SMDEP_FILES)
|
||||
$(QUAGGA)_SMDEP_PATHS := $(SPATH)
|
||||
|
11
rules/quagga.mk
Normal file
11
rules/quagga.mk
Normal file
@ -0,0 +1,11 @@
|
||||
# quagga package
|
||||
|
||||
QUAGGA_VERSION_FULL = 0.99.24.1-2.1
|
||||
|
||||
QUAGGA = quagga_$(QUAGGA_VERSION_FULL)_$(CONFIGURED_ARCH).deb
|
||||
$(QUAGGA)_DEPENDS += $(LIBSNMP_DEV)
|
||||
$(QUAGGA)_SRC_PATH = $(SRC_PATH)/sonic-quagga
|
||||
SONIC_DPKG_DEBS += $(QUAGGA)
|
||||
|
||||
QUAGGA_DBG = quagga-dbg_$(QUAGGA_VERSION_FULL)_$(CONFIGURED_ARCH).deb
|
||||
$(eval $(call add_derived_package,$(QUAGGA),$(QUAGGA_DBG)))
|
1
src/sonic-quagga
Submodule
1
src/sonic-quagga
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit e3b3b634e76b53cc4dce9301839451846eea7415
|
Loading…
Reference in New Issue
Block a user