Skip to content

Commit

Permalink
Update dcnm_interface.py (#359)
Browse files Browse the repository at this point in the history
Update if condition for sub_int to support two regex.
* EthernetX/yyy.zzz
* PortX.zzzzz
  • Loading branch information
ccoueffe authored Dec 20, 2024
1 parent 904144d commit f77ab26
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions plugins/modules/dcnm_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -1887,8 +1887,12 @@ def dcnm_intf_get_if_name(self, name, if_type):
port_id = re.findall(r"\d+", name)
return ("vPC" + str(port_id[0]), port_id[0])
if "sub_int" == if_type:
port_id = re.findall(r"\d+\/\d+.\d+", name)
return ("Ethernet" + str(port_id[0]), port_id[0])
if re.findall(r"\d+\/\d+.\d+", name):
port_id = re.findall(r"\d+\/\d+.\d+", name)
return ("Ethernet" + str(port_id[0]), port_id[0])
if re.findall(r"\d+.\d+", name):
port_id = re.findall(r"\d+\.\d+", name)
return ("Port-channel" + str(port_id[0]), port_id[0])
if "lo" == if_type:
port_id = re.findall(r"\d+", name)
return ("Loopback" + str(port_id[0]), port_id[0])
Expand Down

0 comments on commit f77ab26

Please sign in to comment.