Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add configuration optimization to run SONiC on Appliance DPU #24

Closed
wants to merge 1 commit into from
Closed
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
5 changes: 5 additions & 0 deletions dockers/docker-orchagent/ipinip.json.j2
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{% if DEVICE_METADATA['localhost']['switch_type'] == "dpu" %}
[]
{% else %}
{% set ipv4_addresses = [] %}
{% set ipv6_addresses = [] %}
{% set ipv4_loopback_addresses = [] %}
Expand Down Expand Up @@ -77,3 +80,5 @@
}
{% endif %}
]
{% endif %}

3 changes: 3 additions & 0 deletions dockers/docker-orchagent/orchagent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ if [[ x"${LOCALHOST_SUBTYPE}" == x"SmartSwitch" ]]; then
else
ORCHAGENT_ARGS+=" -q tcp://127.0.0.1:8100"
fi
# Enable ZMQ for DPU Appliance
elif [[ x"${LOCALHOST_SUBTYPE}" == x"Appliance" ]]; then
ORCHAGENT_ARGS+=" -q tcp://127.0.0.1:8100"
fi

exec /usr/bin/orchagent ${ORCHAGENT_ARGS}
2 changes: 2 additions & 0 deletions dockers/docker-orchagent/switch.json.j2
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@
[
{
"SWITCH_TABLE:switch": {
{% if DEVICE_METADATA.localhost.switch_type != "dpu" %}
"ecmp_hash_seed": "{{ hash_seed_value }}",
"lag_hash_seed": "{{ hash_seed_value }}",
"fdb_aging_time": "600",
{% if DEVICE_METADATA.localhost.type and "LeafRouter" in DEVICE_METADATA.localhost.type %}
"ordered_ecmp": "true"
{% else %}
"ordered_ecmp": "false"
{% endif %}
{% endif %}
},
"OP": "SET"
Expand Down
4 changes: 4 additions & 0 deletions dockers/docker-platform-monitor/docker_init.j2
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ if [ -e $SENSORS_CONF_PATH_GETTER ]; then
fi
{% endif %}

{% if CONFIGURED_PLATFORM == "nvidia-bluefield" %}
mount -t debugfs none /sys/kernel/debug
{% endif %}

if [ -e $SENSORS_CONF_FILE ]; then
HAVE_SENSORS_CONF=1
mkdir -p /etc/sensors.d
Expand Down
4 changes: 2 additions & 2 deletions dockers/docker-sonic-gnmi/gnmi-native.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ else
TELEMETRY_ARGS+=" -v=2"
fi

# Enable ZMQ for SmartSwitch
# Enable ZMQ for SmartSwitch or DPU Appliance
LOCALHOST_SUBTYPE=`sonic-db-cli CONFIG_DB hget "DEVICE_METADATA|localhost" "subtype"`
if [[ x"${LOCALHOST_SUBTYPE}" == x"SmartSwitch" ]]; then
if [[ x"${LOCALHOST_SUBTYPE}" == x"SmartSwitch" || x"${LOCALHOST_SUBTYPE}" == x"Appliance" ]]; then
TELEMETRY_ARGS+=" -zmq_port=8100"
fi

Expand Down
38 changes: 36 additions & 2 deletions src/sonic-config-engine/config_samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ def generate_common_config(data):
# 'l2': generate_l2_config,
# 'empty': generate_empty_config,
# 'l1': generate_l1_config,
# 'l3': generate_l3_config
# 'l3': generate_l3_config,
# 'appliance': generate_appliance_config

def generate_l1_config(data):
for port in natsorted(data['PORT']):
Expand Down Expand Up @@ -194,13 +195,46 @@ def generate_l2_config(data):
data['VLAN_MEMBER']['Vlan1000|{}'.format(port)] = {'tagging_mode': 'untagged'}
return data

def generate_appliance_config(data):
data['DEVICE_METADATA']['localhost']['hostname'] = 'sonic'
data['DEVICE_METADATA']['localhost']['switch_type'] = 'dpu'
data['DEVICE_METADATA']['localhost']['type'] = 'SonicHost'
data['DEVICE_METADATA']['localhost']['subtype'] = 'Appliance'
data['DEVICE_METADATA']['localhost']['bgp_asn'] = '65100'
data['LOOPBACK_INTERFACE'] = {"Loopback0|10.1.0.1/32": {}}
data['BGP_NEIGHBOR'] = {}
data['DEVICE_NEIGHBOR'] = {}
data['INTERFACE'] = {}
port_number = 0
total_port_amount = len(data['PORT'])
for port in natsorted(data['PORT']):
data['PORT'][port]['admin_status'] = 'up'
data['PORT'][port]['mtu'] = '9100'
local_addr = '10.0.{}.{}'.format(2 * port_number // 256, 2 * port_number % 256)
peer_addr = '10.0.{}.{}'.format(2 * port_number // 256, 2 * port_number % 256 + 1)
peer_name='ARISTA{0:02d}T1'.format(1 + port_number % (total_port_amount // 2 or 1))
peer_asn = 64001 + port_number
data['INTERFACE']['{}|{}/31'.format(port, local_addr)] = {}
data['BGP_NEIGHBOR'][peer_addr] = {
'rrclient': 0,
'name': peer_name,
'local_addr': local_addr,
'nhopself': 0,
'holdtime': '180',
'asn': str(peer_asn),
'keepalive': '60'
}
port_number += 1
return data

_sample_generators = {
't1': generate_t1_sample_config,
'l2': generate_l2_config,
't1-smartswitch': generate_t1_smartswitch_sample_config,
'empty': generate_empty_config,
'l1': generate_l1_config,
'l3': generate_l3_config
'l3': generate_l3_config,
'appliance': generate_appliance_config
}

def get_available_config():
Expand Down