Remove DNS configuration from minigraph schema (#15727)

#### Why I did it
We should not modify minigraph schema.

#### How I did it
Update minigraph.py and remove unit test.

#### How to verify it
Run sonic-config-engine unit test.
This commit is contained in:
ganglv 2023-07-10 11:42:11 +08:00 committed by GitHub
parent c07447ae61
commit cb3ee6571d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 2 additions and 45 deletions

View File

@ -993,7 +993,6 @@ def parse_meta(meta, hname):
dhcp_servers = []
dhcpv6_servers = []
ntp_servers = []
dns_nameservers = []
tacacs_servers = []
mgmt_routes = []
erspan_dst = []
@ -1024,8 +1023,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":
@ -1064,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):
@ -1491,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 = []
@ -1547,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")):
@ -2003,7 +1999,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)
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

View File

@ -1425,11 +1425,6 @@
<a:Reference i:nil="true"/>
<a:Value>17.39.1.129;17.39.1.130</a:Value>
</a:DeviceProperty>
<a:DeviceProperty>
<a:Name>DnsNameserverResources</a:Name>
<a:Reference i:nil="true"/>
<a:Value>1.1.1.1;8.8.8.8</a:Value>
</a:DeviceProperty>
<a:DeviceProperty>
<a:Name>SnmpResources</a:Name>
<a:Reference i:nil="true"/>

View File

@ -500,12 +500,6 @@
10.0.10.1;10.0.10.2
</a:Value>
</a:DeviceProperty>
<a:DeviceProperty>
<a:Name>DnsNameserverResources</a:Name>
<a:Value>
1.1.1.1;8.8.8.8
</a:Value>
</a:DeviceProperty>
<a:DeviceProperty>
<a:Name>SnmpResources</a:Name>
<a:Value>

View File

@ -236,12 +236,6 @@
10.0.10.1;10.0.10.2
</a:Value>
</a:DeviceProperty>
<a:DeviceProperty>
<a:Name>DnsNameserverResources</a:Name>
<a:Value>
20.2.2.2;30.3.3.3
</a:Value>
</a:DeviceProperty>
<a:DeviceProperty>
<a:Name>SnmpResources</a:Name>
<a:Value>

View File

@ -696,11 +696,6 @@ class TestCfgGen(TestCase):
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"]

View File

@ -277,11 +277,6 @@ class TestCfgGenCaseInsensitive(TestCase):
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)

View File

@ -150,17 +150,6 @@ class TestMultiNpuCfgGen(TestCase):
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))