Skip to content

Commit

Permalink
Update docker-sonic-vs infrastructure in order to run CoPP UT (#10230)
Browse files Browse the repository at this point in the history
*Changes to run CoPP UT in docker-sonic-vs
  • Loading branch information
noaOrMlnx authored Mar 22, 2022
1 parent 1851827 commit 4f021c4
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion files/image_config/copp/copp_cfg.j2
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"trap_group": "queue4_group3"
},
{% if not (DEVICE_METADATA is defined and DEVICE_METADATA['localhost'] is defined and DEVICE_METADATA['localhost']['type'] is defined and DEVICE_METADATA['localhost']['type'] != "ToRRouter") %}
"dhcp": {
"dhcp_relay": {
"trap_ids": "dhcp,dhcpv6",
"trap_group": "queue4_group3"
},
Expand Down
1 change: 1 addition & 0 deletions platform/vs/docker-sonic-vs/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ COPY ["files/sonic_version.yml", "/etc/sonic/"]
COPY ["port_breakout_config_db.json", "/etc/sonic/"]
COPY ["database_config.json", "/etc/default/sonic-db/"]
COPY ["hostname.j2", "/usr/share/sonic/templates/"]
COPY ["init_cfg.json.j2", "/usr/share/sonic/templates/"]
COPY ["default_chassis_cfg.json", "/etc/default/sonic-db/"]
COPY ["asic_table.json", "/etc/sonic/"]
COPY ["zero_profiles.json", "/etc/sonic"]
Expand Down
16 changes: 16 additions & 0 deletions platform/vs/docker-sonic-vs/init_cfg.json.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"DEVICE_METADATA": {
"localhost": {
"mac": "{{ system_mac }}",
"buffer_model": "traditional"
}
},
{% set features = ["swss", "bgp", "teamd", "nat", "database", "lldp", "dhcp_relay", "macsec"] %}
"FEATURE": {
{% for feature in features %}
"{{ feature }}": {
"state": "enabled"
}{% if not loop.last %},{% endif %}
{% endfor %}
}
}
2 changes: 1 addition & 1 deletion platform/vs/docker-sonic-vs/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ mkdir -p /var/run/redis/sonic-db
cp /etc/default/sonic-db/database_config.json /var/run/redis/sonic-db/

SYSTEM_MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}')
sonic-cfggen -a '{"DEVICE_METADATA":{"localhost": {"mac": "'$SYSTEM_MAC_ADDRESS'", "buffer_model": "traditional"}}}' $CHASS_CFG --print-data > /etc/sonic/init_cfg.json
sonic-cfggen -t /usr/share/sonic/templates/init_cfg.json.j2 -a "{\"system_mac\": \"$SYSTEM_MAC_ADDRESS\"}" $CHASS_CFG > /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 Down

0 comments on commit 4f021c4

Please sign in to comment.