Last active
March 24, 2020 15:21
-
-
Save JonTheNiceGuy/38bedf4c0bc6b1f69639 to your computer and use it in GitHub Desktop.
Regex to match Interface details
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IPSO Trunked Non-VRRP (run ifconfig -a) | |
lname\s+([^>]+)\s+flags[^>]+>\s+vlan-id\s+(\d+)\s+inet mtu \d+\s+(inet ([\d+\.\d+\.\d+\.\d+]+)|([\d+\.\d+\.\d+\.\d+]+))\/(\d+)\s+broadcast\s+\S+[^>]+>\s+ether\s+(\S+) | |
ifname 1 | |
vlan 2 | |
ip 4 or 5 | |
subnet 6 | |
mac 7 | |
IPSO Trunked VRRP (run ifconfig -a) | |
lname\s+([^>]+)\s+flags[^>]+>\s+vlan-id\s+(\d+)\s+inet mtu \d+\s+(inet ([\d+\.\d+\.\d+\.\d+]+)|([\d+\.\d+\.\d+\.\d+]+))\/(\d+)\s+broadcast\s+\S+\s+(inet ([\d+\.\d+\.\d+\.\d+]+)|([\d+\.\d+\.\d+\.\d+]+))\/(\d+)\s+broadcast\s+\S+\s+vrrpmac\s+(\S+) | |
ifname 1 | |
vlan 2 | |
ip 8 or 9 | |
subnet 10 | |
mac 11 | |
IPSO Access Non-VRRP (run ifconfig -a) | |
lname\s+([^>]+)\s+flags[^>]+>\s+inet mtu \d+\s+(inet ([\d+\.\d+\.\d+\.\d+]+)|([\d+\.\d+\.\d+\.\d+]+))\/(\d+)\s+broadcast\s+\S+[^>]+>\s+ether\s+(\S+) | |
ifname 1 | |
ip 3 or 4 | |
subnet 5 | |
mac 6 | |
IPSO Access VRRP (run ifconfig -a) | |
lname\s+([^>]+)\s+flags[^>]+>\s+inet mtu \d+\s+(inet ([\d+\.\d+\.\d+\.\d+]+)|([\d+\.\d+\.\d+\.\d+]+))\/(\d+)\s+broadcast\s+\S+\s+(inet ([\d+\.\d+\.\d+\.\d+]+)|([\d+\.\d+\.\d+\.\d+]+))\/(\d+)\s+broadcast\s+\S+\s+vrrpmac\s+(\S+) | |
ifname 1 | |
ip 7 or 8 | |
subnet 9 | |
mac 10 | |
SPLAT Interface (run ifconfig -a) | |
((\S+)\.(\d+)|(\S+))\s+Link\s+encap:\S+\s+HWaddr\s+(\S+)\s+inet\s+addr:(\S+)\s+Bcast:\S+\s+Mask:(\S+) | |
ifname 1 | |
mac 5 | |
ip 6 | |
subnet 7 | |
vlan 3 | |
Solaris Interfaces (run ifconfig -a) | |
(\S+):\s+flags=[^>]+>\s+mtu\s+\d+\s+index\s+\d+\s+inet\s+(\S+)\s+netmask\s+(\S+)\s+\S+\s+\S+\s+ether\s+(\S+) | |
ifname 1 | |
ip 2 | |
subnet 3 | |
mac 4 | |
Juniper ScreenOS - Access (this will match for trunk with IP of 0.0.0.0 - run get tech) | |
(set interface \"(ethernet\d+\/\d+\.\d+)\" tag (\d+) zone \"([^\"]+)\"|set interface (ethernet\d+\/\d+\.\d+)\s+ip\s+(\d+\.\d+\.\d+\.\d+)\/(\d+)|set interface (ethernet\d+\/\d+\.\d+)\s+manage-ip\s+(\d+\.\d+\.\d+\.\d+)|description\s+(\S+)\s+number\s+\d+,\s+if.info\s+\d+,\s+if.index\s+\d+(\s+|, mode\s+\S+)\s+link\s+(\S+),\s+phy-link\s+([^\/]+)\/(\S+|[^\/]+\/\S+),\s+admin\s+status\s+(\S+)\s+status change:\d+,\s+last change:\S+\s+\S+\s+vsys\s+([^,]+),\s+zone\s+([^,]+),\s+vr\s+([^,]+),\s+vsd\s+(\S+)(.*\s+|.*\s+.*\s+|.*\s+.*\s+.*\s+|.*\s+.*\s+.*\s+.*\s+|.*\s+.*\s+.*\s+.*\s+.*\s+|.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+|.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+|.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+|.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+|.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+)\**ip\s+(\d+\.\d+\.\d+\.\d+)\/(\d+)\s+mac\s+(\S+)(\s+\**manage\s+ip\s+(\d+\.\d+\.\d+\.\d+),\s+mac\s+(\S+)|\s+)) | |
ifname 10 | |
ip 21 | |
subnet 22 | |
mac 23 | |
VSYS 16 | |
Zone 17 | |
VR 18 | |
VSD 19 | |
Juniper ScreenOS - Trunk vlan and VR (run get tech) | |
(set interface \"(ethernet\d+\/\d+\.\d+)\" tag (\d+) zone \"([^\"]+)\"|set interface (ethernet\d+\/\d+\.\d+)\s+ip\s+(\d+\.\d+\.\d+\.\d+)\/(\d+)|set interface (ethernet\d+\/\d+\.\d+)\s+manage-ip\s+(\d+\.\d+\.\d+\.\d+)|description\s+(\S+)\s+number\s+\d+,\s+if.info\s+\d+,\s+if.index\s+\d+(\s+|, mode\s+\S+)\s+link\s+(\S+),\s+phy-link\s+([^\/]+)\/(\S+|[^\/]+\/\S+),\s+admin\s+status\s+(\S+)\s+status change:\d+,\s+last change:\S+\s+\S+\s+vsys\s+([^,]+),\s+zone\s+([^,]+),\s+vr\s+([^,]+),\s+vsd\s+(\S+)(.*\s+|.*\s+.*\s+|.*\s+.*\s+.*\s+|.*\s+.*\s+.*\s+.*\s+|.*\s+.*\s+.*\s+.*\s+.*\s+|.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+|.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+|.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+|.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+|.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+)\**ip\s+(\d+\.\d+\.\d+\.\d+)\/(\d+)\s+mac\s+(\S+)(\s+\**manage\s+ip\s+(\d+\.\d+\.\d+\.\d+),\s+mac\s+(\S+)|\s+)) | |
ifname 2 | |
vlan 3 | |
VR 4 | |
Juniper ScreenOS - Trunk IP (run get tech) | |
(set interface \"(ethernet\d+\/\d+\.\d+)\" tag (\d+) zone \"([^\"]+)\"|set interface (ethernet\d+\/\d+\.\d+)\s+ip\s+(\d+\.\d+\.\d+\.\d+)\/(\d+)|set interface (ethernet\d+\/\d+\.\d+)\s+manage-ip\s+(\d+\.\d+\.\d+\.\d+)|description\s+(\S+)\s+number\s+\d+,\s+if.info\s+\d+,\s+if.index\s+\d+(\s+|, mode\s+\S+)\s+link\s+(\S+),\s+phy-link\s+([^\/]+)\/(\S+|[^\/]+\/\S+),\s+admin\s+status\s+(\S+)\s+status change:\d+,\s+last change:\S+\s+\S+\s+vsys\s+([^,]+),\s+zone\s+([^,]+),\s+vr\s+([^,]+),\s+vsd\s+(\S+)(.*\s+|.*\s+.*\s+|.*\s+.*\s+.*\s+|.*\s+.*\s+.*\s+.*\s+|.*\s+.*\s+.*\s+.*\s+.*\s+|.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+|.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+|.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+|.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+|.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+)\**ip\s+(\d+\.\d+\.\d+\.\d+)\/(\d+)\s+mac\s+(\S+)(\s+\**manage\s+ip\s+(\d+\.\d+\.\d+\.\d+),\s+mac\s+(\S+)|\s+)) | |
ifname 5 | |
ip 6 | |
subnet 7 | |
Juniper ScreenOS - Trunk Management (run get tech) | |
(set interface \"(ethernet\d+\/\d+\.\d+)\" tag (\d+) zone \"([^\"]+)\"|set interface (ethernet\d+\/\d+\.\d+)\s+ip\s+(\d+\.\d+\.\d+\.\d+)\/(\d+)|set interface (ethernet\d+\/\d+\.\d+)\s+manage-ip\s+(\d+\.\d+\.\d+\.\d+)|description\s+(\S+)\s+number\s+\d+,\s+if.info\s+\d+,\s+if.index\s+\d+(\s+|, mode\s+\S+)\s+link\s+(\S+),\s+phy-link\s+([^\/]+)\/(\S+|[^\/]+\/\S+),\s+admin\s+status\s+(\S+)\s+status change:\d+,\s+last change:\S+\s+\S+\s+vsys\s+([^,]+),\s+zone\s+([^,]+),\s+vr\s+([^,]+),\s+vsd\s+(\S+)(.*\s+|.*\s+.*\s+|.*\s+.*\s+.*\s+|.*\s+.*\s+.*\s+.*\s+|.*\s+.*\s+.*\s+.*\s+.*\s+|.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+|.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+|.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+|.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+|.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+.*\s+)\**ip\s+(\d+\.\d+\.\d+\.\d+)\/(\d+)\s+mac\s+(\S+)(\s+\**manage\s+ip\s+(\d+\.\d+\.\d+\.\d+),\s+mac\s+(\S+)|\s+)) | |
ifname 8 | |
ip 9 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment