Skip to content
Merged
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
2 changes: 1 addition & 1 deletion README.buildsystem.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ LIBSWSSCOMMON_DEV = libswsscommon-dev_1.0.0_amd64.deb
$(eval $(call add_derived_package,$(LIBSWSSCOMMON),$(LIBSWSSCOMMON_DEV)))
```
First we define our package swsscommon.
Then we secify **SRC_PATH** (path to sources),
Then we specify **SRC_PATH** (path to sources),
**DEPENDS** (build dependencies),
and **RDEPENDS** (runtime dependencies for docker installation).
Then we add our target to SONIC_DPKG_DEBS target group.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ Every target has a clean target, so in order to clean swss, execute:
It is recommended to use clean targets to clean all packages that are built together, like dev packages for instance. In order to be more familiar with build process and make some changes to it, it is recommended to read this short [Documentation](README.buildsystem.md).

## Build debug dockers and debug SONiC installer image:
SONiC build system supports building dockers and ONE-image with debug tools and debug symbols, to help with live & core debugging. For details refer to [(SONiC Buildimage Guide)](https://github.com/Azure/sonic-buildimage/blob/master/README.buildsystem.md).
SONiC build system supports building dockers and ONIE-image with debug tools and debug symbols, to help with live & core debugging. For details refer to [(SONiC Buildimage Guide)](https://github.com/Azure/sonic-buildimage/blob/master/README.buildsystem.md).

## Notes:
- If you are running make for the first time, a sonic-slave-${USER} docker image will be built automatically.
Expand Down
91 changes: 61 additions & 30 deletions src/sonic-config-engine/config_samples.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import sys

from collections import defaultdict
from ipaddress import ip_interface
from natsort import natsorted

Expand Down Expand Up @@ -37,7 +38,7 @@ def generate_t1_sample_config(data):
'keepalive': '60'
}
port_count += 1
return data;
return data

def generate_empty_config(data):
new_data = {'DEVICE_METADATA': data['DEVICE_METADATA']}
Expand All @@ -47,49 +48,79 @@ def generate_empty_config(data):
new_data['DEVICE_METADATA']['localhost']['type'] = 'LeafRouter'
return new_data

def generate_global_dualtor_tables():
data = defaultdict(lambda: defaultdict(dict))
data['LOOPBACK_INTERFACE'] = {
'Loopback2': {},
'Loopback2|3.3.3.3': {}
}
data['MUX_CABLE'] = {}
data['PEER_SWITCH'] = {
"peer_switch_hostname": {
"address_ipv4": "1.1.1.1"
}
}
data['TUNNEL'] = {
"MuxTunnel0": {
"dscp_mode": "uniform",
"dst_ip": "2.2.2.2",
"ecn_mode": "copy_from_outer",
"encap_ecn_mode": "standard",
"ttl_mode": "pipe",
"tunnel_type": "IPINIP"
}
}
return data

def generate_l2_config(data):
# Check if dual ToR configs are needed
if 'is_dualtor' in data and data['is_dualtor']:
is_dualtor = True
data.pop('is_dualtor')
else:
is_dualtor = False

if 'uplinks' in data:
uplinks = data['uplinks']
data.pop('uplinks')

if 'downlinks' in data:
downlinks = data['downlinks']
data.pop('downlinks')

# VLAN initial data
data['VLAN'] = {'Vlan1000': {'vlanid': '1000'}}
data['VLAN_MEMBER'] = {}

if is_dualtor:
data['DEVICE_METADATA']['localhost']['subtype'] = 'DualToR'
data['LOOPBACK_INTERFACE'] = {
'Loopback2': {},
'Loopback2|3.3.3.3': {}
}
data['MUX_CABLE'] = {}
data['PEER_SWITCH'] = {
"peer_switch_hostname": {
"address_ipv4": "1.1.1.1"
}
}
data['TUNNEL'] = {
"MuxTunnel0": {
"dscp_mode": "uniform",
"dst_ip": "2.2.2.2",
"ecn_mode": "copy_from_outer",
"encap_ecn_mode": "standard",
"ttl_mode": "pipe",
"tunnel_type": "IPINIP"
}
}
data['DEVICE_METADATA']['localhost']['peer_switch'] = 'peer_switch_hostname'
data.update(generate_global_dualtor_tables())

server_ipv4_base = ip_interface(UNICODE_TYPE('192.168.0.1/32'))
server_ipv6_base = ip_interface(UNICODE_TYPE('fc02:1000::1/128'))
for i, port in enumerate(natsorted(data['PORT'])):
data['PORT'][port].setdefault('admin_status', 'up')
data['VLAN_MEMBER']['Vlan1000|{}'.format(port)] = {'tagging_mode': 'untagged'}
server_offset = 1
for port in natsorted(data['PORT']):
if is_dualtor:
mux_cable_entry = {
'server_ipv4': str(server_ipv4_base + i),
'server_ipv6': str(server_ipv6_base + i),
'state': 'auto'
}
data['MUX_CABLE'][port] = mux_cable_entry
# Ports in use should be admin up, unused ports default to admin down
if port in downlinks or port in uplinks:
data['PORT'][port].setdefault('admin_status', 'up')
data['VLAN_MEMBER']['Vlan1000|{}'.format(port)] = {'tagging_mode': 'untagged'}

# Downlinks (connected to mux cable) need a MUX_CABLE entry
# as well as the `mux_cable` field in the PORT table
if port in downlinks:
mux_cable_entry = {
'server_ipv4': str(server_ipv4_base + server_offset),
'server_ipv6': str(server_ipv6_base + server_offset),
'state': 'auto'
}
server_offset += 1
data['MUX_CABLE'][port] = mux_cable_entry
data['PORT'][port]['mux_cable'] = 'true'
else:
data['PORT'][port].setdefault('admin_status', 'up')
data['VLAN_MEMBER']['Vlan1000|{}'.format(port)] = {'tagging_mode': 'untagged'}
return data

_sample_generators = {
Expand Down
Loading