ONEImage - Read all platform dependent information from sonic-config-engine (#238)

Read all platform dependent information from sonic-config-engine
This commit is contained in:
Taoyu Li 2017-02-02 20:34:34 -08:00 committed by GitHub
parent 523a738068
commit 60e1fc3c98
15 changed files with 61 additions and 36 deletions

View File

@ -8,6 +8,9 @@ RUN apt-get install -f -y ifupdown bridge-utils libdbus-1-3 libdaemon0 libjansso
## TODO: implicitly install dependencies ## TODO: implicitly install dependencies
RUN apt-get -y install libjemalloc1 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 \ COPY \
{% for deb in docker_orchagent_debs.split(' ') -%} {% for deb in docker_orchagent_debs.split(' ') -%}
debs/{{ deb }}{{' '}} debs/{{ deb }}{{' '}}

View File

@ -25,32 +25,28 @@ trap clean_up SIGTERM SIGKILL
. /host/machine.conf . /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}'` MAC_ADDRESS=`ip link show eth0 | grep ether | awk '{print $2}'`
ORCHAGENT_ARGS="" ORCHAGENT_ARGS=""
PORTSYNCD_ARGS="" PORTSYNCD_ARGS="-p /usr/share/sonic/$HWSKU/port_config.ini"
SWSSCONFIG_ARGS="00-copp.config.json " 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" 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.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 " 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" ORCHAGENT_ARGS+="-m $MAC_ADDRESS"
PORTSYNCD_ARGS+="-p /etc/ssw/Force10-S6100/port_config.ini" elif [ "$HWSKU" == "Arista-7050-QX32" ]; then
elif [ "$aboot_platform" == "x86_64-arista_7050_qx32" ]; then
ORCHAGENT_ARGS+="-m $MAC_ADDRESS" 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.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 " 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 elif [ "$HWSKU" == "AS7512" ]; then
PORTSYNCD_ARGS+="-p /etc/ssw/ACS-MSN2700/port_config.ini"
elif [ "$onie_platform" == "x86_64-accton_as7512_32x-r0" ]; then
ORCHAGENT_ARGS+="-m $MAC_ADDRESS" ORCHAGENT_ARGS+="-m $MAC_ADDRESS"
PORTSYNCD_ARGS+="-p /etc/ssw/AS7512/port_config.ini"
fi fi
service rsyslog start service rsyslog start

View File

@ -1,14 +1,15 @@
#!/bin/bash #!/bin/bash
#sysDescription is currently mounted, uncomment this line and provide version.yml instead if use copying instead of mounting mkdir -p /etc/ssw
#sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/version.yml -t /etc/swss/snmp/sysDescription.j2 >/etc/ssw/sysDescription
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 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 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` 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 mkdir -p /var/sonic
echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status

View File

@ -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 }}

View File

@ -21,7 +21,6 @@ set -x -e
. functions.sh . functions.sh
BUILD_TEMPLATES=files/build_templates BUILD_TEMPLATES=files/build_templates
IMAGE_CONFIGS=files/image_config IMAGE_CONFIGS=files/image_config
VENDOR_CONFIGS=src/sonic-config-engine/platform
{% if installer_debs.strip() -%} {% if installer_debs.strip() -%}
clean_sys() { 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}} sudo dpkg --root=$FILESYSTEM_ROOT -i {{config_engine}}
# Create all needed directories # 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/
sudo mkdir -p $FILESYSTEM_ROOT/etc/sonic/templates/ 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 # Copy SNMP configuration files
sudo cp $IMAGE_CONFIGS/snmp/snmp.yml $FILESYSTEM_ROOT/etc/sonic/ 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 git_revision=$(git rev-parse --short HEAD)
export sonic_hwsku={{sonic_hwsku}} export sonic_hwsku={{sonic_hwsku}}
export debian_version=`cat $FILESYSTEM_ROOT/etc/debian_version` export debian_version=`cat $FILESYSTEM_ROOT/etc/debian_version`
export kernel_version={{kversion}} export kernel_version={{kversion}}
j2 $BUILD_TEMPLATES/sysDescription.j2 > sysDescription j2 $BUILD_TEMPLATES/sonic_version.yml.j2 > sonic_version.yml
sudo mv sysDescription $FILESYSTEM_ROOT/etc/ssw/ sudo mv sonic_version.yml $FILESYSTEM_ROOT/etc/sonic/
# Copy sudoers configuration file # Copy sudoers configuration file
sudo cp $IMAGE_CONFIGS/sudoers/sudoers $FILESYSTEM_ROOT/etc/ 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(' ') -%} {% for deb in installer_debs.strip().split(' ') -%}
sudo dpkg --extract {{deb}} $FILESYSTEM_ROOT sudo dpkg --extract {{deb}} $FILESYSTEM_ROOT
{% endfor %} {% endfor %}

View File

@ -0,0 +1,4 @@
build_version: {{git_revision}}
build_hwsku: {{sonic_hwsku}}
debian_version: {{debian_version}}
kernel_version: {{kernel_version}}

View File

@ -1 +0,0 @@
SONiC Software Version: SONiC-OS-{{git_revision}} HwSku: {{sonic_hwsku}} - Distribution: Debian {{debian_version}} - Kernel: {{kernel_version}}

View File

@ -2,7 +2,7 @@
DOCKER_ORCHAGENT_BRCM = docker-orchagent-brcm.gz DOCKER_ORCHAGENT_BRCM = docker-orchagent-brcm.gz
$(DOCKER_ORCHAGENT_BRCM)_PATH = $(DOCKERS_PATH)/docker-orchagent $(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) $(DOCKER_ORCHAGENT_BRCM)_LOAD_DOCKERS += $(DOCKER_BASE)
SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_BRCM) SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_BRCM)
SONIC_INSTALL_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)_CONTAINER_NAME = swss
$(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += --net=host --privileged -t $(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += --net=host --privileged -t
$(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += --volumes-from database $(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:/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 /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro
$(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /host/machine.conf:/host/machine.conf $(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /host/machine.conf:/host/machine.conf

View File

@ -2,7 +2,7 @@
DOCKER_ORCHAGENT_CAVM = docker-orchagent-cavm.gz DOCKER_ORCHAGENT_CAVM = docker-orchagent-cavm.gz
$(DOCKER_ORCHAGENT_CAVM)_PATH = $(DOCKERS_PATH)/docker-orchagent $(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) $(DOCKER_ORCHAGENT_CAVM)_LOAD_DOCKERS += $(DOCKER_BASE)
SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_CAVM) SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_CAVM)
SONIC_INSTALL_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)_CONTAINER_NAME = swss
$(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += --net=host --privileged -t $(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += --net=host --privileged -t
$(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += --volumes-from database $(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:/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 /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro
$(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /host/machine.conf:/host/machine.conf $(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /host/machine.conf:/host/machine.conf

View File

@ -2,7 +2,7 @@
DOCKER_ORCHAGENT_MLNX = docker-orchagent-mlnx.gz DOCKER_ORCHAGENT_MLNX = docker-orchagent-mlnx.gz
$(DOCKER_ORCHAGENT_MLNX)_PATH = $(DOCKERS_PATH)/docker-orchagent $(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) $(DOCKER_ORCHAGENT_MLNX)_LOAD_DOCKERS += $(DOCKER_BASE)
SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_MLNX) SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_MLNX)
SONIC_INSTALL_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)_CONTAINER_NAME = swss
$(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += --net=host --privileged -t $(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += --net=host --privileged -t
$(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += --volumes-from database $(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:/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 /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro
$(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /host/machine.conf:/host/machine.conf $(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /host/machine.conf:/host/machine.conf

View File

@ -10,5 +10,4 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SNMP_SV2)
$(DOCKER_SNMP_SV2)_CONTAINER_NAME = snmp $(DOCKER_SNMP_SV2)_CONTAINER_NAME = snmp
$(DOCKER_SNMP_SV2)_RUN_OPT += --net=host --privileged -t $(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 $(DOCKER_SNMP_SV2)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro

View File

@ -1 +0,0 @@
#TODO: Add correct info here

View File

@ -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

View File

@ -1 +0,0 @@
# TODO: Add correct info here

View File

@ -9,8 +9,9 @@ def get_platform_file_list():
data_path = os.path.join(repo_path, 'platform') data_path = os.path.join(repo_path, 'platform')
platforms = os.listdir(data_path) platforms = os.listdir(data_path)
for platform in platforms: for platform in platforms:
files = ['platform/' + platform + '/alias_map.json', files = ['platform/' + platform + '/port_config.ini']
'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') ): 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 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) ) data_files.append( (os.path.join('/usr/share/sonic', platform), files) )