Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dockers/docker-fpm-frr/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %}
FROM docker-config-engine-stretch
FROM docker-config-engine-buster

ARG docker_container_name
ARG frr_user_uid
Expand Down
13 changes: 13 additions & 0 deletions dockers/docker-platform-monitor/docker-pmon.supervisord.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,16 @@ startsecs=10
dependent_startup=true
dependent_startup_wait_for=start:exited
{% endif %}

{% if not skip_pcied %}
[program:pcied]
command=/usr/bin/pcied
priority=10
autostart=false
autorestart=unexpected
stdout_logfile=syslog
stderr_logfile=syslog
startsecs=10
dependent_startup=true
dependent_startup_wait_for=start:exited
{% endif %}
2 changes: 2 additions & 0 deletions files/image_config/caclmgrd/caclmgrd.service
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ After=updategraph.service
[Service]
Type=simple
ExecStart=/usr/bin/caclmgrd
Restart=always
RestartSec=30

[Install]
WantedBy=multi-user.target
40 changes: 40 additions & 0 deletions files/scripts/remove_chassisdb_config
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/python
import json
import os
import syslog
import argparse

database_config_file = "/var/run/redis/sonic-db/database_config.json"
redis_chassis = 'redis_chassis'
chassis_db = 'CHASSIS_DB'

def main():
parser=argparse.ArgumentParser(description=
"Remove chassis_db config from database-config.json")
parser.add_argument("-j", "--json", help="databse-config json file", nargs='?',
const=database_config_file)
args = parser.parse_args()
jsonfile = ""
if args.json != None:
jsonfile = args.json
else:
return
data = {}
if os.path.isfile(jsonfile):
with open(jsonfile, "r") as read_file:
data = json.load(read_file)
else:
syslog.syslog(syslog.LOG_ERR,
'config file {} does notexist'.format(jsonfile))
return
if 'INSTANCES' in data and redis_chassis in data['INSTANCES']:
del data['INSTANCES'][redis_chassis]
if 'DATABASES' in data and chassis_db in data['DATABASES']:
del data['DATABASES'][chassis_db]
with open(jsonfile, "w") as write_file:
json.dump(data, write_file, indent=4, separators=(',', ': '))
syslog.syslog(syslog.LOG_INFO,
'remove chassis_db from config file {}'.format(jsonfile))

if __name__ == "__main__":
main()
3 changes: 2 additions & 1 deletion platform/vs/docker-sonic-vs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ $(DOCKER_SONIC_VS)_FILES += $(CONFIGDB_LOAD_SCRIPT) \
$(ARP_UPDATE_SCRIPT) \
$(BUFFERS_CONFIG_TEMPLATE) \
$(QOS_CONFIG_TEMPLATE) \
$(SONIC_VERSION)
$(SONIC_VERSION) \
$(RM_CHASSISDB_CONFIG_SCRIPT)

$(DOCKER_SONIC_VS)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER)
SONIC_DOCKER_IMAGES += $(DOCKER_SONIC_VS)
5 changes: 4 additions & 1 deletion platform/vs/docker-sonic-vs/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,16 @@ RUN sed -ri 's/^(save .*$)/# \1/g;
' /etc/redis/redis.conf

COPY ["50-default.conf", "/etc/rsyslog.d/"]
COPY ["start.sh", "orchagent.sh", "/usr/bin/"]
COPY ["start.sh", "orchagent.sh", "files/remove_chassisdb_config", "/usr/bin/"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
COPY ["files/configdb-load.sh", "/usr/bin/"]
COPY ["files/arp_update", "/usr/bin/"]
COPY ["files/buffers_config.j2", "files/qos_config.j2", "/usr/share/sonic/templates/"]
COPY ["files/sonic_version.yml", "/etc/sonic/"]
COPY ["database_config.json", "/etc/default/sonic-db/"]
COPY ["hostname.j2", "/usr/share/sonic/templates/"]
COPY ["default_chassis_cfg.json", "/etc/default/sonic-db/"]
COPY ["chassis_db.py", "/usr/bin/"]

# Workaround the tcpdump issue
RUN mv /usr/sbin/tcpdump /usr/bin/tcpdump
Expand Down
13 changes: 13 additions & 0 deletions platform/vs/docker-sonic-vs/chassis_db.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env python

import swsssdk
import json
chassisdb = swsssdk.SonicV2Connector(host='10.0.0.200', port='6380')
chassisdb.connect(chassisdb.CHASSIS_DB)
fname='/usr/share/sonic/virtual_chassis/chassis_db.json'
with open(fname) as f:
js = json.load(f)
client=chassisdb.get_redis_client(chassisdb.CHASSIS_DB)
for h, table in js.items():
for k, v in table.items():
client.hset(h, k, v)
11 changes: 11 additions & 0 deletions platform/vs/docker-sonic-vs/database_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
"hostname" : "127.0.0.1",
"port" : 6379,
"unix_socket_path" : "/var/run/redis/redis.sock"
},

"redis_chassis":{
"hostname" : "redis_chassis.server",
"port": 6380,
"unix_socket_path": "/var/run/redis/redis_chassis.sock"
}
},
"DATABASES" : {
Expand Down Expand Up @@ -51,6 +57,11 @@
"id" : 7,
"separator": "|",
"instance" : "redis"
},
"CHASSIS_DB" : {
"id" : 8,
"separator": "|",
"instance" : "redis_chassis"
}
},
"VERSION" : "1.0"
Expand Down
7 changes: 7 additions & 0 deletions platform/vs/docker-sonic-vs/default_chassis_cfg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"DEVICE_METADATA": {
"localhost": {
"chassis_db_address" : "10.8.1.200"
}
}
}
3 changes: 3 additions & 0 deletions platform/vs/docker-sonic-vs/hostname.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% if DEVICE_METADATA.localhost.chassis_db_address %}
{{ DEVICE_METADATA.localhost.chassis_db_address }} redis_chassis.server
{% endif %}
34 changes: 33 additions & 1 deletion platform/vs/docker-sonic-vs/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ popd

[ -d /etc/sonic ] || mkdir -p /etc/sonic

if [[ -f /usr/share/sonic/virtual_chassis/default_config.json ]]; then
CHASS_CFG="-j /usr/share/sonic/virtual_chassis/default_config.json"
fi

SYSTEM_MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}')
sonic-cfggen -a '{"DEVICE_METADATA":{"localhost": {"mac": "'$SYSTEM_MAC_ADDRESS'"}}}' --print-data > /etc/sonic/init_cfg.json
sonic-cfggen -a '{"DEVICE_METADATA":{"localhost": {"mac": "'$SYSTEM_MAC_ADDRESS'"}}}' $CHASS_CFG --print-data > /etc/sonic/init_cfg.json

if [ -f /etc/sonic/config_db.json ]; then
sonic-cfggen -j /etc/sonic/init_cfg.json -j /etc/sonic/config_db.json --print-data > /tmp/config_db.json
Expand All @@ -46,11 +50,39 @@ rm -f /var/run/rsyslogd.pid

supervisorctl start rsyslogd

supervisord_cfg="/etc/supervisor/conf.d/supervisord.conf"
chassis_cfg_file="/usr/share/sonic/virtual_chassis/default_config.json"
chassis_cfg_file_default="/etc/default/sonic-db/default_chassis_cfg.json"
host_template="/usr/share/sonic/templates/hostname.j2"
db_cfg_file="/var/run/redis/sonic-db/database_config.json"
db_cfg_file_tmp="/var/run/redis/sonic-db/database_config.json.tmp"

if [ -r "$chassis_cfg_file" ]; then
echo $(sonic-cfggen -j $chassis_cfg_file -t $host_template) >> /etc/hosts
else
chassis_cfg_file="$chassis_cfg_file_default"
echo "10.8.1.200 redis_chassis.server" >> /etc/hosts
fi

mkdir -p /var/run/redis/sonic-db
cp /etc/default/sonic-db/database_config.json /var/run/redis/sonic-db/

supervisorctl start redis-server

start_chassis_db=`sonic-cfggen -v DEVICE_METADATA.localhost.start_chassis_db -y $chassis_cfg_file`
if [[ "$HOSTNAME" == *"supervisor"* ]] || [ "$start_chassis_db" == "1" ]; then
supervisorctl start redis-chassis
python /usr/bin/chassis_db.py
fi

conn_chassis_db=`sonic-cfggen -v DEVICE_METADATA.localhost.connect_to_chassis_db -y $chassis_cfg_file`
if [ "$start_chassis_db" != "1" ] && [ "$conn_chassis_db" != "1" ]; then
cp $db_cfg_file $db_cfg_file_tmp
remove_chassisdb_config -j $db_cfg_file_tmp
cp $db_cfg_file_tmp $db_cfg_file
fi


/usr/bin/configdb-load.sh

supervisorctl start syncd
Expand Down
8 changes: 8 additions & 0 deletions platform/vs/docker-sonic-vs/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog

[program:redis-chassis]
command=/bin/bash -c "{ [[ -s /var/lib/redis_chassis/dump.rdb ]] || rm -f /var/lib/redis_chassis/dump.rdb; } && mkdir -p /var/lib/redis_chassis && exec /usr/bin/redis-server /etc/redis/redis.conf --bind redis_chassis.server --port 6380 --unixsocket /var/run/redis/redis_chassis.sock --pidfile /var/run/redis/redis_chassis.pid --dir /var/lib/redis_chassis"
priority=3
autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog

[program:syncd]
command=/usr/bin/syncd_start.sh
priority=4
Expand Down
8 changes: 3 additions & 5 deletions rules/docker-fpm-frr.mk
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,17 @@ $(DOCKER_FPM_FRR)_PATH = $(DOCKERS_PATH)/$(DOCKER_FPM_FRR_STEM)
$(DOCKER_FPM_FRR)_PYTHON_WHEELS += $(SONIC_BGPCFGD)

$(DOCKER_FPM_FRR)_DEPENDS += $(FRR) $(FRR_SNMP) $(SWSS) $(LIBYANG)
$(DOCKER_FPM_FRR)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_STRETCH)_DBG_DEPENDS)
$(DOCKER_FPM_FRR)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS)
$(DOCKER_FPM_FRR)_DBG_DEPENDS += $(SWSS_DBG) $(LIBSWSSCOMMON_DBG) \
$(FRR_DBG) $(FRR_SNMP_DBG) $(LIBYANG_DBG)

$(DOCKER_FPM_FRR)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_STRETCH)_DBG_IMAGE_PACKAGES)
$(DOCKER_FPM_FRR)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES)

$(DOCKER_FPM_FRR)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_STRETCH)
$(DOCKER_FPM_FRR)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER)

SONIC_DOCKER_IMAGES += $(DOCKER_FPM_FRR)
SONIC_STRETCH_DOCKERS += $(DOCKER_FPM_FRR)

SONIC_DOCKER_DBG_IMAGES += $(DOCKER_FPM_FRR_DBG)
SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_FPM_FRR_DBG)

$(DOCKER_FPM_FRR)_CONTAINER_NAME = bgp
$(DOCKER_FPM_FRR)_RUN_OPT += --privileged -t
Expand Down
2 changes: 1 addition & 1 deletion rules/docker-platform-monitor.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ $(DOCKER_PLATFORM_MONITOR)_DEPENDS += $(LIBSENSORS) $(LM_SENSORS) $(FANCONTROL)
ifeq ($(CONFIGURED_PLATFORM),barefoot)
$(DOCKER_PLATFORM_MONITOR)_DEPENDS += $(PYTHON_THRIFT)
endif
$(DOCKER_PLATFORM_MONITOR)_PYTHON_DEBS += $(SONIC_LEDD) $(SONIC_XCVRD) $(SONIC_PSUD) $(SONIC_SYSEEPROMD) $(SONIC_THERMALCTLD)
$(DOCKER_PLATFORM_MONITOR)_PYTHON_DEBS += $(SONIC_LEDD) $(SONIC_XCVRD) $(SONIC_PSUD) $(SONIC_SYSEEPROMD) $(SONIC_THERMALCTLD) $(SONIC_PCIED)
$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_PLATFORM_COMMON_PY2)
$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SWSSSDK_PY2)
$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY2)
Expand Down
1 change: 0 additions & 1 deletion rules/libyang.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export LIBYANG_SUBVERSION

LIBYANG = libyang_$(LIBYANG_VERSION)_$(CONFIGURED_ARCH).deb
$(LIBYANG)_SRC_PATH = $(SRC_PATH)/libyang
$(LIBYANG)_DEPENDS += $(SWIG_BASE) $(SWIG)
SONIC_MAKE_DEBS += $(LIBYANG)

LIBYANG_DEV = libyang-dev_$(LIBYANG_VERSION)_$(CONFIGURED_ARCH).deb
Expand Down
6 changes: 5 additions & 1 deletion rules/scripts.mk
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT)_PATH = files/scripts
SYSCTL_NET_CONFIG = sysctl-net.conf
$(SYSCTL_NET_CONFIG)_PATH = files/image_config/sysctl

RM_CHASSISDB_CONFIG_SCRIPT = remove_chassisdb_config
$(RM_CHASSISDB_CONFIG_SCRIPT)_PATH = files/scripts

SONIC_COPY_FILES += $(CONFIGDB_LOAD_SCRIPT) \
$(ARP_UPDATE_SCRIPT) \
$(BUFFERS_CONFIG_TEMPLATE) \
$(QOS_CONFIG_TEMPLATE) \
$(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) \
$(SYSCTL_NET_CONFIG)
$(SYSCTL_NET_CONFIG) \
$(RM_CHASSISDB_CONFIG_SCRIPT)
10 changes: 10 additions & 0 deletions rules/sonic-pcied.dep
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
SPATH:= $($(SONIC_PCIED)_SRC_PATH)
DEP_FILES:= $(SONIC_COMMON_FILES_LIST) rules/sonic-pcied.mk rules/sonic-pcied.dep
DEP_FILES+= $(SONIC_COMMON_BASE_FILES_LIST)
SMDEP_FILES:= $(addprefix $(SPATH)/,$(shell cd $(SPATH) && git ls-files))

$(SONIC_PCIED)_CACHE_MODE:= GIT_CONTENT_SHA
$(SONIC_PCIED)_DEP_FLAGS:= $(SONIC_COMMON_FLAGS_LIST)
$(SONIC_PCIED)_DEP_FILES:= $(DEP_FILES)
$(SONIC_PCIED)_SMDEP_FILES:= $(SMDEP_FILES)
$(SONIC_PCIED)_SMDEP_PATHS:= $(SPATH)
6 changes: 6 additions & 0 deletions rules/sonic-pcied.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# sonic-pcied (SONiC PCIe Monitor daemon) Debian package

SONIC_PCIED = python-sonic-pcied_1.0-1_all.deb
$(SONIC_PCIED)_SRC_PATH = $(SRC_PATH)/sonic-platform-daemons/sonic-pcied
$(SONIC_PCIED)_WHEEL_DEPENDS = $(SONIC_DAEMON_BASE_PY2)
SONIC_PYTHON_STDEB_DEBS += $(SONIC_PCIED)
10 changes: 0 additions & 10 deletions rules/swig.dep

This file was deleted.

21 changes: 0 additions & 21 deletions rules/swig.mk

This file was deleted.

2 changes: 1 addition & 1 deletion rules/swss-common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ LIBSWSSCOMMON = libswsscommon_1.0.0_$(CONFIGURED_ARCH).deb
$(LIBSWSSCOMMON)_SRC_PATH = $(SRC_PATH)/sonic-swss-common
$(LIBSWSSCOMMON)_DEPENDS += $(LIBHIREDIS_DEV) $(LIBNL3_DEV) $(LIBNL_GENL3_DEV) \
$(LIBNL_ROUTE3_DEV) $(LIBNL_NF3_DEV) \
$(LIBNL_CLI_DEV) $(SWIG)
$(LIBNL_CLI_DEV)
$(LIBSWSSCOMMON)_RDEPENDS += $(LIBHIREDIS) $(LIBNL3) $(LIBNL_GENL3) \
$(LIBNL_ROUTE3) $(LIBNL_NF3) $(LIBNL_CLI)
SONIC_DPKG_DEBS += $(LIBSWSSCOMMON)
Expand Down
2 changes: 2 additions & 0 deletions sonic-slave-buster/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,8 @@ RUN apt-get update && apt-get install -y \
# For DHCP Monitor tool
libexplain-dev \
libevent-dev \
# For libyang
swig \
# For SWI Tools
python-m2crypto

Expand Down
2 changes: 2 additions & 0 deletions sonic-slave-stretch/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,8 @@ RUN apt-get update && apt-get install -y \
# For DHCP Monitor tool
libexplain-dev \
libevent-dev \
# For libyang
swig \
# For SWI Tools
python-m2crypto

Expand Down