From 3fb030ae640fe3581481b8c279a4727e65ba655b Mon Sep 17 00:00:00 2001 From: Glen Harmon Date: Mon, 13 Apr 2020 14:06:30 +0200 Subject: [PATCH] Issue 30, Issue 33 --- cisco-ios.sublime-syntax | 280 ++++++++++++++++++++++++++ cisco/ios/ios.sublime-completions | 52 +++++ docs/index.rst | 3 + messages.json | 4 +- messages/2.36.0.md | 12 ++ messages/2.37.0.md | 25 +++ tests/syntax_test_cisco_ios.cisco-ios | 54 +++++ 7 files changed, 429 insertions(+), 1 deletion(-) create mode 100644 messages/2.36.0.md create mode 100644 messages/2.37.0.md diff --git a/cisco-ios.sublime-syntax b/cisco-ios.sublime-syntax index ec7efa8..6152c52 100644 --- a/cisco-ios.sublime-syntax +++ b/cisco-ios.sublime-syntax @@ -78,6 +78,45 @@ variables: (?:ah-md5-hmac)| (?:ah-sha-hmac) ) + logging_level: | + (?xi) + (?: + (?:emergencies)| + (?:alerts)| + (?:critical)| + (?:errors)| + (?:warnings)| + (?:notifications)| + (?:informational)| + (?:debugging)| + (?:[0-7]) + ) + logging_level_digits: | + (?xi) + (?: + (?:[0-7]) + ) + logging_facilities: | + (?xi) + (?: + \b + (?: + (?:auth)| + (?:cron)| + (?:daemon)| + (?:kern)| + (?:local[0-7])| + (?:lpr)| + (?:mail)| + (?:news)| + (?:sys9)| + (?:sys1[0-4])| + (?:syslog)| + (?:user)| + (?:uucp) + ) + \b + ) number_range_1_1440: | (?xi) (?: @@ -137,6 +176,17 @@ variables: ) \b ) + number_range_1_10000: | + (?xi) + (?: + \b + (?: + (?:10000)| + (?:\d{2,4})| + (?:[1-9]) + ) + \b + ) number_range_0_60000: | (?xi) (?: @@ -171,6 +221,41 @@ variables: ) \b ) + number_range_0_604800000: | + (?xi) + (?: + \b + (?: + (?:604800000)| + (?:604[0-7]\d{5})| + (?:60[0-3]\d{6})| + (?:[0-5]\d{8})| + (?:\d{1,8}) + ) + \b + ) + number_range_4096_2147483647: | + (?xi) + (?: + \b + (?: + (?:214748364[0-7])| + (?:21474836[0-3]\d)| + (?:2147483[0-5]\d{2})| + (?:214748[0-2]\d{3})| + (?:21474[0-7]\d{4})| + (?:2147[0-3]\d{5})| + (?:214[0-6]\d{6})| + (?:21[0-3]\d{7})| + (?:20\d{8})| + (?:1\d{9})| + (?:\d{5,9})| + (?:409[6-9])| + (?:4[1-9]\d{2})| + (?:[5-9]\d{3}) + ) + \b + ) # 1 - 255 number_8_bit: | (?xi) @@ -1127,6 +1212,7 @@ contexts: - include: ip_sla - include: extended_acl_old - include: route_map + - include: configure_terminal_ip_dhcp_snooping # - include: partials @@ -1448,6 +1534,19 @@ contexts: 5: invalid.illegal logging: + - include: logging_buffered + - include: logging_discriminator + - match: | + (?xi) + ^\s* + (logging\s+host)\s+ + ( + (?:{{ipv6}})| + (?:{{ip}}) + ) + captures: + 1: support.constant # logging + 2: constant.numeric.ip.ipv4.address # logging ip - match: | (?xi) ^\s* @@ -1471,6 +1570,104 @@ contexts: 6: entity.other.attribute-name # logging source-interface 7: constant.numeric # logging source-interface interface_type + logging_buffered: + - match: | + (?xi) + ^\s* + (logging\s+buffered) + (?: + \s+ + (discriminator)\s+(\S{1,8}) + )? + (?:\s+({{number_range_4096_2147483647}}))? + (\s+{{logging_level}})? + captures: + 1: support.constant # logging buffered + 2: support.constant + 3: string.unquoted + 4: constant.numeric + 5: constant.numeric + + + logging_discriminator: + - match: | + (?xi) + ^\s* + (logging\s+discriminator)\s+(\S{1,8}) + captures: + 1: support.constant + 2: string.unquoted + push: + - match: | + (?xi) + ( + (?:\s+facility)? + (?:\s+mnemonics)? + (?:\s+msg-body)? + ) + (?= + \s+ + (?: + (?:includes)| + (?:drops) + ) + ) + captures: + 1: support.constant + push: + - match: | + (?xi) + (?: + \s+ + (?: + (drops)| + (includes) + ) + \s+ + ) + captures: + 1: keyword.other + 2: entity.other.attribute-name + push: scope:source.regexp.python + with_prototype: + - match: | + (?xi) + (?= + (?: + (?:\s*\n)| + (?:\s+severity)| + (?:\s+rate-limit) + ) + ) + pop: true + - match: | + (?xi) + \s* + (severity)\s+ + (?: + (?: + (drops)| + (includes) + ) + \s+({{logging_level_digits}}) + ) + captures: + 1: support.constant + 2: keyword.other + 3: entity.other.attribute-name + 4: constant.numeric + - match: | + (?xi) + \s* + (rate-limit)\s+({{number_range_1_10000}}) + captures: + 1: support.constant + 2: constant.numeric + - match: (?=(?:\s+)|(?:\n)) + pop: true + - match: (?=\s*\n) + pop: true + standard_acl: - match: ^\s*(ip)\s+(access-list)\s+(standard)\s+(?:(\d+)|(\S+)) captures: @@ -2629,11 +2826,71 @@ contexts: - include: ip_sla_icmp_echo - include: ip_sla_vrf - include: ip_sla_tag + - include: ip_sla_timeout - include: ip_sla_tos - include: ip_sla_threshold - include: ip_sla_frequency + - include: udp_jitter - include: pop_on_configure_terminal_context + udp_jitter: + - match: | + (?xi) + (udp-jitter)\s+ + (?: + ({{ip}})| + ({{ipv6}})| + ({{hostname}}) + ) + \s+ + ({{number_16_bit}}) + (?: + \s+ + (endpoint-list)\s+(\S+) + )? + (\s+ssm)? + (?: + \s+(source-ip)\s+ + (?: + ({{ip}})| + ({{ipv6}})| + ({{hostname}}) + ) + )? + (?:\s+(source-port)\s+({{number_16_bit}}))? + (?: + \s+(control)\s+ + (?: + (enable)| + (disable) + ) + )? + (?:\s+(num-packets)\s+(\d+))? + (?:\s+(interval)\s+(\d+))? + + captures: + 1: support.constant + 2: constant.numeric.ip.ipv4.address + 3: constant.numeric.ip.ipv6.address + 4: constant.language.hostname + 5: constant.numeric + 6: support.constant + 7: string.unquoted + 8: support.constant + 9: support.constant + 10: constant.numeric.ip.ipv4.address + 11: constant.numeric.ip.ipv6.address + 12: constant.language.hostname + 13: support.constant + 14: constant.numeric + 15: support.constant + 16: entity.other.attribute-name + 17: keyword.other + 18: support.constant + 19: constant.numeric + 20: support.constant + 21: constant.numeric + ip_sla_schedule: - match: | (?xi) @@ -2718,10 +2975,20 @@ contexts: - match: | (?xi) ^\s*(tag)\s+((?:{{ascii_character}}){0,16}) + comment: https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/ipsla/command/sla-cr-book/sla_s2.html#wp3793668867 captures: 1: support.constant 2: string.unquoted + ip_sla_timeout: + - match: | + (?xi) + ^\s*(timeout)\s+({{number_range_0_604800000}}) + comment: https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/ipsla/command/sla-cr-book/sla_s2.html#wp3793668867 + captures: + 1: support.constant + 2: constant.numeric + ip_sla_vrf: - match: | (?xi) @@ -3409,6 +3676,19 @@ contexts: 4: entity.other.attribute-name + configure_terminal_ip_dhcp_snooping: + - match: | + (?xi) + ^\s* + (ip\s+dhcp\s+snooping\s+vlan)\s+({{vlan_id}}) + \s*$ + captures: + 1: support.constant + 2: constant.numeric + - match: ^\s*(ip\s+dhcp\s+snooping) + captures: + 1: support.constant + ip_dhcp_snooping: - include: ip_dhcp_snooping_trust diff --git a/cisco/ios/ios.sublime-completions b/cisco/ios/ios.sublime-completions index 77dad02..2c50baf 100644 --- a/cisco/ios/ios.sublime-completions +++ b/cisco/ios/ios.sublime-completions @@ -182,5 +182,57 @@ "trigger": "errdisable\tdetect cause sfp-config-mismatch", "contents": "errdisable detect cause sfp-config-mismatch" }, + { + "trigger": "logging\thost", + "contents": "logging host ${1:192.0.2.1}" + }, + { + "trigger": "logging\tbuffered", + "contents": "logging buffered" + }, + { + "trigger": "logging\tbuffered discriminator", + "contents": "logging buffered discriminator ${1:NAME}" + }, + { + "trigger": "logging\tbuffered discriminator", + "contents": "logging buffered discriminator ${1:NAME}" + }, + { + "trigger":"logging\tdiscriminator NAME includes .*", + "contents": "logging discriminator ${1:NAME} includes ${2:.*}" + }, + { + "trigger": "logging\tdiscriminator NAME drops .*", + "contents": "logging discriminator ${1:NAME} drops ${2:.*}" + }, + { + "trigger": "udp-jitter\t ", + "contents": "udp-jitter ${1:192.0.2.1} ${2:443}" + }, + { + "trigger": "udp-jitter\tsource-ip", + "contents": "udp-jitter ${1:192.0.2.1} ${2:443} source-ip ${3:192.0.2.1}" + }, + { + "trigger": "udp-jitter\tsource-ip source-port ", + "contents": "udp-jitter ${1:192.0.2.1} ${2:443} source-ip ${3:192.0.2.1} source-port ${4:1050}" + }, + { + "trigger": "udp-jitter\tcontrol enable", + "contents": "udp-jitter ${1:192.0.2.1} ${2:443} control enable" + }, + { + "trigger": "udp-jitter\tcontrol disable", + "contents": "udp-jitter ${1:192.0.2.1} ${2:443} control disable" + }, + "logging buffered emergencies", + "logging buffered alerts", + "logging buffered critical", + "logging buffered errors", + "logging buffered warnings", + "logging buffered notifications", + "logging buffered informational", + "logging buffered debugging", ] } diff --git a/docs/index.rst b/docs/index.rst index cf0211e..f868437 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -6,6 +6,9 @@ Network Tech Documentation ========================== +`SubReddit: SublimeNetworkTech `_ + + Quick Start ----------- diff --git a/messages.json b/messages.json index 1961599..b62b53e 100644 --- a/messages.json +++ b/messages.json @@ -36,5 +36,7 @@ "2.32.0": "messages/2.32.0.md", "2.33.0": "messages/2.33.0.md", "2.34.0": "messages/2.34.0.md", - "2.35.0": "messages/2.34.0.md" + "2.35.0": "messages/2.35.0.md", + "2.36.0": "messages/2.36.0.md", + "2.37.0": "messages/2.37.0.md" } diff --git a/messages/2.36.0.md b/messages/2.36.0.md new file mode 100644 index 0000000..28e795a --- /dev/null +++ b/messages/2.36.0.md @@ -0,0 +1,12 @@ +# [2.36.0] - 2020.04.12 + +## Added + +* Cisco IOS [Issue 33](https://github.com/heyglen/network_tech/issues/33) + + * Configure Terminal Scope + + * ip dhcp snooping + + * ip dhcp snooping vlan 123 + diff --git a/messages/2.37.0.md b/messages/2.37.0.md new file mode 100644 index 0000000..b3fc51c --- /dev/null +++ b/messages/2.37.0.md @@ -0,0 +1,25 @@ +# [2.37.0] - 2020.04.13 + +## Added + +* Cisco IOS [Issue 33](https://github.com/heyglen/network_tech/issues/33) + + * Configure Terminal Scope + + * logging buffered + + * logging discriminator + + * logging host + +* Cisco IOS [Issue 30](https://github.com/heyglen/network_tech/issues/30) + + * IP SLA Scope + + * udp-jitter + + * timeout + +[SubReddit](https://www.reddit.com/r/SublimeNetworkTech/) + +[Issues](https://github.com/heyglen/network_tech/issues/) \ No newline at end of file diff --git a/tests/syntax_test_cisco_ios.cisco-ios b/tests/syntax_test_cisco_ios.cisco-ios index 5bc2f80..c1c558c 100644 --- a/tests/syntax_test_cisco_ios.cisco-ios +++ b/tests/syntax_test_cisco_ios.cisco-ios @@ -61,6 +61,43 @@ show standby vlan1 brief show running-config show startup-config +logging 1.2.3.4 +logging facility local5 +logging source-interface gi1/2 +logging host 1.2.3.4 +logging host ::1 +logging buffered +logging buffered discriminator NAME +logging buffered discriminator NAME +logging buffered discriminator NAME 2147483647 +logging buffered discriminator NAME 4096 +logging buffered discriminator NAME 4096 0 +logging buffered discriminator NAME 4096 7 +logging buffered discriminator NAME 4096 emergencies +logging buffered discriminator NAME 4096 alerts +logging buffered discriminator NAME 4096 critical +logging buffered discriminator NAME 4096 errors +logging buffered discriminator NAME 4096 warnings +logging buffered discriminator NAME 4096 notifications +logging buffered discriminator NAME 4096 informational +logging buffered discriminator NAME 4096 debugging +logging buffered emergencies +logging buffered alerts +logging buffered critical +logging buffered errors +logging buffered warnings +logging buffered notifications +logging buffered informational +logging buffered debugging +logging discriminator NAME includes (.*[1-90]+)? +logging discriminator NAME drops (.*[1-90]+)? +logging discriminator NAME drops (.*[1-90]+)? severity drops 1 +logging discriminator NAME drops (.*[1-90]+)? severity includes 7 +logging discriminator NAME includes (.*[1-90]+)? rate-limit 10000 +logging discriminator NAME drops (.*[1-90]+)? rate-limit 10000 +logging discriminator NAME drops (.*[1-90]+)? severity drops 1 rate-limit 10000 +logging discriminator NAME drops (.*[1-90]+)? severity includes 7 rate-limit 10000 + conf t configure terminal @@ -673,6 +710,8 @@ ip nat inside source list 1 interface dialer 0 overload ip classless (default) ip route 1.0.0.0 0.255.255.255 dialer 0 ! +ip dhcp snooping +ip dhcp snooping vlan 123 ip dhcp excluded-address 1.2.3.4 1.2.3.40 ip dhcp excluded-address 10.0.2.1 10.0.2.10 ip dhcp excluded-address 10.0.3.1 10.0.3.10 @@ -999,6 +1038,11 @@ transport input ssh transport output ssh exit ! +line aux 0 + transport input none + transport output none +exit + line console 0 exec-timeout 30 30 logging synchronous @@ -1024,7 +1068,17 @@ ip sla 1 tos 184 vrf RED threshold 2000 + timeout 604800000 frequency 5 + udp-jitter host.example.com 443 + udp-jitter 192.0.2.1 443 endpoint-list NAME + udp-jitter ::1 443 ssm + udp-jitter host.example.com 443 source-ip 192.0.2.1 + udp-jitter host.example.com 443 source-ip 192.0.2.1 source-port 65535 + udp-jitter host.example.com 443 control enable + udp-jitter host.example.com 443 control disable + udp-jitter host.example.com 443 control disable num-packets 123 + udp-jitter host.example.com 443 control disable interval 123 ip sla schedule 1 life 1 ip sla schedule 1 life forever start-time now