Routing application split config support (#2286)
* Routing application split config support Signed-off-by: nikos <ntriantafillis@gmail.com> * Routing application split config support Routing application split config support Signed-off-by: nikos <Nikos Triantafillis>
This commit is contained in:
parent
f09488473d
commit
7056b49af7
@ -1,6 +1,9 @@
|
||||
FROM docker-config-engine
|
||||
|
||||
ARG docker_container_name
|
||||
ARG frr_user_uid
|
||||
ARG frr_user_gid
|
||||
|
||||
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf
|
||||
|
||||
# Make apt-get non-interactive
|
||||
@ -18,6 +21,9 @@ RUN apt-get install -y libdbus-1-3 libdaemon0 libjansson4 libc-ares2 iproute lib
|
||||
COPY debs/{{ deb }} /debs/
|
||||
{%- endfor %}
|
||||
|
||||
RUN groupadd -g ${frr_user_gid} frr
|
||||
RUN useradd -u ${frr_user_uid} -g ${frr_user_gid} -M -s /bin/false frr
|
||||
|
||||
# Install locally-built Debian packages and implicitly install their dependencies
|
||||
{%- for deb in docker_fpm_frr_debs.split(' ') %}
|
||||
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /debs/{{ deb }}
|
||||
|
@ -1,7 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
mkdir -p /etc/frr
|
||||
|
||||
CONFIG_TYPE=`sonic-cfggen -d -v 'DEVICE_METADATA["localhost"]["docker_routing_config_mode"]'`
|
||||
|
||||
if [ -z "$CONFIG_TYPE" ] || [ "$CONFIG_TYPE" == "unified" ]; then
|
||||
sonic-cfggen -d -t /usr/share/sonic/templates/frr.conf.j2 >/etc/frr/frr.conf
|
||||
fi
|
||||
|
||||
sonic-cfggen -d -t /usr/share/sonic/templates/isolate.j2 >/usr/sbin/bgp-isolate
|
||||
chown root:root /usr/sbin/bgp-isolate
|
||||
|
@ -320,3 +320,14 @@ sudo cp target/files/$MLNX_FW_FILE $FILESYSTEM_ROOT/etc/mlnx/fw-SPC.mfa
|
||||
j2 platform/mellanox/mlnx-fw-upgrade.j2 | sudo tee $FILESYSTEM_ROOT/usr/bin/mlnx-fw-upgrade.sh
|
||||
sudo chmod 755 $FILESYSTEM_ROOT/usr/bin/mlnx-fw-upgrade.sh
|
||||
{% endif %}
|
||||
|
||||
{%- if SONIC_ROUTING_STACK == "frr" %}
|
||||
sudo mkdir $FILESYSTEM_ROOT/etc/sonic/frr
|
||||
sudo touch $FILESYSTEM_ROOT/etc/sonic/frr/frr.conf
|
||||
sudo touch $FILESYSTEM_ROOT/etc/sonic/frr/vtysh.conf
|
||||
sudo cp dockers/docker-fpm-frr/daemons.conf $FILESYSTEM_ROOT/etc/sonic/frr/
|
||||
sudo cp dockers/docker-fpm-frr/daemons $FILESYSTEM_ROOT/etc/sonic/frr/
|
||||
sudo chown -R $FRR_USER_UID:$FRR_USER_GID $FILESYSTEM_ROOT/etc/sonic/frr
|
||||
sudo chmod 750 $FILESYSTEM_ROOT/etc/sonic/frr
|
||||
sudo chmod -R 640 $FILESYSTEM_ROOT/etc/sonic/frr/
|
||||
{%- endif %}
|
||||
|
@ -75,3 +75,12 @@ ENABLE_ORGANIZATION_EXTENSIONS = y
|
||||
# build: build kernel from source
|
||||
# download: download pre-built kernel from Azure storage.
|
||||
DEFAULT_KERNEL_PROCURE_METHOD = build
|
||||
|
||||
# FRR user and group id values. These only take effect when SONIC_ROUTING_STACK is frr.
|
||||
# Note: these values match the admin uid/gid of the host's admin account. If these values
|
||||
# change and user doesn't want the frr uid/gid to potentially match a random user on the
|
||||
# host, then either the appropriate account and group will need to be created on the host
|
||||
# manually or changes need to be made when the image is built to create the account and
|
||||
# group during installation.
|
||||
FRR_USER_UID = 1000
|
||||
FRR_USER_GID = 1000
|
||||
|
@ -9,5 +9,6 @@ SONIC_DOCKER_IMAGES += $(DOCKER_FPM_FRR)
|
||||
$(DOCKER_FPM_FRR)_CONTAINER_NAME = bgp
|
||||
$(DOCKER_FPM_FRR)_RUN_OPT += --net=host --privileged -t
|
||||
$(DOCKER_FPM_FRR)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
|
||||
$(DOCKER_FPM_FRR)_RUN_OPT += -v /etc/sonic/frr:/etc/frr:rw
|
||||
|
||||
$(DOCKER_FPM_FRR)_BASE_IMAGE_FILES += vtysh:/usr/bin/vtysh
|
||||
|
14
slave.mk
14
slave.mk
@ -116,6 +116,14 @@ endif
|
||||
MAKEFLAGS += -j $(SONIC_BUILD_JOBS)
|
||||
export SONIC_CONFIG_MAKE_JOBS
|
||||
|
||||
###############################################################################
|
||||
## Routing stack related exports
|
||||
###############################################################################
|
||||
|
||||
export SONIC_ROUTING_STACK
|
||||
export FRR_USER_UID
|
||||
export FRR_USER_GID
|
||||
|
||||
###############################################################################
|
||||
## Dumping key config attributes associated to current building exercise
|
||||
###############################################################################
|
||||
@ -134,6 +142,10 @@ $(info "SHUTDOWN_BGP_ON_START" : "$(SHUTDOWN_BGP_ON_START)")
|
||||
$(info "ENABLE_PFCWD_ON_START" : "$(ENABLE_PFCWD_ON_START)")
|
||||
$(info "INSTALL_DEBUG_TOOLS" : "$(INSTALL_DEBUG_TOOLS)")
|
||||
$(info "ROUTING_STACK" : "$(SONIC_ROUTING_STACK)")
|
||||
ifeq ($(SONIC_ROUTING_STACK),frr)
|
||||
$(info "FRR_USER_UID" : "$(FRR_USER_UID)")
|
||||
$(info "FRR_USER_GID" : "$(FRR_USER_GID)")
|
||||
endif
|
||||
$(info "ENABLE_SYNCD_RPC" : "$(ENABLE_SYNCD_RPC)")
|
||||
$(info "ENABLE_ORGANIZATION_EXTENSIONS" : "$(ENABLE_ORGANIZATION_EXTENSIONS)")
|
||||
$(info "HTTP_PROXY" : "$(HTTP_PROXY)")
|
||||
@ -463,6 +475,8 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .pl
|
||||
--build-arg uid=$(UID) \
|
||||
--build-arg guid=$(GUID) \
|
||||
--build-arg docker_container_name=$($*.gz_CONTAINER_NAME) \
|
||||
--build-arg frr_user_uid=$(FRR_USER_UID) \
|
||||
--build-arg frr_user_gid=$(FRR_USER_GID) \
|
||||
--label Tag=$(SONIC_GET_VERSION) \
|
||||
-t $* $($*.gz_PATH) $(LOG)
|
||||
docker save $* | gzip -c > $@
|
||||
|
@ -422,6 +422,7 @@ def parse_xml(filename, platform=None, port_config_file=None):
|
||||
neighbors = None
|
||||
devices = None
|
||||
hostname = None
|
||||
docker_routing_config_mode = "unified"
|
||||
port_speeds_default = {}
|
||||
port_speed_png = {}
|
||||
port_descriptions = {}
|
||||
@ -437,11 +438,14 @@ def parse_xml(filename, platform=None, port_config_file=None):
|
||||
|
||||
hwsku_qn = QName(ns, "HwSku")
|
||||
hostname_qn = QName(ns, "Hostname")
|
||||
docker_routing_config_mode_qn = QName(ns, "DockerRoutingConfigMode")
|
||||
for child in root:
|
||||
if child.tag == str(hwsku_qn):
|
||||
hwsku = child.text
|
||||
if child.tag == str(hostname_qn):
|
||||
hostname = child.text
|
||||
if child.tag == str(docker_routing_config_mode_qn):
|
||||
docker_routing_config_mode = child.text
|
||||
|
||||
(ports, alias_map) = get_port_config(hwsku, platform, port_config_file)
|
||||
port_alias_map.update(alias_map)
|
||||
@ -464,6 +468,7 @@ def parse_xml(filename, platform=None, port_config_file=None):
|
||||
results['DEVICE_METADATA'] = {'localhost': {
|
||||
'bgp_asn': bgp_asn,
|
||||
'deployment_id': deployment_id,
|
||||
'docker_routing_config_mode': docker_routing_config_mode,
|
||||
'hostname': hostname,
|
||||
'hwsku': hwsku,
|
||||
'type': current_device['type']
|
||||
|
Loading…
Reference in New Issue
Block a user