2017-01-29 13:33:33 -06:00
|
|
|
#!/bin/bash
|
|
|
|
## This script is to automate loading of vendor specific docker images
|
Add gearbox phy device files and a new physyncd docker to support VS gearbox phy feature (#4851)
* buildimage: Add gearbox phy device files and a new physyncd docker to support VS gearbox phy feature
* scripts and configuration needed to support a second syncd docker (physyncd)
* physyncd supports gearbox device and phy SAI APIs and runs multiple instances of syncd, one per phy in the device
* support for VS target (sonic-sairedis vslib has been extended to support a virtual BCM81724 gearbox PHY).
HLD is located at https://github.com/Azure/SONiC/blob/b817a12fd89520d3fd26bbc5897487928e7f6de7/doc/gearbox/gearbox_mgr_design.md
**- Why I did it**
This work is part of the gearbox phy joint effort between Microsoft and Broadcom, and is based
on multi-switch support in sonic-sairedis.
**- How I did it**
Overall feature was implemented across several projects. The collective pull requests (some in late stages of review at this point):
https://github.com/Azure/sonic-utilities/pull/931 - CLI (merged)
https://github.com/Azure/sonic-swss-common/pull/347 - Minor changes (merged)
https://github.com/Azure/sonic-swss/pull/1321 - gearsyncd, config parsers, changes to orchargent to create gearbox phy on supported systems
https://github.com/Azure/sonic-sairedis/pull/624 - physyncd, virtual BCM81724 gearbox phy added to vslib
**- How to verify it**
In a vslib build:
root@sonic:/home/admin# show gearbox interfaces status
PHY Id Interface MAC Lanes MAC Lane Speed PHY Lanes PHY Lane Speed Line Lanes Line Lane Speed Oper Admin
-------- ----------- --------------- ---------------- --------------- ---------------- ------------ ----------------- ------ -------
1 Ethernet48 121,122,123,124 25G 200,201,202,203 25G 204,205 50G down down
1 Ethernet49 125,126,127,128 25G 206,207,208,209 25G 210,211 50G down down
1 Ethernet50 69,70,71,72 25G 212,213,214,215 25G 216 100G down down
In addition, docker ps | grep phy should show a physyncd docker running.
Signed-off-by: syd.logan@broadcom.com
2020-09-25 10:32:44 -05:00
|
|
|
## and installation of configuration files and vendor specific packages
|
2017-01-29 13:33:33 -06:00
|
|
|
## to debian file system.
|
|
|
|
##
|
|
|
|
## USAGE:
|
2017-02-27 15:08:41 -06:00
|
|
|
## ./sonic_debian_extension.sh FILESYSTEM_ROOT PLATFORM_DIR
|
2017-01-29 13:33:33 -06:00
|
|
|
## PARAMETERS:
|
|
|
|
## FILESYSTEM_ROOT
|
|
|
|
## Path to debian file system root directory
|
|
|
|
|
|
|
|
FILESYSTEM_ROOT=$1
|
|
|
|
[ -n "$FILESYSTEM_ROOT" ] || {
|
|
|
|
echo "Error: no or empty FILESYSTEM_ROOT argument"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2017-02-27 15:08:41 -06:00
|
|
|
PLATFORM_DIR=$2
|
|
|
|
[ -n "$PLATFORM_DIR" ] || {
|
|
|
|
echo "Error: no or empty PLATFORM_DIR argument"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2021-04-18 10:17:57 -05:00
|
|
|
IMAGE_DISTRO=$3
|
|
|
|
[ -n "$IMAGE_DISTRO" ] || {
|
|
|
|
echo "Error: no or empty IMAGE_DISTRO argument"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2017-01-29 13:33:33 -06:00
|
|
|
## Enable debug output for script
|
|
|
|
set -x -e
|
|
|
|
|
2019-07-26 00:06:41 -05:00
|
|
|
CONFIGURED_ARCH=$([ -f .arch ] && cat .arch || echo amd64)
|
|
|
|
|
2017-01-29 13:33:33 -06:00
|
|
|
. functions.sh
|
2020-06-24 17:25:16 -05:00
|
|
|
BUILD_SCRIPTS_DIR=files/build_scripts
|
2017-01-29 13:33:33 -06:00
|
|
|
BUILD_TEMPLATES=files/build_templates
|
|
|
|
IMAGE_CONFIGS=files/image_config
|
2018-08-22 15:02:32 -05:00
|
|
|
SCRIPTS_DIR=files/scripts
|
2021-03-14 07:15:42 -05:00
|
|
|
DOCKER_SCRIPTS_DIR=files/docker
|
|
|
|
|
|
|
|
DOCKER_CTL_DIR=/usr/lib/docker/
|
|
|
|
DOCKER_CTL_SCRIPT="$DOCKER_CTL_DIR/docker.sh"
|
2017-01-29 13:33:33 -06:00
|
|
|
|
2018-02-27 14:15:56 -06:00
|
|
|
# Define target fold macro
|
|
|
|
FILESYSTEM_ROOT_USR="$FILESYSTEM_ROOT/usr"
|
2021-03-14 07:15:42 -05:00
|
|
|
FILESYSTEM_ROOT_USR_LIB="$FILESYSTEM_ROOT/usr/lib/"
|
|
|
|
FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM="$FILESYSTEM_ROOT_USR_LIB/systemd/system"
|
2018-02-27 14:15:56 -06:00
|
|
|
FILESYSTEM_ROOT_USR_SHARE="$FILESYSTEM_ROOT_USR/share"
|
|
|
|
FILESYSTEM_ROOT_USR_SHARE_SONIC="$FILESYSTEM_ROOT_USR_SHARE/sonic"
|
First cut image update for kubernetes support. (#5421)
* First cut image update for kubernetes support.
With this,
1) dockers dhcp_relay, lldp, pmon, radv, snmp, telemetry are enabled
for kube management
init_cfg.json configure set_owner as kube for these
2) Each docker's start.sh updated to call container_startup.py to register going up
As part of this call, it registers the current owner as local/kube and its version
The images are built with its version ingrained into image during build
3) Update all docker's bash script to call 'container start/stop/wait' instead of 'docker start/stop/wait'.
For all locally managed containers, it calls docker commands, hence no change for locally managed.
4) Introduced a new ctrmgrd service, that helps with transition between owners as kube & local and carry over any labels update from STATE-DB to API server
5) hostcfgd updated to handle owner change
6) Reboot scripts are updatd to tag kube running images as local, so upon reboot they run the same image.
7) Added kube_commands.py to handle all updates with Kubernetes API serrver -- dedicated for k8s interaction only.
2020-12-22 10:01:33 -06:00
|
|
|
FILESYSTEM_ROOT_USR_SHARE_SONIC_SCRIPTS="$FILESYSTEM_ROOT_USR_SHARE_SONIC/scripts"
|
2018-02-27 14:15:56 -06:00
|
|
|
FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES="$FILESYSTEM_ROOT_USR_SHARE_SONIC/templates"
|
2021-08-03 11:39:39 -05:00
|
|
|
FILESYSTEM_ROOT_USR_SHARE_SONIC_FIRMWARE="$FILESYSTEM_ROOT_USR_SHARE_SONIC/firmware"
|
2019-12-15 18:48:48 -06:00
|
|
|
FILESYSTEM_ROOT_ETC="$FILESYSTEM_ROOT/etc"
|
|
|
|
FILESYSTEM_ROOT_ETC_SONIC="$FILESYSTEM_ROOT_ETC/sonic"
|
2018-02-27 14:15:56 -06:00
|
|
|
|
2019-07-29 17:52:15 -05:00
|
|
|
GENERATED_SERVICE_FILE="$FILESYSTEM_ROOT/etc/sonic/generated_services.conf"
|
|
|
|
|
2017-01-29 13:33:33 -06:00
|
|
|
clean_sys() {
|
2020-02-03 14:31:40 -06:00
|
|
|
sudo chroot $FILESYSTEM_ROOT umount /sys/fs/cgroup/* \
|
|
|
|
/sys/fs/cgroup \
|
|
|
|
/sys || true
|
2017-01-29 13:33:33 -06:00
|
|
|
}
|
|
|
|
trap_push clean_sys
|
|
|
|
sudo LANG=C chroot $FILESYSTEM_ROOT mount sysfs /sys -t sysfs
|
|
|
|
|
2019-01-04 22:47:43 -06:00
|
|
|
sudo bash -c "echo \"DOCKER_OPTS=\"--storage-driver=overlay2\"\" >> $FILESYSTEM_ROOT/etc/default/docker"
|
2021-03-14 07:15:42 -05:00
|
|
|
# Copy docker start script to be able to start docker in chroot
|
|
|
|
sudo mkdir -p "$FILESYSTEM_ROOT/$DOCKER_CTL_DIR"
|
|
|
|
sudo cp $DOCKER_SCRIPTS_DIR/docker "$FILESYSTEM_ROOT/$DOCKER_CTL_SCRIPT"
|
2021-04-18 10:17:57 -05:00
|
|
|
if [ $MULTIARCH_QEMU_ENVIRON == y ]; then
|
2021-08-10 13:11:45 -05:00
|
|
|
DOCKER_HOST="unix:///dockerfs/var/run/docker.sock"
|
2019-07-26 00:06:41 -05:00
|
|
|
SONIC_NATIVE_DOCKERD_FOR_DOCKERFS_PID="cat `pwd`/dockerfs/var/run/docker.pid"
|
|
|
|
else
|
2021-03-14 07:15:42 -05:00
|
|
|
sudo chroot $FILESYSTEM_ROOT $DOCKER_CTL_SCRIPT start
|
2019-07-26 00:06:41 -05:00
|
|
|
fi
|
2017-01-29 13:33:33 -06:00
|
|
|
|
2017-02-27 02:13:36 -06:00
|
|
|
# Update apt's snapshot of its repos
|
|
|
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get update
|
|
|
|
|
2017-01-29 13:33:33 -06:00
|
|
|
# Apply environtment configuration files
|
|
|
|
sudo cp $IMAGE_CONFIGS/environment/environment $FILESYSTEM_ROOT/etc/
|
|
|
|
sudo cp $IMAGE_CONFIGS/environment/motd $FILESYSTEM_ROOT/etc/
|
|
|
|
|
2017-02-27 02:13:36 -06:00
|
|
|
# Create all needed directories
|
|
|
|
sudo mkdir -p $FILESYSTEM_ROOT/etc/sonic/
|
2018-11-21 10:08:37 -06:00
|
|
|
sudo mkdir -p $FILESYSTEM_ROOT/etc/modprobe.d/
|
2018-07-06 04:50:42 -05:00
|
|
|
sudo mkdir -p $FILESYSTEM_ROOT/var/cache/sonic/
|
2018-02-27 14:15:56 -06:00
|
|
|
sudo mkdir -p $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/
|
2021-08-03 11:39:39 -05:00
|
|
|
sudo mkdir -p $FILESYSTEM_ROOT_USR_SHARE_SONIC_FIRMWARE/
|
2020-08-27 13:53:58 -05:00
|
|
|
# This is needed for Stretch and might not be needed for Buster where Linux create this directory by default.
|
2020-06-17 11:16:58 -05:00
|
|
|
# Keeping it generic. It should not harm anyways.
|
|
|
|
sudo mkdir -p $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
|
2017-02-27 02:13:36 -06:00
|
|
|
|
2021-08-09 21:53:49 -05:00
|
|
|
# Install a patched version of ifupdown2 (and its dependencies via 'apt-get -y install -f')
|
2019-07-20 01:09:14 -05:00
|
|
|
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/ifupdown2_*.deb || \
|
|
|
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
|
|
|
|
|
2021-07-23 11:21:15 -05:00
|
|
|
# Install a patched version of ntp (and its dependencies via 'apt-get -y install -f')
|
2020-12-02 17:02:50 -06:00
|
|
|
sudo dpkg --root=$FILESYSTEM_ROOT --force-confdef --force-confold -i $debs_path/ntp_*.deb || \
|
|
|
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y \
|
|
|
|
-o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install -f
|
|
|
|
|
2018-11-20 21:27:56 -06:00
|
|
|
# Install dependencies for SONiC config engine
|
2017-02-27 02:13:36 -06:00
|
|
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install \
|
2020-10-26 15:48:50 -05:00
|
|
|
python3-dev
|
2017-02-27 02:13:36 -06:00
|
|
|
|
2021-08-03 20:06:59 -05:00
|
|
|
# Install j2cli for handling jinja template
|
|
|
|
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install "j2cli==0.3.10"
|
|
|
|
|
2017-03-23 14:18:52 -05:00
|
|
|
# Install Python client for Redis
|
2020-12-29 15:02:11 -06:00
|
|
|
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install "redis==3.5.3"
|
2018-11-20 21:27:56 -06:00
|
|
|
|
2020-05-30 07:52:27 -05:00
|
|
|
# Install redis-dump-load Python 3 package
|
|
|
|
# Note: the scripts will be overwritten by corresponding Python 2 package
|
|
|
|
REDIS_DUMP_LOAD_PY3_WHEEL_NAME=$(basename {{redis_dump_load_py3_wheel_path}})
|
|
|
|
sudo cp {{redis_dump_load_py3_wheel_path}} $FILESYSTEM_ROOT/$REDIS_DUMP_LOAD_PY3_WHEEL_NAME
|
|
|
|
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install $REDIS_DUMP_LOAD_PY3_WHEEL_NAME
|
|
|
|
sudo rm -rf $FILESYSTEM_ROOT/$REDIS_DUMP_LOAD_PY3_WHEEL_NAME
|
|
|
|
|
2020-09-25 02:28:28 -05:00
|
|
|
# Install Python module for psutil
|
2020-11-09 02:14:56 -06:00
|
|
|
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install psutil
|
2020-09-25 02:28:28 -05:00
|
|
|
|
2021-08-09 21:53:49 -05:00
|
|
|
# Install Python module for ipaddr
|
|
|
|
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install ipaddr
|
|
|
|
|
2021-10-26 20:09:32 -05:00
|
|
|
# Install Python module for grpcio and grpcio-toole
|
2022-03-14 00:41:37 -05:00
|
|
|
if [[ $CONFIGURED_ARCH == amd64 ]]; then
|
|
|
|
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install "grpcio==1.39.0"
|
|
|
|
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install "grpcio-tools==1.39.0"
|
|
|
|
fi
|
2021-10-26 20:09:32 -05:00
|
|
|
|
2020-05-19 13:15:05 -05:00
|
|
|
# Install SwSS SDK Python 3 package
|
2020-05-30 07:52:27 -05:00
|
|
|
# Note: the scripts will be overwritten by corresponding Python 2 package
|
2020-12-29 15:02:11 -06:00
|
|
|
SWSSSDK_PY3_WHEEL_NAME=$(basename {{swsssdk_py3_wheel_path}})
|
|
|
|
sudo cp {{swsssdk_py3_wheel_path}} $FILESYSTEM_ROOT/$SWSSSDK_PY3_WHEEL_NAME
|
|
|
|
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install $SWSSSDK_PY3_WHEEL_NAME
|
|
|
|
sudo rm -rf $FILESYSTEM_ROOT/$SWSSSDK_PY3_WHEEL_NAME
|
2020-05-19 13:15:05 -05:00
|
|
|
|
2020-08-03 13:43:12 -05:00
|
|
|
# Install sonic-py-common Python 3 package
|
|
|
|
SONIC_PY_COMMON_PY3_WHEEL_NAME=$(basename {{sonic_py_common_py3_wheel_path}})
|
|
|
|
sudo cp {{sonic_py_common_py3_wheel_path}} $FILESYSTEM_ROOT/$SONIC_PY_COMMON_PY3_WHEEL_NAME
|
|
|
|
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install $SONIC_PY_COMMON_PY3_WHEEL_NAME
|
|
|
|
sudo rm -rf $FILESYSTEM_ROOT/$SONIC_PY_COMMON_PY3_WHEEL_NAME
|
|
|
|
|
2020-12-15 10:44:46 -06:00
|
|
|
# Install dependency pkgs for SONiC config engine Python 2 package
|
|
|
|
if [[ $CONFIGURED_ARCH == armhf || $CONFIGURED_ARCH == arm64 ]]; then
|
|
|
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install libxslt-dev libz-dev
|
|
|
|
fi
|
|
|
|
|
2021-06-10 14:03:33 -05:00
|
|
|
# Install sonic-yang-models Python 3 package, install dependencies
|
|
|
|
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/libyang_*.deb
|
|
|
|
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/libyang-cpp_*.deb
|
|
|
|
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/python3-yang_*.deb
|
|
|
|
SONIC_YANG_MODEL_PY3_WHEEL_NAME=$(basename {{sonic_yang_models_py3_wheel_path}})
|
|
|
|
sudo cp {{sonic_yang_models_py3_wheel_path}} $FILESYSTEM_ROOT/$SONIC_YANG_MODEL_PY3_WHEEL_NAME
|
|
|
|
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install $SONIC_YANG_MODEL_PY3_WHEEL_NAME
|
|
|
|
sudo rm -rf $FILESYSTEM_ROOT/$SONIC_YANG_MODEL_PY3_WHEEL_NAME
|
|
|
|
|
|
|
|
# Install sonic-yang-mgmt Python3 package
|
|
|
|
SONIC_YANG_MGMT_PY3_WHEEL_NAME=$(basename {{sonic_yang_mgmt_py3_wheel_path}})
|
|
|
|
sudo cp {{sonic_yang_mgmt_py3_wheel_path}} $FILESYSTEM_ROOT/$SONIC_YANG_MGMT_PY3_WHEEL_NAME
|
|
|
|
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install $SONIC_YANG_MGMT_PY3_WHEEL_NAME
|
|
|
|
sudo rm -rf $FILESYSTEM_ROOT/$SONIC_YANG_MGMT_PY3_WHEEL_NAME
|
|
|
|
|
2020-11-25 12:28:36 -06:00
|
|
|
# For sonic-config-engine Python 3 package
|
|
|
|
# Install pyangbind here, outside sonic-config-engine dependencies, as pyangbind causes enum34 to be installed.
|
|
|
|
# Then immediately uninstall enum34, as enum34 should not be installed for Python >= 3.4, as it causes a
|
|
|
|
# conflict with the new 'enum' module in the standard library
|
|
|
|
# https://github.com/robshakir/pyangbind/issues/232
|
|
|
|
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install pyangbind==0.8.1
|
|
|
|
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 uninstall -y enum34
|
|
|
|
|
|
|
|
# Install SONiC config engine Python 3 package
|
|
|
|
CONFIG_ENGINE_PY3_WHEEL_NAME=$(basename {{config_engine_py3_wheel_path}})
|
|
|
|
sudo cp {{config_engine_py3_wheel_path}} $FILESYSTEM_ROOT/$CONFIG_ENGINE_PY3_WHEEL_NAME
|
|
|
|
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install $CONFIG_ENGINE_PY3_WHEEL_NAME
|
|
|
|
sudo rm -rf $FILESYSTEM_ROOT/$CONFIG_ENGINE_PY3_WHEEL_NAME
|
|
|
|
|
[sonic-yang-models]: First version of yang models for Port, VLan, Interface, PortChannel, loopback and ACL. (#3730)
[sonic-yang-models]: First version of yang models for Port, VLan, Interface, PortChannel, loopback and ACL.
YANG models as per Guidelines.
Guideline doc: https://github.com/Azure/SONiC/blob/master/doc/mgmt/SONiC_YANG_Model_Guidelines.md
[sonic-yang-models/tests]: YANG model test code and JSON input for testing.
[sonic-yang-models/setup.py]: Build infra for yang models.
**- What I did**
Created Yang model for Sonic.
Tables: PORT, VLAN, VLAN_INTERFACE, VLAN_MEMBER, ACL_RULE, ACL_TABLE, INTERFACE.
Created build infra files using which a new package (sonic-yang-models) can be build and can be deployed on sonic switches. Yang models will be part of this new package.
**- How I did it**
Wrote yang models based on Guideline doc:
https://github.com/Azure/SONiC/blob/master/doc/mgmt/SONiC_YANG_Model_Guidelines.md
and
https://github.com/Azure/SONiC/wiki/Configuration.
Wrote python wheel Package infra which runs test for these Yang models using a json files which consists configuration as per yang models. These configs are for negative tests, which means we want to test that most must condition, pattern and when condition works as expected.
**- How to verify it**
Build Logs and testing:
———————————————————————————————————
```
/sonic/src/sonic-yang-models /sonic
running test
running egg_info
writing top-level names to sonic_yang_models.egg-info/top_level.txt
writing dependency_links to sonic_yang_models.egg-info/dependency_links.txt
writing sonic_yang_models.egg-info/PKG-INFO
reading manifest file 'sonic_yang_models.egg-info/SOURCES.txt'
writing manifest file 'sonic_yang_models.egg-info/SOURCES.txt'
running build_ext
----------------------------------------------------------------------
Ran 0 tests in 0.000s
OK
running bdist_wheel
running build
running build_py
(Reading database ... 155852 files and directories currently installed.)
Preparing to unpack .../libyang_1.0.73_amd64.deb ...
Unpacking libyang (1.0.73) over (1.0.73) ...
Setting up libyang (1.0.73) ...
Processing triggers for libc-bin (2.24-11+deb9u4) ...
Processing triggers for man-db (2.7.6.1-2) ...
(Reading database ... 155852 files and directories currently installed.)
Preparing to unpack .../libyang-cpp_1.0.73_amd64.deb ...
Unpacking libyang-cpp (1.0.73) over (1.0.73) ...
Setting up libyang-cpp (1.0.73) ...
Processing triggers for libc-bin (2.24-11+deb9u4) ...
(Reading database ... 155852 files and directories currently installed.)
Preparing to unpack .../python3-yang_1.0.73_amd64.deb ...
Unpacking python3-yang (1.0.73) over (1.0.73) ...
Setting up python3-yang (1.0.73) ...
INFO:YANG-TEST:module: sonic-vlan is loaded successfully
ERROR:YANG-TEST:Could not get module: sonic-head
INFO:YANG-TEST:module: sonic-portchannel is loaded successfully
INFO:YANG-TEST:module: sonic-acl is loaded successfully
INFO:YANG-TEST:module: sonic-loopback-interface is loaded successfully
ERROR:YANG-TEST:Could not get module: sonic-port
INFO:YANG-TEST:module: sonic-interface is loaded successfully
INFO:YANG-TEST:
------------------- Test 1: Configure a member port in VLAN_MEMBER table which does not exist.---------------------
libyang[0]: Leafref "/sonic-port:sonic-port/sonic-port:PORT/sonic-port:PORT_LIST/sonic-port:port_name" of value "Ethernet156" points to a non
-existing leaf. (path: /sonic-vlan:sonic-vlan/VLAN_MEMBER/VLAN_MEMBER_LIST[vlan_name='Vlan100'][port='Ethernet156']/port)
INFO:YANG-TEST:Configure a member port in VLAN_MEMBER table which does not exist. Passed
INFO:YANG-TEST:
------------------- Test 2: Configure non-existing ACL_TABLE in ACL_RULE.---------------------
libyang[0]: Leafref "/sonic-acl:sonic-acl/sonic-acl:ACL_TABLE/sonic-acl:ACL_TABLE_LIST/sonic-acl:ACL_TABLE_NAME" of value "NOT-EXIST" points
to a non-existing leaf. (path: /sonic-acl:sonic-acl/ACL_RULE/ACL_RULE_LIST[ACL_TABLE_NAME='NOT-EXIST'][RULE_NAME='Rule_20']/ACL_TABLE_NAME)
INFO:YANG-TEST:Configure non-existing ACL_TABLE in ACL_RULE. Passed
INFO:YANG-TEST:
------------------- Test 3: Configure IP_TYPE as ARP and ICMPV6_CODE in ACL_RULE.---------------------
libyang[0]: When condition "boolean(IP_TYPE[.='ANY' or .='IP' or .='IPV6' or .='IPv6ANY'])" not satisfied. (path: /sonic-acl:sonic-acl/ACL_RU
LE/ACL_RULE_LIST[ACL_TABLE_NAME='NO-NSW-PACL-V4'][RULE_NAME='Rule_40']/ICMPV6_CODE)
INFO:YANG-TEST:Configure IP_TYPE as ARP and ICMPV6_CODE in ACL_RULE. Passed
INFO:YANG-TEST:
INFO:YANG-TEST:
------------------- Test 4: Configure IP_TYPE as ipv4any and SRC_IPV6 in ACL_RULE.---------------------
libyang[0]: When condition "boolean(IP_TYPE[.='ANY' or .='IP' or .='IPV6' or .='IPv6ANY'])" not satisfied. (path: /sonic-acl:sonic-acl/ACL_RU
LE/ACL_RULE_LIST[ACL_TABLE_NAME='NO-NSW-PACL-V4'][RULE_NAME='Rule_20']/SRC_IPV6)
INFO:YANG-TEST:Configure IP_TYPE as ipv4any and SRC_IPV6 in ACL_RULE. Passed
------------------- Test 5: Configure l4_src_port_range as 99999-99999 in ACL_RULE---------------------
libyang[0]: Value "99999-99999" does not satisfy the constraint "([0-9]{1,4}|[0-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-2][0-9]{2}|[6][5][3][0-5]{2}|[6][5][3][6][0-5])-([0-9]{1,4}|[0-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-2][0-9]{2}|[6][5][3][0-5]{2}|[6][5][3][6][0-5])" (range, length, or pattern). (path: /sonic-acl:sonic-acl/ACL_RULE/ACL_RULE_LIST[ACL_TABLE_NAME='NO-NSW-PACL-V6'][RULE_NAME='Rule_20']/L4_SRC_PORT_RANGE)
INFO:YANG-TEST:Configure l4_src_port_range as 99999-99999 in ACL_RULE Passed
INFO:YANG-TEST:
------------------- Test 6: Configure empty string as ip-prefix in INTERFACE table.---------------------
libyang[0]: Invalid value "" in "ip-prefix" element. (path: /sonic-interface:sonic-interface/INTERFACE/INTERFACE_LIST[interface='Ethernet8'][ip-prefix='']/ip-prefix)
INFO:YANG-TEST:Configure empty string as ip-prefix in INTERFACE table. Passed
INFO:YANG-TEST:
------------------- Test 7: Configure Wrong family with ip-prefix for VLAN_Interface Table---------------------
libyang[0]: Must condition "(contains(../ip-prefix, ':') and current()='IPv6') or (contains(../ip-prefix, '.') and current()='IPv4')" not satisfied. (path: /sonic-vlan:sonic-vlan/VLAN_INTERFACE/VLAN_INTERFACE_LIST[vlanid='100'][ip-prefix='2a04:5555:66:7777::1/64']/family)
INFO:YANG-TEST:Configure Wrong family with ip-prefix for VLAN_Interface Table Passed
INFO:YANG-TEST:
------------------- Test 8: Configure IP_TYPE as ARP and DST_IPV6 in ACL_RULE.---------------------
libyang[0]: When condition "boolean(IP_TYPE[.='ANY' or .='IP' or .='IPV6' or .='IPV6ANY'])" not satisfied. (path: /sonic-acl:sonic-acl/ACL_RULE/ACL_RULE_LIST[ACL_TABLE_NAME='NO-NS
W-PACL-V6'][RULE_NAME='Rule_20']/DST_IPV6)
INFO:YANG-TEST:Configure IP_TYPE as ARP and DST_IPV6 in ACL_RULE. Passed
INFO:YANG-TEST:
------------------- Test 9: Configure INNER_ETHER_TYPE as 0x080C in ACL_RULE.---------------------
libyang[0]: Value "0x080C" does not satisfy the constraint "(0x88CC|0x8100|0x8915|0x0806|0x0800|0x86DD|0x8847)" (range, length, or pattern). (path: /sonic-acl:sonic-acl/ACL_RULE/ACL_RULE_LIST[ACL_TABLE_NAME='NO-NSW-PACL-V4'][RULE_NAME='Rule_40']/INNER_ETHER_TYPE)
INFO:YANG-TEST:Configure INNER_ETHER_TYPE as 0x080C in ACL_RULE. Passed
INFO:YANG-TEST:
------------------- Test 10: Add dhcp_server which is not in correct ip-prefix format.---------------------
libyang[0]: Invalid value "10.186.72.566" in "dhcp_servers" element. (path: /sonic-vlan:sonic-vlan/VLAN/VLAN_LIST/dhcp_servers[.='10.186.72.566'])
INFO:YANG-TEST:Add dhcp_server which is not in correct ip-prefix format. Passed
INFO:YANG-TEST:
------------------- Test 11: Configure undefined acl_table_type in ACL_TABLE table.---------------------
libyang[0]: Invalid value "LAYER3V4" in "type" element. (path: /sonic-acl:sonic-acl/ACL_TABLE/ACL_TABLE_LIST[ACL_TABLE_NAME='NO-NSW-PACL-V6']/type)
INFO:YANG-TEST:Configure undefined acl_table_type in ACL_TABLE table. Passed
INFO:YANG-TEST:
------------------- Test 12: Configure undefined packet_action in ACL_RULE table.---------------------
libyang[0]: Invalid value "SEND" in "PACKET_ACTION" element. (path: /sonic-acl:sonic-acl/ACL_RULE/ACL_RULE_LIST/PACKET_ACTION)
INFO:YANG-TEST:Configure undefined packet_action in ACL_RULE table. Passed
INFO:YANG-TEST:
------------------- Test 13: Configure wrong value for tagging_mode.---------------------
libyang[0]: Invalid value "non-tagged" in "tagging_mode" element. (path: /sonic-vlan:sonic-vlan/VLAN_MEMBER/VLAN_MEMBER_LIST/tagging_mode)
INFO:YANG-TEST:Configure wrong value for tagging_mode. Passed
INFO:YANG-TEST:
------------------- Test 14: Configure vlan-id in VLAN_MEMBER table which does not exist in VLAN table.---------------------
libyang[0]: Leafref "../../../VLAN/VLAN_LIST/vlanid" of value "200" points to a non-existing leaf. (path: /sonic-vlan:sonic-vlan/VLAN_MEMBER/VLAN_MEMBER_LIST[vlanid='200'][port='Ethernet0']/vlanid)
libyang[0]: Leafref "../../../VLAN/VLAN_LIST/vlanid" of value "200" points to a non-existing leaf. (path: /sonic-vlan:sonic-vlan/VLAN_MEMBER/VLAN_MEMBER_LIST[vlanid='200'][port='Ethernet0']/vlanid)
INFO:YANG-TEST:Configure vlan-id in VLAN_MEMBER table which does not exist in VLAN table. Passed
INFO:YANG-TEST:All Test Passed
../../target/debs/stretch/libyang0.16_0.16.105-1_amd64.deb installtion failed
../../target/debs/stretch/libyang-cpp0.16_0.16.105-1_amd64.deb installtion failed
../../target/debs/stretch/python2-yang_0.16.105-1_amd64.deb installtion failed
YANG Tests passed
Passed: pyang -f tree ./yang-models/*.yang > ./yang-models/sonic_yang_tree
copying tests/yangModelTesting.py -> build/lib/tests
copying tests/test_sonic_yang_models.py -> build/lib/tests
copying tests/__init__.py -> build/lib/tests
running egg_info
writing top-level names to sonic_yang_models.egg-info/top_level.txt
writing dependency_links to sonic_yang_models.egg-info/dependency_links.txt
writing sonic_yang_models.egg-info/PKG-INFO
reading manifest file 'sonic_yang_models.egg-info/SOURCES.txt'
writing manifest file 'sonic_yang_models.egg-info/SOURCES.txt'
installing to build/bdist.linux-x86_64/wheel
running install
running install_lib
creating build/bdist.linux-x86_64/wheel
creating build/bdist.linux-x86_64/wheel/tests
copying build/lib/tests/yangModelTesting.py -> build/bdist.linux-x86_64/wheel/tests
copying build/lib/tests/test_sonic_yang_models.py -> build/bdist.linux-x86_64/wheel/tests
copying build/lib/tests/__init__.py -> build/bdist.linux-x86_64/wheel/tests
running install_data
creating build/bdist.linux-x86_64/wheel/sonic_yang_models-1.0.data
creating build/bdist.linux-x86_64/wheel/sonic_yang_models-1.0.data/data
creating build/bdist.linux-x86_64/wheel/sonic_yang_models-1.0.data/data/yang-models
copying ./yang-models/sonic-head.yang -> build/bdist.linux-x86_64/wheel/sonic_yang_models-1.0.data/data/yang-models
copying ./yang-models/sonic-acl.yang -> build/bdist.linux-x86_64/wheel/sonic_yang_models-1.0.data/data/yang-models
copying ./yang-models/sonic-interface.yang -> build/bdist.linux-x86_64/wheel/sonic_yang_models-1.0.data/data/yang-models
copying ./yang-models/sonic-loopback-interface.yang -> build/bdist.linux-x86_64/wheel/sonic_yang_models-1.0.data/data/yang-models
copying ./yang-models/sonic-port.yang -> build/bdist.linux-x86_64/wheel/sonic_yang_models-1.0.data/data/yang-models
copying ./yang-models/sonic-portchannel.yang -> build/bdist.linux-x86_64/wheel/sonic_yang_models-1.0.data/data/yang-models
copying ./yang-models/sonic-vlan.yang -> build/bdist.linux-x86_64/wheel/sonic_yang_models-1.0.data/data/yang-models
```
2020-04-14 17:36:02 -05:00
|
|
|
|
2021-01-07 12:03:29 -06:00
|
|
|
# Install sonic-platform-common Python 3 package
|
|
|
|
PLATFORM_COMMON_PY3_WHEEL_NAME=$(basename {{platform_common_py3_wheel_path}})
|
|
|
|
sudo cp {{platform_common_py3_wheel_path}} $FILESYSTEM_ROOT/$PLATFORM_COMMON_PY3_WHEEL_NAME
|
|
|
|
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install $PLATFORM_COMMON_PY3_WHEEL_NAME
|
|
|
|
sudo rm -rf $FILESYSTEM_ROOT/$PLATFORM_COMMON_PY3_WHEEL_NAME
|
|
|
|
|
2020-11-12 12:22:38 -06:00
|
|
|
{% if pddf_support == "y" %}
|
2021-01-07 12:03:29 -06:00
|
|
|
# Install pddf-platform-api-base Python 3 package
|
|
|
|
PLATFORM_PDDF_COMMON_PY3_WHEEL_NAME=$(basename {{pddf_platform_api_base_py3_wheel_path}})
|
|
|
|
sudo cp {{pddf_platform_api_base_py3_wheel_path}} $FILESYSTEM_ROOT/$PLATFORM_PDDF_COMMON_PY3_WHEEL_NAME
|
|
|
|
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install $PLATFORM_PDDF_COMMON_PY3_WHEEL_NAME
|
|
|
|
sudo rm -rf $FILESYSTEM_ROOT/$PLATFORM_PDDF_COMMON_PY3_WHEEL_NAME
|
|
|
|
{% endif %}
|
2020-09-29 15:57:54 -05:00
|
|
|
|
2020-12-04 10:41:17 -06:00
|
|
|
{# Barefoot platform vendors' sonic_platform packages import the Python 'thrift' library #}
|
|
|
|
{% if sonic_asic_platform == "barefoot" %}
|
|
|
|
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install thrift==0.13.0
|
|
|
|
{% endif %}
|
|
|
|
|
2020-12-29 16:04:09 -06:00
|
|
|
# Install system-health Python 3 package
|
|
|
|
SYSTEM_HEALTH_PY3_WHEEL_NAME=$(basename {{system_health_py3_wheel_path}})
|
|
|
|
sudo cp {{system_health_py3_wheel_path}} $FILESYSTEM_ROOT/$SYSTEM_HEALTH_PY3_WHEEL_NAME
|
|
|
|
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install $SYSTEM_HEALTH_PY3_WHEEL_NAME
|
|
|
|
sudo rm -rf $FILESYSTEM_ROOT/$SYSTEM_HEALTH_PY3_WHEEL_NAME
|
|
|
|
|
2020-10-14 12:16:35 -05:00
|
|
|
# Install prerequisites needed for installing the Python m2crypto package, used by sonic-utilities
|
|
|
|
# These packages can be uninstalled after intallation
|
|
|
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install build-essential libssl-dev swig
|
2020-09-20 22:16:42 -05:00
|
|
|
|
2020-10-14 12:16:35 -05:00
|
|
|
# Install prerequisites needed for using the Python m2crypto package, used by sonic-utilities
|
|
|
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install openssl
|
2018-06-29 11:59:46 -05:00
|
|
|
|
2020-11-25 12:28:36 -06:00
|
|
|
# Install SONiC Utilities Python package
|
|
|
|
SONIC_UTILITIES_PY3_WHEEL_NAME=$(basename {{sonic_utilities_py3_wheel_path}})
|
|
|
|
sudo cp {{sonic_utilities_py3_wheel_path}} $FILESYSTEM_ROOT/$SONIC_UTILITIES_PY3_WHEEL_NAME
|
|
|
|
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install $SONIC_UTILITIES_PY3_WHEEL_NAME
|
|
|
|
sudo rm -rf $FILESYSTEM_ROOT/$SONIC_UTILITIES_PY3_WHEEL_NAME
|
2020-06-28 13:03:48 -05:00
|
|
|
|
2020-09-20 22:16:42 -05:00
|
|
|
# Install sonic-utilities data files (and any dependencies via 'apt-get -y install -f')
|
|
|
|
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/sonic-utilities-data_*.deb || \
|
2017-10-06 14:46:47 -05:00
|
|
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
|
2017-02-27 02:13:36 -06:00
|
|
|
|
2021-10-11 02:20:51 -05:00
|
|
|
# Install customized bash version to patch bash plugin support.
|
2021-11-12 19:57:30 -06:00
|
|
|
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/bash_*.deb || \
|
2021-10-11 02:20:51 -05:00
|
|
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
|
|
|
|
|
2020-09-20 22:16:42 -05:00
|
|
|
# sonic-utilities-data installs bash-completion as a dependency. However, it is disabled by default
|
|
|
|
# in bash.bashrc, so we copy a version of the file with it enabled here.
|
|
|
|
sudo cp -f $IMAGE_CONFIGS/bash/bash.bashrc $FILESYSTEM_ROOT/etc/
|
|
|
|
|
2022-10-06 09:55:09 -05:00
|
|
|
# Install readline's initialization file
|
|
|
|
sudo cp -f $IMAGE_CONFIGS/readline/inputrc $FILESYSTEM_ROOT/etc/
|
|
|
|
|
2021-02-08 21:35:08 -06:00
|
|
|
# Install prerequisites needed for installing the dependent Python packages of sonic-host-services
|
|
|
|
# These packages can be uninstalled after installation
|
2021-07-15 17:15:45 -05:00
|
|
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install libcairo2-dev libdbus-1-dev libgirepository1.0-dev libsystemd-dev pkg-config
|
2021-02-08 21:35:08 -06:00
|
|
|
|
2021-07-15 17:15:45 -05:00
|
|
|
# Mark runtime dependencies as manually installed to avoid them being auto-removed while uninstalling build dependencies
|
2022-04-26 18:14:51 -05:00
|
|
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-mark manual gir1.2-glib-2.0 libdbus-1-3 libgirepository-1.0-1 libsystemd0 python3-dbus
|
|
|
|
|
|
|
|
# Install systemd-python for SONiC host services
|
|
|
|
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install systemd-python
|
2021-02-08 21:35:08 -06:00
|
|
|
|
2020-10-23 11:52:29 -05:00
|
|
|
# Install SONiC host services package
|
|
|
|
SONIC_HOST_SERVICES_PY3_WHEEL_NAME=$(basename {{sonic_host_services_py3_wheel_path}})
|
|
|
|
sudo cp {{sonic_host_services_py3_wheel_path}} $FILESYSTEM_ROOT/$SONIC_HOST_SERVICES_PY3_WHEEL_NAME
|
|
|
|
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install $SONIC_HOST_SERVICES_PY3_WHEEL_NAME
|
|
|
|
sudo rm -rf $FILESYSTEM_ROOT/$SONIC_HOST_SERVICES_PY3_WHEEL_NAME
|
|
|
|
|
|
|
|
# Install SONiC host services data files (and any dependencies via 'apt-get -y install -f')
|
|
|
|
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/sonic-host-services-data_*.deb || \
|
|
|
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
|
|
|
|
|
2019-12-04 06:50:56 -06:00
|
|
|
{% if enable_ztp == "y" %}
|
|
|
|
# Install ZTP (and its dependencies via 'apt-get -y install -f')
|
|
|
|
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/sonic-ztp_*.deb || \
|
|
|
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
|
|
|
|
{% endif %}
|
|
|
|
|
2021-06-22 13:12:22 -05:00
|
|
|
{% for machine_debs in lazy_build_installer_debs.strip().split() -%}
|
|
|
|
{% set machine, pkgname = machine_debs.split('|') %}
|
|
|
|
if [[ -z "{{machine}}" || -n "{{machine}}" && $TARGET_MACHINE == "{{machine}}" ]]; then
|
|
|
|
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/{{pkgname}} || \
|
|
|
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
|
|
|
|
fi
|
|
|
|
{% endfor %}
|
|
|
|
|
2017-02-27 02:13:36 -06:00
|
|
|
# Install SONiC Device Data (and its dependencies via 'apt-get -y install -f')
|
2019-02-05 00:06:37 -06:00
|
|
|
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/sonic-device-data_*.deb || \
|
2017-02-27 02:13:36 -06:00
|
|
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
|
|
|
|
|
2022-06-29 07:34:56 -05:00
|
|
|
# package for supporting password hardening
|
|
|
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install libpam-cracklib
|
|
|
|
|
2017-12-07 05:36:17 -06:00
|
|
|
# Install pam-tacplus and nss-tacplus
|
2019-02-05 00:06:37 -06:00
|
|
|
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/libtac2_*.deb || \
|
2017-12-11 13:05:03 -06:00
|
|
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
|
2019-02-05 00:06:37 -06:00
|
|
|
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/libpam-tacplus_*.deb || \
|
2017-12-11 13:05:03 -06:00
|
|
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
|
2019-02-05 00:06:37 -06:00
|
|
|
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/libnss-tacplus_*.deb || \
|
2017-12-11 13:05:03 -06:00
|
|
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
|
2021-11-12 19:57:30 -06:00
|
|
|
# Install bash-tacplus
|
|
|
|
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/bash-tacplus_*.deb || \
|
|
|
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
|
2021-11-30 21:50:09 -06:00
|
|
|
# Install audisp-tacplus
|
|
|
|
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/audisp-tacplus_*.deb || \
|
|
|
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
|
2017-12-07 05:36:17 -06:00
|
|
|
# Disable tacplus by default
|
|
|
|
sudo LANG=C chroot $FILESYSTEM_ROOT pam-auth-update --remove tacplus
|
|
|
|
sudo sed -i -e '/^passwd/s/ tacplus//' $FILESYSTEM_ROOT/etc/nsswitch.conf
|
|
|
|
|
2021-04-23 21:09:41 -05:00
|
|
|
# Install pam-radius-auth and nss-radius
|
|
|
|
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/libpam-radius-auth_*.deb || \
|
|
|
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
|
|
|
|
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/libnss-radius_*.deb || \
|
|
|
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
|
|
|
|
# Disable radius by default
|
|
|
|
# radius does not have any profiles
|
|
|
|
#sudo LANG=C chroot $FILESYSTEM_ROOT pam-auth-update --remove radius tacplus
|
|
|
|
sudo sed -i -e '/^passwd/s/ radius//' $FILESYSTEM_ROOT/etc/nsswitch.conf
|
|
|
|
|
2019-11-09 01:08:42 -06:00
|
|
|
# Install a custom version of kdump-tools (and its dependencies via 'apt-get -y install -f')
|
2020-01-29 00:12:52 -06:00
|
|
|
if [[ $CONFIGURED_ARCH == amd64 ]]; then
|
2019-11-09 01:08:42 -06:00
|
|
|
sudo DEBIAN_FRONTEND=noninteractive dpkg --root=$FILESYSTEM_ROOT -i $debs_path/kdump-tools_*.deb || \
|
2021-07-15 17:15:45 -05:00
|
|
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true chroot $FILESYSTEM_ROOT apt-get -q --no-install-suggests --no-install-recommends install
|
2020-12-10 03:32:37 -06:00
|
|
|
cat $IMAGE_CONFIGS/kdump/kdump-tools | sudo tee -a $FILESYSTEM_ROOT/etc/default/kdump-tools > /dev/null
|
2021-07-26 17:42:05 -05:00
|
|
|
|
|
|
|
for kernel_release in $(ls $FILESYSTEM_ROOT/lib/modules/); do
|
|
|
|
sudo LANG=C chroot $FILESYSTEM_ROOT /etc/kernel/postinst.d/kdump-tools $kernel_release > /dev/null 2>&1
|
|
|
|
sudo LANG=C chroot $FILESYSTEM_ROOT kdump-config symlinks $kernel_release
|
|
|
|
done
|
2020-01-29 00:12:52 -06:00
|
|
|
fi
|
2019-11-09 01:08:42 -06:00
|
|
|
|
2020-08-20 17:11:42 -05:00
|
|
|
# Install python-swss-common package and all its dependent packages
|
|
|
|
{% if python_swss_debs.strip() -%}
|
|
|
|
{% for deb in python_swss_debs.strip().split(' ') -%}
|
|
|
|
sudo dpkg --root=$FILESYSTEM_ROOT -i {{deb}} || sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
|
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
|
|
|
|
2022-08-17 02:35:00 -05:00
|
|
|
# Install sonic-db-cli
|
|
|
|
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/sonic-db-cli_*.deb || \
|
|
|
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
|
|
|
|
|
2019-12-30 20:25:57 -06:00
|
|
|
# Install custom-built monit package and SONiC configuration files
|
|
|
|
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/monit_*.deb || \
|
|
|
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
|
|
|
|
sudo cp $IMAGE_CONFIGS/monit/monitrc $FILESYSTEM_ROOT/etc/monit/
|
|
|
|
sudo chmod 600 $FILESYSTEM_ROOT/etc/monit/monitrc
|
|
|
|
sudo cp $IMAGE_CONFIGS/monit/conf.d/* $FILESYSTEM_ROOT/etc/monit/conf.d/
|
|
|
|
sudo chmod 600 $FILESYSTEM_ROOT/etc/monit/conf.d/*
|
2021-01-07 21:52:22 -06:00
|
|
|
sudo cp $IMAGE_CONFIGS/monit/container_checker $FILESYSTEM_ROOT/usr/bin/
|
|
|
|
sudo chmod 755 $FILESYSTEM_ROOT/usr/bin/container_checker
|
2021-05-28 13:13:44 -05:00
|
|
|
sudo cp $IMAGE_CONFIGS/monit/memory_checker $FILESYSTEM_ROOT/usr/bin/
|
|
|
|
sudo chmod 755 $FILESYSTEM_ROOT/usr/bin/memory_checker
|
|
|
|
sudo cp $IMAGE_CONFIGS/monit/restart_service $FILESYSTEM_ROOT/usr/bin/
|
|
|
|
sudo chmod 755 $FILESYSTEM_ROOT/usr/bin/restart_service
|
2021-01-07 21:52:22 -06:00
|
|
|
|
2022-10-17 15:26:31 -05:00
|
|
|
# Installed smartmontools version should match installed smartmontools in docker-platform-monitor Dockerfile
|
2022-03-07 11:39:33 -06:00
|
|
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install smartmontools=7.2-1
|
2019-12-30 20:25:57 -06:00
|
|
|
|
2020-11-01 20:31:15 -06:00
|
|
|
# Install custom-built openssh sshd
|
2022-05-05 18:21:30 -05:00
|
|
|
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/openssh-server_${OPENSSH_VERSION}_*.deb
|
2022-04-25 12:38:52 -05:00
|
|
|
|
2021-06-22 17:29:21 -05:00
|
|
|
{% if sonic_asic_platform == 'broadcom' %}
|
|
|
|
# Install custom-built flashrom
|
|
|
|
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/flashrom_*.deb
|
|
|
|
{% endif %}
|
|
|
|
|
2017-04-21 10:22:44 -05:00
|
|
|
# Copy crontabs
|
|
|
|
sudo cp -f $IMAGE_CONFIGS/cron.d/* $FILESYSTEM_ROOT/etc/cron.d/
|
|
|
|
|
2017-01-29 13:33:33 -06:00
|
|
|
# Copy NTP configuration files and templates
|
2020-05-30 15:46:44 -05:00
|
|
|
sudo cp $IMAGE_CONFIGS/ntp/ntp-config.service $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
|
2019-07-29 17:52:15 -05:00
|
|
|
echo "ntp-config.service" | sudo tee -a $GENERATED_SERVICE_FILE
|
2017-01-29 13:33:33 -06:00
|
|
|
sudo cp $IMAGE_CONFIGS/ntp/ntp-config.sh $FILESYSTEM_ROOT/usr/bin/
|
2018-02-27 14:15:56 -06:00
|
|
|
sudo cp $IMAGE_CONFIGS/ntp/ntp.conf.j2 $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/
|
2020-12-11 01:20:41 -06:00
|
|
|
sudo cp $IMAGE_CONFIGS/ntp/ntp-systemd-wrapper $FILESYSTEM_ROOT/usr/lib/ntp/
|
2020-12-21 07:34:13 -06:00
|
|
|
sudo cp $IMAGE_CONFIGS/ntp/ntp.service $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
|
|
|
|
echo "ntp.service" | sudo tee -a $GENERATED_SERVICE_FILE
|
2017-01-29 13:33:33 -06:00
|
|
|
|
2019-04-12 17:45:58 -05:00
|
|
|
# Copy warmboot-finalizer files
|
|
|
|
sudo LANG=C cp $IMAGE_CONFIGS/warmboot-finalizer/finalize-warmboot.sh $FILESYSTEM_ROOT/usr/local/bin/finalize-warmboot.sh
|
2020-05-30 15:46:44 -05:00
|
|
|
sudo LANG=C cp $IMAGE_CONFIGS/warmboot-finalizer/warmboot-finalizer.service $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
|
2019-07-29 17:52:15 -05:00
|
|
|
echo "warmboot-finalizer.service" | sudo tee -a $GENERATED_SERVICE_FILE
|
2019-04-12 17:45:58 -05:00
|
|
|
|
2020-07-09 18:14:06 -05:00
|
|
|
# Copy watchdog-control files
|
|
|
|
sudo LANG=C cp $IMAGE_CONFIGS/watchdog-control/watchdog-control.sh $FILESYSTEM_ROOT/usr/local/bin/watchdog-control.sh
|
|
|
|
sudo LANG=C cp $IMAGE_CONFIGS/watchdog-control/watchdog-control.service $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
|
|
|
|
echo "watchdog-control.service" | sudo tee -a $GENERATED_SERVICE_FILE
|
|
|
|
|
2017-01-29 13:33:33 -06:00
|
|
|
# Copy rsyslog configuration files and templates
|
2020-05-30 15:46:44 -05:00
|
|
|
sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog-config.service $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
|
2017-01-29 13:33:33 -06:00
|
|
|
sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog-config.sh $FILESYSTEM_ROOT/usr/bin/
|
2018-02-27 14:15:56 -06:00
|
|
|
sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog.conf.j2 $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/
|
2020-06-30 08:29:20 -05:00
|
|
|
sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog-container.conf.j2 $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/
|
2017-01-29 13:33:33 -06:00
|
|
|
sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog.d/* $FILESYSTEM_ROOT/etc/rsyslog.d/
|
2019-07-29 17:52:15 -05:00
|
|
|
echo "rsyslog-config.service" | sudo tee -a $GENERATED_SERVICE_FILE
|
2017-01-29 13:33:33 -06:00
|
|
|
|
2020-05-20 13:18:11 -05:00
|
|
|
# Copy syslog override files
|
|
|
|
sudo mkdir -p $FILESYSTEM_ROOT/etc/systemd/system/syslog.socket.d
|
|
|
|
sudo cp $IMAGE_CONFIGS/syslog/override.conf $FILESYSTEM_ROOT/etc/systemd/system/syslog.socket.d/override.conf
|
|
|
|
sudo cp $IMAGE_CONFIGS/syslog/host_umount.sh $FILESYSTEM_ROOT/usr/bin/
|
|
|
|
|
2020-10-12 03:12:49 -05:00
|
|
|
# Copy system-health files
|
|
|
|
sudo LANG=C cp $IMAGE_CONFIGS/system-health/system-health.service $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
|
|
|
|
echo "system-health.service" | sudo tee -a $GENERATED_SERVICE_FILE
|
|
|
|
|
2017-04-21 10:22:44 -05:00
|
|
|
# Copy logrotate.d configuration files
|
2017-08-10 18:24:57 -05:00
|
|
|
sudo cp -f $IMAGE_CONFIGS/logrotate/logrotate.d/* $FILESYSTEM_ROOT/etc/logrotate.d/
|
2022-01-14 12:24:07 -06:00
|
|
|
sudo cp $IMAGE_CONFIGS/logrotate/rsyslog.j2 $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/
|
|
|
|
sudo cp $IMAGE_CONFIGS/logrotate/logrotate-config.service $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
|
|
|
|
sudo cp $IMAGE_CONFIGS/logrotate/logrotate-config.sh $FILESYSTEM_ROOT/usr/bin/
|
2022-12-08 16:13:11 -06:00
|
|
|
sudo mkdir -p $FILESYSTEM_ROOT/etc/systemd/system/logrotate.timer.d
|
|
|
|
sudo cp $IMAGE_CONFIGS/logrotate/timerOverride.conf $FILESYSTEM_ROOT/etc/systemd/system/logrotate.timer.d/
|
2022-01-14 12:24:07 -06:00
|
|
|
echo "logrotate-config.service" | sudo tee -a $GENERATED_SERVICE_FILE
|
2017-04-21 10:22:44 -05:00
|
|
|
|
|
|
|
# Copy systemd-journald configuration files
|
|
|
|
sudo cp -f $IMAGE_CONFIGS/systemd/journald.conf $FILESYSTEM_ROOT/etc/systemd/
|
|
|
|
|
2017-01-29 13:33:33 -06:00
|
|
|
# Copy interfaces configuration files and templates
|
2020-05-30 15:46:44 -05:00
|
|
|
sudo cp $IMAGE_CONFIGS/interfaces/interfaces-config.service $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
|
2017-01-29 13:33:33 -06:00
|
|
|
sudo cp $IMAGE_CONFIGS/interfaces/interfaces-config.sh $FILESYSTEM_ROOT/usr/bin/
|
2018-02-27 14:15:56 -06:00
|
|
|
sudo cp $IMAGE_CONFIGS/interfaces/*.j2 $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/
|
2019-07-29 17:52:15 -05:00
|
|
|
echo "interfaces-config.service" | sudo tee -a $GENERATED_SERVICE_FILE
|
2017-01-29 13:33:33 -06:00
|
|
|
|
2020-11-23 11:31:42 -06:00
|
|
|
# Copy CoPP configuration files and templates
|
|
|
|
sudo cp $IMAGE_CONFIGS/copp/copp-config.service $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
|
|
|
|
sudo cp $IMAGE_CONFIGS/copp/copp-config.sh $FILESYSTEM_ROOT/usr/bin/
|
|
|
|
sudo cp $IMAGE_CONFIGS/copp/copp_cfg.j2 $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/
|
|
|
|
echo "copp-config.service" | sudo tee -a $GENERATED_SERVICE_FILE
|
|
|
|
|
2019-12-10 10:16:56 -06:00
|
|
|
# Copy dhcp client configuration template and create an initial configuration
|
|
|
|
sudo cp files/dhcp/dhclient.conf.j2 $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/
|
|
|
|
j2 files/dhcp/dhclient.conf.j2 | sudo tee $FILESYSTEM_ROOT/etc/dhcp/dhclient.conf
|
|
|
|
sudo cp files/dhcp/ifupdown2_policy.json $FILESYSTEM_ROOT/etc/network/ifupdown2/policy.d
|
|
|
|
sudo cp files/dhcp/90-dhcp6-systcl.conf.j2 $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/
|
|
|
|
|
2017-02-17 15:47:01 -06:00
|
|
|
# Copy initial interfaces configuration file, will be overwritten on first boot
|
2018-11-27 16:35:17 -06:00
|
|
|
sudo cp $IMAGE_CONFIGS/interfaces/init_interfaces $FILESYSTEM_ROOT/etc/network/interfaces
|
2019-03-09 08:22:32 -06:00
|
|
|
sudo mkdir -p $FILESYSTEM_ROOT/etc/network/interfaces.d
|
2017-02-17 15:47:01 -06:00
|
|
|
|
2021-04-21 19:50:00 -05:00
|
|
|
# System'd network udev rules
|
|
|
|
sudo cp $IMAGE_CONFIGS/systemd/network/* $FILESYSTEM_ROOT_ETC/systemd/network/
|
|
|
|
|
2019-12-15 18:48:48 -06:00
|
|
|
# copy core file uploader files
|
2020-05-30 15:46:44 -05:00
|
|
|
sudo cp $IMAGE_CONFIGS/corefile_uploader/core_uploader.service $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
|
2019-12-15 18:48:48 -06:00
|
|
|
sudo LANG=C chroot $FILESYSTEM_ROOT systemctl disable core_uploader.service
|
|
|
|
sudo cp $IMAGE_CONFIGS/corefile_uploader/core_uploader.py $FILESYSTEM_ROOT/usr/bin/
|
|
|
|
sudo cp $IMAGE_CONFIGS/corefile_uploader/core_analyzer.rc.json $FILESYSTEM_ROOT_ETC_SONIC/
|
|
|
|
sudo chmod og-rw $FILESYSTEM_ROOT_ETC_SONIC/core_analyzer.rc.json
|
2020-05-23 21:37:24 -05:00
|
|
|
|
2023-04-17 23:33:15 -05:00
|
|
|
# Rasdaemon service configuration. Use timer to start rasdaemon with a delay for better fast/warm boot performance
|
|
|
|
sudo cp $IMAGE_CONFIGS/rasdaemon/rasdaemon.timer $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
|
|
|
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT systemctl disable rasdaemon.service
|
|
|
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT systemctl enable rasdaemon.timer
|
|
|
|
|
2020-05-23 21:37:24 -05:00
|
|
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install libffi-dev libssl-dev
|
2021-02-14 12:36:04 -06:00
|
|
|
|
|
|
|
if [[ $CONFIGURED_ARCH == armhf ]]; then
|
|
|
|
# The azure-storage package depends on the cryptography package. Newer
|
|
|
|
# versions of cryptography require the rust compiler, the correct version
|
|
|
|
# for which is not readily available in buster. Hence we pre-install an
|
|
|
|
# older version here to satisfy the azure-storage dependency.
|
|
|
|
# Note: This is not a problem for other architectures as pre-built versions
|
|
|
|
# of cryptography are available for those. This sequence can be removed
|
|
|
|
# after upgrading to debian bullseye.
|
|
|
|
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install cryptography==3.3.1
|
|
|
|
fi
|
2020-11-05 13:19:26 -06:00
|
|
|
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install azure-storage==0.36.0
|
|
|
|
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install watchdog==0.10.3
|
2019-12-15 18:48:48 -06:00
|
|
|
|
2020-08-05 15:23:12 -05:00
|
|
|
{% if include_kubernetes == "y" %}
|
2021-07-15 21:48:55 -05:00
|
|
|
# Point to kubelet to /etc/resolv.conf
|
|
|
|
#
|
2022-12-01 23:13:26 -06:00
|
|
|
echo 'KUBELET_EXTRA_ARGS="--resolv-conf=/etc/resolv.conf --cgroup-driver=cgroupfs --node-ip=::"' | sudo tee -a $FILESYSTEM_ROOT/etc/default/kubelet
|
2021-07-15 21:48:55 -05:00
|
|
|
|
2021-03-09 21:49:54 -06:00
|
|
|
# Copy Flannel conf file into sonic-templates
|
|
|
|
#
|
|
|
|
sudo cp $BUILD_TEMPLATES/kube_cni.10-flannel.conflist $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/
|
|
|
|
|
First cut image update for kubernetes support. (#5421)
* First cut image update for kubernetes support.
With this,
1) dockers dhcp_relay, lldp, pmon, radv, snmp, telemetry are enabled
for kube management
init_cfg.json configure set_owner as kube for these
2) Each docker's start.sh updated to call container_startup.py to register going up
As part of this call, it registers the current owner as local/kube and its version
The images are built with its version ingrained into image during build
3) Update all docker's bash script to call 'container start/stop/wait' instead of 'docker start/stop/wait'.
For all locally managed containers, it calls docker commands, hence no change for locally managed.
4) Introduced a new ctrmgrd service, that helps with transition between owners as kube & local and carry over any labels update from STATE-DB to API server
5) hostcfgd updated to handle owner change
6) Reboot scripts are updatd to tag kube running images as local, so upon reboot they run the same image.
7) Added kube_commands.py to handle all updates with Kubernetes API serrver -- dedicated for k8s interaction only.
2020-12-22 10:01:33 -06:00
|
|
|
# Install remote Container mgmt package
|
2021-02-14 12:36:04 -06:00
|
|
|
# Required even if include_kubernetes != y, as it contains the
|
First cut image update for kubernetes support. (#5421)
* First cut image update for kubernetes support.
With this,
1) dockers dhcp_relay, lldp, pmon, radv, snmp, telemetry are enabled
for kube management
init_cfg.json configure set_owner as kube for these
2) Each docker's start.sh updated to call container_startup.py to register going up
As part of this call, it registers the current owner as local/kube and its version
The images are built with its version ingrained into image during build
3) Update all docker's bash script to call 'container start/stop/wait' instead of 'docker start/stop/wait'.
For all locally managed containers, it calls docker commands, hence no change for locally managed.
4) Introduced a new ctrmgrd service, that helps with transition between owners as kube & local and carry over any labels update from STATE-DB to API server
5) hostcfgd updated to handle owner change
6) Reboot scripts are updatd to tag kube running images as local, so upon reboot they run the same image.
7) Added kube_commands.py to handle all updates with Kubernetes API serrver -- dedicated for k8s interaction only.
2020-12-22 10:01:33 -06:00
|
|
|
# the container wrapper for docker start/stop/wait commands.
|
|
|
|
#
|
|
|
|
SONIC_CTRMGMT_WHEEL_NAME=$(basename {{sonic_ctrmgmt_py3_wheel_path}})
|
|
|
|
sudo cp {{sonic_ctrmgmt_py3_wheel_path}} $FILESYSTEM_ROOT/$SONIC_CTRMGMT_WHEEL_NAME
|
|
|
|
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install $SONIC_CTRMGMT_WHEEL_NAME
|
|
|
|
sudo rm -rf $FILESYSTEM_ROOT/$SONIC_CTRMGMT_WHEEL_NAME
|
|
|
|
|
|
|
|
# Config file used by container mgmt scripts/service
|
2021-07-15 21:48:55 -05:00
|
|
|
fl="${files_path}/remote_ctr.config.json"
|
|
|
|
use_k8s_as_http_proxy=$(python3 -c 'import json
|
|
|
|
with open("'${fl}'", "r") as s:
|
|
|
|
d=json.load(s);print(d.get("use_k8s_as_http_proxy", ""))
|
|
|
|
')
|
|
|
|
if [ "${use_k8s_as_http_proxy}" == "y" ]; then
|
|
|
|
# create proxy files for docker using private IP which will
|
|
|
|
# be later directed to k8s master upon config
|
2021-07-19 23:17:47 -05:00
|
|
|
PROXY_INFO="${kube_docker_proxy}"
|
2021-07-15 21:48:55 -05:00
|
|
|
cat <<EOT | sudo tee $FILESYSTEM_ROOT/etc/systemd/system/docker.service.d/http_proxy.conf > /dev/null
|
|
|
|
[Service]
|
|
|
|
Environment="HTTP_PROXY=${PROXY_INFO}"
|
|
|
|
EOT
|
|
|
|
cat <<EOT | sudo tee $FILESYSTEM_ROOT/etc/systemd/system/docker.service.d/https_proxy.conf > /dev/null
|
|
|
|
[Service]
|
|
|
|
Environment="HTTPS_PROXY=${PROXY_INFO}"
|
|
|
|
EOT
|
|
|
|
fi
|
|
|
|
|
First cut image update for kubernetes support. (#5421)
* First cut image update for kubernetes support.
With this,
1) dockers dhcp_relay, lldp, pmon, radv, snmp, telemetry are enabled
for kube management
init_cfg.json configure set_owner as kube for these
2) Each docker's start.sh updated to call container_startup.py to register going up
As part of this call, it registers the current owner as local/kube and its version
The images are built with its version ingrained into image during build
3) Update all docker's bash script to call 'container start/stop/wait' instead of 'docker start/stop/wait'.
For all locally managed containers, it calls docker commands, hence no change for locally managed.
4) Introduced a new ctrmgrd service, that helps with transition between owners as kube & local and carry over any labels update from STATE-DB to API server
5) hostcfgd updated to handle owner change
6) Reboot scripts are updatd to tag kube running images as local, so upon reboot they run the same image.
7) Added kube_commands.py to handle all updates with Kubernetes API serrver -- dedicated for k8s interaction only.
2020-12-22 10:01:33 -06:00
|
|
|
sudo cp ${files_path}/remote_ctr.config.json ${FILESYSTEM_ROOT_ETC_SONIC}/
|
|
|
|
|
|
|
|
# Remote container management service files
|
|
|
|
sudo cp ${files_path}/ctrmgrd.service ${FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM}/
|
|
|
|
sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable ctrmgrd.service
|
|
|
|
|
|
|
|
# kubelet service is controlled by ctrmgrd daemon.
|
2020-04-13 10:41:18 -05:00
|
|
|
sudo LANG=C chroot $FILESYSTEM_ROOT systemctl disable kubelet.service
|
First cut image update for kubernetes support. (#5421)
* First cut image update for kubernetes support.
With this,
1) dockers dhcp_relay, lldp, pmon, radv, snmp, telemetry are enabled
for kube management
init_cfg.json configure set_owner as kube for these
2) Each docker's start.sh updated to call container_startup.py to register going up
As part of this call, it registers the current owner as local/kube and its version
The images are built with its version ingrained into image during build
3) Update all docker's bash script to call 'container start/stop/wait' instead of 'docker start/stop/wait'.
For all locally managed containers, it calls docker commands, hence no change for locally managed.
4) Introduced a new ctrmgrd service, that helps with transition between owners as kube & local and carry over any labels update from STATE-DB to API server
5) hostcfgd updated to handle owner change
6) Reboot scripts are updatd to tag kube running images as local, so upon reboot they run the same image.
7) Added kube_commands.py to handle all updates with Kubernetes API serrver -- dedicated for k8s interaction only.
2020-12-22 10:01:33 -06:00
|
|
|
{% else %}
|
2021-02-14 12:36:04 -06:00
|
|
|
# container script for docker commands, which is required as
|
First cut image update for kubernetes support. (#5421)
* First cut image update for kubernetes support.
With this,
1) dockers dhcp_relay, lldp, pmon, radv, snmp, telemetry are enabled
for kube management
init_cfg.json configure set_owner as kube for these
2) Each docker's start.sh updated to call container_startup.py to register going up
As part of this call, it registers the current owner as local/kube and its version
The images are built with its version ingrained into image during build
3) Update all docker's bash script to call 'container start/stop/wait' instead of 'docker start/stop/wait'.
For all locally managed containers, it calls docker commands, hence no change for locally managed.
4) Introduced a new ctrmgrd service, that helps with transition between owners as kube & local and carry over any labels update from STATE-DB to API server
5) hostcfgd updated to handle owner change
6) Reboot scripts are updatd to tag kube running images as local, so upon reboot they run the same image.
7) Added kube_commands.py to handle all updates with Kubernetes API serrver -- dedicated for k8s interaction only.
2020-12-22 10:01:33 -06:00
|
|
|
# all docker commands are replaced with container commands.
|
|
|
|
# So just copy that file only.
|
|
|
|
#
|
|
|
|
sudo cp ${files_path}/container $FILESYSTEM_ROOT/usr/local/bin/
|
2020-04-13 10:41:18 -05:00
|
|
|
{% endif %}
|
|
|
|
|
2018-02-27 14:15:56 -06:00
|
|
|
# Copy the buffer configuration template
|
|
|
|
sudo cp $BUILD_TEMPLATES/buffers_config.j2 $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/
|
2017-12-12 05:45:44 -06:00
|
|
|
|
2018-10-17 16:10:34 -05:00
|
|
|
# Copy the qos configuration template
|
|
|
|
sudo cp $BUILD_TEMPLATES/qos_config.j2 $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/
|
|
|
|
|
2020-12-13 13:35:39 -06:00
|
|
|
# Copy the templates for dynamically buffer calculation
|
|
|
|
{% if sonic_asic_platform == "mellanox" or sonic_asic_platform == "vs" %}
|
|
|
|
if [ -f platform/{{ sonic_asic_platform }}/asic_table.j2 ]
|
|
|
|
then
|
|
|
|
sudo cp platform/{{ sonic_asic_platform }}/asic_table.j2 $FILESYSTEM_ROOT/usr/share/sonic/templates/asic_table.j2
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f platform/{{ sonic_asic_platform }}/peripheral_table.j2 ]
|
|
|
|
then
|
|
|
|
sudo cp platform/{{ sonic_asic_platform }}/peripheral_table.j2 $FILESYSTEM_ROOT/usr/share/sonic/templates/peripheral_table.j2
|
|
|
|
fi
|
2021-11-24 07:00:23 -06:00
|
|
|
|
|
|
|
if [ -f platform/{{ sonic_asic_platform }}/zero_profiles.j2 ]
|
|
|
|
then
|
|
|
|
sudo cp platform/{{ sonic_asic_platform }}/zero_profiles.j2 $FILESYSTEM_ROOT/usr/share/sonic/templates/zero_profiles.j2
|
|
|
|
fi
|
2020-12-13 13:35:39 -06:00
|
|
|
{% endif %}
|
|
|
|
|
2022-07-06 12:24:16 -05:00
|
|
|
# Copy backend acl template
|
|
|
|
sudo cp $BUILD_TEMPLATES/backend_acl.j2 $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/
|
|
|
|
|
2017-11-22 16:36:25 -06:00
|
|
|
# Copy hostname configuration scripts
|
2020-05-30 15:46:44 -05:00
|
|
|
sudo cp $IMAGE_CONFIGS/hostname/hostname-config.service $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
|
2019-07-29 17:52:15 -05:00
|
|
|
echo "hostname-config.service" | sudo tee -a $GENERATED_SERVICE_FILE
|
2017-11-22 16:36:25 -06:00
|
|
|
sudo cp $IMAGE_CONFIGS/hostname/hostname-config.sh $FILESYSTEM_ROOT/usr/bin/
|
|
|
|
|
2019-11-09 12:26:39 -06:00
|
|
|
# Copy miscellaneous scripts
|
|
|
|
sudo cp $IMAGE_CONFIGS/misc/docker-wait-any $FILESYSTEM_ROOT/usr/bin/
|
|
|
|
|
2020-01-26 15:56:42 -06:00
|
|
|
# Copy internal topology configuration scripts
|
|
|
|
{%- if sonic_asic_platform == "vs" %}
|
2020-05-30 15:46:44 -05:00
|
|
|
sudo cp $IMAGE_CONFIGS/topology/topology.service $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
|
2020-01-26 15:56:42 -06:00
|
|
|
echo "topology.service" | sudo tee -a $GENERATED_SERVICE_FILE
|
|
|
|
sudo cp $IMAGE_CONFIGS/topology/topology.sh $FILESYSTEM_ROOT/usr/bin
|
|
|
|
{%- endif %}
|
|
|
|
|
2023-02-02 16:34:17 -06:00
|
|
|
# Copy platform topology configuration scripts
|
|
|
|
sudo cp $IMAGE_CONFIGS/config-topology/config-topology.service $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
|
|
|
|
echo "config-topology.service" | sudo tee -a $GENERATED_SERVICE_FILE
|
|
|
|
sudo cp $IMAGE_CONFIGS/config-topology/config-topology.sh $FILESYSTEM_ROOT/usr/bin
|
|
|
|
|
2017-02-17 15:47:01 -06:00
|
|
|
# Copy updategraph script and service file
|
2020-05-30 15:46:44 -05:00
|
|
|
j2 files/build_templates/updategraph.service.j2 | sudo tee $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM/updategraph.service
|
2017-02-17 15:47:01 -06:00
|
|
|
sudo cp $IMAGE_CONFIGS/updategraph/updategraph $FILESYSTEM_ROOT/usr/bin/
|
2019-07-29 17:52:15 -05:00
|
|
|
echo "updategraph.service" | sudo tee -a $GENERATED_SERVICE_FILE
|
2017-02-17 15:47:01 -06:00
|
|
|
{% if enable_dhcp_graph_service == "y" %}
|
|
|
|
sudo bash -c "echo enabled=true > $FILESYSTEM_ROOT/etc/sonic/updategraph.conf"
|
|
|
|
sudo bash -c "echo src=dhcp >> $FILESYSTEM_ROOT/etc/sonic/updategraph.conf"
|
|
|
|
sudo bash -c "echo dhcp_as_static=true >> $FILESYSTEM_ROOT/etc/sonic/updategraph.conf"
|
|
|
|
{% else %}
|
|
|
|
sudo bash -c "echo enabled=false > $FILESYSTEM_ROOT/etc/sonic/updategraph.conf"
|
|
|
|
{% endif %}
|
2020-02-07 14:35:35 -06:00
|
|
|
|
|
|
|
# Generate initial SONiC configuration file
|
|
|
|
j2 files/build_templates/init_cfg.json.j2 | sudo tee $FILESYSTEM_ROOT/etc/sonic/init_cfg.json
|
2018-03-06 01:55:37 -06:00
|
|
|
|
2019-12-04 09:15:58 -06:00
|
|
|
# Copy config-setup script and service file
|
2020-05-30 15:46:44 -05:00
|
|
|
j2 files/build_templates/config-setup.service.j2 | sudo tee $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM/config-setup.service
|
2019-12-04 09:15:58 -06:00
|
|
|
sudo cp $IMAGE_CONFIGS/config-setup/config-setup $FILESYSTEM_ROOT/usr/bin/config-setup
|
2020-03-31 12:06:19 -05:00
|
|
|
echo "config-setup.service" | sudo tee -a $GENERATED_SERVICE_FILE
|
2019-12-04 09:15:58 -06:00
|
|
|
sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable config-setup.service
|
|
|
|
|
2021-06-03 22:07:17 -05:00
|
|
|
# Add delayed tacacs application service
|
|
|
|
sudo cp files/build_templates/tacacs-config.timer $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM/
|
|
|
|
echo "tacacs-config.timer" | sudo tee -a $GENERATED_SERVICE_FILE
|
|
|
|
|
|
|
|
sudo cp files/build_templates/tacacs-config.service $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM/
|
|
|
|
echo "tacacs-config.service" | sudo tee -a $GENERATED_SERVICE_FILE
|
|
|
|
|
2020-10-14 17:15:24 -05:00
|
|
|
# Copy config-chassisdb script and service file
|
|
|
|
j2 files/build_templates/config-chassisdb.service.j2 | sudo tee $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM/config-chassisdb.service
|
|
|
|
sudo cp $IMAGE_CONFIGS/config-chassisdb/config-chassisdb $FILESYSTEM_ROOT/usr/bin/config-chassisdb
|
|
|
|
echo "config-chassisdb.service" | sudo tee -a $GENERATED_SERVICE_FILE
|
|
|
|
sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable config-chassisdb.service
|
|
|
|
|
2023-03-16 19:50:15 -05:00
|
|
|
# Copy backend-acl script and service file
|
|
|
|
sudo cp $IMAGE_CONFIGS/backend_acl/backend-acl.service $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM/backend-acl.service
|
|
|
|
sudo cp $IMAGE_CONFIGS/backend_acl/backend_acl.py $FILESYSTEM_ROOT/usr/bin/backend_acl.py
|
|
|
|
echo "backend-acl.service" | sudo tee -a $GENERATED_SERVICE_FILE
|
|
|
|
|
2017-01-29 13:33:33 -06:00
|
|
|
# Copy SNMP configuration files
|
|
|
|
sudo cp $IMAGE_CONFIGS/snmp/snmp.yml $FILESYSTEM_ROOT/etc/sonic/
|
|
|
|
|
2017-06-21 20:52:50 -05:00
|
|
|
# Copy ASN configuration files
|
2019-11-06 18:07:28 -06:00
|
|
|
sudo cp $IMAGE_CONFIGS/constants/constants.yml $FILESYSTEM_ROOT/etc/sonic/
|
2017-06-21 20:52:50 -05:00
|
|
|
|
2017-01-29 13:33:33 -06:00
|
|
|
# Copy sudoers configuration file
|
|
|
|
sudo cp $IMAGE_CONFIGS/sudoers/sudoers $FILESYSTEM_ROOT/etc/
|
2018-06-21 12:41:50 -05:00
|
|
|
sudo cp $IMAGE_CONFIGS/sudoers/sudoers.lecture $FILESYSTEM_ROOT/etc/
|
2017-01-29 13:33:33 -06:00
|
|
|
|
2020-07-13 16:15:09 -05:00
|
|
|
# Copy pcie-check service files
|
|
|
|
sudo cp $IMAGE_CONFIGS/pcie-check/pcie-check.service $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
|
|
|
|
echo "pcie-check.service" | sudo tee -a $GENERATED_SERVICE_FILE
|
|
|
|
sudo cp $IMAGE_CONFIGS/pcie-check/pcie-check.sh $FILESYSTEM_ROOT/usr/bin/
|
|
|
|
|
2017-02-10 09:39:05 -06:00
|
|
|
## Install package without starting service
|
|
|
|
## ref: https://wiki.debian.org/chroot
|
|
|
|
sudo tee -a $FILESYSTEM_ROOT/usr/sbin/policy-rc.d > /dev/null <<EOF
|
|
|
|
#!/bin/sh
|
|
|
|
exit 101
|
|
|
|
EOF
|
|
|
|
sudo chmod a+x $FILESYSTEM_ROOT/usr/sbin/policy-rc.d
|
|
|
|
|
2017-02-27 15:08:41 -06:00
|
|
|
{% if installer_debs.strip() -%}
|
2017-01-29 13:33:33 -06:00
|
|
|
{% for deb in installer_debs.strip().split(' ') -%}
|
2017-02-10 09:39:05 -06:00
|
|
|
sudo dpkg --root=$FILESYSTEM_ROOT -i {{deb}} || sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
|
2017-01-29 13:33:33 -06:00
|
|
|
{% endfor %}
|
2017-02-27 15:08:41 -06:00
|
|
|
{% endif %}
|
2017-02-10 09:39:05 -06:00
|
|
|
|
2017-01-29 13:33:33 -06:00
|
|
|
## Run depmod command for target kernel modules
|
|
|
|
sudo LANG=C chroot $FILESYSTEM_ROOT depmod -a {{kversion}}
|
2017-02-27 15:08:41 -06:00
|
|
|
|
|
|
|
## download all dependency packages for platform debian packages
|
|
|
|
{% if lazy_installer_debs.strip() -%}
|
|
|
|
{% for file in lazy_installer_debs.strip().split(' ') -%}
|
|
|
|
|
|
|
|
{% set dev = file.split('@')[0] -%}
|
|
|
|
{% set deb = file.split('@')[1] -%}
|
|
|
|
{% set debfilename = deb.split('/')|last -%}
|
|
|
|
{% set debname = debfilename.split('_')|first -%}
|
|
|
|
|
|
|
|
sudo dpkg --root=$FILESYSTEM_ROOT -i {{deb}} || sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f --download-only
|
|
|
|
|
|
|
|
sudo mkdir -p $FILESYSTEM_ROOT/$PLATFORM_DIR/{{dev}}
|
[Build]: Support to use symbol links for lazy installation targets to reduce the image size (#10923)
Why I did it
Support to use symbol links in platform folder to reduce the image size.
The current solution is to copy each lazy installation targets (xxx.deb files) to each of the folders in the platform folder. The size will keep growing when more and more packages added in the platform folder. For cisco-8000 as an example, the size will be up to 2G, while most of them are duplicate packages in the platform folder.
How I did it
Create a new folder in platform/common, all the deb packages are copied to the folder, any other folders where use the packages are the symbol links to the common folder.
Why platform.tar?
We have implemented a patch for it, see #10775, but the problem is the the onie use really old unzip version, cannot support the symbol links.
The current solution is similar to the PR 10775, but make the platform folder into a tar package, which can be supported by onie. During the installation, the package.tar will be extracted to the original folder and removed.
2022-06-21 00:03:55 -05:00
|
|
|
sudo mkdir -p $FILESYSTEM_ROOT/$PLATFORM_DIR/common
|
|
|
|
sudo cp {{ deb }} $FILESYSTEM_ROOT/$PLATFORM_DIR/common/
|
|
|
|
sudo ln -sf "../common/{{ debfilename }}" "$FILESYSTEM_ROOT/$PLATFORM_DIR/{{dev}}/{{ debfilename }}"
|
2017-04-04 01:56:15 -05:00
|
|
|
for f in $(find $FILESYSTEM_ROOT/var/cache/apt/archives -name "*.deb"); do
|
2022-11-16 21:20:42 -06:00
|
|
|
sudo mv $f $FILESYSTEM_ROOT/$PLATFORM_DIR/common/
|
|
|
|
sudo ln -sf "../common/$(basename $f)" "$FILESYSTEM_ROOT/$PLATFORM_DIR/{{dev}}/$(basename $f)"
|
2017-02-27 15:08:41 -06:00
|
|
|
done
|
|
|
|
|
|
|
|
sudo dpkg --root=$FILESYSTEM_ROOT -P {{ debname }}
|
|
|
|
|
|
|
|
{% endfor %}
|
2022-11-16 21:20:42 -06:00
|
|
|
# create a trivial apt repo if any of the debs have dependencies, including between lazy debs
|
|
|
|
if [ $(for f in $FILESYSTEM_ROOT/$PLATFORM_DIR/common/*.deb; do \
|
|
|
|
sudo dpkg -I $f | grep "Depends:\|Pre-Depends:"; done | wc -l) -gt 0 ]; then
|
|
|
|
(cd $FILESYSTEM_ROOT/$PLATFORM_DIR/common && sudo dpkg-scanpackages . | \
|
|
|
|
sudo gzip | sudo tee Packages.gz > /dev/null)
|
|
|
|
fi
|
2017-01-29 13:33:33 -06:00
|
|
|
{% endif %}
|
2017-02-27 15:08:41 -06:00
|
|
|
|
2022-05-05 18:21:30 -05:00
|
|
|
# Remove sshd host keys, and will regenerate on first sshd start. This needs to be
|
|
|
|
# done again here because our custom version of sshd is being installed, which
|
|
|
|
# will regenerate the sshd host keys.
|
|
|
|
sudo rm -f $FILESYSTEM_ROOT/etc/ssh/ssh_host_*_key*
|
|
|
|
|
2017-02-27 15:08:41 -06:00
|
|
|
sudo rm -f $FILESYSTEM_ROOT/usr/sbin/policy-rc.d
|
|
|
|
|
2019-04-21 16:21:16 -05:00
|
|
|
# Copy fstrim service and timer file, enable fstrim timer
|
2020-05-30 15:46:44 -05:00
|
|
|
sudo cp $IMAGE_CONFIGS/fstrim/* $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
|
2019-04-21 16:21:16 -05:00
|
|
|
sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable fstrim.timer
|
|
|
|
|
2017-02-27 15:08:41 -06:00
|
|
|
## copy platform rc.local
|
|
|
|
sudo cp $IMAGE_CONFIGS/platform/rc.local $FILESYSTEM_ROOT/etc/
|
|
|
|
|
2018-11-21 10:08:37 -06:00
|
|
|
## copy blacklist file
|
|
|
|
sudo cp $IMAGE_CONFIGS/platform/linux_kernel_bde.conf $FILESYSTEM_ROOT/etc/modprobe.d/
|
|
|
|
|
2019-09-14 22:27:09 -05:00
|
|
|
# Enable psample drivers to support sFlow on vs
|
|
|
|
{% if sonic_asic_platform == "vs" %}
|
|
|
|
sudo tee -a $FILESYSTEM_ROOT/etc/modules-load.d/modules.conf > /dev/null <<EOF
|
|
|
|
psample
|
|
|
|
act_sample
|
|
|
|
EOF
|
|
|
|
{% endif %}
|
|
|
|
|
2019-07-26 00:06:41 -05:00
|
|
|
## Bind docker path
|
2021-04-18 10:17:57 -05:00
|
|
|
if [ $MULTIARCH_QEMU_ENVIRON == y ]; then
|
2019-07-26 00:06:41 -05:00
|
|
|
sudo mkdir -p $FILESYSTEM_ROOT/dockerfs
|
2019-12-16 11:07:05 -06:00
|
|
|
sudo mount --bind dockerfs $FILESYSTEM_ROOT/dockerfs
|
2019-07-26 00:06:41 -05:00
|
|
|
fi
|
|
|
|
|
2017-01-29 13:33:33 -06:00
|
|
|
{% if installer_images.strip() -%}
|
2022-03-10 19:23:37 -06:00
|
|
|
## ensure proc is mounted
|
2021-10-25 17:36:55 -05:00
|
|
|
sudo mount proc /proc -t proc || true
|
2022-03-14 21:03:54 -05:00
|
|
|
if [[ $CONFIGURED_ARCH == armhf ]]; then
|
2022-04-28 02:35:14 -05:00
|
|
|
# A workaround to fix the armhf build hung issue, caused by sonic-platform-nokia-7215_1.0_armhf.deb post installation script
|
2022-03-14 21:03:54 -05:00
|
|
|
ps -eo pid,cmd | grep python | grep "/etc/entropy.py" | awk '{print $1}' | xargs sudo kill -9 2>/dev/null || true
|
|
|
|
fi
|
|
|
|
|
2020-03-21 16:21:26 -05:00
|
|
|
sudo mkdir $FILESYSTEM_ROOT/target
|
|
|
|
sudo mount --bind target $FILESYSTEM_ROOT/target
|
2021-08-10 13:11:45 -05:00
|
|
|
sudo LANG=C DOCKER_HOST="$DOCKER_HOST" chroot $FILESYSTEM_ROOT docker info
|
2021-04-26 15:51:50 -05:00
|
|
|
|
|
|
|
{% for docker_installation_target in installer_images.strip().split() -%}
|
2021-06-22 13:12:22 -05:00
|
|
|
{% set pkgname, docker_build_path, machine, image = docker_installation_target.split('|') %}
|
2021-04-26 15:51:50 -05:00
|
|
|
{% set imagefilepath = image.split(':')|first -%}
|
|
|
|
{% set imagefilename = imagefilepath.split('/')|last -%}
|
2017-10-08 04:10:14 -05:00
|
|
|
{% set imagename = imagefilename.split('.')|first -%}
|
2021-06-22 13:12:22 -05:00
|
|
|
if [[ -z "{{machine}}" || -n "{{machine}}" && $TARGET_MACHINE == "{{machine}}" ]]; then
|
2021-08-10 13:11:45 -05:00
|
|
|
sudo LANG=C DOCKER_HOST="$DOCKER_HOST" chroot $FILESYSTEM_ROOT docker load -i {{imagefilepath}}
|
|
|
|
sudo LANG=C DOCKER_HOST="$DOCKER_HOST" chroot $FILESYSTEM_ROOT docker tag {{imagename}}:latest {{imagename}}:"${SONIC_IMAGE_VERSION}"
|
2021-04-26 15:51:50 -05:00
|
|
|
# Check if manifest exists for {{imagename}} and it is a valid JSON
|
2021-08-10 13:11:45 -05:00
|
|
|
sudo LANG=C DOCKER_HOST="$DOCKER_HOST" chroot $FILESYSTEM_ROOT docker inspect {{imagename}}:latest \
|
2021-04-26 15:51:50 -05:00
|
|
|
| jq '.[0].Config.Labels["com.azure.sonic.manifest"]' -r > /tmp/manifest.json
|
|
|
|
jq -e . /tmp/manifest.json || {
|
|
|
|
>&2 echo "docker image {{imagename}} has no manifest or manifest is not a valid JSON"
|
|
|
|
exit 1
|
|
|
|
}
|
[build]: Build sonic-broadcom.bin using debug dockers for all stretch based dockers (#2833)
* Updated Makefile infrastructure to build debug images.
As a sample, platform/broadcom/docker-orchagent-brcm.mk is updated to add a docker-orchagent-brcm-dbg.gz target.
Now "BLDENV=stretch make target/docker-orchagent-brcm-dbg.gz" will build the debug image.
NOTE: If you don't specify NOSTRETcH=1, it implicitly calls "make stretch", which builds all stretch targets and that would include debug dockers too.
This debug image can be used in any linux box to inspect core file. If your module's external dependency can be suitably mocked, you my even manually run it inside.
"docker run -it --entrypoint=/bin/bash e47a8fb8ed38"
You may map the core file path to this docker run.
* Dropped the regular binary using DBG_PACKAGES and a small name change to help readability.
* Tweaked the changes to retain the existing behavior w.r.t INSTALL_DEBUG_TOOLS=y.
When this change ('building debug docker image transparently') is extended to all dockers, this flag would become redundant. Yet, there can be some test based use cases that rely on this flag.
Until after all the dockers gets their debug images by default and we switch all use cases of this flag to use the newly built debug images, we need to maintain the existing behavior.
* 1) slave.mk - Dropped unused Docker build args
2) Debug template builder: renamed build_dbg_j2.sh to build_debug_docker_j2.sh
3) Dropped insignifcant statement CMD from debug Docker file, as base docker has Entrypoint.
* Reverted some changes, per review comments.
"User, uid, guid, frr-uid & frr-guid" are required for all docker images, with exception of debug images.
* Get in sync with the new update that filters out dockers to be built (SONIC_STRETCH_DOCKERS_FOR_INSTALLERS) and build debug-dockers only for those to be built and debug target is available.
* Mkae a template for each target that can be shared by all platforms.
Where needed a platform entry can override the template.
This avoids duplication, hence easier to maintain.
* A small change, that can fit better with other targets too.
Just take the platform code and do the rest in template.
* Extended debug to all stretch based docker images
* 1) Combined all orchagent makefiles into one platform independent make under rules/docker-orchagent.mk
2) Extened debug image to all stretch dockers
* Changes per review comments:
1) Dropped LIBSAIREDIS_DBG from database, teamd, router-advertiser, telemetry, and platform-monitor docker*.mk files from _DBG_DEPENDS list
2) W.r.t docker make for syncd, moved DEPENDS from template to specific makefile and let the template has stuff that is applicable to all.
* 1) Corrected a copy/paste mistake
* Fixed a copy/paste bug
* The base syncd dockers follow a template, which defines the base docker as DOCKER_SYNCD_BASE instead of DOCKER_SYNCD_<platform code>. Fix the docker-syncd-<mlnx, bfn>.mk to use the new one.
[Yet to be tested locally]
* Fixed spelling mistake
* Enable build of dbg-sonic-broadcom.bin, which uses dbg-dockers in place of regular dockers, for dockers that build debug version. For dockers that do not build debug version, it uses the regular docker.
This debug bin is installable and usable in a DUT, just like a regular bin.
* Per review comments:
1) Share a single rule for final image for normal & debug flavors (e.g. sonic-broadcom.bin & sonic-broadcom-dbg.bin)
2) Put dbg as suffix in final image name.
3) Compared target/sonic-broadcom.bin.logs with & w/o fix to verify integrity of sonic-broadcom.bin
4) Compared target/sonic-broadcom.bin.logs with sonic-broadcom-dbg.bin.log for verification
This fix takes care of ONIE image only. The next PR will cover the rest.
The next PR, will also make debug image conditional with flag.
* Updated per comments.
Now that debug dockers are available, do not need a way to install debug symbols in regular dockers.
With this commit, when INSTALL_DEBUG_TOOLS=y is set, it builds debug dockers (for dockers that enable debug build) and the final image uses debug dockers. For dockers that do not enable debug build, regular dockers get used in the final image.
Note:
The debug dockers are explicitly named as <docker name>-dbg.gz. But there is no "-dbg" suffix for image.
Hence if you make two runs with and w/o INSTALL_DEBUG_TOOLS=y, you have complete set of regular dockers + debug dockers. But the image gets overwritten.
Hence if both regular & debug images are needed, make two runs, as one with INSTALL_DEBUG_TOOLS=y and one w/o. Make sure to copy/rename the final image, before making the second run.
2019-06-12 03:36:21 -05:00
|
|
|
{% if imagename.endswith('-dbg') %}
|
|
|
|
{% set imagebasename = imagename.replace('-dbg', '') -%}
|
2021-08-10 13:11:45 -05:00
|
|
|
sudo LANG=C DOCKER_HOST="$DOCKER_HOST" chroot $FILESYSTEM_ROOT docker tag {{imagename}}:latest {{imagebasename}}:"${SONIC_IMAGE_VERSION}"
|
|
|
|
sudo LANG=C DOCKER_HOST="$DOCKER_HOST" chroot $FILESYSTEM_ROOT docker tag {{imagename}}:latest {{imagebasename}}:latest
|
[build]: Build sonic-broadcom.bin using debug dockers for all stretch based dockers (#2833)
* Updated Makefile infrastructure to build debug images.
As a sample, platform/broadcom/docker-orchagent-brcm.mk is updated to add a docker-orchagent-brcm-dbg.gz target.
Now "BLDENV=stretch make target/docker-orchagent-brcm-dbg.gz" will build the debug image.
NOTE: If you don't specify NOSTRETcH=1, it implicitly calls "make stretch", which builds all stretch targets and that would include debug dockers too.
This debug image can be used in any linux box to inspect core file. If your module's external dependency can be suitably mocked, you my even manually run it inside.
"docker run -it --entrypoint=/bin/bash e47a8fb8ed38"
You may map the core file path to this docker run.
* Dropped the regular binary using DBG_PACKAGES and a small name change to help readability.
* Tweaked the changes to retain the existing behavior w.r.t INSTALL_DEBUG_TOOLS=y.
When this change ('building debug docker image transparently') is extended to all dockers, this flag would become redundant. Yet, there can be some test based use cases that rely on this flag.
Until after all the dockers gets their debug images by default and we switch all use cases of this flag to use the newly built debug images, we need to maintain the existing behavior.
* 1) slave.mk - Dropped unused Docker build args
2) Debug template builder: renamed build_dbg_j2.sh to build_debug_docker_j2.sh
3) Dropped insignifcant statement CMD from debug Docker file, as base docker has Entrypoint.
* Reverted some changes, per review comments.
"User, uid, guid, frr-uid & frr-guid" are required for all docker images, with exception of debug images.
* Get in sync with the new update that filters out dockers to be built (SONIC_STRETCH_DOCKERS_FOR_INSTALLERS) and build debug-dockers only for those to be built and debug target is available.
* Mkae a template for each target that can be shared by all platforms.
Where needed a platform entry can override the template.
This avoids duplication, hence easier to maintain.
* A small change, that can fit better with other targets too.
Just take the platform code and do the rest in template.
* Extended debug to all stretch based docker images
* 1) Combined all orchagent makefiles into one platform independent make under rules/docker-orchagent.mk
2) Extened debug image to all stretch dockers
* Changes per review comments:
1) Dropped LIBSAIREDIS_DBG from database, teamd, router-advertiser, telemetry, and platform-monitor docker*.mk files from _DBG_DEPENDS list
2) W.r.t docker make for syncd, moved DEPENDS from template to specific makefile and let the template has stuff that is applicable to all.
* 1) Corrected a copy/paste mistake
* Fixed a copy/paste bug
* The base syncd dockers follow a template, which defines the base docker as DOCKER_SYNCD_BASE instead of DOCKER_SYNCD_<platform code>. Fix the docker-syncd-<mlnx, bfn>.mk to use the new one.
[Yet to be tested locally]
* Fixed spelling mistake
* Enable build of dbg-sonic-broadcom.bin, which uses dbg-dockers in place of regular dockers, for dockers that build debug version. For dockers that do not build debug version, it uses the regular docker.
This debug bin is installable and usable in a DUT, just like a regular bin.
* Per review comments:
1) Share a single rule for final image for normal & debug flavors (e.g. sonic-broadcom.bin & sonic-broadcom-dbg.bin)
2) Put dbg as suffix in final image name.
3) Compared target/sonic-broadcom.bin.logs with & w/o fix to verify integrity of sonic-broadcom.bin
4) Compared target/sonic-broadcom.bin.logs with sonic-broadcom-dbg.bin.log for verification
This fix takes care of ONIE image only. The next PR will cover the rest.
The next PR, will also make debug image conditional with flag.
* Updated per comments.
Now that debug dockers are available, do not need a way to install debug symbols in regular dockers.
With this commit, when INSTALL_DEBUG_TOOLS=y is set, it builds debug dockers (for dockers that enable debug build) and the final image uses debug dockers. For dockers that do not enable debug build, regular dockers get used in the final image.
Note:
The debug dockers are explicitly named as <docker name>-dbg.gz. But there is no "-dbg" suffix for image.
Hence if you make two runs with and w/o INSTALL_DEBUG_TOOLS=y, you have complete set of regular dockers + debug dockers. But the image gets overwritten.
Hence if both regular & debug images are needed, make two runs, as one with INSTALL_DEBUG_TOOLS=y and one w/o. Make sure to copy/rename the final image, before making the second run.
2019-06-12 03:36:21 -05:00
|
|
|
{% endif %}
|
2021-06-22 13:12:22 -05:00
|
|
|
fi
|
2017-01-29 13:33:33 -06:00
|
|
|
{% endfor %}
|
2020-04-13 10:41:18 -05:00
|
|
|
|
2021-04-26 15:51:50 -05:00
|
|
|
SONIC_PACKAGE_MANAGER_FOLDER="/var/lib/sonic-package-manager/"
|
|
|
|
sudo mkdir -p $FILESYSTEM_ROOT/$SONIC_PACKAGE_MANAGER_FOLDER
|
2021-07-09 14:29:33 -05:00
|
|
|
target_machine="$TARGET_MACHINE" j2 $BUILD_TEMPLATES/packages.json.j2 | sudo tee $FILESYSTEM_ROOT/$SONIC_PACKAGE_MANAGER_FOLDER/packages.json
|
|
|
|
if [ "${PIPESTATUS[0]}" != "0" ]; then
|
|
|
|
echo "Failed to generate packages.json" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
2021-04-26 15:51:50 -05:00
|
|
|
|
2021-02-25 11:11:12 -06:00
|
|
|
# Copy docker_image_ctl.j2 for SONiC Package Manager
|
|
|
|
sudo cp $BUILD_TEMPLATES/docker_image_ctl.j2 $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/docker_image_ctl.j2
|
|
|
|
|
2021-07-11 08:58:05 -05:00
|
|
|
# Generate shutdown order
|
2021-08-10 13:11:45 -05:00
|
|
|
sudo LANG=C DOCKER_HOST="$DOCKER_HOST" chroot $FILESYSTEM_ROOT /usr/local/bin/generate_shutdown_order.py
|
2021-07-11 08:58:05 -05:00
|
|
|
|
2020-08-05 15:23:12 -05:00
|
|
|
{% if include_kubernetes == "y" %}
|
2020-04-13 10:41:18 -05:00
|
|
|
## Pull in kubernetes docker images
|
|
|
|
echo "pulling universal k8s images ..."
|
2021-08-07 01:33:40 -05:00
|
|
|
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS pull k8s.gcr.io/pause:${K8s_GCR_IO_PAUSE_VERSION}
|
2020-04-13 10:41:18 -05:00
|
|
|
echo "docker images pull complete"
|
|
|
|
{% endif %}
|
|
|
|
|
2022-12-08 20:43:54 -06:00
|
|
|
{% if include_kubernetes_master == "y" %}
|
|
|
|
# Pull in kubernetes master docker images
|
|
|
|
echo "pulling kubernetes master images ..."
|
|
|
|
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS pull k8s.gcr.io/pause:${MASTER_PAUSE_VERSION}
|
|
|
|
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS pull k8s.gcr.io/kube-apiserver:${MASTER_KUBERNETES_CONTAINER_IMAGE_VERSION}
|
|
|
|
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS pull k8s.gcr.io/kube-controller-manager:${MASTER_KUBERNETES_CONTAINER_IMAGE_VERSION}
|
|
|
|
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS pull k8s.gcr.io/kube-scheduler:${MASTER_KUBERNETES_CONTAINER_IMAGE_VERSION}
|
|
|
|
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS pull k8s.gcr.io/kube-proxy:${MASTER_KUBERNETES_CONTAINER_IMAGE_VERSION}
|
|
|
|
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS pull k8s.gcr.io/coredns/coredns:${MASTER_COREDNS_VERSION}
|
|
|
|
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS pull k8s.gcr.io/etcd:${MASTER_ETCD_VERSION}
|
|
|
|
echo "kubernetes master docker images pull complete"
|
|
|
|
# Install python package for mdm service usage
|
|
|
|
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install psutil
|
|
|
|
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install statsd
|
|
|
|
sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable mdm.service
|
|
|
|
sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable kubelet.service
|
|
|
|
# Add kubernetes master entrance
|
|
|
|
sudo cp files/image_config/kubernetes/kubernetes_master_entrance.sh $FILESYSTEM_ROOT/usr/sbin/
|
|
|
|
sudo sed -i '/^exit 0/i\bash /usr/sbin/kubernetes_master_entrance.sh' $FILESYSTEM_ROOT/etc/rc.local
|
|
|
|
{% endif %}
|
|
|
|
|
2021-06-29 11:07:33 -05:00
|
|
|
{% macro get_install_options(set_owner, enabled) -%}
|
|
|
|
{% set args = ["-y", "-v", "DEBUG"] -%}
|
|
|
|
{% if set_owner -%}
|
|
|
|
{% set args = args + ["--set-owner", set_owner] -%}
|
|
|
|
{% endif -%}
|
|
|
|
{% if enabled == "y" -%}
|
|
|
|
{% set args = args + ["--enable"] -%}
|
|
|
|
{% endif -%}
|
|
|
|
{{ args | join(' ') }}
|
|
|
|
{% endmacro -%}
|
|
|
|
|
|
|
|
{% for package in sonic_packages.strip().split() -%}
|
|
|
|
{% set name, repo, version, set_owner, enabled = package.split('|') -%}
|
2021-08-10 13:11:45 -05:00
|
|
|
sudo LANG=C DOCKER_HOST="$DOCKER_HOST" chroot $FILESYSTEM_ROOT sonic-package-manager repository add {{ name }} {{ repo }}
|
|
|
|
sudo LANG=C DOCKER_HOST="$DOCKER_HOST" chroot $FILESYSTEM_ROOT sonic-package-manager install {{ name }}=={{ version }} {{ get_install_options(set_owner, enabled) }}
|
2021-06-29 11:07:33 -05:00
|
|
|
{% endfor -%}
|
|
|
|
|
|
|
|
{% for package in sonic_local_packages.strip().split() -%}
|
|
|
|
{% set name, path, set_owner, enabled = package.split('|') -%}
|
2021-08-10 13:11:45 -05:00
|
|
|
sudo LANG=C DOCKER_HOST="$DOCKER_HOST" chroot $FILESYSTEM_ROOT sonic-package-manager install --from-tarball {{ path }} {{ get_install_options(set_owner, enabled) }}
|
2021-06-29 11:07:33 -05:00
|
|
|
{% endfor -%}
|
|
|
|
|
2020-03-21 16:21:26 -05:00
|
|
|
sudo umount $FILESYSTEM_ROOT/target
|
|
|
|
sudo rm -r $FILESYSTEM_ROOT/target
|
2021-04-18 10:17:57 -05:00
|
|
|
if [ $MULTIARCH_QEMU_ENVIRON == y ]; then
|
2019-12-16 11:07:05 -06:00
|
|
|
sudo umount $FILESYSTEM_ROOT/dockerfs
|
2019-07-26 00:06:41 -05:00
|
|
|
sudo rm -fr $FILESYSTEM_ROOT/dockerfs
|
|
|
|
sudo kill -9 `sudo $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS_PID` || true
|
|
|
|
else
|
2021-03-14 07:15:42 -05:00
|
|
|
sudo chroot $FILESYSTEM_ROOT $DOCKER_CTL_SCRIPT stop
|
2019-07-26 00:06:41 -05:00
|
|
|
fi
|
First cut image update for kubernetes support. (#5421)
* First cut image update for kubernetes support.
With this,
1) dockers dhcp_relay, lldp, pmon, radv, snmp, telemetry are enabled
for kube management
init_cfg.json configure set_owner as kube for these
2) Each docker's start.sh updated to call container_startup.py to register going up
As part of this call, it registers the current owner as local/kube and its version
The images are built with its version ingrained into image during build
3) Update all docker's bash script to call 'container start/stop/wait' instead of 'docker start/stop/wait'.
For all locally managed containers, it calls docker commands, hence no change for locally managed.
4) Introduced a new ctrmgrd service, that helps with transition between owners as kube & local and carry over any labels update from STATE-DB to API server
5) hostcfgd updated to handle owner change
6) Reboot scripts are updatd to tag kube running images as local, so upon reboot they run the same image.
7) Added kube_commands.py to handle all updates with Kubernetes API serrver -- dedicated for k8s interaction only.
2020-12-22 10:01:33 -06:00
|
|
|
|
|
|
|
sudo bash -c "echo { > $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/ctr_image_names.json"
|
|
|
|
{% for entry in feature_vs_image_names.split(' ') -%}
|
|
|
|
{% if entry|length %}
|
|
|
|
{% set lst = entry.split(':') %}
|
|
|
|
{% set lst1 = lst[1].split('.') %}
|
|
|
|
sudo bash -c "echo -n -e \"\x22{{ lst[0] }}\x22 : \x22{{ lst1[0] }}\x22\" >> $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/ctr_image_names.json"
|
|
|
|
{% if not loop.last %}
|
|
|
|
sudo bash -c "echo \",\" >> $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/ctr_image_names.json"
|
|
|
|
{% else %}
|
|
|
|
sudo bash -c "echo \"\" >> $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/ctr_image_names.json"
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
|
|
|
sudo bash -c "echo } >> $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/ctr_image_names.json"
|
|
|
|
|
2017-04-04 01:56:15 -05:00
|
|
|
{% for script in installer_start_scripts.split(' ') -%}
|
2021-06-22 13:12:22 -05:00
|
|
|
if [ -f $TARGET_MACHINE"_{{script}}" ]; then
|
|
|
|
sudo cp $TARGET_MACHINE"_{{script}}" $FILESYSTEM_ROOT/usr/bin/{{script}}
|
|
|
|
else
|
|
|
|
sudo cp {{script}} $FILESYSTEM_ROOT/usr/bin/
|
|
|
|
fi
|
2017-01-29 13:33:33 -06:00
|
|
|
{% endfor %}
|
|
|
|
{% for service in installer_services.split(' ') -%}
|
2017-03-01 12:57:35 -06:00
|
|
|
if [ -f {{service}} ]; then
|
2020-05-30 15:46:44 -05:00
|
|
|
sudo cp {{service}} $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
|
2020-01-26 15:56:42 -06:00
|
|
|
|
|
|
|
{% if "@" in service %}
|
|
|
|
MULTI_INSTANCE="{{service}}"
|
|
|
|
SINGLE_INSTANCE=${MULTI_INSTANCE/"@"}
|
2020-05-30 15:46:44 -05:00
|
|
|
sudo cp $SINGLE_INSTANCE $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
|
2020-01-26 15:56:42 -06:00
|
|
|
{% endif %}
|
|
|
|
|
2019-07-29 17:52:15 -05:00
|
|
|
echo "{{service}}" | sudo tee -a $GENERATED_SERVICE_FILE
|
2017-03-01 12:57:35 -06:00
|
|
|
fi
|
2017-01-29 13:33:33 -06:00
|
|
|
{% endfor %}
|
2022-04-28 02:35:14 -05:00
|
|
|
{% for timer in installer_timers.split(' ') -%}
|
|
|
|
if [ -f {{timer}} ]; then
|
|
|
|
sudo cp {{timer}} $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
|
|
|
|
|
|
|
|
{% if "@" in timer %}
|
|
|
|
MULTI_INSTANCE="{{timer}}"
|
|
|
|
SINGLE_INSTANCE=${MULTI_INSTANCE/"@"}
|
|
|
|
sudo cp $SINGLE_INSTANCE $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
echo "{{timer}}" | sudo tee -a $GENERATED_SERVICE_FILE
|
|
|
|
fi
|
|
|
|
{% endfor %}
|
2020-04-04 17:24:06 -05:00
|
|
|
if [ -f iccpd.service ]; then
|
|
|
|
sudo LANG=C chroot $FILESYSTEM_ROOT systemctl disable iccpd.service
|
|
|
|
fi
|
2017-01-29 13:33:33 -06:00
|
|
|
sudo LANG=C chroot $FILESYSTEM_ROOT fuser -km /sys || true
|
|
|
|
sudo LANG=C chroot $FILESYSTEM_ROOT umount -lf /sys
|
|
|
|
{% endif %}
|
|
|
|
|
[systemd] ASIC status based service bringup on VOQ chassis (#7477)
Changes to allow starting per asic services like swss and syncd only if the platform vendor codedetects the asic is detected and notified. The systemd services ordering we want is database->database@->pmon->swss@->syncd@->teamd@->lldp@
There is also a requirement that management, telemetry, snmp dockers can start even if all asic services are not up.
Why I did it
For VOQ chassis, the fabric cards will have 1-N asics. Also, there could be multiple removable fabric cards. On the supervisor, swss and syncd containers need to be started only if the fabric-card is in Online state and respective asics are detected by the kernel. Using systemd, the dependent services can be in inactive state.
How I did it
Introduce a mechanism where all ASIC dependent service wait on its state to be published via PMON to REDIS. Once the subscription is received, the service proceeds to create respective dockers.
For fixed platforms, systemd is unchanged i.e. the service bring up and docker creation happens in the start()/ExecStartPre routine of the .sh scripts.
For VOQ chassis platform on supervisor, the service bringup skips docker creation in the start() routine, but does it in the wait()/ExecStart routine of the .sh scrips.
Management dockers are decoupled from ASIC docker creation.
2021-07-28 01:02:49 -05:00
|
|
|
# Copy service scripts (swss, syncd, bgp, teamd, lldp, radv)
|
2018-08-22 15:02:32 -05:00
|
|
|
sudo LANG=C cp $SCRIPTS_DIR/swss.sh $FILESYSTEM_ROOT/usr/local/bin/swss.sh
|
2018-09-24 18:35:01 -05:00
|
|
|
sudo LANG=C cp $SCRIPTS_DIR/syncd.sh $FILESYSTEM_ROOT/usr/local/bin/syncd.sh
|
Add gearbox phy device files and a new physyncd docker to support VS gearbox phy feature (#4851)
* buildimage: Add gearbox phy device files and a new physyncd docker to support VS gearbox phy feature
* scripts and configuration needed to support a second syncd docker (physyncd)
* physyncd supports gearbox device and phy SAI APIs and runs multiple instances of syncd, one per phy in the device
* support for VS target (sonic-sairedis vslib has been extended to support a virtual BCM81724 gearbox PHY).
HLD is located at https://github.com/Azure/SONiC/blob/b817a12fd89520d3fd26bbc5897487928e7f6de7/doc/gearbox/gearbox_mgr_design.md
**- Why I did it**
This work is part of the gearbox phy joint effort between Microsoft and Broadcom, and is based
on multi-switch support in sonic-sairedis.
**- How I did it**
Overall feature was implemented across several projects. The collective pull requests (some in late stages of review at this point):
https://github.com/Azure/sonic-utilities/pull/931 - CLI (merged)
https://github.com/Azure/sonic-swss-common/pull/347 - Minor changes (merged)
https://github.com/Azure/sonic-swss/pull/1321 - gearsyncd, config parsers, changes to orchargent to create gearbox phy on supported systems
https://github.com/Azure/sonic-sairedis/pull/624 - physyncd, virtual BCM81724 gearbox phy added to vslib
**- How to verify it**
In a vslib build:
root@sonic:/home/admin# show gearbox interfaces status
PHY Id Interface MAC Lanes MAC Lane Speed PHY Lanes PHY Lane Speed Line Lanes Line Lane Speed Oper Admin
-------- ----------- --------------- ---------------- --------------- ---------------- ------------ ----------------- ------ -------
1 Ethernet48 121,122,123,124 25G 200,201,202,203 25G 204,205 50G down down
1 Ethernet49 125,126,127,128 25G 206,207,208,209 25G 210,211 50G down down
1 Ethernet50 69,70,71,72 25G 212,213,214,215 25G 216 100G down down
In addition, docker ps | grep phy should show a physyncd docker running.
Signed-off-by: syd.logan@broadcom.com
2020-09-25 10:32:44 -05:00
|
|
|
sudo LANG=C cp $SCRIPTS_DIR/syncd_common.sh $FILESYSTEM_ROOT/usr/local/bin/syncd_common.sh
|
|
|
|
sudo LANG=C cp $SCRIPTS_DIR/gbsyncd.sh $FILESYSTEM_ROOT/usr/local/bin/gbsyncd.sh
|
[gearbox] Add gbsyncd container for Credo gearbox chips (#8144)
This change is to add a gbsyncd container to accommodate the syncd process and the SAI libraries for the Credo gearbox chips.
How I did it
This container works similar to the existing Broadcom syncd container. Its main difference is that the SAI-related dynamic libraries are replaced by the ones for Credo gearbox chips, and the container only reacts to SAI events for the gearbox chips. The SAI libraries will be provided by the package libsai-credo_1.0_amd64.deb.
For the image build, the added container will be built and included in the Broadcom platform image, after $(LIBSAI_CREDO)_URL = is replaced to the correct value. For now, as $(LIBSAI_CREDO)_URL is empty, the container build is skipped in the image build.
After the container is included in the image, in the runtime, the container will begin with checking the existence of /usr/share/sonic/hwsku/gearbox_config.json; if that file is not provided, the container will exit by itself. Therefore, for platforms unrelated to the Credo chips, as long as they are not providing the file, they will not be affected by this change.
2021-08-04 18:05:53 -05:00
|
|
|
sudo LANG=C cp $SCRIPTS_DIR/gbsyncd-platform.sh $FILESYSTEM_ROOT/usr/bin/gbsyncd-platform.sh
|
2020-07-15 13:46:23 -05:00
|
|
|
sudo LANG=C cp $SCRIPTS_DIR/bgp.sh $FILESYSTEM_ROOT/usr/local/bin/bgp.sh
|
2020-11-13 15:34:18 -06:00
|
|
|
sudo LANG=C cp $SCRIPTS_DIR/teamd.sh $FILESYSTEM_ROOT/usr/local/bin/teamd.sh
|
[systemd] ASIC status based service bringup on VOQ chassis (#7477)
Changes to allow starting per asic services like swss and syncd only if the platform vendor codedetects the asic is detected and notified. The systemd services ordering we want is database->database@->pmon->swss@->syncd@->teamd@->lldp@
There is also a requirement that management, telemetry, snmp dockers can start even if all asic services are not up.
Why I did it
For VOQ chassis, the fabric cards will have 1-N asics. Also, there could be multiple removable fabric cards. On the supervisor, swss and syncd containers need to be started only if the fabric-card is in Online state and respective asics are detected by the kernel. Using systemd, the dependent services can be in inactive state.
How I did it
Introduce a mechanism where all ASIC dependent service wait on its state to be published via PMON to REDIS. Once the subscription is received, the service proceeds to create respective dockers.
For fixed platforms, systemd is unchanged i.e. the service bring up and docker creation happens in the start()/ExecStartPre routine of the .sh scripts.
For VOQ chassis platform on supervisor, the service bringup skips docker creation in the start() routine, but does it in the wait()/ExecStart routine of the .sh scrips.
Management dockers are decoupled from ASIC docker creation.
2021-07-28 01:02:49 -05:00
|
|
|
sudo LANG=C cp $SCRIPTS_DIR/lldp.sh $FILESYSTEM_ROOT/usr/local/bin/lldp.sh
|
2020-08-11 15:13:13 -05:00
|
|
|
sudo LANG=C cp $SCRIPTS_DIR/radv.sh $FILESYSTEM_ROOT/usr/local/bin/radv.sh
|
2022-09-19 11:34:33 -05:00
|
|
|
sudo LANG=C cp $SCRIPTS_DIR/database.sh $FILESYSTEM_ROOT/usr/local/bin/database.sh
|
|
|
|
sudo LANG=C cp $SCRIPTS_DIR/snmp.sh $FILESYSTEM_ROOT/usr/local/bin/snmp.sh
|
|
|
|
sudo LANG=C cp $SCRIPTS_DIR/telemetry.sh $FILESYSTEM_ROOT/usr/local/bin/telemetry.sh
|
|
|
|
sudo LANG=C cp $SCRIPTS_DIR/mgmt-framework.sh $FILESYSTEM_ROOT/usr/local/bin/mgmt-framework.sh
|
[systemd] ASIC status based service bringup on VOQ chassis (#7477)
Changes to allow starting per asic services like swss and syncd only if the platform vendor codedetects the asic is detected and notified. The systemd services ordering we want is database->database@->pmon->swss@->syncd@->teamd@->lldp@
There is also a requirement that management, telemetry, snmp dockers can start even if all asic services are not up.
Why I did it
For VOQ chassis, the fabric cards will have 1-N asics. Also, there could be multiple removable fabric cards. On the supervisor, swss and syncd containers need to be started only if the fabric-card is in Online state and respective asics are detected by the kernel. Using systemd, the dependent services can be in inactive state.
How I did it
Introduce a mechanism where all ASIC dependent service wait on its state to be published via PMON to REDIS. Once the subscription is received, the service proceeds to create respective dockers.
For fixed platforms, systemd is unchanged i.e. the service bring up and docker creation happens in the start()/ExecStartPre routine of the .sh scripts.
For VOQ chassis platform on supervisor, the service bringup skips docker creation in the start() routine, but does it in the wait()/ExecStart routine of the .sh scrips.
Management dockers are decoupled from ASIC docker creation.
2021-07-28 01:02:49 -05:00
|
|
|
sudo LANG=C cp $SCRIPTS_DIR/asic_status.sh $FILESYSTEM_ROOT/usr/local/bin/asic_status.sh
|
|
|
|
sudo LANG=C cp $SCRIPTS_DIR/asic_status.py $FILESYSTEM_ROOT/usr/local/bin/asic_status.py
|
2018-08-22 15:02:32 -05:00
|
|
|
|
2020-03-31 12:06:19 -05:00
|
|
|
# Copy sonic-netns-exec script
|
|
|
|
sudo LANG=C cp $SCRIPTS_DIR/sonic-netns-exec $FILESYSTEM_ROOT/usr/bin/sonic-netns-exec
|
|
|
|
|
2021-04-30 19:49:00 -05:00
|
|
|
# Copy write_standby script for mux state
|
2021-05-05 01:14:48 -05:00
|
|
|
sudo LANG=C cp $SCRIPTS_DIR/write_standby.py $FILESYSTEM_ROOT/usr/local/bin/write_standby.py
|
2021-04-30 19:49:00 -05:00
|
|
|
|
2021-10-26 16:10:13 -05:00
|
|
|
# Copy mark_dhcp_packet script
|
|
|
|
sudo LANG=C cp $SCRIPTS_DIR/mark_dhcp_packet.py $FILESYSTEM_ROOT/usr/local/bin/mark_dhcp_packet.py
|
|
|
|
|
2018-06-22 21:53:51 -05:00
|
|
|
# Copy systemd timer configuration
|
|
|
|
# It implements delayed start of services
|
2020-05-30 15:46:44 -05:00
|
|
|
sudo cp $BUILD_TEMPLATES/snmp.timer $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
|
2020-06-29 11:39:23 -05:00
|
|
|
echo "snmp.timer" | sudo tee -a $GENERATED_SERVICE_FILE
|
2020-08-27 13:53:58 -05:00
|
|
|
|
2020-08-05 15:23:12 -05:00
|
|
|
{% if include_system_telemetry == 'y' %}
|
2020-05-30 15:46:44 -05:00
|
|
|
sudo cp $BUILD_TEMPLATES/telemetry.timer $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
|
2020-06-29 11:39:23 -05:00
|
|
|
echo "telemetry.timer" | sudo tee -a $GENERATED_SERVICE_FILE
|
2019-12-16 11:07:05 -06:00
|
|
|
{% endif %}
|
2018-06-22 21:53:51 -05:00
|
|
|
|
2020-08-27 13:53:58 -05:00
|
|
|
{% if include_mgmt_framework == 'y' %}
|
|
|
|
sudo cp $BUILD_TEMPLATES/mgmt-framework.timer $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
|
|
|
|
echo "mgmt-framework.timer" | sudo tee -a $GENERATED_SERVICE_FILE
|
|
|
|
{% endif %}
|
|
|
|
|
2022-05-02 02:44:17 -05:00
|
|
|
sudo cp $BUILD_TEMPLATES/pmon.timer $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
|
|
|
|
echo "pmon.timer" | sudo tee -a $GENERATED_SERVICE_FILE
|
|
|
|
|
2021-02-25 06:26:24 -06:00
|
|
|
sudo cp $BUILD_TEMPLATES/sonic.target $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
|
|
|
|
sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable sonic.target
|
2021-06-21 13:55:02 -05:00
|
|
|
|
|
|
|
sudo cp $BUILD_TEMPLATES/sonic-delayed.target $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
|
|
|
|
sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable sonic-delayed.target
|
2021-02-25 06:26:24 -06:00
|
|
|
|
2021-07-15 17:15:45 -05:00
|
|
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get purge -y python3-dev
|
2020-10-14 12:16:35 -05:00
|
|
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get purge -y build-essential libssl-dev swig
|
2021-02-08 21:35:08 -06:00
|
|
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get purge -y libcairo2-dev libdbus-1-dev libgirepository1.0-dev libsystemd-dev pkg-config
|
2017-03-17 16:51:42 -05:00
|
|
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get clean -y
|
2018-11-20 21:27:56 -06:00
|
|
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get autoremove -y
|
2017-03-17 16:51:42 -05:00
|
|
|
|
2017-02-07 02:33:20 -06:00
|
|
|
{% for file in installer_extra_files.split(' ') -%}
|
|
|
|
{% if file.strip() -%}
|
|
|
|
{% set src = file.split(':')[0] -%}
|
|
|
|
{% set dst = file.split(':')[1] -%}
|
|
|
|
sudo cp {{src}} $FILESYSTEM_ROOT/{{dst}}
|
|
|
|
{% endif -%}
|
|
|
|
{% endfor -%}
|
2017-07-28 12:57:51 -05:00
|
|
|
|
|
|
|
{% if sonic_asic_platform == "mellanox" %}
|
2023-02-22 09:40:50 -06:00
|
|
|
declare -rA FW_FILE_MAP=( \
|
|
|
|
[$MLNX_SPC_FW_FILE]="fw-SPC.mfa" \
|
|
|
|
[$MLNX_SPC2_FW_FILE]="fw-SPC2.mfa" \
|
|
|
|
[$MLNX_SPC3_FW_FILE]="fw-SPC3.mfa" \
|
|
|
|
)
|
|
|
|
sudo mkdir -p $FILESYSTEM_ROOT/$PLATFORM_DIR/fw/asic/
|
|
|
|
sudo mkdir -p $FILESYSTEM_ROOT_ETC/mlnx/
|
|
|
|
for fw_file_name in ${!FW_FILE_MAP[@]}; do
|
|
|
|
sudo cp $files_path/$fw_file_name $FILESYSTEM_ROOT/$PLATFORM_DIR/fw/asic/${FW_FILE_MAP[$fw_file_name]}
|
|
|
|
# Link old FW location to not break existing automation/scripts
|
|
|
|
sudo ln -s /host/image-$SONIC_IMAGE_VERSION/$PLATFORM_DIR/fw/asic/${FW_FILE_MAP[$fw_file_name]} $FILESYSTEM_ROOT/etc/mlnx/${FW_FILE_MAP[$fw_file_name]}
|
|
|
|
done
|
2023-06-30 15:53:33 -05:00
|
|
|
sudo cp $files_path/$ISSU_VERSION_FILE $FILESYSTEM_ROOT/$PLATFORM_DIR/fw/asic/issu-version
|
|
|
|
sudo ln -s /host/image-$SONIC_IMAGE_VERSION/$PLATFORM_DIR/fw/asic/issu-version $FILESYSTEM_ROOT/etc/mlnx/issu-version
|
2019-05-27 17:50:51 -05:00
|
|
|
sudo cp $files_path/$MLNX_FFB_SCRIPT $FILESYSTEM_ROOT/usr/bin/mlnx-ffb.sh
|
2020-04-13 10:13:19 -05:00
|
|
|
sudo cp $files_path/$MLNX_ONIE_FW_UPDATE $FILESYSTEM_ROOT/usr/bin/$MLNX_ONIE_FW_UPDATE
|
|
|
|
sudo cp $files_path/$MLNX_SSD_FW_UPDATE $FILESYSTEM_ROOT/usr/bin/$MLNX_SSD_FW_UPDATE
|
2022-01-24 02:56:38 -06:00
|
|
|
sudo cp $files_path/$MLNX_INSTALL_PENDING_FW $FILESYSTEM_ROOT/usr/bin/$MLNX_INSTALL_PENDING_FW
|
2017-08-22 10:08:07 -05:00
|
|
|
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
|
2019-09-25 13:00:24 -05:00
|
|
|
|
2020-12-11 12:51:31 -06:00
|
|
|
# Install mlnx-sonic-platform Python 3 package
|
|
|
|
MLNX_SONIC_PLATFORM_PY3_WHEEL_NAME=$(basename {{mlnx_platform_api_py3_wheel_path}})
|
|
|
|
sudo cp {{mlnx_platform_api_py3_wheel_path}} $FILESYSTEM_ROOT/$MLNX_SONIC_PLATFORM_PY3_WHEEL_NAME
|
|
|
|
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install $MLNX_SONIC_PLATFORM_PY3_WHEEL_NAME
|
|
|
|
sudo rm -rf $FILESYSTEM_ROOT/$MLNX_SONIC_PLATFORM_PY3_WHEEL_NAME
|
2017-07-28 12:57:51 -05:00
|
|
|
{% endif %}
|
2018-11-26 20:19:12 -06:00
|
|
|
|
|
|
|
{%- 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 chown -R $FRR_USER_UID:$FRR_USER_GID $FILESYSTEM_ROOT/etc/sonic/frr
|
|
|
|
sudo chmod -R 640 $FILESYSTEM_ROOT/etc/sonic/frr/
|
2019-02-19 23:50:19 -06:00
|
|
|
sudo chmod 750 $FILESYSTEM_ROOT/etc/sonic/frr
|
2018-11-26 20:19:12 -06:00
|
|
|
{%- endif %}
|
2020-06-24 17:25:16 -05:00
|
|
|
|
|
|
|
# Mask services which are disabled by default
|
|
|
|
sudo cp $BUILD_SCRIPTS_DIR/mask_disabled_services.py $FILESYSTEM_ROOT/tmp/
|
|
|
|
sudo chmod a+x $FILESYSTEM_ROOT/tmp/mask_disabled_services.py
|
|
|
|
sudo LANG=C chroot $FILESYSTEM_ROOT /tmp/mask_disabled_services.py
|
|
|
|
sudo rm -rf $FILESYSTEM_ROOT/tmp/mask_disabled_services.py
|
2022-05-20 15:25:11 -05:00
|
|
|
|
|
|
|
|
|
|
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install python3-dbus
|