From 042bbe48cba6f64f6c32ea42e4dd9879783a4e21 Mon Sep 17 00:00:00 2001 From: ganglyu Date: Thu, 6 Jul 2023 15:58:36 +0800 Subject: [PATCH 1/3] Revert minigraph update --- src/sonic-config-engine/minigraph.py | 2 -- .../tests/multi_npu_data/sample-minigraph.xml | 5 ----- .../tests/simple-sample-graph-case.xml | 6 ------ .../tests/simple-sample-graph-metadata.xml | 6 ------ src/sonic-config-engine/tests/test_cfggen.py | 5 ----- src/sonic-config-engine/tests/test_minigraph_case.py | 5 ----- src/sonic-config-engine/tests/test_multinpu_cfggen.py | 11 ----------- 7 files changed, 40 deletions(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 558c7e24e929..09a7d4478e62 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -1024,8 +1024,6 @@ def parse_meta(meta, hname): dhcp_servers = value_group elif name == "NtpResources": ntp_servers = value_group - elif name == "DnsNameserverResources": - dns_nameservers = value_group elif name == "SyslogResources": syslog_servers = value_group elif name == "TacacsServer": diff --git a/src/sonic-config-engine/tests/multi_npu_data/sample-minigraph.xml b/src/sonic-config-engine/tests/multi_npu_data/sample-minigraph.xml index 0adcec5c8420..be3938f24bc4 100644 --- a/src/sonic-config-engine/tests/multi_npu_data/sample-minigraph.xml +++ b/src/sonic-config-engine/tests/multi_npu_data/sample-minigraph.xml @@ -1425,11 +1425,6 @@ 17.39.1.129;17.39.1.130 - - DnsNameserverResources - - 1.1.1.1;8.8.8.8 - SnmpResources diff --git a/src/sonic-config-engine/tests/simple-sample-graph-case.xml b/src/sonic-config-engine/tests/simple-sample-graph-case.xml index 7e8f1579cdf4..69b27c33e7b4 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph-case.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph-case.xml @@ -500,12 +500,6 @@ 10.0.10.1;10.0.10.2 - - DnsNameserverResources - - 1.1.1.1;8.8.8.8 - - SnmpResources diff --git a/src/sonic-config-engine/tests/simple-sample-graph-metadata.xml b/src/sonic-config-engine/tests/simple-sample-graph-metadata.xml index c841ff8d1a9f..fbc33b49862a 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph-metadata.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph-metadata.xml @@ -236,12 +236,6 @@ 10.0.10.1;10.0.10.2 - - DnsNameserverResources - - 20.2.2.2;30.3.3.3 - - SnmpResources diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 50e3c2758a1e..1428250aada4 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -696,11 +696,6 @@ def test_metadata_ntp(self): output = self.run_script(argument) self.assertEqual(utils.to_dict(output.strip()), utils.to_dict("{'10.0.10.1': {}, '10.0.10.2': {}}")) - def test_metadata_dns_nameserver(self): - argument = ['-m', self.sample_graph_metadata, '-p', self.port_config, '-v', "DNS_NAMESERVER"] - output = self.run_script(argument) - self.assertEqual(utils.to_dict(output.strip()), utils.to_dict("{'20.2.2.2': {}, '30.3.3.3': {}}")) - def test_minigraph_vnet(self, **kwargs): graph_file = kwargs.get('graph_file', self.sample_graph_simple) argument = ['-m', graph_file, '-p', self.port_config, '-v', "VNET"] diff --git a/src/sonic-config-engine/tests/test_minigraph_case.py b/src/sonic-config-engine/tests/test_minigraph_case.py index 035cff6edb25..d33d2c14e825 100644 --- a/src/sonic-config-engine/tests/test_minigraph_case.py +++ b/src/sonic-config-engine/tests/test_minigraph_case.py @@ -277,11 +277,6 @@ def test_metadata_ntp(self): output = self.run_script(argument) self.assertEqual(output.strip(), "{'10.0.10.1': {}, '10.0.10.2': {}}") - def test_metadata_dns_nameserver(self): - argument = ['-m', self.sample_graph, '-p', self.port_config, '-v', "DNS_NAMESERVER"] - output = self.run_script(argument) - self.assertEqual(output.strip(), "{'1.1.1.1': {}, '8.8.8.8': {}}") - def test_minigraph_vnet(self): argument = ['-m', self.sample_graph, '-p', self.port_config, '-v', "VNET"] output = self.run_script(argument) diff --git a/src/sonic-config-engine/tests/test_multinpu_cfggen.py b/src/sonic-config-engine/tests/test_multinpu_cfggen.py index 7026dfa84a61..bc4227f85d52 100644 --- a/src/sonic-config-engine/tests/test_multinpu_cfggen.py +++ b/src/sonic-config-engine/tests/test_multinpu_cfggen.py @@ -150,17 +150,6 @@ def test_metadata_ntp(self): print("Log:asic{} sku {}".format(asic,output)) self.assertDictEqual(output, {}) - def test_metadata_dns_nameserver(self): - argument = ['-m', self.sample_graph, '-p', self.sample_port_config, '--var-json', "DNS_NAMESERVER"] - output = json.loads(self.run_script(argument)) - self.assertDictEqual(output, {'1.1.1.1': {}, '8.8.8.8': {}}) - #DNS_NAMESERVER data is present only in the host config - argument = ['-m', self.sample_graph, '--var-json', "DNS_NAMESERVER"] - for asic in range(NUM_ASIC): - output = json.loads(self.run_script_for_asic(argument, asic, self.port_config[asic])) - print("Log:asic{} sku {}".format(asic,output)) - self.assertDictEqual(output, {}) - def test_mgmt_port(self): argument = ['-m', self.sample_graph, '-p', self.sample_port_config, '--var-json', "MGMT_PORT"] output = json.loads(self.run_script(argument)) From e5f546f2a4b52435d980c1d0e45f969b11beb5ac Mon Sep 17 00:00:00 2001 From: ganglyu Date: Fri, 7 Jul 2023 11:15:24 +0800 Subject: [PATCH 2/3] Remove dns_nameservers --- src/sonic-config-engine/minigraph.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 09a7d4478e62..530d26e28a13 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -993,7 +993,6 @@ def parse_meta(meta, hname): dhcp_servers = [] dhcpv6_servers = [] ntp_servers = [] - dns_nameservers = [] tacacs_servers = [] mgmt_routes = [] erspan_dst = [] @@ -1062,7 +1061,7 @@ def parse_meta(meta, hname): qos_profile = value elif name == "RackMgmtMap": rack_mgmt_map = value - return syslog_servers, dhcp_servers, dhcpv6_servers, ntp_servers, dns_nameservers, tacacs_servers, mgmt_routes, erspan_dst, deployment_id, region, cloudtype, resource_type, downstream_subrole, switch_id, switch_type, max_cores, kube_data, macsec_profile, downstream_redundancy_types, redundancy_type, qos_profile, rack_mgmt_map + 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, macsec_profile, downstream_redundancy_types, redundancy_type, qos_profile, rack_mgmt_map def parse_linkmeta(meta, hname): @@ -1489,7 +1488,6 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw dhcp_servers = [] dhcpv6_servers = [] ntp_servers = [] - dns_nameservers = [] tacacs_servers = [] mgmt_routes = [] erspan_dst = [] @@ -1545,7 +1543,7 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw elif child.tag == str(QName(ns, "UngDec")): (u_neighbors, u_devices, _, _, _, _, _, _) = parse_png(child, hostname, None) elif child.tag == str(QName(ns, "MetadataDeclaration")): - (syslog_servers, dhcp_servers, dhcpv6_servers, ntp_servers, dns_nameservers, tacacs_servers, mgmt_routes, erspan_dst, deployment_id, region, cloudtype, resource_type, downstream_subrole, switch_id, switch_type, max_cores, kube_data, macsec_profile, downstream_redundancy_types, redundancy_type, qos_profile, rack_mgmt_map) = parse_meta(child, hostname) + (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, macsec_profile, downstream_redundancy_types, redundancy_type, qos_profile, rack_mgmt_map) = parse_meta(child, hostname) elif child.tag == str(QName(ns, "LinkMetadataDeclaration")): linkmetas = parse_linkmeta(child, hostname) elif child.tag == str(QName(ns, "DeviceInfos")): @@ -1997,6 +1995,8 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw results['DHCP_SERVER'] = dict((item, {}) for item in dhcp_servers) results['DHCP_RELAY'] = dhcp_relay_table results['NTP_SERVER'] = dict((item, {}) for item in ntp_servers) + # Reserve for SONiC DNS configuration + dns_nameservers = [] results['DNS_NAMESERVER'] = dict((item, {}) for item in dns_nameservers) results['TACPLUS_SERVER'] = dict((item, {'priority': '1', 'tcp_port': '49'}) for item in tacacs_servers) if len(acl_table_types) > 0: From c049fff96ae86ba1e6fe3e5e5572d047c06a2855 Mon Sep 17 00:00:00 2001 From: ganglyu Date: Fri, 7 Jul 2023 11:21:14 +0800 Subject: [PATCH 3/3] Remove all DNS configuration --- src/sonic-config-engine/minigraph.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 530d26e28a13..81479d83669b 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -1995,9 +1995,6 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw results['DHCP_SERVER'] = dict((item, {}) for item in dhcp_servers) results['DHCP_RELAY'] = dhcp_relay_table results['NTP_SERVER'] = dict((item, {}) for item in ntp_servers) - # Reserve for SONiC DNS configuration - dns_nameservers = [] - results['DNS_NAMESERVER'] = dict((item, {}) for item in dns_nameservers) results['TACPLUS_SERVER'] = dict((item, {'priority': '1', 'tcp_port': '49'}) for item in tacacs_servers) if len(acl_table_types) > 0: results['ACL_TABLE_TYPE'] = acl_table_types