Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
heyglen committed Mar 26, 2019
1 parent ccaeee9 commit dfb4068
Show file tree
Hide file tree
Showing 5 changed files with 233 additions and 0 deletions.
13 changes: 13 additions & 0 deletions cisco-ios-xr.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,19 @@ variables:
)
\b
)
number_range_1_1440: |
(?xi)
(?:
\b
(?:
(?:1440)|
(?:14[0-3]\d)|
(?:1[0-3]\d{2})|
(?:\d{2,3})|
(?:[1-9])
)
\b
)
# 0 - 2047
number_11_bit: |
(?xi)
Expand Down
177 changes: 177 additions & 0 deletions cisco-ios.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,56 @@ variables:
route_target: '\d+:\d+'
type_5_password: \S+
type_7_password: \S+
mac_address: |
(?xi)
(?:
(?:[a-f0-9]{1,4}\.){2}[a-f0-9]{1,4}
)
ah_transform: |
(?xi)
(?:
(?:ah-md5-hmac)|
(?:ah-sha-hmac)
)
number_range_1_1440: |
(?xi)
(?:
\b
(?:
(?:1440)|
(?:14[0-3]\d)|
(?:1[0-3]\d{2})|
(?:\d{2,3})|
(?:[1-9])
)
\b
)
number_range_1_4097: |
(?xi)
(?:
\b
(?:
(?:409[0-7])|
(?:40[0-8]\d)|
(?:[1-3]\d{3})|
(?:\d{2,3})|
(?:[1-9])
)
\b
)
number_range_1_1024: |
(?xi)
(?:
\b
(?:
(?:102[0-4])|
(?:10[0-1]\d)|
(?:\d{2,3})|
(?:[1-9])
)
\b
)
# 1 - 255
number_8_bit: |
(?xi)
Expand Down Expand Up @@ -2947,13 +2991,146 @@ contexts:
- match: '^\s*(switchport\s+mode\s+(?:trunk|access|capture))'
captures:
1: support.constant
- include: interface_switchport_port_security
- include: switchport_trunk
- include: switchport_access
- include: switchport_voice
- match: '^\s*(switchport)'
captures:
1: support.constant

interface_switchport_port_security:
- include: interface_switchport_port_security_aging
- include: interface_switchport_port_security_maximum
- include: interface_switchport_port_security_mac_address
- include: interface_switchport_port_security_violation
- match: |
(?xi)
^\s*
(switchport)\s+(port-security)
\s*$
captures:
1: support.constant
2: support.constant
interface_switchport_port_security_aging:
- match: |
(?xi)
^\s*
(switchport)\s+(port-security)\s+(aging)\s+
(?:
(?:(static))|
(?:(time)\s+({{number_range_1_1440}}))|
(?:(type)\s+
(
(?:absolute)|
(?:inactivity)
)
)
)
\s*$
captures:
1: support.constant
2: support.constant
3: support.constant
4: support.constant
5: support.constant
6: constant.numeric
7: support.constant
8: constant.language
interface_switchport_port_security_mac_address:
- match: |
(?xi)
^\s*
(switchport)\s+(port-security)\s+(mac-address)\s+
(?:
({{number_range_1_1024}})|
(?:(sticky)(\s+{{mac_address}})?)|
(?:(vlan)\s+
(?:
(?:({{vlan_id}})(?:\s+(voice))?)|
(?:
(?:
(?:({{vlan_id}}))(?:(-)({{vlan_id}}))?
(,)
)*
({{vlan_id}})(?:(-)({{vlan_id}}))?
)
)
)|
(?:({{mac_address}})\s+(vlan)\s+(voice))
)
\s*$
captures:
1: support.constant
2: support.constant
3: support.constant
4: constant.numeric
5: support.constant
6: constant.numeric.mac
7: support.constant
8: constant.numeric.vlan
9: support.constant
10: constant.numeric.vlan
11: comment
12: constant.numeric.vlan
13: comment
14: constant.numeric.vlan
15: comment
16: constant.numeric.vlan
17: constant.numeric.mac
18: support.constant
19: support.constant
interface_switchport_port_security_maximum:
- match: |
(?xi)
^\s*
(switchport)\s+(port-security)\s+(maximum)\s+({{number_range_1_4097}})
(?:
\s+(vlan)\s+
(?:
(?:
(?:({{vlan_id}}))(?:(-)({{vlan_id}}))?
(,)
)*
({{vlan_id}})(?:(-)({{vlan_id}}))?
)
)?
\s*$
captures:
1: support.constant
2: support.constant
3: support.constant
4: constant.numeric
5: support.constant
6: constant.numeric.vlan
7: comment
8: constant.numeric.vlan
9: comment
10: constant.numeric.vlan
11: comment
12: constant.numeric.vlan
interface_switchport_port_security_violation:
- match: |
(?xi)
^\s*
(switchport)\s+(port-security)\s+(violation)\s+
(
(?:shutdown)|
(?:restrict)|
(?:protect)
)
\s*$
captures:
1: support.constant
2: support.constant
3: support.constant
4: constant.language
switchport_voice:
- match: ^\s*(switchport\s+voice\s+vlan)\s+({{vlan_id}})
captures:
Expand Down
2 changes: 2 additions & 0 deletions messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@
"2.20.0": "messages/2.20.0.md",
"2.21.0": "messages/2.21.0.md",
"2.21.1": "messages/2.21.1.md",
"2.22.0": "messages/2.22.0.md",
"2.23.0": "messages/2.23.0.md",
}
22 changes: 22 additions & 0 deletions messages/2.23.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# [2.23.0] - 2019-03-26

## Added

- Cisco IOS

- Syntax

- switchport port-security [Issue 16](https://github.com/heyglen/network_tech/issues/16)

- Cisco IOS XR

- Syntax support! [Issue 15](https://github.com/heyglen/network_tech/issues/15)

Some basic syntax highlighting is now supported, you can see which syntax is supported [here](https://github.com/heyglen/network_tech/blob/master/tests/syntax_test_cisco_ios_xr.cisco-ios-xr)

Other (specific) syntax will be added by opening issues.


- RIR Lookup from IANA

- Hover the mouse over an IP and see which [RIR](https://www.iana.org/numbers) it belongs to
19 changes: 19 additions & 0 deletions tests/syntax_test_cisco_ios.cisco-ios
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,25 @@ interface range GigabitEthernet1/1-2
no switchport
no shutdown
shutdown
switchport port-security
switchport port-security aging static
switchport port-security aging time 1440
switchport port-security aging type absolute
switchport port-security aging type inactivity
switchport port-security mac-address 1024
switchport port-security mac-address sticky
switchport port-security mac-address sticky 0.0.1
switchport port-security mac-address vlan 4095
switchport port-security mac-address vlan 1,2-3
switchport port-security mac-address vlan 4095 voice
switchport port-security mac-address 0.0.1 vlan voice
switchport port-security maximum 4097
switchport port-security maximum 4097 vlan 4095
switchport port-security maximum 4097 vlan 1-4095
switchport port-security maximum 4097 vlan 1-2,4-4095
switchport port-security violation shutdown
switchport port-security violation restrict
switchport port-security violation protect
spanning-tree bpduguard enable
spanning-tree bpduguard disable
service-policy output SOMETHING
Expand Down

0 comments on commit dfb4068

Please sign in to comment.