Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normalize pvid with vlan_id #2019

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/dev/data_model.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ Example: Imagine the extra programming logic needed to consume structured data w
| `PREFIX_LENGTH` | instead of PREFIX or CIDR for the numbers of a slash notation or CIDR mask |
| `PROTOCOL` | instead of PROTO |
| `ROUTER_ID` | for local router IDs (local to the device being parsed) |
| `VLAN_ID` | instead of VLAN or TAG |
| `VLAN_NAME` | VLAN name or description |
| `VLAN_ID` | instead of VLAN, TAG, or PVID (Port VLAN ID) |
| `VLAN_NAME` | VLAN name or VLAN description |
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Value INTERFACE (\S+\s+\d+\s*/\s*\d+)
Value NAME (.*?)
Value STATUS (Up|Down|Disabled)
Value PVID (\d+)
Value VLAN_ID (\d+)
Value PRIORITY (\d+)
Value NEGOTIATION (Auto)
Value SPEED (\d+)
Expand All @@ -16,6 +16,6 @@ Start

IfacesTable
^(?:\s*-+)+\s*$$
^\s*${INTERFACE}(?:\s+${NAME})?\s+${STATUS}\s+${PVID}\s+${PRIORITY}\s+(?:${NEGOTIATION})?-?(?:${SPEED}${DUPLEX})?\s+${TYPE}\s+${TRUNK}\s*$$ -> Record
^\s*${INTERFACE}(?:\s+${NAME})?\s+${STATUS}\s+${VLAN_ID}\s+${PRIORITY}\s+(?:${NEGOTIATION})?-?(?:${SPEED}${DUPLEX})?\s+${TYPE}\s+${TRUNK}\s*$$ -> Record
^\s*$$
^. -> Error
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Value MAIN_IP (\S+)
Value SPEED (\S+)
Value DUPLEX (A|H|F)
Value TYPE (A|T|H)
Value PVID (\d+)
Value VLAN_ID (\d+)
Value DESCRIPTION (.*?)

Start
Expand All @@ -27,6 +27,6 @@ RouteModeIfaces
^. -> Error

BridgeModeIfaces
^${INTERFACE}\s+${LINK}\s+${SPEED}\s+${DUPLEX}\s+${TYPE}\s+${PVID}(?:\s+${DESCRIPTION})?\s*$$ -> Record
^${INTERFACE}\s+${LINK}\s+${SPEED}\s+${DUPLEX}\s+${TYPE}\s+${VLAN_ID}(?:\s+${DESCRIPTION})?\s*$$ -> Record
^\s*$$
^. -> Error
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Value PROTOCOL_STATUS (\S*|\S*\s+\(\w+\))
Value INTERFACE_DESCRIPTION (.*)
Value LINK_TYPE (\S+)
Value PORT_TYPE (\S*)
Value PVID (\d+)
Value VLAN_ID (\d+)
Value TPID (\S+)
Value MTU (\d+)
Value HOLD_TIMER (\d+)
Expand All @@ -30,9 +30,9 @@ Start
^Description:${INTERFACE_DESCRIPTION}\s*$$
^${PORT_TYPE}\s+Port,\s*Link-type\s*:\s*${LINK_TYPE},\s*$$
^${PORT_TYPE}\s+Port,\s*The\s+(MTU|Maximum\s+Transmit\s+Unit)\s+is\s+${MTU}(,\s*Hold\s*timer\s*is\s*${HOLD_TIMER}\(sec\))?\s*$$
^${PORT_TYPE}\s+Port,(\s*PVID\s*:\s*${PVID},)?\s*TPID\s*:\s*${TPID},\s*The\s*Maximum\s*(Frame\s*Length|Transmit\s*Unit)\s*is\s*${MTU}\s*$$
^${PORT_TYPE}\s+Port,(\s*PVID\s*:\s*${VLAN_ID},)?\s*TPID\s*:\s*${TPID},\s*The\s*Maximum\s*(Frame\s*Length|Transmit\s*Unit)\s*is\s*${MTU}\s*$$
^TPID\s*:\s*${TPID},\s*The\s*Maximum\s*Frame\s*Length\s*is\s*${MTU}\s*$$
^PVID\s*:\s+${PVID},(\s*[^,]+,){0,}\s+The\s+Maximum\s+Frame\s+Length\s+is\s+${MTU}
^PVID\s*:\s+${VLAN_ID},(\s*[^,]+,){0,}\s+The\s+Maximum\s+Frame\s+Length\s+is\s+${MTU}
^Internet\s+Address\s+is\s+allocated\s+by\s+DHCP,\s+${INTERNET_ADDRESS}\s*$$
^Internet\s+Address\s+is\s+negotiated,\s+${INTERNET_ADDRESS}\s*$$
^Internet\s+Address\s+is\s+${INTERNET_ADDRESS}\s*$$
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Value Required INTERFACE ([\w\.\/\-]+)
Value LINK_TYPE (trunk|access|auto|hybrid|desirable)
Value PVID (\d+)
Value VLAN_ID (\d+)
Value List TRUNK_VLAN_LIST (\d+\-\d+|\d+)


Expand All @@ -11,7 +11,7 @@ Start

VLANS
^[\w\.\/\-]+ -> Continue.Record
^${INTERFACE}\s+${LINK_TYPE}\s+${PVID}\s+${TRUNK_VLAN_LIST}\s* -> Continue
^${INTERFACE}\s+${LINK_TYPE}\s+${VLAN_ID}\s+${TRUNK_VLAN_LIST}\s* -> Continue
^[\w\.\/\-]+\s+(?:\S+\s+){3}${TRUNK_VLAN_LIST}\s* -> Continue
^[\w\.\/\-]+\s+(?:\S+\s+){4}${TRUNK_VLAN_LIST}\s* -> Continue
^[\w\.\/\-]+\s+(?:\S+\s+){5}${TRUNK_VLAN_LIST}\s* -> Continue
Expand Down Expand Up @@ -134,7 +134,7 @@ VLANS
# Bundled interface (PVID is 0)
^${INTERFACE}\s+-\s+0\s+-\s*$$ -> Record
# Access port (PVID is empty)
^${INTERFACE}\s+${LINK_TYPE}\s+${PVID}\s+-\s*$$ -> Record
^${INTERFACE}\s+${LINK_TYPE}\s+${VLAN_ID}\s+-\s*$$ -> Record
# Interface lists
^[\w\.\/\-]+\s+\S+\s+\d+\s+[0-9\- ]+$$
^\s{6,}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ Value DUPLEX (\S+)
Value SPEED (\S+)
Value TRUNK (\S+)
Value TAG (\S+)
Value PVID (\S+)
Value VLAN_ID (\S+)
Value PRIORITY (\S+)
Value MAC_ADDRESS (([A-Fa-f0-9\.]{14}|None))
Value NAME (\S+)

Start
^Port\s+Link\s+State\s+Dupl\s+Speed\s+Trunk\s+Tag\s+Pvid\s+Pri\s+MAC\s+Name
^${PORT}\s+${LINK}\s+${STATE}\s+${DUPLEX}\s+${SPEED}\s+${TRUNK}\s+${TAG}\s+${PVID}\s+${PRIORITY}\s+${MAC_ADDRESS}\s+${NAME} -> Record
^${PORT}\s+${LINK}\s+${STATE}\s+${DUPLEX}\s+${SPEED}\s+${TRUNK}\s+${TAG}\s+${PVID}\s+${PRIORITY}\s+${MAC_ADDRESS} -> Record
^${PORT}\s+${LINK}\s+${STATE}\s+${DUPLEX}\s+${SPEED}\s+${TRUNK}\s+${TAG}\s+${VLAN_ID}\s+${PRIORITY}\s+${MAC_ADDRESS}\s+${NAME} -> Record
^${PORT}\s+${LINK}\s+${STATE}\s+${DUPLEX}\s+${SPEED}\s+${TRUNK}\s+${TAG}\s+${VLAN_ID}\s+${PRIORITY}\s+${MAC_ADDRESS} -> Record
^\s*$$
^. -> Error
Original file line number Diff line number Diff line change
@@ -1,102 +1,102 @@
---
parsed_sample:
- interface: "Eth 1/ 1"
- duplex: ""
interface: "Eth 1/ 1"
name: "Mikrotik-11.22.33."
priority: "0"
pvid: "1"
negotiation: "Auto"
priority: "0"
speed: ""
duplex: ""
status: "Down"
trunk: "None"
type: "100TX"
- interface: "Eth 1/ 2"
vlan_id: "1"
- duplex: ""
interface: "Eth 1/ 2"
name: "vl10_toTESTS-PC"
priority: "0"
pvid: "5"
negotiation: "Auto"
priority: "0"
speed: ""
duplex: ""
status: "Down"
trunk: "None"
type: "100TX"
- interface: "Eth 1/ 3"
vlan_id: "5"
- duplex: "full"
interface: "Eth 1/ 3"
name: "FortiGateLOL-vl10"
priority: "0"
pvid: "730"
negotiation: "Auto"
priority: "0"
speed: "100"
duplex: "full"
status: "Up"
trunk: "None"
type: "100TX"
- interface: "Eth 1/ 4"
vlan_id: "730"
- duplex: ""
interface: "Eth 1/ 4"
name: ""
priority: "0"
pvid: "3010"
negotiation: "Auto"
priority: "0"
speed: ""
duplex: ""
status: "Down"
trunk: "None"
type: "100TX"
- interface: "Eth 1/ 5"
vlan_id: "3010"
- duplex: "full"
interface: "Eth 1/ 5"
name: ""
priority: "0"
pvid: "884"
negotiation: ""
priority: "0"
speed: "100"
duplex: "full"
status: "Down"
trunk: "None"
type: "100TX"
- interface: "Eth 1/ 6"
vlan_id: "884"
- duplex: ""
interface: "Eth 1/ 6"
name: ""
priority: "0"
pvid: "884"
negotiation: "Auto"
priority: "0"
speed: ""
duplex: ""
status: "Down"
trunk: "None"
type: "100TX"
- interface: "Eth 1/ 7"
vlan_id: "884"
- duplex: "full"
interface: "Eth 1/ 7"
name: "Phone_Lollink_RNCB"
priority: "0"
pvid: "222"
negotiation: "Auto"
priority: "0"
speed: "100"
duplex: "full"
status: "Up"
trunk: "None"
type: "100TX"
- interface: "Eth 1/ 8"
vlan_id: "222"
- duplex: "full"
interface: "Eth 1/ 8"
name: ""
priority: "0"
pvid: "222"
negotiation: "Auto"
priority: "0"
speed: "100"
duplex: "full"
status: "Up"
trunk: "None"
type: "100TX"
- interface: "Eth 1/ 9"
vlan_id: "222"
- duplex: "full"
interface: "Eth 1/ 9"
name: ""
priority: "0"
pvid: "1"
negotiation: "Auto"
priority: "0"
speed: "1000"
duplex: "full"
status: "Up"
trunk: "None"
type: "1000T"
- interface: "Eth 1/10"
vlan_id: "1"
- duplex: "full"
interface: "Eth 1/10"
name: "Uplink"
priority: "0"
pvid: "1"
negotiation: "Auto"
priority: "0"
speed: "1000"
duplex: "full"
status: "Up"
trunk: "None"
type: "1000Base SFP"
vlan_id: "1"
Original file line number Diff line number Diff line change
Expand Up @@ -6,96 +6,96 @@ parsed_sample:
link: "UP"
main_ip: "--"
protocol: "UP"
pvid: ""
speed: ""
type: ""
vlan_id: ""
- description: ""
duplex: ""
interface: "Cellular0/0"
link: "DOWN"
main_ip: "--"
protocol: "DOWN"
pvid: ""
speed: ""
type: ""
vlan_id: ""
- description: "The interface for connecting RouterA."
duplex: ""
interface: "GE0/0"
link: "UP"
main_ip: "192.168.100.1"
protocol: "UP"
pvid: ""
speed: ""
type: ""
vlan_id: ""
- description: "--"
duplex: ""
interface: "Loop0"
link: "UP"
main_ip: "--"
protocol: "UP(s)"
pvid: ""
speed: ""
type: ""
vlan_id: ""
- description: ""
duplex: ""
interface: "MP0"
link: "DOWN"
main_ip: "--"
protocol: "DOWN"
pvid: ""
speed: ""
type: ""
vlan_id: ""
- description: "--"
duplex: ""
interface: "NULL0"
link: "UP"
main_ip: "--"
protocol: "UP(s)"
pvid: ""
speed: ""
type: ""
vlan_id: ""
- description: ""
duplex: ""
interface: "Vlan1"
link: "DOWN"
main_ip: "192.168.1.1"
protocol: "DOWN"
pvid: ""
speed: ""
type: ""
vlan_id: ""
- description: ""
duplex: "A"
interface: "GE0/1"
link: "DOWN"
main_ip: ""
protocol: ""
pvid: "1"
speed: "auto"
type: "A"
vlan_id: "1"
- description: ""
duplex: "A"
interface: "GE0/2"
link: "DOWN"
main_ip: ""
protocol: ""
pvid: "1"
speed: "auto"
type: "A"
vlan_id: "1"
- description: ""
duplex: "A"
interface: "GE0/3"
link: "DOWN"
main_ip: ""
protocol: ""
pvid: "1"
speed: "auto"
type: "A"
vlan_id: "1"
- description: ""
duplex: "A"
interface: "GE0/4"
link: "DOWN"
main_ip: ""
protocol: ""
pvid: "1"
speed: "auto"
type: "A"
vlan_id: "1"
Loading