Add DHCPv6 to minigraph.py and improve unit test (#8125)
Why I did it Allow deploying DHCPv6 servers following the implementation PR: #7772 How I did it Add DHCPv6 to minigraph.py on sonic-cfggen tool and improve the unit test to cover this change. How to verify it Try to deploy a switch with DHCPv6 servers. Signed-off-by: Shlomi Bitton <shlomibi@nvidia.com>
This commit is contained in:
parent
5cb4ddfff0
commit
a54a3126f6
@ -562,6 +562,12 @@ def parse_dpg(dpg, hname):
|
|||||||
vdhcpserver_list = vintfdhcpservers.split(';')
|
vdhcpserver_list = vintfdhcpservers.split(';')
|
||||||
vlan_attributes['dhcp_servers'] = vdhcpserver_list
|
vlan_attributes['dhcp_servers'] = vdhcpserver_list
|
||||||
|
|
||||||
|
vintf_node = vintf.find(str(QName(ns, "Dhcpv6Relays")))
|
||||||
|
if vintf_node is not None and vintf_node.text is not None:
|
||||||
|
vintfdhcpservers = vintf_node.text
|
||||||
|
vdhcpserver_list = vintfdhcpservers.split(';')
|
||||||
|
vlan_attributes['dhcpv6_servers'] = vdhcpserver_list
|
||||||
|
|
||||||
vlanmac = vintf.find(str(QName(ns, "MacAddress")))
|
vlanmac = vintf.find(str(QName(ns, "MacAddress")))
|
||||||
if vlanmac is not None and vlanmac.text is not None:
|
if vlanmac is not None and vlanmac.text is not None:
|
||||||
vlan_attributes['mac'] = vlanmac.text
|
vlan_attributes['mac'] = vlanmac.text
|
||||||
@ -803,6 +809,7 @@ def parse_cpg(cpg, hname, local_devices=[]):
|
|||||||
def parse_meta(meta, hname):
|
def parse_meta(meta, hname):
|
||||||
syslog_servers = []
|
syslog_servers = []
|
||||||
dhcp_servers = []
|
dhcp_servers = []
|
||||||
|
dhcpv6_servers = []
|
||||||
ntp_servers = []
|
ntp_servers = []
|
||||||
tacacs_servers = []
|
tacacs_servers = []
|
||||||
mgmt_routes = []
|
mgmt_routes = []
|
||||||
@ -856,7 +863,7 @@ def parse_meta(meta, hname):
|
|||||||
kube_data["enable"] = value
|
kube_data["enable"] = value
|
||||||
elif name == "KubernetesServerIp":
|
elif name == "KubernetesServerIp":
|
||||||
kube_data["ip"] = value
|
kube_data["ip"] = value
|
||||||
return syslog_servers, dhcp_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
|
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_linkmeta(meta, hname):
|
def parse_linkmeta(meta, hname):
|
||||||
@ -1170,6 +1177,7 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
|
|||||||
mux_cable_ports = {}
|
mux_cable_ports = {}
|
||||||
syslog_servers = []
|
syslog_servers = []
|
||||||
dhcp_servers = []
|
dhcp_servers = []
|
||||||
|
dhcpv6_servers = []
|
||||||
ntp_servers = []
|
ntp_servers = []
|
||||||
tacacs_servers = []
|
tacacs_servers = []
|
||||||
mgmt_routes = []
|
mgmt_routes = []
|
||||||
@ -1217,7 +1225,7 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
|
|||||||
elif child.tag == str(QName(ns, "UngDec")):
|
elif child.tag == str(QName(ns, "UngDec")):
|
||||||
(u_neighbors, u_devices, _, _, _, _, _, _) = parse_png(child, hostname, None)
|
(u_neighbors, u_devices, _, _, _, _, _, _) = parse_png(child, hostname, None)
|
||||||
elif child.tag == str(QName(ns, "MetadataDeclaration")):
|
elif child.tag == str(QName(ns, "MetadataDeclaration")):
|
||||||
(syslog_servers, dhcp_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) = 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) = parse_meta(child, hostname)
|
||||||
elif child.tag == str(QName(ns, "LinkMetadataDeclaration")):
|
elif child.tag == str(QName(ns, "LinkMetadataDeclaration")):
|
||||||
linkmetas = parse_linkmeta(child, hostname)
|
linkmetas = parse_linkmeta(child, hostname)
|
||||||
elif child.tag == str(QName(ns, "DeviceInfos")):
|
elif child.tag == str(QName(ns, "DeviceInfos")):
|
||||||
@ -1567,6 +1575,7 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
|
|||||||
results['DEVICE_NEIGHBOR_METADATA'] = { key:devices[key] for key in devices if key in {device['name'] for device in neighbors.values()} }
|
results['DEVICE_NEIGHBOR_METADATA'] = { key:devices[key] for key in devices if key in {device['name'] for device in neighbors.values()} }
|
||||||
results['SYSLOG_SERVER'] = dict((item, {}) for item in syslog_servers)
|
results['SYSLOG_SERVER'] = dict((item, {}) for item in syslog_servers)
|
||||||
results['DHCP_SERVER'] = dict((item, {}) for item in dhcp_servers)
|
results['DHCP_SERVER'] = dict((item, {}) for item in dhcp_servers)
|
||||||
|
results['DHCPv6_SERVER'] = dict((item, {}) for item in dhcpv6_servers)
|
||||||
results['NTP_SERVER'] = dict((item, {}) for item in ntp_servers)
|
results['NTP_SERVER'] = dict((item, {}) for item in ntp_servers)
|
||||||
results['TACPLUS_SERVER'] = dict((item, {'priority': '1', 'tcp_port': '49'}) for item in tacacs_servers)
|
results['TACPLUS_SERVER'] = dict((item, {'priority': '1', 'tcp_port': '49'}) for item in tacacs_servers)
|
||||||
results['ACL_TABLE'] = filter_acl_table_bindings(acls, neighbors, pcs, sub_role)
|
results['ACL_TABLE'] = filter_acl_table_bindings(acls, neighbors, pcs, sub_role)
|
||||||
|
@ -256,6 +256,7 @@
|
|||||||
<FhrpProtoType i:nil="true"/>
|
<FhrpProtoType i:nil="true"/>
|
||||||
<Type i:nil="true"/>
|
<Type i:nil="true"/>
|
||||||
<DhcpRelays>192.0.0.1;192.0.0.2</DhcpRelays>
|
<DhcpRelays>192.0.0.1;192.0.0.2</DhcpRelays>
|
||||||
|
<Dhcpv6Relays>fc02:2000::1;fc02:2000::2</Dhcpv6Relays>
|
||||||
<VlanID>1000</VlanID>
|
<VlanID>1000</VlanID>
|
||||||
<Tag>1000</Tag>
|
<Tag>1000</Tag>
|
||||||
<Subnets>192.168.0.0/27</Subnets>
|
<Subnets>192.168.0.0/27</Subnets>
|
||||||
|
Loading…
Reference in New Issue
Block a user