[sonic-cfggen]: Fix minigraph DhcpRelays parsing issue (#2154)
* Check that we have dhcprelays text before using it * Add additional variable to avoid extracting node again and again
This commit is contained in:
parent
e2ffb589ed
commit
bcea4b3fa9
@ -211,8 +211,9 @@ def parse_dpg(dpg, hname):
|
|||||||
|
|
||||||
# If this VLAN requires a DHCP relay agent, it will contain a <DhcpRelays> element
|
# If this VLAN requires a DHCP relay agent, it will contain a <DhcpRelays> element
|
||||||
# containing a list of DHCP server IPs
|
# containing a list of DHCP server IPs
|
||||||
if vintf.find(str(QName(ns, "DhcpRelays"))) is not None:
|
vintf_node = vintf.find(str(QName(ns, "DhcpRelays")))
|
||||||
vintfdhcpservers = vintf.find(str(QName(ns, "DhcpRelays"))).text
|
if vintf_node is not None and vintf_node.text is not None:
|
||||||
|
vintfdhcpservers = vintf_node.text
|
||||||
vdhcpserver_list = vintfdhcpservers.split(';')
|
vdhcpserver_list = vintfdhcpservers.split(';')
|
||||||
vlan_attributes['dhcp_servers'] = vdhcpserver_list
|
vlan_attributes['dhcp_servers'] = vdhcpserver_list
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user