junoser 0.3.10 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -2
- data/CHANGELOG.md +94 -43
- data/Gemfile.lock +12 -10
- data/LICENSE.txt +1 -1
- data/README.md +47 -11
- data/Rakefile +2 -2
- data/example/get-schema.xml +19 -0
- data/example/junos-18.1R3-S9.rb +102366 -0
- data/example/mx-19.3R3-S1.3.rb +118419 -0
- data/example/vmx-17.2R1.13.rb +2287 -2272
- data/junoser.gemspec +1 -1
- data/lib/junoser/display/structure.rb +1 -1
- data/lib/junoser/js_ruler.rb +20 -21
- data/lib/junoser/parser.rb +60100 -41527
- data/lib/junoser/ruler.rb +129 -84
- data/lib/junoser/squash.rb +10 -12
- data/lib/junoser/version.rb +1 -1
- data/lib/junoser/xsd/base.rb +5 -4
- data/lib/junoser/xsd/choice.rb +6 -2
- data/lib/junoser/xsd/complex_type.rb +3 -3
- data/lib/junoser/xsd/element.rb +7 -3
- data/lib/junoser/xsd/restriction.rb +2 -2
- data/lib/junoser/xsd/sequence.rb +11 -3
- data/lib/junoser/xsd/simple_content.rb +1 -1
- data/lib/junoser/xsd/simple_type.rb +2 -2
- data/lib/junoser/xsd/union.rb +1 -1
- metadata +11 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b370402809bb2214265f0dd6e692c591337882121f7f5c1f8f3653553cd29f83
|
4
|
+
data.tar.gz: 72dd3c61381706e34cba7618e6402f6be59380137c3b7198747d898e17d550c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 606fec606c9882cddbef3f1cc687d00f19cf0f535acdb84da448dfea730e5c7d69f16d4837014c5b7c4b1a68fea00c957f72c867ffcdccae3773b7fbf2c76b5d
|
7
|
+
data.tar.gz: d88215e1ef62177ed15e5c0e76a149ac53a96880fb19c9bfd32c275e750b2aa298bb39a6a01b6a3ee3b650592da1d843b7bb443ac9bbfa75ef620b1e2c061752
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,57 @@
|
|
1
|
-
## [0.
|
1
|
+
## [0.4.1] - 2021-06-06
|
2
2
|
|
3
3
|
### Added
|
4
4
|
|
5
|
-
*
|
5
|
+
* Newly supported syntax
|
6
|
+
* "apply-groups-except"
|
7
|
+
|
8
|
+
### Fixed
|
9
|
+
|
10
|
+
* "scpf-link", "https", "inet6", "icmp6", "icmpv6", "ospf3", and "snmptrap" keywords might be marked as invalid in some hierarchies
|
11
|
+
* "policy-options community xxx members"
|
12
|
+
* "policy-options route-distinguisher xxx members"
|
13
|
+
* "routing-options confederation members"
|
14
|
+
|
15
|
+
|
16
|
+
## [0.4.0] - 2021-05-02
|
17
|
+
|
18
|
+
### Added
|
19
|
+
|
20
|
+
* Recreate parser based on MX 19.3R3-S1.3 xsd
|
21
|
+
|
22
|
+
|
23
|
+
## [0.3.13] - 2020-05-20
|
24
|
+
|
25
|
+
### Fixed
|
26
|
+
|
27
|
+
* Accept quoted strings under
|
28
|
+
* "system login message"
|
29
|
+
* "policy-options prefix-list xxx apply-path"
|
30
|
+
|
31
|
+
* <xsd:documentation/> processing during "rake build:config"
|
32
|
+
* <xsd:sequence><xsd:choice maxOccurs="unbounded"></xsd:sequence> should be considered as a sequence
|
33
|
+
|
34
|
+
|
35
|
+
## [0.3.12] - 2020-02-06
|
36
|
+
|
37
|
+
### Fixed
|
38
|
+
|
39
|
+
* "insert" statement whose last two tokens are keyword and argument, with the following single "before" (or "after") argument
|
40
|
+
* eg) insert protocols bgp group foo export bar before baz
|
41
|
+
|
42
|
+
|
43
|
+
## [0.3.11] - 2020-01-28
|
44
|
+
|
45
|
+
### Added
|
46
|
+
|
47
|
+
* junoser-squash supports "activate" statement
|
48
|
+
|
49
|
+
|
50
|
+
## [0.3.10] - 2020-01-27
|
51
|
+
|
52
|
+
### Added
|
53
|
+
|
54
|
+
* junoser-squash experimentally supports "insert" statement
|
6
55
|
|
7
56
|
### Fixed
|
8
57
|
|
@@ -10,6 +59,7 @@
|
|
10
59
|
* junoser-squash unexpectedly removed "deactivate" statements
|
11
60
|
* "deactivate" to "inactive:" translation during "junoser -s"
|
12
61
|
|
62
|
+
|
13
63
|
## [0.3.9] - 2019-11-17
|
14
64
|
|
15
65
|
### Fixed
|
@@ -17,12 +67,13 @@
|
|
17
67
|
* security policies
|
18
68
|
* "junoser -s" and "junoser -d" unexpectedly raises errors
|
19
69
|
|
70
|
+
|
20
71
|
## [0.3.8] - 2019-11-04
|
21
72
|
|
22
73
|
### Added
|
23
74
|
|
24
75
|
* Newly supported syntax
|
25
|
-
* security (by porting the hierarchy from vSRX 18.3R1.9)
|
76
|
+
* "security" (by porting the hierarchy from vSRX 18.3R1.9)
|
26
77
|
|
27
78
|
|
28
79
|
## [0.3.7] - 2019-09-03
|
@@ -47,7 +98,7 @@
|
|
47
98
|
|
48
99
|
### Fixed
|
49
100
|
|
50
|
-
* Accept quoted
|
101
|
+
* Accept quoted strings under
|
51
102
|
* "as-path path"
|
52
103
|
|
53
104
|
|
@@ -56,16 +107,16 @@
|
|
56
107
|
### Added
|
57
108
|
|
58
109
|
* Newly supported syntax
|
59
|
-
* protocols bgp minimum-hold-time xxx
|
60
|
-
* system dump-on-panic
|
61
|
-
* chassis fpc x pic x port x number-of-sub-ports x
|
110
|
+
* "protocols bgp minimum-hold-time xxx"
|
111
|
+
* "system dump-on-panic"
|
112
|
+
* "chassis fpc x pic x port x number-of-sub-ports x"
|
62
113
|
|
63
114
|
|
64
115
|
## [0.3.3] - 2018-10-09
|
65
116
|
|
66
117
|
### Fixed
|
67
118
|
|
68
|
-
* Accept quoted
|
119
|
+
* Accept quoted strings under
|
69
120
|
* "snmp location"
|
70
121
|
* "snmp contact"
|
71
122
|
|
@@ -108,7 +159,7 @@
|
|
108
159
|
### Added
|
109
160
|
|
110
161
|
* Newly supported syntax
|
111
|
-
* class-of-service shared-buffer
|
162
|
+
* "class-of-service shared-buffer"
|
112
163
|
|
113
164
|
|
114
165
|
## [0.2.11] - 2017-09-07
|
@@ -116,15 +167,15 @@
|
|
116
167
|
### Added
|
117
168
|
|
118
169
|
* Newly supported syntax
|
119
|
-
* forwarding-options analyzer
|
120
|
-
* routing-options dynamic-tunnels <name> udp
|
170
|
+
* "forwarding-options analyzer"
|
171
|
+
* "routing-options dynamic-tunnels <name> udp"
|
121
172
|
|
122
173
|
|
123
174
|
## [0.2.10] - 2017-08-22
|
124
175
|
|
125
176
|
### Fixed
|
126
177
|
|
127
|
-
* routing-options dynamic-tunnels
|
178
|
+
* "routing-options dynamic-tunnels"
|
128
179
|
|
129
180
|
|
130
181
|
## [0.2.9] - 2017-06-09
|
@@ -132,14 +183,14 @@
|
|
132
183
|
### Added
|
133
184
|
|
134
185
|
* Newly supported syntax
|
135
|
-
* protocols sflow
|
186
|
+
* "protocols sflow"
|
136
187
|
|
137
188
|
|
138
189
|
## [0.2.8] - 2017-05-17
|
139
190
|
|
140
191
|
### Fixed
|
141
192
|
|
142
|
-
* chassis forwarding-options
|
193
|
+
* "chassis forwarding-options"
|
143
194
|
|
144
195
|
|
145
196
|
## [0.2.7] - 2017-05-01
|
@@ -147,9 +198,9 @@
|
|
147
198
|
### Added
|
148
199
|
|
149
200
|
* Newly supported syntax
|
150
|
-
* system processes app-engine-virtual-machine-management-service
|
151
|
-
* system processes app-engine-management-service
|
152
|
-
* chassis fpc ? pic ? tunnel-services
|
201
|
+
* "system processes app-engine-virtual-machine-management-service"
|
202
|
+
* "system processes app-engine-management-service"
|
203
|
+
* "chassis fpc ? pic ? tunnel-services"
|
153
204
|
|
154
205
|
|
155
206
|
## [0.2.6] - 2017-04-21
|
@@ -157,7 +208,7 @@
|
|
157
208
|
### Added
|
158
209
|
|
159
210
|
* Newly supported syntax
|
160
|
-
* chassis fpc ? pic ? port ? channel-speed ?
|
211
|
+
* "chassis fpc ? pic ? port ? channel-speed ?"
|
161
212
|
|
162
213
|
## [0.2.5] - 2017-04-18
|
163
214
|
|
@@ -171,7 +222,7 @@
|
|
171
222
|
### Added
|
172
223
|
|
173
224
|
* Newly supported syntax
|
174
|
-
* system processes app-engine-virtual-machine-management-service traceoptions
|
225
|
+
* "system processes app-engine-virtual-machine-management-service traceoptions"
|
175
226
|
* Some platforms expect "system processes dhcp", not "system processes dhcp-service"
|
176
227
|
* "storm-control" under family bridge
|
177
228
|
|
@@ -185,8 +236,8 @@
|
|
185
236
|
### Added
|
186
237
|
|
187
238
|
* Newly supported syntax
|
188
|
-
* chassis fpc N error
|
189
|
-
* forwarding-options sampling family mpls
|
239
|
+
* "chassis fpc N error"
|
240
|
+
* "forwarding-options sampling family mpls"
|
190
241
|
|
191
242
|
|
192
243
|
## [0.2.2] - 2016-02-15
|
@@ -194,7 +245,7 @@
|
|
194
245
|
### Added
|
195
246
|
|
196
247
|
* Newly supported syntax
|
197
|
-
* system services ssh
|
248
|
+
* "system services ssh"
|
198
249
|
|
199
250
|
### Fixed
|
200
251
|
|
@@ -211,7 +262,7 @@
|
|
211
262
|
|
212
263
|
### Fixed
|
213
264
|
|
214
|
-
* template-name
|
265
|
+
* "template-name"
|
215
266
|
|
216
267
|
|
217
268
|
## [0.2.0] - 2015-12-26
|
@@ -230,44 +281,44 @@
|
|
230
281
|
|
231
282
|
### Fixed
|
232
283
|
|
233
|
-
* 802.3ad
|
234
|
-
* ether-options
|
235
|
-
* storm-control default
|
236
|
-
* vrf-target
|
237
|
-
* maximum-prefix teardown
|
238
|
-
* traceoptions
|
239
|
-
* system syslog archive
|
240
|
-
* system login user
|
241
|
-
* routing-options confederation
|
242
|
-
* hold-time
|
243
|
-
* protocols ospf area x.x.x.x stub default-metric x x
|
244
|
-
* protocols rsvp interface xxx subscription x
|
245
|
-
* traceoptions cspf-link
|
246
|
-
* protocols mpls priority
|
247
|
-
* protocols mpls label-switched-path xxx primary xxx bandwidth xxx
|
248
|
-
* protocols xxx rib-group xxx xxx
|
249
|
-
* protocols mpls path xxx xxx
|
284
|
+
* "802.3ad"
|
285
|
+
* "ether-options"
|
286
|
+
* "storm-control default"
|
287
|
+
* "vrf-target"
|
288
|
+
* "maximum-prefix teardown"
|
289
|
+
* "traceoptions"
|
290
|
+
* "system syslog archive"
|
291
|
+
* "system login user"
|
292
|
+
* "routing-options confederation"
|
293
|
+
* "hold-time"
|
294
|
+
* "protocols ospf area x.x.x.x stub default-metric x x"
|
295
|
+
* "protocols rsvp interface xxx subscription x"
|
296
|
+
* "traceoptions cspf-link"
|
297
|
+
* "protocols mpls priority"
|
298
|
+
* "protocols mpls label-switched-path xxx primary xxx bandwidth xxx"
|
299
|
+
* "protocols xxx rib-group xxx xxx"
|
300
|
+
* "protocols mpls path xxx xxx"
|
250
301
|
|
251
302
|
|
252
303
|
## [0.1.6] - 2015-10-31
|
253
304
|
|
254
305
|
### Fixed
|
255
306
|
|
256
|
-
* route-filter statement should be translated into one-line
|
307
|
+
* "route-filter" statement should be translated into one-line
|
257
308
|
|
258
309
|
|
259
310
|
## [0.1.5] - 2015-09-11
|
260
311
|
|
261
312
|
### Fixed
|
262
313
|
|
263
|
-
*
|
314
|
+
* Mistakenly processed '{' and '}' in as-path string
|
264
315
|
|
265
316
|
|
266
317
|
## [0.1.4] - 2015-09-11
|
267
318
|
|
268
319
|
### Fixed
|
269
320
|
|
270
|
-
*
|
321
|
+
* Missing community operator in policy-statement didn't fail
|
271
322
|
|
272
323
|
|
273
324
|
## [0.1.3] - 2015-07-26
|
data/Gemfile.lock
CHANGED
@@ -1,19 +1,21 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
junoser (0.
|
4
|
+
junoser (0.4.1)
|
5
5
|
parslet
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
mini_portile2 (2.
|
11
|
-
nokogiri (1.
|
12
|
-
mini_portile2 (~> 2.
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
10
|
+
mini_portile2 (2.5.3)
|
11
|
+
nokogiri (1.11.7)
|
12
|
+
mini_portile2 (~> 2.5.0)
|
13
|
+
racc (~> 1.4)
|
14
|
+
parslet (2.0.0)
|
15
|
+
power_assert (2.0.0)
|
16
|
+
racc (1.5.2)
|
17
|
+
rake (13.0.3)
|
18
|
+
test-unit (3.4.4)
|
17
19
|
power_assert
|
18
20
|
|
19
21
|
PLATFORMS
|
@@ -23,8 +25,8 @@ DEPENDENCIES
|
|
23
25
|
bundler (~> 2.0)
|
24
26
|
junoser!
|
25
27
|
nokogiri
|
26
|
-
rake (~>
|
28
|
+
rake (~> 13.0)
|
27
29
|
test-unit
|
28
30
|
|
29
31
|
BUNDLED WITH
|
30
|
-
2.
|
32
|
+
2.2.16
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -28,34 +28,70 @@ $ gem install junoser
|
|
28
28
|
|
29
29
|
### Usage
|
30
30
|
|
31
|
-
|
31
|
+
#### Syntax validation
|
32
32
|
|
33
33
|
```zsh
|
34
34
|
$ junoser -c config.txt
|
35
|
-
```
|
36
35
|
|
37
|
-
or
|
36
|
+
# or
|
38
37
|
|
39
|
-
```zsh
|
40
38
|
$ cat config.txt | junoser -c
|
41
39
|
```
|
42
40
|
|
43
|
-
|
41
|
+
#### Syntax translation
|
42
|
+
|
43
|
+
##### Structured form into "display set"
|
44
44
|
|
45
45
|
```zsh
|
46
|
-
$
|
46
|
+
$ junoser -d config.txt
|
47
47
|
set protocols bgp group ebgp-peers neighbor 192.0.2.2
|
48
|
-
```
|
49
48
|
|
50
|
-
or
|
49
|
+
# or
|
51
50
|
|
52
|
-
```zsh
|
53
51
|
$ cat config.txt | junoser -d
|
54
52
|
set protocols bgp group ebgp-peers neighbor 192.0.2.2
|
55
53
|
```
|
56
54
|
|
57
|
-
|
55
|
+
##### "display set" into structured form
|
56
|
+
|
57
|
+
```zsh
|
58
|
+
$ junoser -s config.txt
|
59
|
+
|
60
|
+
# or
|
61
|
+
|
62
|
+
$ cat config.txt | junoser -s
|
63
|
+
```
|
64
|
+
|
65
|
+
|
66
|
+
## Updating parser for new directives
|
67
|
+
|
68
|
+
From [Juniper
|
69
|
+
website](https://support.juniper.net/support/downloads/), you can
|
70
|
+
download the XSD schema for the version of JunOS you want to target:
|
58
71
|
|
72
|
+
- Junos XML API
|
73
|
+
- Select your version
|
74
|
+
- Application Tools
|
75
|
+
- XML Schema for Configurator Data
|
76
|
+
|
77
|
+
Alternatively, you can retrieve the schema with Netconf:
|
78
|
+
|
79
|
+
```zsh
|
80
|
+
$ ssh -Csp 830 JUNOS netconf < example/get-schema.xml | sed -n '/^<xsd:schema/,/^<\/xsd:schema/p' > junos-XXX.xsd
|
81
|
+
```
|
82
|
+
|
83
|
+
Put it in `tmp/`, update `xsd_path` in `Rakefile` and run:
|
84
|
+
|
85
|
+
```zsh
|
86
|
+
$ bundle exec rake build:config build:rule
|
87
|
+
```
|
88
|
+
|
89
|
+
Alternatively, you may look in `example/` for some prebuilt rules
|
90
|
+
file. If you want to use them, copy one to `tmp/rules.rb` and run:
|
91
|
+
|
92
|
+
```zsh
|
93
|
+
$ bundle exec rake build:rule
|
94
|
+
```
|
59
95
|
|
60
96
|
## Contributing
|
61
97
|
|
@@ -67,4 +103,4 @@ Or send a pull request to fix.
|
|
67
103
|
|
68
104
|
## Copyright and License
|
69
105
|
|
70
|
-
Copyright (c)
|
106
|
+
Copyright (c) 2015-2021 Shintaro Kojima. Code released under the [MIT license](LICENSE.txt).
|
data/Rakefile
CHANGED
@@ -4,10 +4,10 @@ require 'nokogiri'
|
|
4
4
|
require 'pathname'
|
5
5
|
require 'rake/testtask'
|
6
6
|
|
7
|
-
xsd_path = File.join(__dir__, 'tmp/junos-system-
|
7
|
+
xsd_path = File.join(__dir__, 'tmp/junos-system-19.3.xsd')
|
8
8
|
rule_path = File.join(__dir__, 'tmp/rule.rb')
|
9
9
|
ruby_parser_path = File.join(__dir__, 'lib/junoser/parser.rb')
|
10
|
-
js_parser_path = File.join(__dir__, 'tmp/
|
10
|
+
js_parser_path = File.join(__dir__, 'tmp/junos.js')
|
11
11
|
|
12
12
|
def open_files(input, output, &block)
|
13
13
|
i = open(input)
|