File tree 11 files changed +33
-15
lines changed
docker-config-engine-buster
docker-config-engine-stretch
11 files changed +33
-15
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,9 @@ RUN pip install \
39
39
{{ install_python_wheels(docker_config_engine_buster_whls.split(' ')) }}
40
40
{% endif %}
41
41
42
+ # Copy files
43
+ COPY ["files/swss_vars.j2", "/usr/share/sonic/templates/"]
44
+
42
45
## Clean up
43
46
RUN apt-get purge -y \
44
47
python-pip \
Original file line number Diff line number Diff line change @@ -38,6 +38,9 @@ RUN pip install \
38
38
{{ install_python_wheels(docker_config_engine_stretch_whls.split(' ')) }}
39
39
{% endif %}
40
40
41
+ # Copy files
42
+ COPY ["files/swss_vars.j2", "/usr/share/sonic/templates/"]
43
+
41
44
## Clean up
42
45
RUN apt-get purge -y \
43
46
python-pip \
Original file line number Diff line number Diff line change @@ -42,6 +42,9 @@ python-wheels/{{ whl }}{{' '}}
42
42
{% - endfor %}
43
43
{% - endif -%}
44
44
45
+ # Copy files
46
+ COPY ["files/swss_vars.j2", "/usr/share/sonic/templates/"]
47
+
45
48
## Clean up
46
49
RUN apt-get purge -y python-pip python-dev; apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
47
50
RUN rm -rf /debs /python-wheels
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
- EXIT_SWSS_VARS_FILE_NOT_FOUND=1
4
3
SWSS_VARS_FILE=/usr/share/sonic/templates/swss_vars.j2
5
4
6
- if [ ! -f " $SWSS_VARS_FILE " ]; then
7
- echo " SWSS vars template file not found"
8
- exit $EXIT_SWSS_VARS_FILE_NOT_FOUND
9
- fi
10
-
11
5
# Retrieve SWSS vars from sonic-cfggen
12
- SWSS_VARS=$( sonic-cfggen -d -y /etc/sonic/sonic_version.yml -t $SWSS_VARS_FILE )
6
+ SWSS_VARS=$( sonic-cfggen -d -y /etc/sonic/sonic_version.yml -t $SWSS_VARS_FILE ) || exit 1
13
7
export platform=$( echo $SWSS_VARS | jq -r ' .asic_type' )
14
8
15
9
MAC_ADDRESS=$( echo $SWSS_VARS | jq -r ' .mac' )
Original file line number Diff line number Diff line change 2
2
"asic_type": "{{ asic_type }}",
3
3
"asic_id": "{{ DEVICE_METADATA.localhost.asic_id }}",
4
4
"mac": "{{ DEVICE_METADATA.localhost.mac }}",
5
- "synchronous_mode": "{{ DEVICE_METADATA.localhost.synchronous_mode }}"
5
+ "synchronous_mode": {% if DEVICE_METADATA .localhost .synchronous_mode == "enable" %} "enable" {% else %} "disable" {% endif %}
6
6
}
7
-
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
- MAC_ADDRESS=$( sonic-cfggen -d -v ' DEVICE_METADATA.localhost.mac' )
3
+ SWSS_VARS_FILE=/usr/share/sonic/templates/swss_vars.j2
4
+
5
+ # Retrieve SWSS vars from sonic-cfggen
6
+ SWSS_VARS=$( sonic-cfggen -d -y /etc/sonic/sonic_version.yml -t $SWSS_VARS_FILE ) || exit 1
7
+
8
+ MAC_ADDRESS=$( echo $SWSS_VARS | jq -r ' .mac' )
4
9
if [ " $MAC_ADDRESS " == " None" ] || [ -z " $MAC_ADDRESS " ]; then
5
10
MAC_ADDRESS=$( ip link show eth0 | grep ether | awk ' {print $2}' )
6
11
logger " Mac address not found in Device Metadata, Falling back to eth0"
@@ -14,7 +19,7 @@ ORCHAGENT_ARGS="-d /var/log/swss "
14
19
ORCHAGENT_ARGS+=" -b 8192 "
15
20
16
21
# Set synchronous mode if it is enabled in CONFIG_DB
17
- SYNC_MODE=$( sonic-cfggen -d -v DEVICE_METADATA.localhost. synchronous_mode)
22
+ SYNC_MODE=$( echo $SWSS_VARS | jq -r ' . synchronous_mode' )
18
23
if [ " $SYNC_MODE " == " enable" ]; then
19
24
ORCHAGENT_ARGS+=" -s "
20
25
fi
Original file line number Diff line number Diff line change 6
6
export platform=$fake_platform
7
7
fi
8
8
9
- CFG_VARS=$( sonic-cfggen -d --var-json ' DEVICE_METADATA' )
10
- MAC_ADDRESS=$( echo $CFG_VARS | jq -r ' .localhost.mac' )
9
+ SWSS_VARS_FILE=/usr/share/sonic/templates/swss_vars.j2
10
+
11
+ # Retrieve SWSS vars from sonic-cfggen
12
+ SWSS_VARS=$( sonic-cfggen -d -y /etc/sonic/sonic_version.yml -t $SWSS_VARS_FILE ) || exit 1
13
+
14
+ MAC_ADDRESS=$( echo $SWSS_VARS | jq -r ' .mac' )
11
15
if [ " $MAC_ADDRESS " == " None" ] || [ -z " $MAC_ADDRESS " ]; then
12
16
MAC_ADDRESS=$( ip link show eth0 | grep ether | awk ' {print $2}' )
13
17
logger " Mac address not found in Device Metadata, Falling back to eth0"
@@ -21,7 +25,7 @@ ORCHAGENT_ARGS="-d /var/log/swss "
21
25
ORCHAGENT_ARGS+=" -b 8192 "
22
26
23
27
# Set synchronous mode if it is enabled in CONFIG_DB
24
- SYNC_MODE=$( echo $CFG_VARS | jq -r ' .localhost .synchronous_mode' )
28
+ SYNC_MODE=$( echo $SWSS_VARS | jq -r ' .synchronous_mode' )
25
29
if [ " $SYNC_MODE " == " enable" ]; then
26
30
ORCHAGENT_ARGS+=" -s "
27
31
fi
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ $(DOCKER_CONFIG_ENGINE_BUSTER)_PYTHON_WHEELS += $(SWSSSDK_PY2)
7
7
$(DOCKER_CONFIG_ENGINE_BUSTER)_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY2 )
8
8
$(DOCKER_CONFIG_ENGINE_BUSTER)_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE_PY2 )
9
9
$(DOCKER_CONFIG_ENGINE_BUSTER)_LOAD_DOCKERS += $(DOCKER_BASE_BUSTER )
10
+ $(DOCKER_CONFIG_ENGINE_BUSTER)_FILES += $(SWSS_VARS_TEMPLATE )
10
11
11
12
$(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS = $($(DOCKER_BASE_BUSTER ) _DBG_DEPENDS)
12
13
$(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES = $($(DOCKER_BASE_BUSTER ) _DBG_IMAGE_PACKAGES)
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ $(DOCKER_CONFIG_ENGINE_STRETCH)_PYTHON_WHEELS += $(SWSSSDK_PY2)
6
6
$(DOCKER_CONFIG_ENGINE_STRETCH)_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY2 )
7
7
$(DOCKER_CONFIG_ENGINE_STRETCH)_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE_PY2 )
8
8
$(DOCKER_CONFIG_ENGINE_STRETCH)_LOAD_DOCKERS += $(DOCKER_BASE_STRETCH )
9
+ $(DOCKER_CONFIG_ENGINE_STRETCH)_FILES += $(SWSS_VARS_TEMPLATE )
9
10
10
11
$(DOCKER_CONFIG_ENGINE_STRETCH)_DBG_DEPENDS = $($(DOCKER_BASE_STRETCH ) _DBG_DEPENDS)
11
12
$(DOCKER_CONFIG_ENGINE_STRETCH)_DBG_IMAGE_PACKAGES = $($(DOCKER_BASE_STRETCH ) _DBG_IMAGE_PACKAGES)
Original file line number Diff line number Diff line change @@ -6,4 +6,5 @@ $(DOCKER_CONFIG_ENGINE)_PYTHON_WHEELS += $(SWSSSDK_PY2)
6
6
$(DOCKER_CONFIG_ENGINE)_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY2 )
7
7
$(DOCKER_CONFIG_ENGINE)_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE_PY2 )
8
8
$(DOCKER_CONFIG_ENGINE)_LOAD_DOCKERS += $(DOCKER_BASE )
9
+ $(DOCKER_CONFIG_ENGINE)_FILES += $(SWSS_VARS_TEMPLATE )
9
10
SONIC_DOCKER_IMAGES += $(DOCKER_CONFIG_ENGINE )
Original file line number Diff line number Diff line change @@ -23,11 +23,15 @@ $(SYSCTL_NET_CONFIG)_PATH = files/image_config/sysctl
23
23
UPDATE_CHASSISDB_CONFIG_SCRIPT = update_chassisdb_config
24
24
$(UPDATE_CHASSISDB_CONFIG_SCRIPT)_PATH = files/scripts
25
25
26
+ SWSS_VARS_TEMPLATE = swss_vars.j2
27
+ $(SWSS_VARS_TEMPLATE)_PATH = files/build_templates
28
+
26
29
SONIC_COPY_FILES += $(CONFIGDB_LOAD_SCRIPT ) \
27
30
$(ARP_UPDATE_SCRIPT ) \
28
31
$(ARP_UPDATE_VARS_TEMPLATE ) \
29
32
$(BUFFERS_CONFIG_TEMPLATE ) \
30
33
$(QOS_CONFIG_TEMPLATE ) \
31
34
$(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT ) \
32
35
$(SYSCTL_NET_CONFIG ) \
33
- $(UPDATE_CHASSISDB_CONFIG_SCRIPT )
36
+ $(UPDATE_CHASSISDB_CONFIG_SCRIPT ) \
37
+ $(SWSS_VARS_TEMPLATE )
You can’t perform that action at this time.
0 commit comments