diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py
index 1446457eb513..b1ad117d255c 100644
--- a/src/sonic-config-engine/minigraph.py
+++ b/src/sonic-config-engine/minigraph.py
@@ -66,7 +66,9 @@ def default(self, obj):
def get_peer_switch_info(link_metadata, devices):
peer_switch_table = {}
- for data in link_metadata.values():
+ peer_switch_ip = None
+ mux_tunnel_name = None
+ for port, data in link_metadata.items():
if "PeerSwitch" in data:
peer_hostname = data["PeerSwitch"]
peer_lo_addr_str = devices[peer_hostname]["lo_addr"]
@@ -75,8 +77,10 @@ def get_peer_switch_info(link_metadata, devices):
peer_switch_table[peer_hostname] = {
'address_ipv4': str(peer_lo_addr.network_address) if peer_lo_addr else peer_lo_addr_str
}
+ mux_tunnel_name = port
+ peer_switch_ip = peer_switch_table[peer_hostname]['address_ipv4']
- return peer_switch_table
+ return peer_switch_table, mux_tunnel_name, peer_switch_ip
def parse_device(device):
@@ -410,6 +414,8 @@ def parse_dpg(dpg, hname):
mgmtintfs = None
subintfs = None
tunnelintfs = defaultdict(dict)
+ tunnelintfs_qos_remap_config = defaultdict(dict)
+
for child in dpg:
"""
In Multi-NPU platforms the acl intfs are defined only for the host not for individual asic.
@@ -717,6 +723,13 @@ def parse_dpg(dpg, hname):
"ecn_mode": "EcnDecapsulationMode",
"dscp_mode": "DifferentiatedServicesCodePointMode",
"ttl_mode": "TtlMode"}
+
+ tunnel_qos_remap_table_key_to_mg_key_map = {
+ "decap_dscp_to_tc_map": "DecapDscpToTcMap",
+ "decap_tc_to_pg_map": "DecapTcToPgMap",
+ "encap_tc_to_queue_map": "EncapTcToQueueMap",
+ "encap_tc_to_dscp_map": "EncapTcToDscpMap"}
+
for mg_tunnel in mg_tunnels.findall(str(QName(ns, "TunnelInterface"))):
tunnel_type = mg_tunnel.attrib["Type"]
tunnel_name = mg_tunnel.attrib["Name"]
@@ -728,9 +741,17 @@ def parse_dpg(dpg, hname):
# If the minigraph has the key, add the corresponding config DB key to the table
if mg_key in mg_tunnel.attrib:
tunnelintfs[tunnel_type][tunnel_name][table_key] = mg_tunnel.attrib[mg_key]
+
+ tunnelintfs_qos_remap_config[tunnel_type][tunnel_name] = {
+ "tunnel_type": mg_tunnel.attrib["Type"].upper(),
+ }
- return intfs, lo_intfs, mvrf, mgmt_intf, voq_inband_intfs, vlans, vlan_members, dhcp_relay_table, pcs, pc_members, acls, vni, tunnelintfs, dpg_ecmp_content, static_routes
- return None, None, None, None, None, None, None, None, None, None, None, None, None, None, None
+ for table_key, mg_key in tunnel_qos_remap_table_key_to_mg_key_map.items():
+ if mg_key in mg_tunnel.attrib:
+ tunnelintfs_qos_remap_config[tunnel_type][tunnel_name][table_key] = mg_tunnel.attrib[mg_key]
+
+ return intfs, lo_intfs, mvrf, mgmt_intf, voq_inband_intfs, vlans, vlan_members, dhcp_relay_table, pcs, pc_members, acls, vni, tunnelintfs, dpg_ecmp_content, static_routes, tunnelintfs_qos_remap_config
+ return None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None
@@ -909,6 +930,29 @@ def parse_meta(meta, hname):
return syslog_servers, dhcp_servers, dhcpv6_servers, ntp_servers, tacacs_servers, mgmt_routes, erspan_dst, deployment_id, region, cloudtype, resource_type, downstream_subrole, switch_id, switch_type, max_cores, kube_data
+def parse_system_defaults(meta):
+ system_default_values = {}
+
+ system_defaults = meta.find(str(QName(ns1, "SystemDefaults")))
+
+ if system_defaults is None:
+ return system_default_values
+
+ for system_default in system_defaults.findall(str(QName(ns1, "SystemDefault"))):
+ name = system_default.find(str(QName(ns1, "Name"))).text
+ value = system_default.find(str(QName(ns1, "Value"))).text
+
+ # Tunnel Qos remapping
+ if name == "TunnelQosRemapEnabled":
+ if value.lower() == "true":
+ status = "enabled"
+ else:
+ status = "disabled"
+ system_default_values["tunnel_qos_remap"] = {"status": status}
+
+ return system_default_values
+
+
def parse_linkmeta(meta, hname):
link = meta.find(str(QName(ns, "Link")))
linkmetas = {}
@@ -1200,6 +1244,7 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
vlan_intfs = None
pc_intfs = None
tunnel_intfs = None
+ tunnel_intfs_qos_remap_config = None
vlans = None
vlan_members = None
dhcp_relay_table = None
@@ -1240,6 +1285,7 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
local_devices = []
kube_data = {}
static_routes = {}
+ system_defaults = {}
hwsku_qn = QName(ns, "HwSku")
hostname_qn = QName(ns, "Hostname")
@@ -1262,7 +1308,7 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
for child in root:
if asic_name is None:
if child.tag == str(QName(ns, "DpgDec")):
- (intfs, lo_intfs, mvrf, mgmt_intf, voq_inband_intfs, vlans, vlan_members, dhcp_relay_table, pcs, pc_members, acls, vni, tunnel_intfs, dpg_ecmp_content, static_routes) = parse_dpg(child, hostname)
+ (intfs, lo_intfs, mvrf, mgmt_intf, voq_inband_intfs, vlans, vlan_members, dhcp_relay_table, pcs, pc_members, acls, vni, tunnel_intfs, dpg_ecmp_content, static_routes, tunnel_intfs_qos_remap_config) = parse_dpg(child, hostname)
elif child.tag == str(QName(ns, "CpgDec")):
(bgp_sessions, bgp_internal_sessions, bgp_voq_chassis_sessions, bgp_asn, bgp_peers_with_range, bgp_monitors) = parse_cpg(child, hostname)
elif child.tag == str(QName(ns, "PngDec")):
@@ -1275,9 +1321,11 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
linkmetas = parse_linkmeta(child, hostname)
elif child.tag == str(QName(ns, "DeviceInfos")):
(port_speeds_default, port_descriptions, sys_ports) = parse_deviceinfo(child, hwsku)
+ elif child.tag == str(QName(ns, "SystemDefaultsDeclaration")):
+ system_defaults = parse_system_defaults(child)
else:
if child.tag == str(QName(ns, "DpgDec")):
- (intfs, lo_intfs, mvrf, mgmt_intf, voq_inband_intfs, vlans, vlan_members, dhcp_relay_table, pcs, pc_members, acls, vni, tunnel_intfs, dpg_ecmp_content, static_routes) = parse_dpg(child, asic_name)
+ (intfs, lo_intfs, mvrf, mgmt_intf, voq_inband_intfs, vlans, vlan_members, dhcp_relay_table, pcs, pc_members, acls, vni, tunnel_intfs, dpg_ecmp_content, static_routes, tunnel_intfs_qos_remap_config) = parse_dpg(child, asic_name)
host_lo_intfs = parse_host_loopback(child, hostname)
elif child.tag == str(QName(ns, "CpgDec")):
(bgp_sessions, bgp_internal_sessions, bgp_voq_chassis_sessions, bgp_asn, bgp_peers_with_range, bgp_monitors) = parse_cpg(child, asic_name, local_devices)
@@ -1289,6 +1337,8 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
linkmetas = parse_linkmeta(child, hostname)
elif child.tag == str(QName(ns, "DeviceInfos")):
(port_speeds_default, port_descriptions, sys_ports) = parse_deviceinfo(child, hwsku)
+ elif child.tag == str(QName(ns, "SystemDefaultsDeclaration")):
+ system_defaults = parse_system_defaults(child)
# set the host device type in asic metadata also
device_type = [devices[key]['type'] for key in devices if key.lower() == hostname.lower()][0]
@@ -1324,8 +1374,11 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
'ip': kube_data.get('ip', '')
}
}
-
- results['PEER_SWITCH'] = get_peer_switch_info(linkmetas, devices)
+
+ if len(system_defaults) > 0:
+ results['SYSTEM_DEFAULTS'] = system_defaults
+
+ results['PEER_SWITCH'], mux_tunnel_name, peer_switch_ip = get_peer_switch_info(linkmetas, devices)
if bool(results['PEER_SWITCH']):
results['DEVICE_METADATA']['localhost']['subtype'] = 'DualToR'
@@ -1625,7 +1678,8 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
results['VLAN'] = vlans
results['VLAN_MEMBER'] = vlan_members
- results['TUNNEL'] = get_tunnel_entries(tunnel_intfs, lo_intfs, hostname)
+ # Add src_ip and qos remapping config into TUNNEL table if tunnel_qos_remap is enabled
+ results['TUNNEL'] = get_tunnel_entries(tunnel_intfs, tunnel_intfs_qos_remap_config, lo_intfs, system_defaults.get('tunnel_qos_remap', {}), mux_tunnel_name, peer_switch_ip)
results['MUX_CABLE'] = get_mux_cable_entries(mux_cable_ports, neighbors, devices)
@@ -1717,7 +1771,7 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
return results
-def get_tunnel_entries(tunnel_intfs, lo_intfs, hostname):
+def get_tunnel_entries(tunnel_intfs, tunnel_intfs_qos_remap_config, lo_intfs, tunnel_qos_remap, mux_tunnel_name, peer_switch_ip):
lo_addr = ''
# Use the first IPv4 loopback as the tunnel destination IP
for addr in lo_intfs.keys():
@@ -1730,7 +1784,14 @@ def get_tunnel_entries(tunnel_intfs, lo_intfs, hostname):
for type, tunnel_dict in tunnel_intfs.items():
for tunnel_key, tunnel_attr in tunnel_dict.items():
tunnel_attr['dst_ip'] = lo_addr
+
+ if (tunnel_qos_remap.get('status') == 'enabled') and (mux_tunnel_name == tunnel_key) and (peer_switch_ip is not None):
+ tunnel_attr['src_ip'] = peer_switch_ip
+ if tunnel_key in tunnel_intfs_qos_remap_config[type]:
+ tunnel_attr.update(tunnel_intfs_qos_remap_config[type][tunnel_key].items())
+
tunnels[tunnel_key] = tunnel_attr
+
return tunnels
def get_mux_cable_entries(mux_cable_ports, neighbors, devices):
@@ -1754,7 +1815,7 @@ def get_mux_cable_entries(mux_cable_ports, neighbors, devices):
entry['server_ipv6'] = str(server_ipv6_lo_prefix)
mux_cable_table[intf] = entry
else:
- print("Warning: no server IPv4 loopback found for {}, skipping mux cable table entry".format(neighbor))
+ print("Warning: no server IPv4 loopback found for {}, skipping mux cable table entry".format(neighbor), file=sys.stderr)
if cable_name in devices:
cable_type = devices[cable_name].get('subtype')
@@ -1767,9 +1828,9 @@ def get_mux_cable_entries(mux_cable_ports, neighbors, devices):
soc_ipv4_prefix = ipaddress.ip_network(UNICODE_TYPE(soc_ipv4))
mux_cable_table[intf]['soc_ipv4'] = str(soc_ipv4_prefix)
else:
- print("Warning: skip parsing device %s for mux cable entry, cable type %s not supported" % (cable_name, cable_type))
+ print("Warning: skip parsing device %s for mux cable entry, cable type %s not supported" % (cable_name, cable_type), file=sys.stderr)
else:
- print("Warning: skip parsing device %s for mux cable entry, device definition not found" % cable_name)
+ print("Warning: skip parsing device %s for mux cable entry, device definition not found" % cable_name, file=sys.stderr)
return mux_cable_table
diff --git a/src/sonic-config-engine/tests/simple-sample-graph-case-remap-disabled.xml b/src/sonic-config-engine/tests/simple-sample-graph-case-remap-disabled.xml
new file mode 100644
index 000000000000..7d0be06e4e82
--- /dev/null
+++ b/src/sonic-config-engine/tests/simple-sample-graph-case-remap-disabled.xml
@@ -0,0 +1,894 @@
+
+
+
+
+
+ false
+ switch-t0
+ 10.0.0.56
+ ARISTA01T1
+ 10.0.0.57
+ 1
+ 180
+ 60
+
+
+ switch-t0
+ FC00::71
+ ARISTA01T1
+ FC00::72
+ 1
+ 180
+ 60
+
+
+ false
+ switch-t0
+ 10.0.0.58
+ ARISTA02T1
+ 10.0.0.59
+ 1
+ 180
+ 60
+
+
+ switch-t0
+ FC00::75
+ ARISTA02T1
+ FC00::76
+ 1
+ 180
+ 60
+
+
+
+
+ 65100
+ switch-t0
+
+
+ 10.0.0.57
+
+
+
+
+
+ 10.0.0.59
+
+
+
+
+
+
+
+
+ 64600
+ ARISTA01T1
+
+
+
+ 64600
+ ARISTA02T1
+
+
+
+ 64600
+ ARISTA03T1
+
+
+
+ 64600
+ ARISTA04T1
+
+
+
+
+
+
+
+
+
+ HostIP
+ Loopback0
+
+ 10.1.0.32/32
+
+ 10.1.0.32/32
+
+
+ HostIP1
+ Loopback0
+
+ FC00:1::32/128
+
+ FC00:1::32/128
+
+
+
+
+ HostIP
+ eth0
+
+ 10.0.0.100/24
+
+ 10.0.0.100/24
+
+
+
+
+
+
+ switch-t0
+
+
+ PortChannel01
+ fortyGigE0/4
+
+
+
+
+
+
+
+
+ ab1
+ fortyGigE0/8
+ 192.0.0.1;192.0.0.2
+ fc02:2000::1;fc02:2000::2
+ 1000
+ 1000
+ 192.168.0.0/27
+ 00:aa:bb:cc:dd:ee
+
+
+ ab2
+ fortyGigE0/4
+ 192.0.0.1
+ fc02:2000::3;fc02:2000::4
+ 2000
+ 2000
+
+
+
+
+
+
+ PortChannel01
+ 10.0.0.56/31
+
+
+
+ PortChannel01
+ FC00::71/126
+
+
+
+ fortyGigE0/0
+ 10.0.0.58/31
+
+
+
+ fortyGigE0/0
+ FC00::75/126
+
+
+
+ ab1
+ 192.168.0.1/27
+
+
+
+
+
+ PortChannel01
+ DataAcl
+ DataPlane
+
+
+ SNMP
+ SNMP_ACL
+ SNMP
+
+
+ ERSPAN_DSCP
+ Everflow_dscp
+ Everflow_dscp
+
+
+
+
+
+
+
+
+
+ DeviceSerialLink
+ 9600
+ switch-t0
+ console
+ true
+ switch-t1
+ 1
+
+
+ DeviceSerialLink
+ 9600
+ switch-t0
+ 1
+ true
+ managed_device
+ console
+
+
+ DeviceInterfaceLink
+ 10000
+ switch-t0
+ fortyGigE0/0
+ switch-01t1
+ port1
+
+
+ DeviceInterfaceLink
+ 10000
+ switch-t0
+ fortyGigE0/12
+ switch-02t1
+ port1
+
+
+ DeviceInterfaceLink
+ 25000
+ switch-t0
+ fortyGigE0/4
+ server1
+ port1
+
+
+ DeviceInterfaceLink
+ 40000
+ switch-t0
+ fortyGigE0/8
+ server2
+ port1
+
+
+ LogicalLink
+ 10000
+ false
+ switch-t0
+ fortyGigE0/4
+ true
+ mux-cable
+ L
+ true
+
+
+ LogicalLink
+ 10000
+ false
+ switch-t0
+ fortyGigE0/8
+ true
+ mux-cable
+ U
+ true
+
+
+ LogicalLink
+ 0
+ false
+ switch-t0
+ MuxTunnel0
+ false
+ switch2-t0
+ MuxTunnel0
+ true
+
+
+
+
+ ToRRouter
+
+ 26.1.1.10/32
+
+ switch-t0
+ Force10-S6000
+ AAA00PrdStr00
+
+
+
+ 25.1.1.10/32
+
+
+ 10.7.0.196/26
+
+ switch2-t0
+ Force10-S6000
+
+
+ switch-01t1
+
+ 10.1.0.186/32
+
+ 2
+
+
+ 10.7.0.196/26
+
+ Force10-S6000
+
+
+ Server
+
+ 10.10.10.1/32
+
+
+ fe80::0001/80
+
+
+ 10.0.0.1/32
+
+ server1
+ server-sku
+
+
+ Server
+
+ 10.10.10.2/32
+
+
+ fe80::0002/128
+
+
+ 10.0.0.2/32
+
+ server2
+ server-sku
+
+
+
+
+
+
+
+
+
+ GeminiPeeringLink
+
+ True
+
+
+ UpperTOR
+
+ switch-t0
+
+
+ LowerTOR
+
+ switch2-t0
+
+
+ switch2-t0:MuxTunnel0;switch-t0:MuxTunnel0
+
+
+
+
+
+ AutoNegotiation
+
+ True
+
+
+ switch-01t1:port1;switch-t0:fortyGigE0/0
+
+
+
+
+
+ AutoNegotiation
+
+ True
+
+
+ switch-02t1:port1;switch-t0:fortyGigE0/12
+
+
+
+
+
+ AutoNegotiation
+
+ True
+
+
+ server1:port1;switch-t0:fortyGigE0/4
+
+
+
+
+
+ AutoNegotiation
+
+ True
+
+
+ server2:port1;switch-t0:fortyGigE0/8
+
+
+
+
+
+
+ switch-t0
+
+
+ DeploymentId
+
+ 1
+
+
+ ErspanDestinationIpv4
+
+ 10.0.100.1
+
+
+ NtpResources
+
+ 10.0.10.1;10.0.10.2
+
+
+
+ SnmpResources
+
+ 10.0.10.3;10.0.10.4
+
+
+
+ SyslogResources
+
+ 10.0.10.5;10.0.10.6
+
+
+
+ TacacsServer
+
+ 10.0.10.7;10.0.10.8
+
+
+ KubernetesEnabled
+
+ 0
+
+
+ KubernetesServerIp
+
+ 10.10.10.10
+
+
+ ResourceType
+
+ Storage
+
+
+
+
+
+
+
+
+
+ TunnelQosRemapEnabled
+ False
+
+
+
+
+
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/0
+
+ false
+ 0
+ 0
+ 10000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/4
+
+ false
+ 0
+ 0
+ 25000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/8
+
+ false
+ 0
+ 0
+ 40000
+ Interface description
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/12
+
+ false
+ 0
+ 0
+ 100000
+ Interface description
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/16
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/20
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/24
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/28
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/32
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/36
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/40
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/44
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/48
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/52
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/56
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/60
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/64
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/68
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/72
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/76
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/80
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/84
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/88
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/92
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/96
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/100
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/104
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/108
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/112
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/116
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/120
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/124
+
+ false
+ 0
+ 0
+ 100000
+
+
+ true
+ 0
+ Force10-S6000
+
+
+ DeviceInterface
+
+ true
+ 1
+ eth0
+ false
+ eth0
+ 1000
+
+
+
+
+ switch-t0
+ Force10-S6000
+
diff --git a/src/sonic-config-engine/tests/simple-sample-graph-case-remap-enabled.xml b/src/sonic-config-engine/tests/simple-sample-graph-case-remap-enabled.xml
new file mode 100644
index 000000000000..d38f77774e9f
--- /dev/null
+++ b/src/sonic-config-engine/tests/simple-sample-graph-case-remap-enabled.xml
@@ -0,0 +1,894 @@
+
+
+
+
+
+ false
+ switch-t0
+ 10.0.0.56
+ ARISTA01T1
+ 10.0.0.57
+ 1
+ 180
+ 60
+
+
+ switch-t0
+ FC00::71
+ ARISTA01T1
+ FC00::72
+ 1
+ 180
+ 60
+
+
+ false
+ switch-t0
+ 10.0.0.58
+ ARISTA02T1
+ 10.0.0.59
+ 1
+ 180
+ 60
+
+
+ switch-t0
+ FC00::75
+ ARISTA02T1
+ FC00::76
+ 1
+ 180
+ 60
+
+
+
+
+ 65100
+ switch-t0
+
+
+ 10.0.0.57
+
+
+
+
+
+ 10.0.0.59
+
+
+
+
+
+
+
+
+ 64600
+ ARISTA01T1
+
+
+
+ 64600
+ ARISTA02T1
+
+
+
+ 64600
+ ARISTA03T1
+
+
+
+ 64600
+ ARISTA04T1
+
+
+
+
+
+
+
+
+
+ HostIP
+ Loopback0
+
+ 10.1.0.32/32
+
+ 10.1.0.32/32
+
+
+ HostIP1
+ Loopback0
+
+ FC00:1::32/128
+
+ FC00:1::32/128
+
+
+
+
+ HostIP
+ eth0
+
+ 10.0.0.100/24
+
+ 10.0.0.100/24
+
+
+
+
+
+
+ switch-t0
+
+
+ PortChannel01
+ fortyGigE0/4
+
+
+
+
+
+
+
+
+ ab1
+ fortyGigE0/8
+ 192.0.0.1;192.0.0.2
+ fc02:2000::1;fc02:2000::2
+ 1000
+ 1000
+ 192.168.0.0/27
+ 00:aa:bb:cc:dd:ee
+
+
+ ab2
+ fortyGigE0/4
+ 192.0.0.1
+ fc02:2000::3;fc02:2000::4
+ 2000
+ 2000
+
+
+
+
+
+
+ PortChannel01
+ 10.0.0.56/31
+
+
+
+ PortChannel01
+ FC00::71/126
+
+
+
+ fortyGigE0/0
+ 10.0.0.58/31
+
+
+
+ fortyGigE0/0
+ FC00::75/126
+
+
+
+ ab1
+ 192.168.0.1/27
+
+
+
+
+
+ PortChannel01
+ DataAcl
+ DataPlane
+
+
+ SNMP
+ SNMP_ACL
+ SNMP
+
+
+ ERSPAN_DSCP
+ Everflow_dscp
+ Everflow_dscp
+
+
+
+
+
+
+
+
+
+ DeviceSerialLink
+ 9600
+ switch-t0
+ console
+ true
+ switch-t1
+ 1
+
+
+ DeviceSerialLink
+ 9600
+ switch-t0
+ 1
+ true
+ managed_device
+ console
+
+
+ DeviceInterfaceLink
+ 10000
+ switch-t0
+ fortyGigE0/0
+ switch-01t1
+ port1
+
+
+ DeviceInterfaceLink
+ 10000
+ switch-t0
+ fortyGigE0/12
+ switch-02t1
+ port1
+
+
+ DeviceInterfaceLink
+ 25000
+ switch-t0
+ fortyGigE0/4
+ server1
+ port1
+
+
+ DeviceInterfaceLink
+ 40000
+ switch-t0
+ fortyGigE0/8
+ server2
+ port1
+
+
+ LogicalLink
+ 10000
+ false
+ switch-t0
+ fortyGigE0/4
+ true
+ mux-cable
+ L
+ true
+
+
+ LogicalLink
+ 10000
+ false
+ switch-t0
+ fortyGigE0/8
+ true
+ mux-cable
+ U
+ true
+
+
+ LogicalLink
+ 0
+ false
+ switch-t0
+ MuxTunnel0
+ false
+ switch2-t0
+ MuxTunnel0
+ true
+
+
+
+
+ ToRRouter
+
+ 26.1.1.10/32
+
+ switch-t0
+ Force10-S6000
+ AAA00PrdStr00
+
+
+
+ 25.1.1.10/32
+
+
+ 10.7.0.196/26
+
+ switch2-t0
+ Force10-S6000
+
+
+ switch-01t1
+
+ 10.1.0.186/32
+
+ 2
+
+
+ 10.7.0.196/26
+
+ Force10-S6000
+
+
+ Server
+
+ 10.10.10.1/32
+
+
+ fe80::0001/80
+
+
+ 10.0.0.1/32
+
+ server1
+ server-sku
+
+
+ Server
+
+ 10.10.10.2/32
+
+
+ fe80::0002/128
+
+
+ 10.0.0.2/32
+
+ server2
+ server-sku
+
+
+
+
+
+
+
+
+
+ GeminiPeeringLink
+
+ True
+
+
+ UpperTOR
+
+ switch-t0
+
+
+ LowerTOR
+
+ switch2-t0
+
+
+ switch2-t0:MuxTunnel0;switch-t0:MuxTunnel0
+
+
+
+
+
+ AutoNegotiation
+
+ True
+
+
+ switch-01t1:port1;switch-t0:fortyGigE0/0
+
+
+
+
+
+ AutoNegotiation
+
+ True
+
+
+ switch-02t1:port1;switch-t0:fortyGigE0/12
+
+
+
+
+
+ AutoNegotiation
+
+ True
+
+
+ server1:port1;switch-t0:fortyGigE0/4
+
+
+
+
+
+ AutoNegotiation
+
+ True
+
+
+ server2:port1;switch-t0:fortyGigE0/8
+
+
+
+
+
+
+ switch-t0
+
+
+ DeploymentId
+
+ 1
+
+
+ ErspanDestinationIpv4
+
+ 10.0.100.1
+
+
+ NtpResources
+
+ 10.0.10.1;10.0.10.2
+
+
+
+ SnmpResources
+
+ 10.0.10.3;10.0.10.4
+
+
+
+ SyslogResources
+
+ 10.0.10.5;10.0.10.6
+
+
+
+ TacacsServer
+
+ 10.0.10.7;10.0.10.8
+
+
+ KubernetesEnabled
+
+ 0
+
+
+ KubernetesServerIp
+
+ 10.10.10.10
+
+
+ ResourceType
+
+ Storage
+
+
+
+
+
+
+
+
+
+ TunnelQosRemapEnabled
+ True
+
+
+
+
+
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/0
+
+ false
+ 0
+ 0
+ 10000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/4
+
+ false
+ 0
+ 0
+ 25000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/8
+
+ false
+ 0
+ 0
+ 40000
+ Interface description
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/12
+
+ false
+ 0
+ 0
+ 100000
+ Interface description
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/16
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/20
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/24
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/28
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/32
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/36
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/40
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/44
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/48
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/52
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/56
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/60
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/64
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/68
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/72
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/76
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/80
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/84
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/88
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/92
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/96
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/100
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/104
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/108
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/112
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/116
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/120
+
+ false
+ 0
+ 0
+ 100000
+
+
+ DeviceInterface
+
+ true
+ 1
+ fortyGigE0/124
+
+ false
+ 0
+ 0
+ 100000
+
+
+ true
+ 0
+ Force10-S6000
+
+
+ DeviceInterface
+
+ true
+ 1
+ eth0
+ false
+ eth0
+ 1000
+
+
+
+
+ switch-t0
+ Force10-S6000
+
diff --git a/src/sonic-config-engine/tests/test_minigraph_case.py b/src/sonic-config-engine/tests/test_minigraph_case.py
index d5fe3aad7535..b4756219399d 100644
--- a/src/sonic-config-engine/tests/test_minigraph_case.py
+++ b/src/sonic-config-engine/tests/test_minigraph_case.py
@@ -369,6 +369,42 @@ def test_minigraph_tunnel_table(self):
expected_tunnel
)
+ # Validate tunnel config is as before when tunnel_qos_remap = disabled
+ sample_graph_disabled_remap = os.path.join(self.test_dir, 'simple-sample-graph-case-remap-disabled.xml')
+ argument = '-m "' + sample_graph_disabled_remap + '" -p "' + self.port_config + '" -v "TUNNEL"'
+
+ output = self.run_script(argument)
+ self.assertEqual(
+ utils.to_dict(output.strip()),
+ expected_tunnel
+ )
+
+ # Validate extra config is generated when tunnel_qos_remap = enabled
+ sample_graph_enabled_remap = os.path.join(self.test_dir, 'simple-sample-graph-case-remap-enabled.xml')
+ argument = '-m "' + sample_graph_enabled_remap + '" -p "' + self.port_config + '" -v "TUNNEL"'
+ expected_tunnel = {
+ "MuxTunnel0": {
+ "tunnel_type": "IPINIP",
+ "src_ip": "25.1.1.10",
+ "dst_ip": "10.1.0.32",
+ "dscp_mode": "uniform",
+ "encap_ecn_mode": "standard",
+ "ecn_mode": "copy_from_outer",
+ "ttl_mode": "pipe",
+ "decap_dscp_to_tc_map": "AZURE_TUNNEL",
+ "decap_tc_to_pg_map": "AZURE_TUNNEL",
+ "encap_tc_to_dscp_map": "AZURE_TUNNEL",
+ "encap_tc_to_queue_map": "AZURE_TUNNEL"
+ }
+ }
+
+ output = self.run_script(argument)
+ self.assertEqual(
+ utils.to_dict(output.strip()),
+ expected_tunnel
+ )
+
+
def test_minigraph_mux_cable_table(self):
argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v "MUX_CABLE"'
expected_table = {