junoser 0.4.5 → 0.4.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -0
- data/Gemfile.lock +3 -3
- data/lib/junoser/js_ruler.rb +27 -2
- data/lib/junoser/parser.rb +78 -76
- data/lib/junoser/ruler.rb +45 -31
- data/lib/junoser/version.rb +1 -1
- data/sig/junoser/ruler.rbs +21 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0f5175a9101056425a61f1d23d8c9ecfc258b25c23deea881bb82a6df7a80b2
|
4
|
+
data.tar.gz: 60ae6a0222865a2f06d05e40fdd9c495103e97b7b60665138a7c1354cb70bb84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b3db43a02237e582b130324c0cd63340254e9cab85fa9ac525ed7a4fb5c053f06c0eae3d20bd91ebd1a1937ab0aed2ccb537ce6937c25692ab83f8a937e9fe9
|
7
|
+
data.tar.gz: 1fb1f8a6b02658522cdc042fc63bb1a864a4d6be147723169f5e5990762fe51124920d8266759631873e63a80f3186b05642c2584475878218fc2207f5f22fa3
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,23 @@
|
|
1
|
+
## [0.4.7] - 2022-09-20
|
2
|
+
|
3
|
+
### Added
|
4
|
+
|
5
|
+
* Faster interface speed up to 800g
|
6
|
+
|
7
|
+
### Fixed
|
8
|
+
|
9
|
+
* "interfaces interface-range xxx member-range"
|
10
|
+
* "classifiers" for QoS
|
11
|
+
|
12
|
+
|
13
|
+
## [0.4.6] - 2022-07-02
|
14
|
+
|
15
|
+
### Fixed
|
16
|
+
|
17
|
+
* Accept quoted strings under "system license keys key"
|
18
|
+
* "protocols bgp ... prefix-limit teardown"
|
19
|
+
|
20
|
+
|
1
21
|
## [0.4.5] - 2022-04-27
|
2
22
|
|
3
23
|
### Fixed
|
data/Gemfile.lock
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
junoser (0.4.
|
4
|
+
junoser (0.4.7)
|
5
5
|
parslet
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
10
|
mini_portile2 (2.8.0)
|
11
|
-
nokogiri (1.13.
|
11
|
+
nokogiri (1.13.8)
|
12
12
|
mini_portile2 (~> 2.8.0)
|
13
13
|
racc (~> 1.4)
|
14
14
|
parslet (2.0.0)
|
@@ -29,4 +29,4 @@ DEPENDENCIES
|
|
29
29
|
test-unit
|
30
30
|
|
31
31
|
BUNDLED WITH
|
32
|
-
2.
|
32
|
+
2.3.13
|
data/lib/junoser/js_ruler.rb
CHANGED
@@ -16,8 +16,9 @@ module Junoser
|
|
16
16
|
|
17
17
|
def rule
|
18
18
|
str = @rule.read
|
19
|
+
str = process_lines(str)
|
19
20
|
str = str.split(/\n/).map {|l|
|
20
|
-
|
21
|
+
process_line(l) unless l =~ /^ *#/ # Skip additional comment lines
|
21
22
|
}.compact.join("\n")
|
22
23
|
finalize(str)
|
23
24
|
end
|
@@ -161,9 +162,12 @@ module Junoser
|
|
161
162
|
end
|
162
163
|
|
163
164
|
def process_reserved_word(str)
|
164
|
-
# ieee-802.3ad
|
165
|
+
# ieee-802.3ad -> 802.3ad
|
165
166
|
str.gsub! 'ieee-802.3ad', '802.3ad'
|
166
167
|
|
168
|
+
# end-range -> to
|
169
|
+
str.gsub! '"end-range"', '"to"'
|
170
|
+
|
167
171
|
# "policy | Define a policy context from this zone" -> "from-zone | Define a policy context from this zone"
|
168
172
|
str.gsub! 'policy | Define a policy context from this zone', 'from-zone | Define a policy context from this zone'
|
169
173
|
# "to-zone-name | Destination zone" -> "to-zone | Destination zone"
|
@@ -171,6 +175,18 @@ module Junoser
|
|
171
175
|
# "system-name | System name override" -> "name | System name override"
|
172
176
|
str.gsub! 'system-name | System name override', 'name | System name override'
|
173
177
|
|
178
|
+
# "set class-of-service interfaces all unit"
|
179
|
+
str.gsub! '"unit(*)"', '"unit(*|arg)"'
|
180
|
+
# "classifiers xxx"
|
181
|
+
str.gsub! '["default"]', '["default", "arg"]'
|
182
|
+
|
183
|
+
# keywords "dest-nat-rule-match", "src-nat-rule-match", "static-nat-rule-match" are wrong
|
184
|
+
str.gsub!(/"(dest|src|static)-nat-rule-match/) { '"match' }
|
185
|
+
|
186
|
+
# faster interface speed support
|
187
|
+
str.gsub! '"40g", "oc3"', '"40g", "100g", "200g", "400g", "800g", "oc3"'
|
188
|
+
str.gsub! '"100G"', '"100G", "200G", "400G", "800G"'
|
189
|
+
|
174
190
|
fix_route_filter(str)
|
175
191
|
|
176
192
|
str
|
@@ -192,6 +208,15 @@ module Junoser
|
|
192
208
|
str
|
193
209
|
end
|
194
210
|
|
211
|
+
def process_lines(str)
|
212
|
+
# "set protocols mpls path"
|
213
|
+
str.gsub!(/("path" arg \(.*Route of a label-switched path.*)(\s*)c\(/) do
|
214
|
+
"#{$1}#{$2}s(#{$2}ipaddr,"
|
215
|
+
end
|
216
|
+
|
217
|
+
str
|
218
|
+
end
|
219
|
+
|
195
220
|
def finalize(lines)
|
196
221
|
lines = balance_parenthesis(lines)
|
197
222
|
objectize_arg_of_s(lines)
|
data/lib/junoser/parser.rb
CHANGED
@@ -5324,7 +5324,7 @@ module Junoser
|
|
5324
5324
|
a(str("member"), arg),
|
5325
5325
|
b(a(str("member-range"), arg),
|
5326
5326
|
sc(
|
5327
|
-
b(str("
|
5327
|
+
b(str("to"),
|
5328
5328
|
interface_device
|
5329
5329
|
)
|
5330
5330
|
)
|
@@ -5406,7 +5406,7 @@ module Junoser
|
|
5406
5406
|
),
|
5407
5407
|
str("no-pseudowire-down-on-core-isolation"),
|
5408
5408
|
b(str("speed"),
|
5409
|
-
(str("auto") | str("auto-10m-100m") | str("10m") | str("100m") | str("1g") | str("2.5g") | str("5g") | str("10g") | str("40g") | str("oc3") | str("oc12") | str("oc48"))
|
5409
|
+
(str("auto") | str("auto-10m-100m") | str("10m") | str("100m") | str("1g") | str("2.5g") | str("5g") | str("10g") | str("40g") | str("100g") | str("200g") | str("400g") | str("800g") | str("oc3") | str("oc12") | str("oc48"))
|
5410
5410
|
),
|
5411
5411
|
b(str("forwarding-class-accounting"),
|
5412
5412
|
c(
|
@@ -21052,7 +21052,7 @@ module Junoser
|
|
21052
21052
|
b(arg.as(:arg),
|
21053
21053
|
c(
|
21054
21054
|
b(str("pic-mode"),
|
21055
|
-
(str("10G") | str("25G") | str("40G") | str("100G"))
|
21055
|
+
(str("10G") | str("25G") | str("40G") | str("100G") | str("200G") | str("400G") | str("800G"))
|
21056
21056
|
),
|
21057
21057
|
b(str("tunnel-port"),
|
21058
21058
|
chassis_port_type
|
@@ -27760,7 +27760,7 @@ module Junoser
|
|
27760
27760
|
),
|
27761
27761
|
str("no-pseudowire-down-on-core-isolation"),
|
27762
27762
|
b(str("speed"),
|
27763
|
-
(str("auto") | str("auto-10m-100m") | str("10m") | str("100m") | str("1g") | str("2.5g") | str("5g") | str("10g") | str("40g") | str("oc3") | str("oc12") | str("oc48"))
|
27763
|
+
(str("auto") | str("auto-10m-100m") | str("10m") | str("100m") | str("1g") | str("2.5g") | str("5g") | str("10g") | str("40g") | str("100g") | str("200g") | str("400g") | str("800g") | str("oc3") | str("oc12") | str("oc48"))
|
27764
27764
|
),
|
27765
27765
|
b(str("forwarding-class-accounting"),
|
27766
27766
|
c(
|
@@ -40179,7 +40179,7 @@ module Junoser
|
|
40179
40179
|
b(a(str("dscp"), arg),
|
40180
40180
|
c(
|
40181
40181
|
b(str("import"),
|
40182
|
-
(str("default"))
|
40182
|
+
(str("default") | arg)
|
40183
40183
|
),
|
40184
40184
|
b(a(str("forwarding-class"), arg),
|
40185
40185
|
c(
|
@@ -40195,7 +40195,7 @@ module Junoser
|
|
40195
40195
|
b(a(str("dscp-ipv6"), arg),
|
40196
40196
|
c(
|
40197
40197
|
b(str("import"),
|
40198
|
-
(str("default"))
|
40198
|
+
(str("default") | arg)
|
40199
40199
|
),
|
40200
40200
|
b(a(str("forwarding-class"), arg),
|
40201
40201
|
c(
|
@@ -40211,7 +40211,7 @@ module Junoser
|
|
40211
40211
|
b(a(str("exp"), arg),
|
40212
40212
|
c(
|
40213
40213
|
b(str("import"),
|
40214
|
-
(str("default"))
|
40214
|
+
(str("default") | arg)
|
40215
40215
|
),
|
40216
40216
|
b(a(str("forwarding-class"), arg),
|
40217
40217
|
c(
|
@@ -40227,7 +40227,7 @@ module Junoser
|
|
40227
40227
|
b(a(str("ieee-802.1"), arg),
|
40228
40228
|
c(
|
40229
40229
|
b(str("import"),
|
40230
|
-
(str("default"))
|
40230
|
+
(str("default") | arg)
|
40231
40231
|
),
|
40232
40232
|
b(a(str("forwarding-class"), arg),
|
40233
40233
|
c(
|
@@ -40243,7 +40243,7 @@ module Junoser
|
|
40243
40243
|
b(a(str("inet-precedence"), arg),
|
40244
40244
|
c(
|
40245
40245
|
b(str("import"),
|
40246
|
-
(str("default"))
|
40246
|
+
(str("default") | arg)
|
40247
40247
|
),
|
40248
40248
|
b(a(str("forwarding-class"), arg),
|
40249
40249
|
c(
|
@@ -40259,7 +40259,7 @@ module Junoser
|
|
40259
40259
|
b(a(str("ieee-802.1ad"), arg),
|
40260
40260
|
c(
|
40261
40261
|
b(str("import"),
|
40262
|
-
(str("default"))
|
40262
|
+
(str("default") | arg)
|
40263
40263
|
),
|
40264
40264
|
b(a(str("forwarding-class"), arg),
|
40265
40265
|
c(
|
@@ -40899,8 +40899,8 @@ module Junoser
|
|
40899
40899
|
b(str("classifiers"),
|
40900
40900
|
c(
|
40901
40901
|
b(str("exp"),
|
40902
|
-
|
40903
|
-
|
40902
|
+
sc(
|
40903
|
+
(str("default") | arg)
|
40904
40904
|
)
|
40905
40905
|
).as(:oneline)
|
40906
40906
|
)
|
@@ -40978,13 +40978,13 @@ module Junoser
|
|
40978
40978
|
c(
|
40979
40979
|
str("no-default"),
|
40980
40980
|
b(str("exp"),
|
40981
|
-
|
40982
|
-
|
40981
|
+
sc(
|
40982
|
+
(str("default") | arg)
|
40983
40983
|
)
|
40984
40984
|
).as(:oneline),
|
40985
40985
|
b(str("ieee-802.1"),
|
40986
40986
|
sc(
|
40987
|
-
(str("default")),
|
40987
|
+
(str("default") | arg),
|
40988
40988
|
str("encapsulated"),
|
40989
40989
|
b(str("vlan-tag"),
|
40990
40990
|
(str("outer") | str("inner"))
|
@@ -40992,13 +40992,13 @@ module Junoser
|
|
40992
40992
|
)
|
40993
40993
|
).as(:oneline),
|
40994
40994
|
b(str("dscp"),
|
40995
|
-
|
40996
|
-
|
40995
|
+
sc(
|
40996
|
+
(str("default") | arg)
|
40997
40997
|
)
|
40998
40998
|
).as(:oneline),
|
40999
40999
|
b(str("dscp-ipv6"),
|
41000
|
-
|
41001
|
-
|
41000
|
+
sc(
|
41001
|
+
(str("default") | arg)
|
41002
41002
|
)
|
41003
41003
|
).as(:oneline)
|
41004
41004
|
)
|
@@ -41008,7 +41008,7 @@ module Junoser
|
|
41008
41008
|
c(
|
41009
41009
|
b(str("ieee-802.1"),
|
41010
41010
|
sc(
|
41011
|
-
(str("default")),
|
41011
|
+
(str("default") | arg),
|
41012
41012
|
str("encapsulated"),
|
41013
41013
|
b(str("vlan-tag"),
|
41014
41014
|
(str("outer") | str("outer-and-inner"))
|
@@ -41017,7 +41017,7 @@ module Junoser
|
|
41017
41017
|
).as(:oneline),
|
41018
41018
|
b(str("ieee-802.1ad"),
|
41019
41019
|
sc(
|
41020
|
-
(str("default")),
|
41020
|
+
(str("default") | arg),
|
41021
41021
|
str("encapsulated"),
|
41022
41022
|
b(str("vlan-tag"),
|
41023
41023
|
(str("outer") | str("outer-and-inner"))
|
@@ -41039,7 +41039,7 @@ module Junoser
|
|
41039
41039
|
b(a(str("dscp"), arg),
|
41040
41040
|
c(
|
41041
41041
|
b(str("import"),
|
41042
|
-
(str("default"))
|
41042
|
+
(str("default") | arg)
|
41043
41043
|
),
|
41044
41044
|
b(a(str("forwarding-class"), arg),
|
41045
41045
|
c(
|
@@ -41055,7 +41055,7 @@ module Junoser
|
|
41055
41055
|
b(a(str("dscp-ipv6"), arg),
|
41056
41056
|
c(
|
41057
41057
|
b(str("import"),
|
41058
|
-
(str("default"))
|
41058
|
+
(str("default") | arg)
|
41059
41059
|
),
|
41060
41060
|
b(a(str("forwarding-class"), arg),
|
41061
41061
|
c(
|
@@ -41071,7 +41071,7 @@ module Junoser
|
|
41071
41071
|
b(a(str("exp"), arg),
|
41072
41072
|
c(
|
41073
41073
|
b(str("import"),
|
41074
|
-
(str("default"))
|
41074
|
+
(str("default") | arg)
|
41075
41075
|
),
|
41076
41076
|
b(a(str("forwarding-class"), arg),
|
41077
41077
|
c(
|
@@ -41087,7 +41087,7 @@ module Junoser
|
|
41087
41087
|
b(a(str("ieee-802.1"), arg),
|
41088
41088
|
c(
|
41089
41089
|
b(str("import"),
|
41090
|
-
(str("default"))
|
41090
|
+
(str("default") | arg)
|
41091
41091
|
),
|
41092
41092
|
b(a(str("forwarding-class"), arg),
|
41093
41093
|
c(
|
@@ -41103,7 +41103,7 @@ module Junoser
|
|
41103
41103
|
b(a(str("inet-precedence"), arg),
|
41104
41104
|
c(
|
41105
41105
|
b(str("import"),
|
41106
|
-
(str("default"))
|
41106
|
+
(str("default") | arg)
|
41107
41107
|
),
|
41108
41108
|
b(a(str("forwarding-class"), arg),
|
41109
41109
|
c(
|
@@ -41119,7 +41119,7 @@ module Junoser
|
|
41119
41119
|
b(a(str("frame-relay-de"), arg),
|
41120
41120
|
c(
|
41121
41121
|
b(str("import"),
|
41122
|
-
(str("default"))
|
41122
|
+
(str("default") | arg)
|
41123
41123
|
),
|
41124
41124
|
b(a(str("forwarding-class"), arg),
|
41125
41125
|
c(
|
@@ -41135,7 +41135,7 @@ module Junoser
|
|
41135
41135
|
b(a(str("ieee-802.1ad"), arg),
|
41136
41136
|
c(
|
41137
41137
|
b(str("import"),
|
41138
|
-
(str("default"))
|
41138
|
+
(str("default") | arg)
|
41139
41139
|
),
|
41140
41140
|
b(a(str("forwarding-class"), arg),
|
41141
41141
|
c(
|
@@ -41151,7 +41151,7 @@ module Junoser
|
|
41151
41151
|
b(a(str("inet6-precedence"), arg),
|
41152
41152
|
c(
|
41153
41153
|
b(str("import"),
|
41154
|
-
(str("default"))
|
41154
|
+
(str("default") | arg)
|
41155
41155
|
),
|
41156
41156
|
b(a(str("forwarding-class"), arg),
|
41157
41157
|
c(
|
@@ -41650,7 +41650,7 @@ module Junoser
|
|
41650
41650
|
)
|
41651
41651
|
),
|
41652
41652
|
str("logical-interface-aggregate-statistics"),
|
41653
|
-
a(str("unit"), enum(
|
41653
|
+
a(str("unit"), enum(arg),
|
41654
41654
|
c(
|
41655
41655
|
a(str("output-forwarding-class-map"), arg),
|
41656
41656
|
a(str("forwarding-class"), arg),
|
@@ -41701,37 +41701,37 @@ module Junoser
|
|
41701
41701
|
b(str("classifiers"),
|
41702
41702
|
c(
|
41703
41703
|
str("no-default"),
|
41704
|
-
a(str("dscp"), str("default"),
|
41704
|
+
a(str("dscp"), str("default") | arg,
|
41705
41705
|
c(
|
41706
41706
|
a(str("family"), arg)
|
41707
41707
|
)
|
41708
41708
|
),
|
41709
|
-
a(str("dscp-ipv6"), str("default"),
|
41709
|
+
a(str("dscp-ipv6"), str("default") | arg,
|
41710
41710
|
c(
|
41711
41711
|
a(str("family"), arg)
|
41712
41712
|
)
|
41713
41713
|
),
|
41714
41714
|
b(str("exp"),
|
41715
|
-
|
41716
|
-
|
41715
|
+
sc(
|
41716
|
+
(str("default") | arg)
|
41717
41717
|
)
|
41718
41718
|
).as(:oneline),
|
41719
41719
|
b(str("ieee-802.1"),
|
41720
41720
|
sc(
|
41721
|
-
(str("default")),
|
41721
|
+
(str("default") | arg),
|
41722
41722
|
b(str("vlan-tag"),
|
41723
41723
|
(str("outer") | str("inner") | str("transparent"))
|
41724
41724
|
)
|
41725
41725
|
)
|
41726
41726
|
).as(:oneline),
|
41727
41727
|
b(str("inet-precedence"),
|
41728
|
-
|
41729
|
-
|
41728
|
+
sc(
|
41729
|
+
(str("default") | arg)
|
41730
41730
|
)
|
41731
41731
|
).as(:oneline),
|
41732
41732
|
b(str("ieee-802.1ad"),
|
41733
41733
|
sc(
|
41734
|
-
(str("default")),
|
41734
|
+
(str("default") | arg),
|
41735
41735
|
b(str("vlan-tag"),
|
41736
41736
|
(str("outer") | str("inner"))
|
41737
41737
|
)
|
@@ -41741,41 +41741,41 @@ module Junoser
|
|
41741
41741
|
),
|
41742
41742
|
b(str("ingress-rewrite-rules"),
|
41743
41743
|
c(
|
41744
|
-
a(str("dscp"), str("default")).as(:oneline),
|
41744
|
+
a(str("dscp"), str("default") | arg).as(:oneline),
|
41745
41745
|
b(str("dscp-ipv6"),
|
41746
|
-
|
41747
|
-
|
41746
|
+
sc(
|
41747
|
+
(str("default") | arg)
|
41748
41748
|
)
|
41749
41749
|
).as(:oneline),
|
41750
|
-
a(str("inet-precedence"), str("default")).as(:oneline)
|
41750
|
+
a(str("inet-precedence"), str("default") | arg).as(:oneline)
|
41751
41751
|
)
|
41752
41752
|
),
|
41753
41753
|
b(str("loss-priority-maps"),
|
41754
41754
|
c(
|
41755
41755
|
b(str("frame-relay-de"),
|
41756
|
-
|
41757
|
-
|
41756
|
+
sc(
|
41757
|
+
(str("default") | arg)
|
41758
41758
|
)
|
41759
41759
|
).as(:oneline)
|
41760
41760
|
)
|
41761
41761
|
),
|
41762
41762
|
b(str("rewrite-rules"),
|
41763
41763
|
c(
|
41764
|
-
a(str("dscp"), str("default"),
|
41764
|
+
a(str("dscp"), str("default") | arg,
|
41765
41765
|
sc(
|
41766
41766
|
b(str("protocol"),
|
41767
41767
|
(str("mpls") | str("gtp-inet-outer") | str("gtp-inet-both") | str("inet-outer") | str("inet-both"))
|
41768
41768
|
)
|
41769
41769
|
)
|
41770
41770
|
).as(:oneline),
|
41771
|
-
a(str("dscp-ipv6"), str("default"),
|
41771
|
+
a(str("dscp-ipv6"), str("default") | arg,
|
41772
41772
|
sc(
|
41773
41773
|
b(str("protocol"),
|
41774
41774
|
(str("mpls") | str("gtp-inet-outer") | str("gtp-inet-both"))
|
41775
41775
|
)
|
41776
41776
|
)
|
41777
41777
|
).as(:oneline),
|
41778
|
-
a(str("exp"), str("default"),
|
41778
|
+
a(str("exp"), str("default") | arg,
|
41779
41779
|
sc(
|
41780
41780
|
b(str("protocol"),
|
41781
41781
|
(str("mpls-any") | str("mpls-inet-both") | str("mpls-inet-both-non-vpn"))
|
@@ -41784,13 +41784,13 @@ module Junoser
|
|
41784
41784
|
).as(:oneline),
|
41785
41785
|
b(str("ieee-802.1"),
|
41786
41786
|
sc(
|
41787
|
-
(str("default")),
|
41787
|
+
(str("default") | arg),
|
41788
41788
|
b(str("vlan-tag"),
|
41789
41789
|
(str("outer") | str("outer-and-inner"))
|
41790
41790
|
)
|
41791
41791
|
)
|
41792
41792
|
).as(:oneline),
|
41793
|
-
a(str("inet-precedence"), str("default"),
|
41793
|
+
a(str("inet-precedence"), str("default") | arg,
|
41794
41794
|
sc(
|
41795
41795
|
b(str("protocol"),
|
41796
41796
|
(str("mpls") | str("gtp-inet-outer") | str("gtp-inet-both") | str("inet-outer") | str("inet-both"))
|
@@ -41812,19 +41812,19 @@ module Junoser
|
|
41812
41812
|
)
|
41813
41813
|
).as(:oneline),
|
41814
41814
|
b(str("frame-relay-de"),
|
41815
|
-
|
41816
|
-
|
41815
|
+
sc(
|
41816
|
+
(str("default") | arg)
|
41817
41817
|
)
|
41818
41818
|
).as(:oneline),
|
41819
41819
|
b(str("ieee-802.1ad"),
|
41820
41820
|
c(
|
41821
|
-
(str("default")),
|
41821
|
+
(str("default") | arg),
|
41822
41822
|
b(str("vlan-tag"),
|
41823
41823
|
(str("outer") | str("outer-and-inner"))
|
41824
41824
|
)
|
41825
41825
|
)
|
41826
41826
|
),
|
41827
|
-
a(str("inet6-precedence"), str("default"),
|
41827
|
+
a(str("inet6-precedence"), str("default") | arg,
|
41828
41828
|
sc(
|
41829
41829
|
b(str("protocol"),
|
41830
41830
|
(str("mpls"))
|
@@ -41836,8 +41836,8 @@ module Junoser
|
|
41836
41836
|
b(str("loss-priority-rewrites"),
|
41837
41837
|
c(
|
41838
41838
|
b(str("frame-relay-de"),
|
41839
|
-
|
41840
|
-
|
41839
|
+
sc(
|
41840
|
+
(str("default") | arg)
|
41841
41841
|
)
|
41842
41842
|
).as(:oneline)
|
41843
41843
|
)
|
@@ -41875,11 +41875,11 @@ module Junoser
|
|
41875
41875
|
),
|
41876
41876
|
b(str("classifiers"),
|
41877
41877
|
c(
|
41878
|
-
a(str("dscp"), str("default")),
|
41879
|
-
a(str("dscp-ipv6"), str("default")),
|
41878
|
+
a(str("dscp"), str("default") | arg),
|
41879
|
+
a(str("dscp-ipv6"), str("default") | arg),
|
41880
41880
|
b(str("ieee-802.1"),
|
41881
41881
|
sc(
|
41882
|
-
(str("default")),
|
41882
|
+
(str("default") | arg),
|
41883
41883
|
b(str("vlan-tag"),
|
41884
41884
|
(str("outer") | str("inner"))
|
41885
41885
|
)
|
@@ -41887,15 +41887,15 @@ module Junoser
|
|
41887
41887
|
).as(:oneline),
|
41888
41888
|
b(str("ieee-802.1ad"),
|
41889
41889
|
sc(
|
41890
|
-
(str("default")),
|
41890
|
+
(str("default") | arg),
|
41891
41891
|
b(str("vlan-tag"),
|
41892
41892
|
(str("outer") | str("inner"))
|
41893
41893
|
)
|
41894
41894
|
)
|
41895
41895
|
).as(:oneline),
|
41896
41896
|
b(str("inet-precedence"),
|
41897
|
-
|
41898
|
-
|
41897
|
+
sc(
|
41898
|
+
(str("default") | arg)
|
41899
41899
|
)
|
41900
41900
|
).as(:oneline)
|
41901
41901
|
)
|
@@ -41903,22 +41903,22 @@ module Junoser
|
|
41903
41903
|
a(str("forwarding-class"), arg),
|
41904
41904
|
b(str("rewrite-rules"),
|
41905
41905
|
c(
|
41906
|
-
a(str("dscp"), str("default")).as(:oneline),
|
41907
|
-
a(str("dscp-ipv6"), str("default")).as(:oneline),
|
41906
|
+
a(str("dscp"), str("default") | arg).as(:oneline),
|
41907
|
+
a(str("dscp-ipv6"), str("default") | arg).as(:oneline),
|
41908
41908
|
b(str("ieee-802.1"),
|
41909
|
-
|
41910
|
-
|
41909
|
+
sc(
|
41910
|
+
(str("default") | arg)
|
41911
41911
|
)
|
41912
41912
|
).as(:oneline),
|
41913
41913
|
b(str("ieee-802.1ad"),
|
41914
41914
|
c(
|
41915
|
-
(str("default")),
|
41915
|
+
(str("default") | arg),
|
41916
41916
|
b(str("vlan-tag"),
|
41917
41917
|
(str("outer"))
|
41918
41918
|
)
|
41919
41919
|
)
|
41920
41920
|
),
|
41921
|
-
a(str("inet-precedence"), str("default")).as(:oneline)
|
41921
|
+
a(str("inet-precedence"), str("default") | arg).as(:oneline)
|
41922
41922
|
)
|
41923
41923
|
),
|
41924
41924
|
b(str("multi-destination"),
|
@@ -43080,7 +43080,7 @@ module Junoser
|
|
43080
43080
|
a(str("member"), arg),
|
43081
43081
|
b(a(str("member-range"), arg),
|
43082
43082
|
sc(
|
43083
|
-
b(str("
|
43083
|
+
b(str("to"),
|
43084
43084
|
interface_device
|
43085
43085
|
)
|
43086
43086
|
)
|
@@ -43162,7 +43162,7 @@ module Junoser
|
|
43162
43162
|
),
|
43163
43163
|
str("no-pseudowire-down-on-core-isolation"),
|
43164
43164
|
b(str("speed"),
|
43165
|
-
(str("auto") | str("auto-10m-100m") | str("10m") | str("100m") | str("1g") | str("2.5g") | str("5g") | str("10g") | str("40g") | str("oc3") | str("oc12") | str("oc48"))
|
43165
|
+
(str("auto") | str("auto-10m-100m") | str("10m") | str("100m") | str("1g") | str("2.5g") | str("5g") | str("10g") | str("40g") | str("100g") | str("200g") | str("400g") | str("800g") | str("oc3") | str("oc12") | str("oc48"))
|
43166
43166
|
),
|
43167
43167
|
b(str("forwarding-class-accounting"),
|
43168
43168
|
c(
|
@@ -46532,7 +46532,7 @@ module Junoser
|
|
46532
46532
|
a(str("member"), arg),
|
46533
46533
|
b(a(str("member-range"), arg),
|
46534
46534
|
sc(
|
46535
|
-
b(str("
|
46535
|
+
b(str("to"),
|
46536
46536
|
interface_device
|
46537
46537
|
)
|
46538
46538
|
)
|
@@ -46614,7 +46614,7 @@ module Junoser
|
|
46614
46614
|
),
|
46615
46615
|
str("no-pseudowire-down-on-core-isolation"),
|
46616
46616
|
b(str("speed"),
|
46617
|
-
(str("auto") | str("auto-10m-100m") | str("10m") | str("100m") | str("1g") | str("2.5g") | str("5g") | str("10g") | str("40g") | str("oc3") | str("oc12") | str("oc48"))
|
46617
|
+
(str("auto") | str("auto-10m-100m") | str("10m") | str("100m") | str("1g") | str("2.5g") | str("5g") | str("10g") | str("40g") | str("100g") | str("200g") | str("400g") | str("800g") | str("oc3") | str("oc12") | str("oc48"))
|
46618
46618
|
),
|
46619
46619
|
b(str("forwarding-class-accounting"),
|
46620
46620
|
c(
|
@@ -63641,7 +63641,7 @@ module Junoser
|
|
63641
63641
|
rule(:bgpaf_accepted_prefix_limit) do
|
63642
63642
|
c(
|
63643
63643
|
a(str("maximum"), arg),
|
63644
|
-
b(str("teardown"),
|
63644
|
+
b(a(str("teardown"), arg),
|
63645
63645
|
ca(
|
63646
63646
|
b(str("idle-timeout"),
|
63647
63647
|
sc(
|
@@ -63652,7 +63652,8 @@ module Junoser
|
|
63652
63652
|
)
|
63653
63653
|
).as(:oneline)
|
63654
63654
|
)
|
63655
|
-
)
|
63655
|
+
),
|
63656
|
+
str("teardown")
|
63656
63657
|
)
|
63657
63658
|
end
|
63658
63659
|
|
@@ -63671,7 +63672,7 @@ module Junoser
|
|
63671
63672
|
rule(:bgpaf_prefix_limit) do
|
63672
63673
|
c(
|
63673
63674
|
a(str("maximum"), arg),
|
63674
|
-
b(str("teardown"),
|
63675
|
+
b(a(str("teardown"), arg),
|
63675
63676
|
ca(
|
63676
63677
|
b(str("idle-timeout"),
|
63677
63678
|
sc(
|
@@ -63682,7 +63683,8 @@ module Junoser
|
|
63682
63683
|
)
|
63683
63684
|
).as(:oneline)
|
63684
63685
|
)
|
63685
|
-
)
|
63686
|
+
),
|
63687
|
+
str("teardown")
|
63686
63688
|
)
|
63687
63689
|
end
|
63688
63690
|
|
@@ -97992,7 +97994,7 @@ module Junoser
|
|
97992
97994
|
),
|
97993
97995
|
b(str("keys"),
|
97994
97996
|
c(
|
97995
|
-
a(str("key"), arg)
|
97997
|
+
a(str("key"), quote | arg)
|
97996
97998
|
)
|
97997
97999
|
),
|
97998
98000
|
c(
|
data/lib/junoser/ruler.rb
CHANGED
@@ -14,7 +14,7 @@ module Junoser
|
|
14
14
|
str = @rule.read
|
15
15
|
str = remove_comments(str)
|
16
16
|
str = process_reserved_element(str)
|
17
|
-
str
|
17
|
+
str.split(/\n/).map { |l| format(process_line(l)) }.join("\n")
|
18
18
|
end
|
19
19
|
|
20
20
|
private
|
@@ -26,16 +26,16 @@ module Junoser
|
|
26
26
|
def process_line(str)
|
27
27
|
return str if str =~ /^(.* do|end)$/
|
28
28
|
|
29
|
-
str.gsub!(/("[^"]+")/) { "str(
|
29
|
+
str.gsub!(/("[^"]+")/) { "str(#{$1})" } # "foo" -> str("foo")
|
30
30
|
|
31
|
-
str.gsub!(/^(\s*)arg(\.as\(:\S+\))? \($/) { "#{$1}b(arg
|
32
|
-
str.gsub!(/^(\s*)(str\(\S+\)) ([^ \t\n\r\f
|
33
|
-
str.gsub!(/^(\s*)(str\(\S+\)) (enum)?\((.*)\)(,?)$/) { "#{$1}a(
|
31
|
+
str.gsub!(/^(\s*)arg(\.as\(:\S+\))? \($/) { "#{$1}b(arg#{$2}," } # arg ( -> b(arg,
|
32
|
+
str.gsub!(/^(\s*)(str\(\S+\)) ([^ \t\n\r\f(|,]+)(\.as\(:\S+\))?(,?)$/) { "#{$1}a(#{$2}, #{$3})#{$4}#{$5}" } # str("foo") bar -> a(str("foo"), bar)
|
33
|
+
str.gsub!(/^(\s*)(str\(\S+\)) (enum)?\((.*)\)(,?)$/) { "#{$1}a(#{$2}, #{$3}#{$4})#{$5}" } # str("foo") (a | b) -> a(str("foo"), a | b)
|
34
34
|
|
35
|
-
str.gsub!(/^(\s*)(str\(\S+\)) \($/) { "#{$1}b(
|
36
|
-
str.gsub!(/^(\s*)(enum)?(\(.*\))(\.as\(:\S\))? \($/) { "#{$1}b(
|
37
|
-
str.gsub!(/^(\s*)(str\(\S+\)) ([^ \t\n\r\f
|
38
|
-
str.gsub!(/^(\s*)(str\(\S+\)) (enum)?\((.*)\) \($/) { "#{$1}a(
|
35
|
+
str.gsub!(/^(\s*)(str\(\S+\)) \($/) { "#{$1}b(#{$2}," } # str("foo") ( -> b(str("foo"),
|
36
|
+
str.gsub!(/^(\s*)(enum)?(\(.*\))(\.as\(:\S\))? \($/) { "#{$1}b(#{$2}#{$3}#{$4}," } # (a | b) ( -> b((a | b),
|
37
|
+
str.gsub!(/^(\s*)(str\(\S+\)) ([^ \t\n\r\f(|,]+) \($/) { "#{$1}b(a(#{$2}, #{$3})," } # str("foo") bar ( -> b(a(str("foo"), bar),
|
38
|
+
str.gsub!(/^(\s*)(str\(\S+\)) (enum)?\((.*)\) \($/) { "#{$1}a(#{$2}, #{$3}#{$4}," } # str("foo") (a | b) ( -> a(str("foo"), a | b,
|
39
39
|
|
40
40
|
str
|
41
41
|
end
|
@@ -52,7 +52,7 @@ module Junoser
|
|
52
52
|
#
|
53
53
|
# Statements can be quoted
|
54
54
|
#
|
55
|
-
str.gsub!(/("ssh-\S+") arg/) { "
|
55
|
+
str.gsub!(/("ssh-\S+") arg/) { "#{$1} (quote | arg)" }
|
56
56
|
str.gsub! '"message" arg', '"message" (quote | arg)'
|
57
57
|
str.gsub! '"description" arg', '"description" (quote | arg)'
|
58
58
|
str.gsub! '"as-path-prepend" arg', '"as-path-prepend" (quote | arg)'
|
@@ -63,7 +63,7 @@ module Junoser
|
|
63
63
|
' quote | arg'], $1)
|
64
64
|
end
|
65
65
|
|
66
|
-
str.gsub!(/^rule\(:regular_expression\) do\s
|
66
|
+
str.gsub!(/^rule\(:regular_expression\) do\s.*?\s*end/) do
|
67
67
|
<<~EOS
|
68
68
|
rule(:regular_expression) do
|
69
69
|
(quote | arg).as(:arg)
|
@@ -99,7 +99,7 @@ module Junoser
|
|
99
99
|
#
|
100
100
|
# "arg" matches anything so move to the end
|
101
101
|
#
|
102
|
-
str.gsub!(/arg \| (".*")/) { "
|
102
|
+
str.gsub!(/arg \| (".*")/) { "#{$1} | arg" }
|
103
103
|
str.gsub!(/^(\s*)c\(\s*arg,$/) { "#{$1}ca(" }
|
104
104
|
str.gsub!(/(rule\(:control_route_filter_type\) do\s*)s\(\s*arg,/) { "#{$1}b(" }
|
105
105
|
str.gsub!(/(rule\(:control_source_address_filter_type\) do\s*)s\(\s*arg,/) { "#{$1}b(" }
|
@@ -130,18 +130,18 @@ module Junoser
|
|
130
130
|
#
|
131
131
|
# "inet",
|
132
132
|
# "inet6"
|
133
|
-
str.gsub!(/"cspf"(.*\s*.*)"cspf-link"/) { %["cspf-link"
|
134
|
-
str.gsub!(/"http"(.*\s*.*)"https"/) { %["https"
|
135
|
-
str.gsub!(/"inet"(.*\s*.*)"inet6"/) { %["inet6"
|
136
|
-
str.gsub!(/"icmp"(.*\s*.*)"icmp6"/) { %["icmp6"
|
137
|
-
str.gsub!(/"icmp"(.*\s*.*)"icmpv6"/) { %["icmpv6"
|
138
|
-
str.gsub!(/"snmp"(.*\s*.*)"snmptrap"/) { %["snmptrap"
|
139
|
-
str.gsub!(/"ospf"(.*\s*.*)"ospf3"/) { %["ospf3"
|
133
|
+
str.gsub!(/"cspf"(.*\s*.*)"cspf-link"/) { %["cspf-link"#{$1}"cspf"] }
|
134
|
+
str.gsub!(/"http"(.*\s*.*)"https"/) { %["https"#{$1}"http"] }
|
135
|
+
str.gsub!(/"inet"(.*\s*.*)"inet6"/) { %["inet6"#{$1}"inet"] }
|
136
|
+
str.gsub!(/"icmp"(.*\s*.*)"icmp6"/) { %["icmp6"#{$1}"icmp"] }
|
137
|
+
str.gsub!(/"icmp"(.*\s*.*)"icmpv6"/) { %["icmpv6"#{$1}"icmp"] }
|
138
|
+
str.gsub!(/"snmp"(.*\s*.*)"snmptrap"/) { %["snmptrap"#{$1}"snmp"] }
|
139
|
+
str.gsub!(/"ospf"(.*\s*.*)"ospf3"/) { %["ospf3"#{$1}"ospf"] }
|
140
140
|
str.gsub! '"tls1" | "tls11" | "tls12"', '"tls11" | "tls12" | "tls1"'
|
141
|
-
str.gsub!(/("group1" \| "group2" \| "group5") \| ([
|
141
|
+
str.gsub!(/("group1" \| "group2" \| "group5") \| ([^)]+)/) { "#{$2} | #{$1}"}
|
142
142
|
|
143
143
|
%w[ccc ethernet-over-atm tcc vpls bridge].each do |encap|
|
144
|
-
str.gsub!(/"ethernet"(.*)"ethernet-#{encap}"/) { %["ethernet-#{encap}"
|
144
|
+
str.gsub!(/"ethernet"(.*)"ethernet-#{encap}"/) { %["ethernet-#{encap}"#{$1}"ethernet"] }
|
145
145
|
end
|
146
146
|
|
147
147
|
str.gsub!(/^(\s*)"path" arg \(\s*c\(\s*sc\(\s*"abstract",\s*c\(\s*"loose",\s*"loose-link",\s*"strict"\s*\)\s*\)\.as\(:oneline\)/) do
|
@@ -163,9 +163,9 @@ module Junoser
|
|
163
163
|
#
|
164
164
|
# Fix .xsd: Elements without "nokeyword" flag
|
165
165
|
#
|
166
|
-
str.gsub!(/\((.*) \| "name"\)/) { "(
|
166
|
+
str.gsub!(/\((.*) \| "name"\)/) { "(#{$1} | arg)" }
|
167
167
|
str.gsub! '"vlan" ("all" | "vlan-name")', '"vlan" ("all" | arg)'
|
168
|
-
str.gsub!(/\((.*) \| "vlan-id"\)/) { "(
|
168
|
+
str.gsub!(/\((.*) \| "vlan-id"\)/) { "(#{$1} | arg)" }
|
169
169
|
|
170
170
|
%w[filename].each do |key|
|
171
171
|
str.gsub! %["#{key}" arg], 'arg'
|
@@ -180,6 +180,9 @@ module Junoser
|
|
180
180
|
# Fix .xsd: "icmpv6" is also acceptable
|
181
181
|
str.gsub! '"icmp6" |', '"icmp6" | "icmpv6" |'
|
182
182
|
|
183
|
+
# Fix .xsd: "end-range" of "member-range"
|
184
|
+
str.gsub! '"end-range"', '"to"'
|
185
|
+
|
183
186
|
#
|
184
187
|
# Fix .xsd: "arg" is missing
|
185
188
|
#
|
@@ -197,12 +200,11 @@ module Junoser
|
|
197
200
|
# Fix .xsd: "ieee-802.3ad" is invalid
|
198
201
|
str.gsub! '"ieee-802.3ad"', '"802.3ad"'
|
199
202
|
|
200
|
-
# Fix .xsd: "
|
201
|
-
str.gsub!(
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
end
|
203
|
+
# Fix .xsd: "classifiers"
|
204
|
+
str.gsub! '("default")', '("default" | arg)'
|
205
|
+
|
206
|
+
# Fix .xsd: "class-of-service interfaces xxx unit x"
|
207
|
+
str.gsub! '"*"', 'arg'
|
206
208
|
|
207
209
|
# Fix .xsd: "from-zone" arg is also required
|
208
210
|
str.gsub!(/^(\s*)"policy" \(\s*s\(\s*arg,\s*"to-zone-name" arg,\s*c\(\s*"policy" \(\s*policy_type\s*\)\s*\)/) do
|
@@ -220,10 +222,22 @@ module Junoser
|
|
220
222
|
# Fix .xsd: keywords "dest-nat-rule-match", "src-nat-rule-match", "static-nat-rule-match" are wrong
|
221
223
|
str.gsub!(/"(dest|src|static)-nat-rule-match"/) { '"match"' }
|
222
224
|
|
223
|
-
str
|
224
|
-
|
225
225
|
# Fix .xsd: "snmp system-name" should be "snmp name"
|
226
226
|
str.gsub! '"system-name" arg', '"name" (quote | arg)'
|
227
|
+
|
228
|
+
# Fix .xsd: argument of "system license keys key" can be quoted
|
229
|
+
str.gsub!(/^(rule\(:license_object\) do.*?"key") arg/m) { "#{$1} (quote | arg)"}
|
230
|
+
|
231
|
+
# Fix .xsd: "prefix-limit teardown"
|
232
|
+
str.gsub!(/^(\s*)"teardown" (\(.*?as\(:oneline\)\s*\)\s*\))/m) do
|
233
|
+
"#{$1}\"teardown\" arg #{$2},\n#{$1}\"teardown\""
|
234
|
+
end
|
235
|
+
|
236
|
+
# Fix .xsd: faster interface speed support
|
237
|
+
str.gsub! '"40g" | "oc3"', '"40g" | "100g" | "200g" | "400g" | "800g" | "oc3"'
|
238
|
+
str.gsub! '"100G"', '"100G" | "200G" | "400G" | "800G"'
|
239
|
+
|
240
|
+
str
|
227
241
|
end
|
228
242
|
|
229
243
|
def format(str, offset = OFFSET)
|
data/lib/junoser/version.rb
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
# TypeProf 0.21.2
|
2
|
+
|
3
|
+
# Classes
|
4
|
+
module Junoser
|
5
|
+
class Ruler
|
6
|
+
OFFSET: String
|
7
|
+
@rule: untyped
|
8
|
+
|
9
|
+
def initialize: (untyped input) -> void
|
10
|
+
def to_rule: -> String
|
11
|
+
def rule: -> untyped
|
12
|
+
|
13
|
+
private
|
14
|
+
def remove_comments: (untyped str) -> untyped
|
15
|
+
def process_line: (untyped str) -> untyped
|
16
|
+
def process_reserved_element: (untyped str) -> untyped
|
17
|
+
def format: (Array[String?] | String str, ?String? offset) -> String?
|
18
|
+
def rule_header: -> String
|
19
|
+
def rule_footer: -> String
|
20
|
+
end
|
21
|
+
end
|
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.4.
|
4
|
+
version: 0.4.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shintaro Kojima
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parslet
|
@@ -137,6 +137,7 @@ files:
|
|
137
137
|
- lib/junoser/xsd/simple_type.rb
|
138
138
|
- lib/junoser/xsd/union.rb
|
139
139
|
- lib/underscorable.rb
|
140
|
+
- sig/junoser/ruler.rbs
|
140
141
|
homepage: https://github.com/codeout/junoser
|
141
142
|
licenses: []
|
142
143
|
metadata: {}
|
@@ -155,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
155
156
|
- !ruby/object:Gem::Version
|
156
157
|
version: '0'
|
157
158
|
requirements: []
|
158
|
-
rubygems_version: 3.
|
159
|
+
rubygems_version: 3.3.7
|
159
160
|
signing_key:
|
160
161
|
specification_version: 4
|
161
162
|
summary: PEG parser for JUNOS configuration.
|