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

[minigraph] Added support to parse "AssociatedSliceStr" attribute of minigraph #19160

Merged
merged 26 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
7a3d7e5
Fix the Loopback0 IPv6 address of LC's in chassis not reachable from
abdosi Aug 3, 2023
b5b08cf
Merge remote-tracking branch 'upstream/master'
abdosi Aug 17, 2023
8d9dbb6
Added change to have flag
abdosi Aug 17, 2023
d04bc54
Merge remote-tracking branch 'upstream/master'
abdosi Aug 23, 2023
264d912
Merge remote-tracking branch 'upstream/master'
abdosi Aug 25, 2023
957cd71
Merge remote-tracking branch 'upstream/master'
abdosi Aug 31, 2023
4e8b101
Assign the metric vaule for Ipv6 default route learnt via RA message to
abdosi Aug 31, 2023
05ec92a
Merge remote-tracking branch 'upstream/master'
abdosi Sep 8, 2023
fcbd38d
Add alternate name for bridge interface on supversior in chassis systrem
abdosi Sep 8, 2023
76019a7
Merge remote-tracking branch 'upstream/master'
abdosi Sep 8, 2023
6ad8644
Merge branch 'sonic-net:master' into master
abdosi Oct 28, 2023
7bb9243
Merge branch 'sonic-net:master' into master
abdosi Jan 18, 2024
fbaab85
Update service_checker.py
abdosi Jan 18, 2024
6c5ed3a
Update init_cfg.json.j2 to handle global scope for lldp feature
abdosi Apr 26, 2024
d17cde2
Merge branch 'sonic-net:master' into master
abdosi May 24, 2024
33a03e1
Update sonic-feature.yang
abdosi May 29, 2024
ed933ed
Merge remote-tracking branch 'origin/master'
abdosi May 31, 2024
93ee8f2
Merge remote-tracking branch 'upstream/master'
abdosi May 31, 2024
b110783
Merge remote-tracking branch 'upstream/master'
abdosi May 31, 2024
0f2d26d
Added support to parse "AssociatedSliceStr" attribute of minigraph and
abdosi May 31, 2024
c676b70
Revert "Added support to parse "AssociatedSliceStr" attribute of mini…
abdosi May 31, 2024
c862d61
Added support to parse "AssociatedSliceStr" attribute of minigraph and
abdosi May 31, 2024
5ba4ab2
Merge remote-tracking branch 'upstream/master'
abdosi Jun 3, 2024
d7705ee
Update minigraph.py
abdosi Jun 3, 2024
121ba2a
Merge remote-tracking branch 'upstream/master'
abdosi Jun 4, 2024
1a5c764
Merge branch 'master' of https://github.com/abdosi/sonic-buildimage
abdosi Jun 4, 2024
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
22 changes: 17 additions & 5 deletions src/sonic-config-engine/minigraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,7 @@ def parse_device(device):
deployment_id = None
cluster = None
d_subtype = None
slice_type = None

for node in device:
if node.tag == str(QName(ns, "Address")):
Expand All @@ -492,11 +493,13 @@ def parse_device(device):
cluster = node.text
elif node.tag == str(QName(ns, "SubType")):
d_subtype = node.text
elif node.tag == str(QName(ns, "AssociatedSliceStr")) and node.text and "AZNG_Production" in node.text:
slice_type = "AZNG_Production"

if d_type is None and str(QName(ns3, "type")) in device.attrib:
d_type = device.attrib[str(QName(ns3, "type"))]

return (lo_prefix, lo_prefix_v6, mgmt_prefix, mgmt_prefix_v6, name, hwsku, d_type, deployment_id, cluster, d_subtype)
return (lo_prefix, lo_prefix_v6, mgmt_prefix, mgmt_prefix_v6, name, hwsku, d_type, deployment_id, cluster, d_subtype, slice_type)


def calculate_lcm_for_ecmp (nhdevices_bank_map, nhip_bank_map):
Expand Down Expand Up @@ -634,7 +637,8 @@ def parse_png(png, hname, dpg_ecmp_content = None):

if child.tag == str(QName(ns, "Devices")):
for device in child.findall(str(QName(ns, "Device"))):
(lo_prefix, lo_prefix_v6, mgmt_prefix, mgmt_prefix_v6, name, hwsku, d_type, deployment_id, cluster, d_subtype) = parse_device(device)
(lo_prefix, lo_prefix_v6, mgmt_prefix, mgmt_prefix_v6, name, hwsku, d_type, deployment_id, cluster, d_subtype, slice_type) = \
parse_device(device)
device_data = {}
if hwsku != None:
device_data['hwsku'] = hwsku
Expand All @@ -654,6 +658,8 @@ def parse_png(png, hname, dpg_ecmp_content = None):
device_data['type'] = d_type
if d_subtype != None:
device_data['subtype'] = d_subtype
if slice_type != None:
device_data['slice_type'] = slice_type
devices[name] = device_data

if child.tag == str(QName(ns, "DeviceInterfaceLinks")):
Expand Down Expand Up @@ -775,7 +781,7 @@ def parse_asic_png(png, asic_name, hostname):

if child.tag == str(QName(ns, "Devices")):
for device in child.findall(str(QName(ns, "Device"))):
(lo_prefix, lo_prefix_v6, mgmt_prefix, mgmt_prefix_v6, name, hwsku, d_type, deployment_id, cluster, _) = parse_device(device)
(lo_prefix, lo_prefix_v6, mgmt_prefix, mgmt_prefix_v6, name, hwsku, d_type, deployment_id, cluster, _, slice_type) = parse_device(device)
device_data = {}
if hwsku != None:
device_data['hwsku'] = hwsku
Expand All @@ -793,6 +799,8 @@ def parse_asic_png(png, asic_name, hostname):
device_data['mgmt_addr_v6'] = mgmt_prefix_v6
if d_type != None:
device_data['type'] = d_type
if slice_type != None:
device_data['slice_type'] = slice_type
devices[name] = device_data

return (neighbors, devices, port_speeds)
Expand Down Expand Up @@ -2101,7 +2109,7 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
current_device = [devices[key] for key in devices if key.lower() == hostname.lower()][0]
else:
try:
current_device = [devices[key] for key in devices if key.lower() == asic_name.lower()][0]
current_device = [devices[key] for key in devices if key.lower() == asic_hostname.lower()][0]
except:
current_device = {}

Expand Down Expand Up @@ -2137,6 +2145,10 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
if cluster:
results['DEVICE_METADATA']['localhost']['cluster'] = cluster

# Update Slice Type for T2/Chassis Role
if current_device and 'slice_type' in current_device and current_device['slice_type'] and chassis_hostname:
results['DEVICE_METADATA']['localhost']['slice_type'] = current_device['slice_type']

if kube_data:
results['KUBERNETES_MASTER'] = {
'SERVER': {
Expand Down Expand Up @@ -2809,7 +2821,7 @@ def get_mux_cable_entries(ports, mux_cable_ports, active_active_ports, neighbors

def parse_device_desc_xml(filename):
root = ET.parse(filename).getroot()
(lo_prefix, lo_prefix_v6, mgmt_prefix, mgmt_prefix_v6, hostname, hwsku, d_type, _, _, _) = parse_device(root)
(lo_prefix, lo_prefix_v6, mgmt_prefix, mgmt_prefix_v6, hostname, hwsku, d_type, _, _, _, _) = parse_device(root)

results = {}
results['DEVICE_METADATA'] = {'localhost': {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45188,7 +45188,7 @@
<a:IPPrefix>::/0</a:IPPrefix>
</AddressV6>
<AssociatedClustersStr>TestbedForstr-sonic</AssociatedClustersStr>
<AssociatedSliceStr>TestbedForstr-sonic</AssociatedSliceStr>
<AssociatedSliceStr>AZNG_Production</AssociatedSliceStr>
<AssociatedTagsStr/>
<ChassisInternalDevices/>
<ClusterName>TestbedForstr-sonic</ClusterName>
Expand All @@ -45215,7 +45215,7 @@
<a:IPPrefix>::/0</a:IPPrefix>
</AddressV6>
<AssociatedClustersStr>TestbedForstr-sonic</AssociatedClustersStr>
<AssociatedSliceStr>TestbedForstr-sonic</AssociatedSliceStr>
<AssociatedSliceStr>AZNG_Production</AssociatedSliceStr>
<AssociatedTagsStr/>
<ChassisInternalDevices/>
<ClusterName>TestbedForstr-sonic</ClusterName>
Expand All @@ -45242,7 +45242,7 @@
<a:IPPrefix>::/0</a:IPPrefix>
</AddressV6>
<AssociatedClustersStr>TestbedForstr-sonic</AssociatedClustersStr>
<AssociatedSliceStr>TestbedForstr-sonic</AssociatedSliceStr>
<AssociatedSliceStr>AZNG_Production</AssociatedSliceStr>
<AssociatedTagsStr/>
<ChassisInternalDevices/>
<ClusterName>TestbedForstr-sonic</ClusterName>
Expand All @@ -45269,7 +45269,7 @@
<a:IPPrefix>::/0</a:IPPrefix>
</AddressV6>
<AssociatedClustersStr>TestbedForstr-sonic</AssociatedClustersStr>
<AssociatedSliceStr>TestbedForstr-sonic</AssociatedSliceStr>
<AssociatedSliceStr>AZNG_Production</AssociatedSliceStr>
<AssociatedTagsStr/>
<ChassisInternalDevices/>
<ClusterName>TestbedForstr-sonic</ClusterName>
Expand All @@ -45296,7 +45296,7 @@
<a:IPPrefix>::/0</a:IPPrefix>
</AddressV6>
<AssociatedClustersStr>TestbedForstr-sonic</AssociatedClustersStr>
<AssociatedSliceStr>TestbedForstr-sonic</AssociatedSliceStr>
<AssociatedSliceStr>AZNG_Production</AssociatedSliceStr>
<AssociatedTagsStr/>
<ChassisInternalDevices/>
<ClusterName>TestbedForstr-sonic</ClusterName>
Expand All @@ -45323,7 +45323,7 @@
<a:IPPrefix>::/0</a:IPPrefix>
</AddressV6>
<AssociatedClustersStr>TestbedForstr-sonic</AssociatedClustersStr>
<AssociatedSliceStr>TestbedForstr-sonic</AssociatedSliceStr>
<AssociatedSliceStr>AZNG_Production</AssociatedSliceStr>
<AssociatedTagsStr/>
<ChassisInternalDevices/>
<ClusterName>TestbedForstr-sonic</ClusterName>
Expand All @@ -45350,7 +45350,7 @@
<a:IPPrefix>::/0</a:IPPrefix>
</AddressV6>
<AssociatedClustersStr>TestbedForstr-sonic</AssociatedClustersStr>
<AssociatedSliceStr>TestbedForstr-sonic</AssociatedSliceStr>
<AssociatedSliceStr>AZNG_Production</AssociatedSliceStr>
<AssociatedTagsStr/>
<ChassisInternalDevices/>
<ClusterName>TestbedForstr-sonic</ClusterName>
Expand All @@ -45377,7 +45377,7 @@
<a:IPPrefix>::/0</a:IPPrefix>
</AddressV6>
<AssociatedClustersStr>TestbedForstr-sonic</AssociatedClustersStr>
<AssociatedSliceStr>TestbedForstr-sonic</AssociatedSliceStr>
<AssociatedSliceStr>AZNG_Production</AssociatedSliceStr>
<AssociatedTagsStr/>
<ChassisInternalDevices/>
<ClusterName>TestbedForstr-sonic</ClusterName>
Expand All @@ -45404,7 +45404,7 @@
<a:IPPrefix>::/0</a:IPPrefix>
</AddressV6>
<AssociatedClustersStr>TestbedForstr-sonic</AssociatedClustersStr>
<AssociatedSliceStr>TestbedForstr-sonic</AssociatedSliceStr>
<AssociatedSliceStr>AZNG_Production</AssociatedSliceStr>
<AssociatedTagsStr/>
<ChassisInternalDevices/>
<ClusterName>TestbedForstr-sonic</ClusterName>
Expand All @@ -45431,7 +45431,7 @@
<a:IPPrefix>::/0</a:IPPrefix>
</AddressV6>
<AssociatedClustersStr>TestbedForstr-sonic</AssociatedClustersStr>
<AssociatedSliceStr>TestbedForstr-sonic</AssociatedSliceStr>
<AssociatedSliceStr>AZNG_Production</AssociatedSliceStr>
<AssociatedTagsStr/>
<ChassisInternalDevices/>
<ClusterName>TestbedForstr-sonic</ClusterName>
Expand All @@ -45458,7 +45458,7 @@
<a:IPPrefix>::/0</a:IPPrefix>
</AddressV6>
<AssociatedClustersStr>TestbedForstr-sonic</AssociatedClustersStr>
<AssociatedSliceStr>TestbedForstr-sonic</AssociatedSliceStr>
<AssociatedSliceStr>AZNG_Production</AssociatedSliceStr>
<AssociatedTagsStr/>
<ChassisInternalDevices/>
<ClusterName>TestbedForstr-sonic</ClusterName>
Expand Down Expand Up @@ -46133,7 +46133,7 @@
<a:IPPrefix>fc00:23::1/128</a:IPPrefix>
</AddressV6>
<AssociatedClustersStr>TestbedForstr-sonic</AssociatedClustersStr>
<AssociatedSliceStr>TestbedForstr-sonic</AssociatedSliceStr>
<AssociatedSliceStr>AZNG_Production</AssociatedSliceStr>
<AssociatedTagsStr/>
<ChassisInternalDevices/>
<ClusterName>TestbedForstr-sonic</ClusterName>
Expand All @@ -46160,7 +46160,7 @@
<a:IPPrefix>2a01:111:e210:5e::/128</a:IPPrefix>
</AddressV6>
<AssociatedClustersStr>TestbedForstr-sonic</AssociatedClustersStr>
<AssociatedSliceStr>TestbedForstr-sonic</AssociatedSliceStr>
<AssociatedSliceStr>AZNG_Production</AssociatedSliceStr>
<AssociatedTagsStr/>
<ChassisInternalDevices/>
<ClusterName>TestbedForstr-sonic</ClusterName>
Expand All @@ -46187,7 +46187,7 @@
<a:IPPrefix>2a01:111:e210:5e::/128</a:IPPrefix>
</AddressV6>
<AssociatedClustersStr>TestbedForstr-sonic</AssociatedClustersStr>
<AssociatedSliceStr>TestbedForstr-sonic</AssociatedSliceStr>
<AssociatedSliceStr>AZNG_Production</AssociatedSliceStr>
<AssociatedTagsStr>None</AssociatedTagsStr>
<ChassisInternalDevices/>
<ClusterName>TestbedForstr-sonic</ClusterName>
Expand Down
5 changes: 3 additions & 2 deletions src/sonic-config-engine/tests/test_chassis_cfggen.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ def test_device_metadata(self):
'sub_role': 'FrontEnd',
'switch_type': 'voq',
'switch_id': 20,
'max_cores': 64})
'max_cores': 64,
'slice_type': 'AZNG_Production'})

def test_port(self):
argument = ['-m', self.sample_graph, '-p',
Expand Down Expand Up @@ -1156,4 +1157,4 @@ def tearDown(self):
os.environ['CFGGEN_UNIT_TESTING'] = ''
os.environ['CFGGEN_UNIT_TESTING_TOPOLOGY'] = ''
if os.path.exists(self.output_file):
os.remove(self.output_file)
os.remove(self.output_file)
Loading