Fix nxos_l3_interfaces rendering of dhcp (#66049)
Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>
This commit is contained in:
parent
abad4fbf5e
commit
94e054755f
1 changed files with 7 additions and 10 deletions
|
@ -17,7 +17,7 @@ from copy import deepcopy
|
||||||
|
|
||||||
from ansible.module_utils.network.common import utils
|
from ansible.module_utils.network.common import utils
|
||||||
from ansible.module_utils.network.nxos.argspec.l3_interfaces.l3_interfaces import L3_interfacesArgs
|
from ansible.module_utils.network.nxos.argspec.l3_interfaces.l3_interfaces import L3_interfacesArgs
|
||||||
from ansible.module_utils.network.nxos.utils.utils import get_interface_type, validate_ipv4_addr, validate_ipv6_addr
|
from ansible.module_utils.network.nxos.utils.utils import get_interface_type
|
||||||
|
|
||||||
|
|
||||||
class L3_interfacesFacts(object):
|
class L3_interfacesFacts(object):
|
||||||
|
@ -83,18 +83,16 @@ class L3_interfacesFacts(object):
|
||||||
if get_interface_type(intf) == 'unknown':
|
if get_interface_type(intf) == 'unknown':
|
||||||
return {}
|
return {}
|
||||||
config['name'] = intf
|
config['name'] = intf
|
||||||
|
|
||||||
ipv4_match = re.compile(r'\n ip address (.*)')
|
ipv4_match = re.compile(r'\n ip address (.*)')
|
||||||
matches = ipv4_match.findall(conf)
|
matches = ipv4_match.findall(conf)
|
||||||
if matches:
|
if matches:
|
||||||
if validate_ipv4_addr(matches[0]):
|
if matches[0]:
|
||||||
config['ipv4'] = []
|
config['ipv4'] = []
|
||||||
for m in matches:
|
for m in matches:
|
||||||
ipv4_conf = m.split()
|
ipv4_conf = m.split()
|
||||||
addr = ipv4_conf[0]
|
addr = ipv4_conf[0]
|
||||||
ipv4_addr = addr if validate_ipv4_addr(addr) else None
|
if addr:
|
||||||
if ipv4_addr:
|
config_dict = {'address': addr}
|
||||||
config_dict = {'address': ipv4_addr}
|
|
||||||
if len(ipv4_conf) > 1:
|
if len(ipv4_conf) > 1:
|
||||||
d = ipv4_conf[1]
|
d = ipv4_conf[1]
|
||||||
if d == 'secondary':
|
if d == 'secondary':
|
||||||
|
@ -109,14 +107,13 @@ class L3_interfacesFacts(object):
|
||||||
ipv6_match = re.compile(r'\n ipv6 address (.*)')
|
ipv6_match = re.compile(r'\n ipv6 address (.*)')
|
||||||
matches = ipv6_match.findall(conf)
|
matches = ipv6_match.findall(conf)
|
||||||
if matches:
|
if matches:
|
||||||
if validate_ipv6_addr(matches[0]):
|
if matches[0]:
|
||||||
config['ipv6'] = []
|
config['ipv6'] = []
|
||||||
for m in matches:
|
for m in matches:
|
||||||
ipv6_conf = m.split()
|
ipv6_conf = m.split()
|
||||||
addr = ipv6_conf[0]
|
addr = ipv6_conf[0]
|
||||||
ipv6_addr = addr if validate_ipv6_addr(addr) else None
|
if addr:
|
||||||
if ipv6_addr:
|
config_dict = {'address': addr}
|
||||||
config_dict = {'address': ipv6_addr}
|
|
||||||
if len(ipv6_conf) > 1:
|
if len(ipv6_conf) > 1:
|
||||||
d = ipv6_conf[1]
|
d = ipv6_conf[1]
|
||||||
if d == 'tag':
|
if d == 'tag':
|
||||||
|
|
Loading…
Reference in a new issue