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

[dpu-appliance] Add support of appliance topology. #20933

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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
39 changes: 37 additions & 2 deletions src/sonic-config-engine/config_samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,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 @@ -255,13 +256,47 @@ 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": {}, "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'][port] = {}
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
17 changes: 17 additions & 0 deletions src/sonic-config-engine/minigraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -2686,6 +2686,23 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
'ca_crt': '/etc/sonic/telemetry/dsmsroot.cer'
}
}
results['FEATURE'] = {
'gnmi': {
'state': 'enabled'
}
}
results['GNMI'] = {
'gnmi': {
'client_auth': 'true',
'port': '50052',
'log_level': '2'
},
'certs': {
'server_crt': '/etc/sonic/telemetry/streamingtelemetryserver.cer',
'server_key': '/etc/sonic/telemetry/streamingtelemetryserver.key',
'ca_crt': '/etc/sonic/telemetry/dsmsroot.cer'
}
}
results['RESTAPI'] = {
'config': {
'client_auth': 'true',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ module sonic-device_metadata {

leaf subtype {
type string {
pattern "DualToR|SmartSwitch|Supervisor|UpstreamLC|DownstreamLC";
pattern "Appliance|DualToR|SmartSwitch|Supervisor|UpstreamLC|DownstreamLC";
}
}

Expand Down
Loading