junoser 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/test-linux.yaml +1 -1
- data/CHANGELOG.md +14 -4
- data/Gemfile.lock +8 -8
- data/LICENSE.txt +1 -1
- data/README.md +1 -1
- data/lib/junoser/js_ruler.rb +66 -54
- data/lib/junoser/parser.rb +102 -0
- data/lib/junoser/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4241a7b2a24ab7118dae491d2538107fdfa0b4a0f8f4fe701e713a00197a424c
|
4
|
+
data.tar.gz: fba378b8cf21dc3ffc554c20ad6b0650844546b54defbe6f1fec15cea6294182
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3283f8dfa5972d2ca4bdd25abc0b6c30d9b41266afb6a4ac31b6e9144c46b1adc1e4d03af939fb0ebce2a2e42b57197acaaf38c81005ffe7b1b66df75e42bef0
|
7
|
+
data.tar.gz: a626b7bd44f66b3cc9606a23a4342b5101deedd75f8df70eac66afa87d695971bb598a9546a50d83fea4115a9974cd23c78381a0a76e337d914facab8a8c3ebd
|
data/CHANGELOG.md
CHANGED
@@ -1,20 +1,30 @@
|
|
1
|
+
## [0.5.3] - 2023-07-10
|
2
|
+
|
3
|
+
### Added
|
4
|
+
|
5
|
+
* Newly supported syntax
|
6
|
+
* "chassis cluster" (by porting the hierarchy from vSRX 18.3R1.9)
|
7
|
+
* "security log stream xxx transport"
|
8
|
+
|
9
|
+
|
1
10
|
## [0.5.2] - 2022-12-10
|
2
11
|
|
3
12
|
### Fixed
|
4
13
|
|
5
|
-
* "system services ssh root-login deny-password"
|
14
|
+
* "system services ssh root-login deny-password" was unexpectedly marked as invalid
|
6
15
|
|
7
16
|
|
8
17
|
## [0.5.1] - 2022-11-02
|
9
18
|
|
10
19
|
### Added
|
11
20
|
|
12
|
-
*
|
21
|
+
* Newly supported syntax
|
22
|
+
* "protocols iccp peer xxx liveness-detection single-hop"
|
23
|
+
* "poe" based on EX 18.1R3-S6.1
|
13
24
|
|
14
25
|
### Fixed
|
15
26
|
|
16
|
-
*
|
17
|
-
* "interfaces xxx ether-options speed"
|
27
|
+
* "interfaces xxx ether-options speed" was unexpectedly marked as invalid
|
18
28
|
|
19
29
|
|
20
30
|
## [0.5.0] - 2022-11-02
|
data/Gemfile.lock
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
junoser (0.5.
|
4
|
+
junoser (0.5.3)
|
5
5
|
parslet
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
mini_portile2 (2.8.
|
11
|
-
nokogiri (1.
|
12
|
-
mini_portile2 (~> 2.8.
|
10
|
+
mini_portile2 (2.8.2)
|
11
|
+
nokogiri (1.15.3)
|
12
|
+
mini_portile2 (~> 2.8.2)
|
13
13
|
racc (~> 1.4)
|
14
14
|
parslet (2.0.0)
|
15
|
-
power_assert (2.0.
|
16
|
-
racc (1.
|
15
|
+
power_assert (2.0.3)
|
16
|
+
racc (1.7.1)
|
17
17
|
rake (13.0.6)
|
18
|
-
test-unit (3.
|
18
|
+
test-unit (3.6.1)
|
19
19
|
power_assert
|
20
20
|
|
21
21
|
PLATFORMS
|
@@ -29,4 +29,4 @@ DEPENDENCIES
|
|
29
29
|
test-unit
|
30
30
|
|
31
31
|
BUNDLED WITH
|
32
|
-
2.
|
32
|
+
2.4.1
|
data/LICENSE.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2015-
|
3
|
+
Copyright (c) 2015-2023 Shintaro Kojima
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
data/lib/junoser/js_ruler.rb
CHANGED
@@ -17,23 +17,22 @@ module Junoser
|
|
17
17
|
def rule
|
18
18
|
str = @rule.read
|
19
19
|
str = process_lines(str)
|
20
|
-
str = str.split(/\n/).map {|l|
|
21
|
-
process_line(l) unless l =~ /^ *#/
|
20
|
+
str = str.split(/\n/).map { |l|
|
21
|
+
process_line(l) unless l =~ /^ *#/ # Skip additional comment lines
|
22
22
|
}.compact.join("\n")
|
23
23
|
finalize(str)
|
24
24
|
end
|
25
25
|
|
26
|
-
|
27
26
|
private
|
28
27
|
|
29
28
|
def process_line(str)
|
30
|
-
remove_undefined_variables(str)
|
31
|
-
process_common_syntax(str)
|
32
|
-
process_argument_syntax(str)
|
33
|
-
process_structural_syntax(str)
|
34
|
-
process_word(str)
|
35
|
-
process_reserved_word(str)
|
36
|
-
process_comment(str)
|
29
|
+
str = remove_undefined_variables(str)
|
30
|
+
str = process_common_syntax(str)
|
31
|
+
str = process_argument_syntax(str)
|
32
|
+
str = process_structural_syntax(str)
|
33
|
+
str = process_word(str)
|
34
|
+
str = process_reserved_word(str)
|
35
|
+
str = process_comment(str)
|
37
36
|
|
38
37
|
str
|
39
38
|
end
|
@@ -49,31 +48,31 @@ module Junoser
|
|
49
48
|
|
50
49
|
def process_common_syntax(str)
|
51
50
|
# rule(:foo) do -> foo(...args) {
|
52
|
-
str.gsub!(/^rule\(:(\S+)\) do/) {"#$1(...args) { return_next_line"}
|
51
|
+
str.gsub!(/^rule\(:(\S+)\) do/) { "#$1(...args) { return_next_line" }
|
53
52
|
# end -> }
|
54
|
-
str.gsub!(/^(\s*)end$/) {"#$1}"}
|
53
|
+
str.gsub!(/^(\s*)end$/) { "#$1}" }
|
55
54
|
|
56
55
|
# arg.as(:arg) ( -> {"arg":
|
57
56
|
str.gsub! /arg\.as\(:arg\) \(/, '{"arg":'
|
58
57
|
# arg.as(:arg) -> {"arg": null}
|
59
58
|
str.gsub! /arg.as\(:arg\)/, '{"arg": null}'
|
60
59
|
# ("foo" | "bar").as(:arg) ( -> {"(bar|baz)":
|
61
|
-
str.gsub!(/\(([^)]+)\)\.as\(:arg\) \(/) {"{\"(#{$1.gsub('"', '').split(' | ').join('|')})\":"}
|
60
|
+
str.gsub!(/\(([^)]+)\)\.as\(:arg\) \(/) { "{\"(#{$1.gsub('"', '').split(' | ').join('|')})\":" }
|
62
61
|
# enum(("foo" | "bar")).as(:arg) ( -> {"(bar|baz)": # TODO: support "enum" in the middle of line
|
63
|
-
str.gsub!(/enum\(\(([^)]+)\)\)\.as\(:arg\) \(/) {"{\"(#{$1.gsub('"', '').split(' | ').join('|')})\":"}
|
62
|
+
str.gsub!(/enum\(\(([^)]+)\)\)\.as\(:arg\) \(/) { "{\"(#{$1.gsub('"', '').split(' | ').join('|')})\":" }
|
64
63
|
|
65
64
|
str.gsub! '.as(:arg)', ''
|
66
65
|
|
67
66
|
# c( -> {
|
68
|
-
str.gsub!(/^(\s*)c\(/) {"#$1{"}
|
67
|
+
str.gsub!(/^(\s*)c\(/) { "#$1{" }
|
69
68
|
|
70
69
|
# foo /* doc */, -> foo() /* doc */,
|
71
|
-
str.gsub!(%r|^(\s*)(?!arg)(\w+)( /\* (.*) \*/,?)$|) {"#$1this.#$2()#$3"}
|
70
|
+
str.gsub!(%r|^(\s*)(?!arg)(\w+)( /\* (.*) \*/,?)$|) { "#$1this.#$2()#$3" }
|
72
71
|
# foo, -> foo(),
|
73
|
-
str.gsub!(%r|^(\s*)(?!arg)(\w+)(,?)$|) {"#$1this.#$2()#$3"}
|
72
|
+
str.gsub!(%r|^(\s*)(?!arg)(\w+)(,?)$|) { "#$1this.#$2()#$3" }
|
74
73
|
|
75
74
|
# ) -> }
|
76
|
-
str.gsub!(/^(\s+)\)/) {"#$1}"}
|
75
|
+
str.gsub!(/^(\s+)\)/) { "#$1}" }
|
77
76
|
|
78
77
|
str
|
79
78
|
end
|
@@ -81,56 +80,56 @@ module Junoser
|
|
81
80
|
def process_argument_syntax(str)
|
82
81
|
# "foo" (("bar" | "baz")) ( -> "foo(bar|baz)": {
|
83
82
|
# "foo" enum(("bar" | "baz")) ( -> "foo(bar|baz)": { # TODO: support "enum" in the middle of line
|
84
|
-
str.gsub!(/^(\s*)"(\S+)" (?:enum)?\(\((.*)\)\) \(/) {"#$1\"#$2(#{$3.gsub('"', '').split(' | ').join('|')})\": {"}
|
83
|
+
str.gsub!(/^(\s*)"(\S+)" (?:enum)?\(\((.*)\)\) \(/) { "#$1\"#$2(#{$3.gsub('"', '').split(' | ').join('|')})\": {" }
|
85
84
|
# "foo" arg ( -> "foo(arg)": {
|
86
|
-
str.gsub!(/^(\s*)"(\S+)" arg \(/) {"#$1\"#$2(arg)\": {"}
|
85
|
+
str.gsub!(/^(\s*)"(\S+)" arg \(/) { "#$1\"#$2(arg)\": {" }
|
87
86
|
|
88
87
|
# "foo" (... | arg) /* doc */ -> "foo": "arg"
|
89
|
-
str.gsub!(%r|^(\s*)"(\S+)" \(.* \| arg ?.*\) /\* (.*) \*/(,?)$|) {"#$1\"#$2 | #$3\": arg#$4"}
|
88
|
+
str.gsub!(%r|^(\s*)"(\S+)" \(.* \| arg ?.*\) /\* (.*) \*/(,?)$|) { "#$1\"#$2 | #$3\": arg#$4" }
|
90
89
|
|
91
90
|
# "foo" (... | arg) ( /* doc */ -> "foo(arg)": {
|
92
|
-
str.gsub!(%r|^(\s*)"(\S+)" \(.* \| arg ?.*\) \( /\* (.*) \*/$|) {"#$1\"#$2(arg) | #$3\": {"}
|
91
|
+
str.gsub!(%r|^(\s*)"(\S+)" \(.* \| arg ?.*\) \( /\* (.*) \*/$|) { "#$1\"#$2(arg) | #$3\": {" }
|
93
92
|
# "foo" (... | arg) ( -> "foo(arg)": {
|
94
|
-
str.gsub!(%r|^(\s*)"(\S+)" \(.* \| arg ?.*\) \($|) {"#$1\"#$2(arg)\": {"}
|
93
|
+
str.gsub!(%r|^(\s*)"(\S+)" \(.* \| arg ?.*\) \($|) { "#$1\"#$2(arg)\": {" }
|
95
94
|
|
96
95
|
# "foo" (arg | ...) /* doc */ -> "foo": "arg"
|
97
|
-
str.gsub!(%r|^(\s*)"(\S+)" \(arg ?.*\) /\* (.*) \*/(,?)$|) {"#$1\"#$2 | #$3\": arg#$4"}
|
96
|
+
str.gsub!(%r|^(\s*)"(\S+)" \(arg ?.*\) /\* (.*) \*/(,?)$|) { "#$1\"#$2 | #$3\": arg#$4" }
|
98
97
|
|
99
98
|
# "foo" (arg | ...) ( /* doc */ -> "foo(arg)": {
|
100
|
-
str.gsub!(%r|^(\s*)"(\S+)" \(arg ?.*\) \( /\* (.*) \*/(,?)$|) {"#$1\"#$2(arg) | #$3\": {#$4"}
|
99
|
+
str.gsub!(%r|^(\s*)"(\S+)" \(arg ?.*\) \( /\* (.*) \*/(,?)$|) { "#$1\"#$2(arg) | #$3\": {#$4" }
|
101
100
|
|
102
101
|
# "foo" ("bar" | "baz") ( /* doc */ -> "foo(bar|baz)": {
|
103
|
-
str.gsub!(%r|^(\s*)"(\S+)" \("([^)]+)"\) \( /\* (.*) \*/$|) {"#$1\"#$2(#{$3.split('" | "').join('|')}) | #$4\": {"}
|
102
|
+
str.gsub!(%r|^(\s*)"(\S+)" \("([^)]+)"\) \( /\* (.*) \*/$|) { "#$1\"#$2(#{$3.split('" | "').join('|')}) | #$4\": {" }
|
104
103
|
# "foo" ("bar" | "baz") ( -> "foo(bar|baz)": {
|
105
|
-
str.gsub!(%r|^(\s*)"(\S+)" \("([^)]+)"\) \($|) {"#$1\"#$2(#{$3.split('" | "').join('|')})\": {"}
|
104
|
+
str.gsub!(%r|^(\s*)"(\S+)" \("([^)]+)"\) \($|) { "#$1\"#$2(#{$3.split('" | "').join('|')})\": {" }
|
106
105
|
|
107
106
|
# "foo" ("bar" | "baz") /* doc */, -> "foo": ["bar", "baz"],
|
108
|
-
str.gsub!(%r|^(\s*)"(\S+)" \(([^)]+)\) /\* (.*) \*/(,?)$|) {"#$1\"#$2 | #$4\": [#{$3.split(' | ').join(', ')}]#$5"}
|
107
|
+
str.gsub!(%r|^(\s*)"(\S+)" \(([^)]+)\) /\* (.*) \*/(,?)$|) { "#$1\"#$2 | #$4\": [#{$3.split(' | ').join(', ')}]#$5" }
|
109
108
|
# "foo" ("bar" | "baz"), -> "foo": ["bar", "baz"],
|
110
|
-
str.gsub!(%r|^(\s*)"(\S+)" \(([^)]+)\)(,?)$|) {"#$1\"#$2\": [#{$3.split(' | ').join(', ')}]#$4"}
|
109
|
+
str.gsub!(%r|^(\s*)"(\S+)" \(([^)]+)\)(,?)$|) { "#$1\"#$2\": [#{$3.split(' | ').join(', ')}]#$4" }
|
111
110
|
|
112
111
|
# "foo" enum(("bar" | "baz")) -> "foo": new Enumeration(["bar", "baz"])
|
113
|
-
str.gsub!(/^(\s*)("\S+") enum\(\((.*)\)\)/) {"#$1#$2: new Enumeration(#{$3.gsub('"', '').split(' | ')})"}
|
112
|
+
str.gsub!(/^(\s*)("\S+") enum\(\((.*)\)\)/) { "#$1#$2: new Enumeration(#{$3.gsub('"', '').split(' | ')})" }
|
114
113
|
|
115
114
|
# "foo" arg /* doc */, -> "foo | doc": "arg",
|
116
|
-
str.gsub!(%r|^(\s*)"([^"]+)" arg /\* (.*) \*/(,?)$|) {"#$1\"#$2 | #$3\": \"arg\"#$4"}
|
115
|
+
str.gsub!(%r|^(\s*)"([^"]+)" arg /\* (.*) \*/(,?)$|) { "#$1\"#$2 | #$3\": \"arg\"#$4" }
|
117
116
|
# "foo" arg, -> "foo": "arg",
|
118
|
-
str.gsub!(%r|(\s*)"([^"]+)" arg(,?)$|) {"#$1\"#$2\": \"arg\"#$3"}
|
117
|
+
str.gsub!(%r|(\s*)"([^"]+)" arg(,?)$|) { "#$1\"#$2\": \"arg\"#$3" }
|
119
118
|
|
120
119
|
# "foo" ipaddr, -> "foo": this.ipaddr(),
|
121
|
-
str.gsub!(%r|(\s*)"([^"]+)" ipaddr(,?)$|) {"#$1\"#$2\": this.ipaddr()#$3"}
|
120
|
+
str.gsub!(%r|(\s*)"([^"]+)" ipaddr(,?)$|) { "#$1\"#$2\": this.ipaddr()#$3" }
|
122
121
|
|
123
122
|
str
|
124
123
|
end
|
125
124
|
|
126
125
|
def process_structural_syntax(str)
|
127
126
|
# "foo" ( /* doc */ -> "foo | doc": (...args) => {
|
128
|
-
str.gsub!(%r|^(\s*)"(\S+)" \( /\* (.*) \*/|) {"#$1\"#$2 | #$3\": {"}
|
127
|
+
str.gsub!(%r|^(\s*)"(\S+)" \( /\* (.*) \*/|) { "#$1\"#$2 | #$3\": {" }
|
129
128
|
# "foo" ( -> "foo": (...args) => {
|
130
|
-
str.gsub!(%r|^(\s*)"(\S+)" \($|) {"#$1\"#$2\": {"}
|
129
|
+
str.gsub!(%r|^(\s*)"(\S+)" \($|) { "#$1\"#$2\": {" }
|
131
130
|
|
132
131
|
# "foo" arg ( /* doc */ -> "foo | doc": (...args) => {
|
133
|
-
str.gsub!(%r|^(\s*)"(\S+)" arg \( /\* (.*) \*/|) {"#$1\"#$2 | #$3\": {"}
|
132
|
+
str.gsub!(%r|^(\s*)"(\S+)" arg \( /\* (.*) \*/|) { "#$1\"#$2 | #$3\": {" }
|
134
133
|
|
135
134
|
str
|
136
135
|
end
|
@@ -142,9 +141,9 @@ module Junoser
|
|
142
141
|
str.gsub!(/ ((?!arg\w)(arg)|(enum)?\(arg\))/, ' "arg"')
|
143
142
|
|
144
143
|
# "foo" /* doc */, -> "foo | doc": null,
|
145
|
-
str.gsub!(%r|^(\s*)"([^"]+)" /\* (.*) \*/(,?)$|) {"#$1\"#$2 | #$3\": null#$4"}
|
144
|
+
str.gsub!(%r|^(\s*)"([^"]+)" /\* (.*) \*/(,?)$|) { "#$1\"#$2 | #$3\": null#$4" }
|
146
145
|
# "foo", -> "foo": null,
|
147
|
-
str.gsub!(%r|^(\s*)"([^"]+)"(,?)$|) {"#$1\"#$2\": null#$3"}
|
146
|
+
str.gsub!(%r|^(\s*)"([^"]+)"(,?)$|) { "#$1\"#$2\": null#$3" }
|
148
147
|
|
149
148
|
# ("foo" | "bar") -> ["foo", "bar"]
|
150
149
|
str.gsub!(/^(\s*) \(+("[^"]+(?:" \| "[^"]+)*")\)+(,?)$/) do
|
@@ -153,10 +152,10 @@ module Junoser
|
|
153
152
|
end
|
154
153
|
|
155
154
|
# enum(("bar" | "baz")) -> "foo": new Enumeration(["bar", "baz"])
|
156
|
-
str.gsub!(/^(\s*)enum\(\((.*)\)\)/) {"#$1new Enumeration(#{$2.gsub('"', '').split(' | ')})"}
|
155
|
+
str.gsub!(/^(\s*)enum\(\((.*)\)\)/) { "#$1new Enumeration(#{$2.gsub('"', '').split(' | ')})" }
|
157
156
|
|
158
157
|
# (arg | "foo") -> ["arg", "foo"]
|
159
|
-
str.gsub!(/^(\s*) \(arg( \| "[^"]+")+\)/) {"#$1[\"arg\"#{$2.split(' | ').join(', ')}]"}
|
158
|
+
str.gsub!(/^(\s*) \(arg( \| "[^"]+")+\)/) { "#$1[\"arg\"#{$2.split(' | ').join(', ')}]" }
|
160
159
|
|
161
160
|
str
|
162
161
|
end
|
@@ -184,8 +183,11 @@ module Junoser
|
|
184
183
|
str.gsub!(/"(dest|src|static)-nat-rule-match/) { '"match' }
|
185
184
|
|
186
185
|
# faster interface speed support
|
187
|
-
str.gsub! '"
|
188
|
-
str.gsub! '"
|
186
|
+
str.gsub! '"400g", "oc3"', '"400g", "800g", "oc3"'
|
187
|
+
str.gsub! '"400G"', '"400G", "800G"'
|
188
|
+
|
189
|
+
# support "set interfaces xxx ether-options speed"
|
190
|
+
str.gsub! '"ethernet-1', '"1'
|
189
191
|
|
190
192
|
fix_route_filter(str)
|
191
193
|
|
@@ -193,9 +195,9 @@ module Junoser
|
|
193
195
|
end
|
194
196
|
|
195
197
|
def fix_route_filter(str)
|
196
|
-
str.gsub!(/("exact \| [^"]*"): "arg"/) {"#$1: null"}
|
197
|
-
str.gsub!(/("longer \| [^"]*"): "arg"/) {"#$1: null"}
|
198
|
-
str.gsub!(/("orlonger \| [^"]*"): "arg"/) {"#$1: null"}
|
198
|
+
str.gsub!(/("exact \| [^"]*"): "arg"/) { "#$1: null" }
|
199
|
+
str.gsub!(/("longer \| [^"]*"): "arg"/) { "#$1: null" }
|
200
|
+
str.gsub!(/("orlonger \| [^"]*"): "arg"/) { "#$1: null" }
|
199
201
|
end
|
200
202
|
|
201
203
|
def process_comment(str)
|
@@ -203,17 +205,27 @@ module Junoser
|
|
203
205
|
str.gsub! '%', '' % %''
|
204
206
|
|
205
207
|
# "foo": ... /* doc */, -> "foo | doc": ...,
|
206
|
-
str.gsub!(%r|^(\s*)"([^"]+)": (.*) /\* (.*) \*/(,?)$|) {"#$1\"#$2 | #$4\": #$3#$5"}
|
208
|
+
str.gsub!(%r|^(\s*)"([^"]+)": (.*) /\* (.*) \*/(,?)$|) { "#$1\"#$2 | #$4\": #$3#$5" }
|
207
209
|
|
208
210
|
str
|
209
211
|
end
|
210
212
|
|
211
213
|
def process_lines(str)
|
212
|
-
#
|
214
|
+
# set protocols mpls path
|
213
215
|
str.gsub!(/("path" arg \(.*Route of a label-switched path.*)(\s*)c\(/) do
|
214
216
|
"#{$1}#{$2}s(#{$2}ipaddr,"
|
215
217
|
end
|
216
218
|
|
219
|
+
# set protocols iccp peer xxx liveness-detection single-hop
|
220
|
+
str.gsub!(/(^rule\(:peer_group\) do.*?\n(\s*)"detection-time" \(.*?c\(\s*"threshold" arg .*?\)\s*\))/m) do
|
221
|
+
"#{$1},\n#{format('"single-hop"', $2)}"
|
222
|
+
end
|
223
|
+
|
224
|
+
# set forwarding-options dhcp-relay server-group
|
225
|
+
str.gsub!(/^(rule\(:(?:v6_)?server_group_type\) do)\n(.*?)\nend/m) do
|
226
|
+
"#{$1}\n arg.as(:arg) (\n#{$2}\n )\nend"
|
227
|
+
end
|
228
|
+
|
217
229
|
str
|
218
230
|
end
|
219
231
|
|
@@ -227,7 +239,7 @@ module Junoser
|
|
227
239
|
# ->
|
228
240
|
#
|
229
241
|
# return ...
|
230
|
-
lines.gsub!(/return_next_line\n(\s*)/m) {"\n#$1return "}
|
242
|
+
lines.gsub!(/return_next_line\n(\s*)/m) { "\n#$1return " }
|
231
243
|
|
232
244
|
# {
|
233
245
|
# {
|
@@ -236,7 +248,7 @@ module Junoser
|
|
236
248
|
#
|
237
249
|
# {
|
238
250
|
# "null_1": {
|
239
|
-
lines.gsub!(/([{,]\n\s*){/m) {"#$1\"null_#{sequence}\": {"}
|
251
|
+
lines.gsub!(/([{,]\n\s*){/m) { "#$1\"null_#{sequence}\": {" }
|
240
252
|
|
241
253
|
# {
|
242
254
|
# foo()
|
@@ -245,10 +257,10 @@ module Junoser
|
|
245
257
|
#
|
246
258
|
# {
|
247
259
|
# "null_1": foo()
|
248
|
-
lines.gsub!(/([{,]\n\s*)([^ "(]+)/m) {"#$1\"null_#{sequence}\": #$2"}
|
260
|
+
lines.gsub!(/([{,]\n\s*)([^ "(]+)/m) { "#$1\"null_#{sequence}\": #$2" }
|
249
261
|
|
250
262
|
# "arg" -> "arg_1"
|
251
|
-
lines.gsub('"arg":') {%["arg_#{sequence}":]}
|
263
|
+
lines.gsub('"arg":') { %["arg_#{sequence}":] }
|
252
264
|
end
|
253
265
|
|
254
266
|
# } -> )
|
@@ -302,12 +314,12 @@ module Junoser
|
|
302
314
|
|
303
315
|
def objectize_arg_of_s(lines)
|
304
316
|
# s( -> s({
|
305
|
-
lines.gsub!(/^( *(?:return|\S+:)? +)s\($/m) {"#$1this.s({"}
|
317
|
+
lines.gsub!(/^( *(?:return|\S+:)? +)s\($/m) { "#$1this.s({" }
|
306
318
|
# sc( -> sc({
|
307
|
-
lines.gsub!(/^( *(?:return|\S+:)? +)sc\($/m) {"#$1this.sc({"}
|
319
|
+
lines.gsub!(/^( *(?:return|\S+:)? +)sc\($/m) { "#$1this.sc({" }
|
308
320
|
|
309
321
|
# ) -> })
|
310
|
-
lines.gsub!(/^( *)\)(,?)$/m) {"#$1})#$2"}
|
322
|
+
lines.gsub!(/^( *)\)(,?)$/m) { "#$1})#$2" }
|
311
323
|
|
312
324
|
lines
|
313
325
|
end
|
data/lib/junoser/parser.rb
CHANGED
@@ -3611,6 +3611,15 @@ module Junoser
|
|
3611
3611
|
a(str("rotation"), arg),
|
3612
3612
|
str("allow-duplicates")
|
3613
3613
|
)
|
3614
|
+
),
|
3615
|
+
b(str("transport"),
|
3616
|
+
c(
|
3617
|
+
a(str("tcp-connections"), arg),
|
3618
|
+
b(str("protocol"),
|
3619
|
+
(str("udp") | str("tcp") | str("tls"))
|
3620
|
+
),
|
3621
|
+
a(str("tls-profile"), arg)
|
3622
|
+
)
|
3614
3623
|
)
|
3615
3624
|
)
|
3616
3625
|
),
|
@@ -22376,7 +22385,86 @@ module Junoser
|
|
22376
22385
|
),
|
22377
22386
|
str("vlan-isolation")
|
22378
22387
|
)
|
22388
|
+
),
|
22389
|
+
# Ported from vSRX 18.3R1.9
|
22390
|
+
b(str("cluster"),
|
22391
|
+
c(
|
22392
|
+
b(str("traceoptions"),
|
22393
|
+
c(
|
22394
|
+
str("no-remote-trace"),
|
22395
|
+
b(str("file"),
|
22396
|
+
sc(
|
22397
|
+
arg,
|
22398
|
+
a(str("size"), arg),
|
22399
|
+
a(str("files"), arg),
|
22400
|
+
str("world-readable"),
|
22401
|
+
str("no-world-readable"),
|
22402
|
+
b(str("match"),
|
22403
|
+
regular_expression
|
22404
|
+
)
|
22405
|
+
)
|
22406
|
+
).as(:oneline),
|
22407
|
+
a(str("flag"), enum(str("cli") | str("configuration") | str("eventlib") | str("fsm") | str("heartbeat") | str("interface") | str("routing-socket") | str("uspipc") | str("init") | str("socket") | str("snmp") | str("ip-monitoring") | str("hw-monitoring") | str("fabric-monitoring") | str("schedule-monitoring") | str("heartbeat-tlv") | str("all"))).as(:oneline),
|
22408
|
+
b(str("level"),
|
22409
|
+
(str("emergency") | str("alert") | str("critical") | str("error") | str("warning") | str("notice") | str("info") | str("debug") | str("all"))
|
22410
|
+
)
|
22411
|
+
)
|
22412
|
+
),
|
22413
|
+
str("control-link-recovery"),
|
22414
|
+
a(str("reth-count"), arg),
|
22415
|
+
str("control-ports").as(:oneline),
|
22416
|
+
a(str("heartbeat-interval"), arg),
|
22417
|
+
a(str("heartbeat-threshold"), arg),
|
22418
|
+
str("network-management"),
|
22419
|
+
a(str("node"), enum(str("0") | str("1"))),
|
22420
|
+
b(a(str("redundancy-group"), arg),
|
22421
|
+
c(
|
22422
|
+
a(str("node"), enum(str("0") | str("1")),
|
22423
|
+
sc(
|
22424
|
+
a(str("priority"), arg)
|
22425
|
+
)
|
22426
|
+
).as(:oneline),
|
22427
|
+
b(str("preempt"),
|
22428
|
+
c(
|
22429
|
+
a(str("delay"), arg),
|
22430
|
+
a(str("limit"), arg),
|
22431
|
+
a(str("period"), arg)
|
22432
|
+
)
|
22433
|
+
),
|
22434
|
+
a(str("gratuitous-arp-count"), arg),
|
22435
|
+
a(str("hold-down-interval"), arg),
|
22436
|
+
b(a(str("interface-monitor"), arg),
|
22437
|
+
sc(
|
22438
|
+
a(str("weight"), arg)
|
22439
|
+
)
|
22440
|
+
).as(:oneline),
|
22441
|
+
b(str("ip-monitoring"),
|
22442
|
+
c(
|
22443
|
+
a(str("global-weight"), arg),
|
22444
|
+
a(str("global-threshold"), arg),
|
22445
|
+
a(str("retry-interval"), arg),
|
22446
|
+
a(str("retry-count"), arg),
|
22447
|
+
b(str("family"),
|
22448
|
+
c(
|
22449
|
+
b(str("inet"),
|
22450
|
+
c(
|
22451
|
+
ip_monitoring_address_type
|
22452
|
+
)
|
22453
|
+
)
|
22454
|
+
)
|
22455
|
+
)
|
22456
|
+
)
|
22457
|
+
)
|
22458
|
+
)
|
22459
|
+
),
|
22460
|
+
b(str("configuration-synchronize"),
|
22461
|
+
c(
|
22462
|
+
str("no-secondary-bootup-auto")
|
22463
|
+
)
|
22464
|
+
)
|
22465
|
+
)
|
22379
22466
|
)
|
22467
|
+
# End of vSRX 18.3R1.9
|
22380
22468
|
)
|
22381
22469
|
end
|
22382
22470
|
|
@@ -127220,6 +127308,20 @@ module Junoser
|
|
127220
127308
|
str("no-world-readable")
|
127221
127309
|
).as(:oneline)
|
127222
127310
|
end
|
127311
|
+
|
127312
|
+
rule(:ip_monitoring_address_type) do
|
127313
|
+
b(arg.as(:arg),
|
127314
|
+
c(
|
127315
|
+
a(str("weight"), arg),
|
127316
|
+
b(str("interface"),
|
127317
|
+
s(
|
127318
|
+
arg,
|
127319
|
+
a(str("secondary-ip-address"), arg)
|
127320
|
+
)
|
127321
|
+
)
|
127322
|
+
)
|
127323
|
+
)
|
127324
|
+
end
|
127223
127325
|
# End of vSRX 18.3R1.9
|
127224
127326
|
end
|
127225
127327
|
end
|
data/lib/junoser/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: junoser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shintaro Kojima
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parslet
|
@@ -150,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
150
|
- !ruby/object:Gem::Version
|
151
151
|
version: '0'
|
152
152
|
requirements: []
|
153
|
-
rubygems_version: 3.
|
153
|
+
rubygems_version: 3.4.1
|
154
154
|
signing_key:
|
155
155
|
specification_version: 4
|
156
156
|
summary: PEG parser for JUNOS configuration.
|