diff --git a/dockers/docker-orchagent/Dockerfile.j2 b/dockers/docker-orchagent/Dockerfile.j2 index cea7cb1a3a..9a72faf333 100755 --- a/dockers/docker-orchagent/Dockerfile.j2 +++ b/dockers/docker-orchagent/Dockerfile.j2 @@ -8,6 +8,9 @@ RUN apt-get install -f -y ifupdown bridge-utils libdbus-1-3 libdaemon0 libjansso ## TODO: implicitly install dependencies RUN apt-get -y install libjemalloc1 +# Dependencies for sonic-cfggen +RUN apt-get install -y python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml + COPY \ {% for deb in docker_orchagent_debs.split(' ') -%} debs/{{ deb }}{{' '}} diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index ca97c03a12..4ef7638809 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -25,32 +25,28 @@ trap clean_up SIGTERM SIGKILL . /host/machine.conf +HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku` + MAC_ADDRESS=`ip link show eth0 | grep ether | awk '{print $2}'` ORCHAGENT_ARGS="" -PORTSYNCD_ARGS="" +PORTSYNCD_ARGS="-p /usr/share/sonic/$HWSKU/port_config.ini" SWSSCONFIG_ARGS="00-copp.config.json " -if [ "$onie_platform" == "x86_64-dell_s6000_s1220-r0" ]; then +if [ "$HWSKU" == "Force10-S6000" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" - PORTSYNCD_ARGS+="-p /etc/ssw/Force10-S6000/port_config.ini" SWSSCONFIG_ARGS+="td2.32ports.qos.1.json td2.32ports.qos.2.json td2.32ports.qos.3.json td2.32ports.qos.4.json td2.32ports.qos.5.json td2.32ports.qos.6.json " SWSSCONFIG_ARGS+="td2.32ports.buffers.1.json td2.32ports.buffers.2.json td2.32ports.buffers.3.json " -elif [ "$onie_platform" == "x86_64-dell_s6100_c2538-r0" ]; then +elif [ "$HWSKU" == "Force10-S6100" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" - PORTSYNCD_ARGS+="-p /etc/ssw/Force10-S6100/port_config.ini" -elif [ "$aboot_platform" == "x86_64-arista_7050_qx32" ]; then +elif [ "$HWSKU" == "Arista-7050-QX32" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" - PORTSYNCD_ARGS+="-p /etc/ssw/Arista-7050-QX32/port_config.ini" SWSSCONFIG_ARGS+="td2.32ports.qos.1.json td2.32ports.qos.2.json td2.32ports.qos.3.json td2.32ports.qos.4.json td2.32ports.qos.5.json td2.32ports.qos.6.json " SWSSCONFIG_ARGS+="td2.32ports.buffers.1.json td2.32ports.buffers.2.json td2.32ports.buffers.3.json " -elif [ "$onie_platform" == "x86_64-mlnx_x86-r5.0.1400" ] || [ "$onie_platform" == "x86_64-mlnx_msn2700-r0" ]; then - PORTSYNCD_ARGS+="-p /etc/ssw/ACS-MSN2700/port_config.ini" -elif [ "$onie_platform" == "x86_64-accton_as7512_32x-r0" ]; then +elif [ "$HWSKU" == "AS7512" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" - PORTSYNCD_ARGS+="-p /etc/ssw/AS7512/port_config.ini" fi service rsyslog start diff --git a/dockers/docker-snmp-sv2/config.sh b/dockers/docker-snmp-sv2/config.sh index d100573d93..0681416b1a 100755 --- a/dockers/docker-snmp-sv2/config.sh +++ b/dockers/docker-snmp-sv2/config.sh @@ -1,14 +1,15 @@ #!/bin/bash -#sysDescription is currently mounted, uncomment this line and provide version.yml instead if use copying instead of mounting -#sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/version.yml -t /etc/swss/snmp/sysDescription.j2 >/etc/ssw/sysDescription +mkdir -p /etc/ssw + +sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/sonic_version.yml -t /etc/swss/snmp/sysDescription.j2 >/etc/ssw/sysDescription mkdir -p /etc/snmp sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/snmp.yml -t /etc/swss/snmp/snmpd.conf.j2 >/etc/snmp/snmpd.conf hwsku=`sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku` -/bin/cp -rf /etc/ssw/$hwsku/alias_map.json /etc/snmp/ +/bin/cp -rf /usr/share/sonic/$hwsku/alias_map.json /etc/snmp/ mkdir -p /var/sonic echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status diff --git a/dockers/docker-snmp-sv2/sysDescription.j2 b/dockers/docker-snmp-sv2/sysDescription.j2 index a4871a6ffd..54860a229d 100644 --- a/dockers/docker-snmp-sv2/sysDescription.j2 +++ b/dockers/docker-snmp-sv2/sysDescription.j2 @@ -1 +1 @@ -SONiC Software Version: {{ sonic_baseimage_version}}.SONiC.{{ sonic_version }} - HwSku: {{ minigraph_hwsku }} +SONiC Software Version: {{ build_version }}.SONiC.v2 - HwSku: {{ minigraph_hwsku }} - Distribution: Debian {{ debian_version }} - Kernel: {{ kernel_version }} diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 00fcf67321..4cebcb2227 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -21,7 +21,6 @@ set -x -e . functions.sh BUILD_TEMPLATES=files/build_templates IMAGE_CONFIGS=files/image_config -VENDOR_CONFIGS=src/sonic-config-engine/platform {% if installer_debs.strip() -%} clean_sys() { @@ -46,7 +45,6 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in sudo dpkg --root=$FILESYSTEM_ROOT -i {{config_engine}} # Create all needed directories -sudo mkdir -p $FILESYSTEM_ROOT/etc/ssw/ sudo mkdir -p $FILESYSTEM_ROOT/etc/sonic/ sudo mkdir -p $FILESYSTEM_ROOT/etc/sonic/templates/ @@ -86,20 +84,17 @@ sudo cp $IMAGE_CONFIGS/interfaces/*.j2 $FILESYSTEM_ROOT/etc/sonic/templates/ # Copy SNMP configuration files sudo cp $IMAGE_CONFIGS/snmp/snmp.yml $FILESYSTEM_ROOT/etc/sonic/ -# Generate system desription file +# Generate build version file export git_revision=$(git rev-parse --short HEAD) export sonic_hwsku={{sonic_hwsku}} export debian_version=`cat $FILESYSTEM_ROOT/etc/debian_version` export kernel_version={{kversion}} -j2 $BUILD_TEMPLATES/sysDescription.j2 > sysDescription -sudo mv sysDescription $FILESYSTEM_ROOT/etc/ssw/ +j2 $BUILD_TEMPLATES/sonic_version.yml.j2 > sonic_version.yml +sudo mv sonic_version.yml $FILESYSTEM_ROOT/etc/sonic/ # Copy sudoers configuration file sudo cp $IMAGE_CONFIGS/sudoers/sudoers $FILESYSTEM_ROOT/etc/ -# Copy vendor specific configuration files -sudo cp -R $VENDOR_CONFIGS/{{sonic_hwsku}}/ $FILESYSTEM_ROOT/etc/ssw/ - {% for deb in installer_debs.strip().split(' ') -%} sudo dpkg --extract {{deb}} $FILESYSTEM_ROOT {% endfor %} diff --git a/files/build_templates/sonic_version.yml.j2 b/files/build_templates/sonic_version.yml.j2 new file mode 100644 index 0000000000..d0dd45aea5 --- /dev/null +++ b/files/build_templates/sonic_version.yml.j2 @@ -0,0 +1,4 @@ +build_version: {{git_revision}} +build_hwsku: {{sonic_hwsku}} +debian_version: {{debian_version}} +kernel_version: {{kernel_version}} diff --git a/files/build_templates/sysDescription.j2 b/files/build_templates/sysDescription.j2 deleted file mode 100644 index cfbdca1333..0000000000 --- a/files/build_templates/sysDescription.j2 +++ /dev/null @@ -1 +0,0 @@ -SONiC Software Version: SONiC-OS-{{git_revision}} HwSku: {{sonic_hwsku}} - Distribution: Debian {{debian_version}} - Kernel: {{kernel_version}} diff --git a/platform/broadcom/docker-orchagent-brcm.mk b/platform/broadcom/docker-orchagent-brcm.mk index 646626ff89..f04103ef15 100644 --- a/platform/broadcom/docker-orchagent-brcm.mk +++ b/platform/broadcom/docker-orchagent-brcm.mk @@ -2,7 +2,7 @@ DOCKER_ORCHAGENT_BRCM = docker-orchagent-brcm.gz $(DOCKER_ORCHAGENT_BRCM)_PATH = $(DOCKERS_PATH)/docker-orchagent -$(DOCKER_ORCHAGENT_BRCM)_DEPENDS += $(SWSS) $(REDIS_TOOLS) +$(DOCKER_ORCHAGENT_BRCM)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(SONIC_CONFIG_ENGINE) $(DOCKER_ORCHAGENT_BRCM)_LOAD_DOCKERS += $(DOCKER_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_BRCM) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_BRCM) @@ -10,7 +10,6 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_BRCM) $(DOCKER_ORCHAGENT_BRCM)_CONTAINER_NAME = swss $(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += --net=host --privileged -t $(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += --volumes-from database -$(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /etc/ssw/:/etc/ssw/:ro $(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /etc/network/interfaces:/etc/network/interfaces:ro $(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro $(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /host/machine.conf:/host/machine.conf diff --git a/platform/cavium/docker-orchagent-cavm.mk b/platform/cavium/docker-orchagent-cavm.mk index 9befdb11e8..e4ea730549 100644 --- a/platform/cavium/docker-orchagent-cavm.mk +++ b/platform/cavium/docker-orchagent-cavm.mk @@ -2,7 +2,7 @@ DOCKER_ORCHAGENT_CAVM = docker-orchagent-cavm.gz $(DOCKER_ORCHAGENT_CAVM)_PATH = $(DOCKERS_PATH)/docker-orchagent -$(DOCKER_ORCHAGENT_CAVM)_DEPENDS += $(SWSS) $(REDIS_TOOLS) +$(DOCKER_ORCHAGENT_CAVM)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(SONIC_CONFIG_ENGINE) $(DOCKER_ORCHAGENT_CAVM)_LOAD_DOCKERS += $(DOCKER_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_CAVM) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_CAVM) @@ -10,7 +10,6 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_CAVM) $(DOCKER_ORCHAGENT_CAVM)_CONTAINER_NAME = swss $(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += --net=host --privileged -t $(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += --volumes-from database -$(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /etc/ssw/:/etc/ssw/:ro $(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /etc/network/interfaces:/etc/network/interfaces:ro $(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro $(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /host/machine.conf:/host/machine.conf diff --git a/platform/mellanox/docker-orchagent-mlnx.mk b/platform/mellanox/docker-orchagent-mlnx.mk index 682c91f45c..5b526cc6f3 100644 --- a/platform/mellanox/docker-orchagent-mlnx.mk +++ b/platform/mellanox/docker-orchagent-mlnx.mk @@ -2,7 +2,7 @@ DOCKER_ORCHAGENT_MLNX = docker-orchagent-mlnx.gz $(DOCKER_ORCHAGENT_MLNX)_PATH = $(DOCKERS_PATH)/docker-orchagent -$(DOCKER_ORCHAGENT_MLNX)_DEPENDS += $(SWSS) $(REDIS_TOOLS) +$(DOCKER_ORCHAGENT_MLNX)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(SONIC_CONFIG_ENGINE) $(DOCKER_ORCHAGENT_MLNX)_LOAD_DOCKERS += $(DOCKER_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_MLNX) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_MLNX) @@ -10,7 +10,6 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_MLNX) $(DOCKER_ORCHAGENT_MLNX)_CONTAINER_NAME = swss $(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += --net=host --privileged -t $(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += --volumes-from database -$(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /etc/ssw/:/etc/ssw/:ro $(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /etc/network/interfaces:/etc/network/interfaces:ro $(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro $(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /host/machine.conf:/host/machine.conf diff --git a/rules/docker-snmp-sv2.mk b/rules/docker-snmp-sv2.mk index 1d55cbded8..e3ed0cf1ea 100644 --- a/rules/docker-snmp-sv2.mk +++ b/rules/docker-snmp-sv2.mk @@ -10,5 +10,4 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SNMP_SV2) $(DOCKER_SNMP_SV2)_CONTAINER_NAME = snmp $(DOCKER_SNMP_SV2)_RUN_OPT += --net=host --privileged -t -$(DOCKER_SNMP_SV2)_RUN_OPT += -v /etc/ssw/:/etc/ssw/:ro $(DOCKER_SNMP_SV2)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/src/sonic-config-engine/platform/AS7512/alias_map.json b/src/sonic-config-engine/platform/AS7512/alias_map.json deleted file mode 100644 index 53be265702..0000000000 --- a/src/sonic-config-engine/platform/AS7512/alias_map.json +++ /dev/null @@ -1 +0,0 @@ -#TODO: Add correct info here diff --git a/src/sonic-config-engine/platform/AS7512/port_config.ini b/src/sonic-config-engine/platform/AS7512/port_config.ini index 1d60deaf60..c35776dcfc 100644 --- a/src/sonic-config-engine/platform/AS7512/port_config.ini +++ b/src/sonic-config-engine/platform/AS7512/port_config.ini @@ -1 +1,33 @@ -# TODO: Add correct info here +# alias lanes +Ethernet0 16,17,18,19 +Ethernet4 20,21,22,23 +Ethernet8 24,25,26,27 +Ethernet12 28,29,30,31 +Ethernet16 32,33,34,35 +Ethernet20 36,37,38,39 +Ethernet24 40,41,42,43 +Ethernet28 44,45,46,47 +Ethernet32 0,1,2,3 +Ethernet36 4,5,6,7 +Ethernet40 8,9,10,11 +Ethernet44 12,13,14,15 +Ethernet48 48,49,50,51 +Ethernet52 52,53,54,55 +Ethernet56 56,57,58,59 +Ethernet60 60,61,62,63 +Ethernet64 127,126,125,124 +Ethernet68 123,122,121,120 +Ethernet72 115,114,113,112 +Ethernet76 119,118,117,116 +Ethernet80 79,78,77,76 +Ethernet84 75,74,73,72 +Ethernet88 64,65,66,67 +Ethernet92 71,70,68,69 +Ethernet96 111,110,109,108 +Ethernet100 107,106,105,104 +Ethernet104 103,102,101,100 +Ethernet108 99,98,97,96 +Ethernet112 95,94,93,92 +Ethernet116 91,90,89,88 +Ethernet120 87,86,85,84 +Ethernet124 83,82,81,80 diff --git a/src/sonic-config-engine/platform/AS7512/sensors.conf b/src/sonic-config-engine/platform/AS7512/sensors.conf deleted file mode 100644 index 1d60deaf60..0000000000 --- a/src/sonic-config-engine/platform/AS7512/sensors.conf +++ /dev/null @@ -1 +0,0 @@ -# TODO: Add correct info here diff --git a/src/sonic-config-engine/setup.py b/src/sonic-config-engine/setup.py index 4c11ceb604..92f1b2f848 100644 --- a/src/sonic-config-engine/setup.py +++ b/src/sonic-config-engine/setup.py @@ -9,8 +9,9 @@ def get_platform_file_list(): data_path = os.path.join(repo_path, 'platform') platforms = os.listdir(data_path) for platform in platforms: - files = ['platform/' + platform + '/alias_map.json', - 'platform/' + platform + '/port_config.ini'] + files = ['platform/' + platform + '/port_config.ini'] + if os.path.isfile( os.path.join(data_path, platform, 'alias_map.json') ): + files.append('platform/' + platform + '/alias_map.json') #If a platform doesnot have alias_map.json minigraph.py will fall back to no alias mapping if os.path.isfile( os.path.join(data_path, platform, 'sensors.conf') ): files.append('platform/' + platform + '/sensors.conf') #Not all platforms need to have a sensors.conf file data_files.append( (os.path.join('/usr/share/sonic', platform), files) )