junoser 0.3.9 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4593e83820c87e14eb51c1bc781a7ef739a30fd81ddbb0438a144b637897d8bc
4
- data.tar.gz: 9334a3f8c869085ac0d435f48b0cbc3add246b105f49215d72b355a8d2880dc6
3
+ metadata.gz: aaec08e09e4a42a8f3f9fb44e00fcb2d5eca3e074f5588d77d86c72d9ed37f52
4
+ data.tar.gz: 477440a7283850df8a638fe78bb71837e11e7feff8eff600d665bd56aace5260
5
5
  SHA512:
6
- metadata.gz: c7c4846a31f13cb84d6c82d08c6dd07b21cfa4941799bfff38f82e353db29bc8ffb8c8663b7b29cb658bc37eba9b49802d09c15c5c07ada303bdf7fee1654ca8
7
- data.tar.gz: 1802d0a8ba430e735d4f5f6c96264adf71396c30010a7fc8d620ad5ccb040b15595bd9e0f88f5db5ccd6c4fc980887d7f25f74a29ff539a0477467b8c4c2ba09
6
+ metadata.gz: 5fff90b0676b526f00c5946116fc4af18fa9a55f431efab460d012551956db180a1b20971923e5069fb059a4e7136ad3f995deef76abea15db4302fbdb91949e
7
+ data.tar.gz: 2046e70037d4fffff6705d6cdbc02d7542107c92d98905f2858f5398b00769da22fc1f33353747c9918ccd225b9fa72be0a689f10c345ec0a7e5e136711debb7
data/.travis.yml CHANGED
@@ -1,9 +1,9 @@
1
1
  language: ruby
2
2
 
3
3
  rvm:
4
- - 2.4
5
- - 2.5
6
4
  - 2.6
5
+ - 2.7
6
+ - 3.0
7
7
  - ruby-head
8
8
 
9
9
  before_install:
data/CHANGELOG.md CHANGED
@@ -1,3 +1,50 @@
1
+ ## [0.4.0] - 2021-05-02
2
+
3
+ ### Added
4
+
5
+ * Recreate parser based on MX 19.3R3-S1.3 xsd
6
+
7
+
8
+ ## [0.3.13] - 2020-05-20
9
+
10
+ ### Fixed
11
+
12
+ * Accept quoted strings under
13
+ * "system login message"
14
+ * "policy-options prefix-list xxx apply-path"
15
+
16
+ * <xsd:documentation/> processing during "rake build:config"
17
+ * <xsd:sequence><xsd:choice maxOccurs="unbounded"></xsd:sequence> should be considered as a sequence
18
+
19
+
20
+ ## [0.3.12] - 2020-02-06
21
+
22
+ ### Fixed
23
+
24
+ * "insert" statement whose last two tokens are keyword and argument, with the following single "before" (or "after") argument
25
+ * eg) insert protocols bgp group foo export bar before baz
26
+
27
+
28
+ ## [0.3.11] - 2020-01-28
29
+
30
+ ### Added
31
+
32
+ * junoser-squash supports "activate" statement
33
+
34
+
35
+ ## [0.3.10] - 2020-01-27
36
+
37
+ ### Added
38
+
39
+ * junoser-squash experimentally supports "insert" statement
40
+
41
+ ### Fixed
42
+
43
+ * junoser-squash unexpectedly kept statements intact due to tokenization bug
44
+ * junoser-squash unexpectedly removed "deactivate" statements
45
+ * "deactivate" to "inactive:" translation during "junoser -s"
46
+
47
+
1
48
  ## [0.3.9] - 2019-11-17
2
49
 
3
50
  ### Fixed
@@ -5,24 +52,25 @@
5
52
  * security policies
6
53
  * "junoser -s" and "junoser -d" unexpectedly raises errors
7
54
 
55
+
8
56
  ## [0.3.8] - 2019-11-04
9
57
 
10
58
  ### Added
11
59
 
12
60
  * Newly supported syntax
13
- * security (by porting the hierarchy from vSRX 18.3R1.9)
61
+ * "security" (by porting the hierarchy from vSRX 18.3R1.9)
14
62
 
15
63
 
16
64
  ## [0.3.7] - 2019-09-03
17
65
 
18
- ### Fixed
19
-
20
- * "apply-groups" translation between "display set" and structured form
21
-
22
66
  ### Added
23
67
 
24
68
  * Support "deactivate ... apply-groups"
25
69
 
70
+ ### Fixed
71
+
72
+ * "apply-groups" translation between "display set" and structured form
73
+
26
74
 
27
75
  ## [0.3.6] - 2019-08-25
28
76
 
@@ -35,7 +83,7 @@
35
83
 
36
84
  ### Fixed
37
85
 
38
- * Accept quoted string for
86
+ * Accept quoted strings under
39
87
  * "as-path path"
40
88
 
41
89
 
@@ -44,16 +92,16 @@
44
92
  ### Added
45
93
 
46
94
  * Newly supported syntax
47
- * protocols bgp minimum-hold-time xxx
48
- * system dump-on-panic
49
- * chassis fpc x pic x port x number-of-sub-ports x
95
+ * "protocols bgp minimum-hold-time xxx"
96
+ * "system dump-on-panic"
97
+ * "chassis fpc x pic x port x number-of-sub-ports x"
50
98
 
51
99
 
52
100
  ## [0.3.3] - 2018-10-09
53
101
 
54
102
  ### Fixed
55
103
 
56
- * Accept quoted string for
104
+ * Accept quoted strings under
57
105
  * "snmp location"
58
106
  * "snmp contact"
59
107
 
@@ -96,7 +144,7 @@
96
144
  ### Added
97
145
 
98
146
  * Newly supported syntax
99
- * class-of-service shared-buffer
147
+ * "class-of-service shared-buffer"
100
148
 
101
149
 
102
150
  ## [0.2.11] - 2017-09-07
@@ -104,15 +152,15 @@
104
152
  ### Added
105
153
 
106
154
  * Newly supported syntax
107
- * forwarding-options analyzer
108
- * routing-options dynamic-tunnels <name> udp
155
+ * "forwarding-options analyzer"
156
+ * "routing-options dynamic-tunnels <name> udp"
109
157
 
110
158
 
111
159
  ## [0.2.10] - 2017-08-22
112
160
 
113
161
  ### Fixed
114
162
 
115
- * routing-options dynamic-tunnels
163
+ * "routing-options dynamic-tunnels"
116
164
 
117
165
 
118
166
  ## [0.2.9] - 2017-06-09
@@ -120,14 +168,14 @@
120
168
  ### Added
121
169
 
122
170
  * Newly supported syntax
123
- * protocols sflow
171
+ * "protocols sflow"
124
172
 
125
173
 
126
174
  ## [0.2.8] - 2017-05-17
127
175
 
128
176
  ### Fixed
129
177
 
130
- * chassis forwarding-options
178
+ * "chassis forwarding-options"
131
179
 
132
180
 
133
181
  ## [0.2.7] - 2017-05-01
@@ -135,9 +183,9 @@
135
183
  ### Added
136
184
 
137
185
  * Newly supported syntax
138
- * system processes app-engine-virtual-machine-management-service
139
- * system processes app-engine-management-service
140
- * chassis fpc ? pic ? tunnel-services
186
+ * "system processes app-engine-virtual-machine-management-service"
187
+ * "system processes app-engine-management-service"
188
+ * "chassis fpc ? pic ? tunnel-services"
141
189
 
142
190
 
143
191
  ## [0.2.6] - 2017-04-21
@@ -145,7 +193,7 @@
145
193
  ### Added
146
194
 
147
195
  * Newly supported syntax
148
- * chassis fpc ? pic ? port ? channel-speed ?
196
+ * "chassis fpc ? pic ? port ? channel-speed ?"
149
197
 
150
198
  ## [0.2.5] - 2017-04-18
151
199
 
@@ -159,7 +207,7 @@
159
207
  ### Added
160
208
 
161
209
  * Newly supported syntax
162
- * system processes app-engine-virtual-machine-management-service traceoptions
210
+ * "system processes app-engine-virtual-machine-management-service traceoptions"
163
211
  * Some platforms expect "system processes dhcp", not "system processes dhcp-service"
164
212
  * "storm-control" under family bridge
165
213
 
@@ -173,8 +221,8 @@
173
221
  ### Added
174
222
 
175
223
  * Newly supported syntax
176
- * chassis fpc N error
177
- * forwarding-options sampling family mpls
224
+ * "chassis fpc N error"
225
+ * "forwarding-options sampling family mpls"
178
226
 
179
227
 
180
228
  ## [0.2.2] - 2016-02-15
@@ -182,7 +230,7 @@
182
230
  ### Added
183
231
 
184
232
  * Newly supported syntax
185
- * system services ssh
233
+ * "system services ssh"
186
234
 
187
235
  ### Fixed
188
236
 
@@ -199,7 +247,7 @@
199
247
 
200
248
  ### Fixed
201
249
 
202
- * template-name
250
+ * "template-name"
203
251
 
204
252
 
205
253
  ## [0.2.0] - 2015-12-26
@@ -218,44 +266,44 @@
218
266
 
219
267
  ### Fixed
220
268
 
221
- * 802.3ad
222
- * ether-options
223
- * storm-control default
224
- * vrf-target
225
- * maximum-prefix teardown
226
- * traceoptions
227
- * system syslog archive
228
- * system login user
229
- * routing-options confederation
230
- * hold-time
231
- * protocols ospf area x.x.x.x stub default-metric x x
232
- * protocols rsvp interface xxx subscription x
233
- * traceoptions cspf-link
234
- * protocols mpls priority
235
- * protocols mpls label-switched-path xxx primary xxx bandwidth xxx
236
- * protocols xxx rib-group xxx xxx
237
- * protocols mpls path xxx xxx
269
+ * "802.3ad"
270
+ * "ether-options"
271
+ * "storm-control default"
272
+ * "vrf-target"
273
+ * "maximum-prefix teardown"
274
+ * "traceoptions"
275
+ * "system syslog archive"
276
+ * "system login user"
277
+ * "routing-options confederation"
278
+ * "hold-time"
279
+ * "protocols ospf area x.x.x.x stub default-metric x x"
280
+ * "protocols rsvp interface xxx subscription x"
281
+ * "traceoptions cspf-link"
282
+ * "protocols mpls priority"
283
+ * "protocols mpls label-switched-path xxx primary xxx bandwidth xxx"
284
+ * "protocols xxx rib-group xxx xxx"
285
+ * "protocols mpls path xxx xxx"
238
286
 
239
287
 
240
288
  ## [0.1.6] - 2015-10-31
241
289
 
242
290
  ### Fixed
243
291
 
244
- * route-filter statement should be translated into one-line
292
+ * "route-filter" statement should be translated into one-line
245
293
 
246
294
 
247
295
  ## [0.1.5] - 2015-09-11
248
296
 
249
297
  ### Fixed
250
298
 
251
- * mistakenly processed '{' and '}' in as-path string
299
+ * Mistakenly processed '{' and '}' in as-path string
252
300
 
253
301
 
254
302
  ## [0.1.4] - 2015-09-11
255
303
 
256
304
  ### Fixed
257
305
 
258
- * missing community operator in policy-statement didn't fail
306
+ * Missing community operator in policy-statement didn't fail
259
307
 
260
308
 
261
309
  ## [0.1.3] - 2015-07-26
data/Gemfile.lock CHANGED
@@ -1,19 +1,19 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- junoser (0.3.9)
4
+ junoser (0.4.0)
5
5
  parslet
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- mini_portile2 (2.4.0)
11
- nokogiri (1.10.4)
12
- mini_portile2 (~> 2.4.0)
13
- parslet (1.8.2)
14
- power_assert (1.1.5)
15
- rake (10.5.0)
16
- test-unit (3.3.3)
10
+ nokogiri (1.11.3)
11
+ racc (~> 1.4)
12
+ parslet (2.0.0)
13
+ power_assert (2.0.0)
14
+ racc (1.5.2)
15
+ rake (13.0.3)
16
+ test-unit (3.4.1)
17
17
  power_assert
18
18
 
19
19
  PLATFORMS
@@ -23,8 +23,8 @@ DEPENDENCIES
23
23
  bundler (~> 2.0)
24
24
  junoser!
25
25
  nokogiri
26
- rake (~> 10.0)
26
+ rake (~> 13.0)
27
27
  test-unit
28
28
 
29
29
  BUNDLED WITH
30
- 2.0.2
30
+ 2.2.16
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2019 Shintaro Kojima
3
+ Copyright (c) 2015-2021 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
@@ -28,34 +28,70 @@ $ gem install junoser
28
28
 
29
29
  ### Usage
30
30
 
31
- To verify configurations syntax:
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
- To translate configuration into "display set" form:
41
+ #### Syntax translation
42
+
43
+ ##### Structured form into "display set"
44
44
 
45
45
  ```zsh
46
- $ /exe/junoser -d config.txt
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
- Use ```junoser -s``` to translate into structured form.
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) 2019 Shintaro Kojima. Code released under the [MIT license](LICENSE.txt).
106
+ Copyright (c) 2015-2021 Shintaro Kojima. Code released under the [MIT license](LICENSE.txt).
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ require 'nokogiri'
4
4
  require 'pathname'
5
5
  require 'rake/testtask'
6
6
 
7
- xsd_path = File.join(__dir__, 'tmp/junos-system-17.2.xsd')
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
10
  js_parser_path = File.join(__dir__, 'tmp/schema.js')
@@ -0,0 +1,19 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
3
+ <capabilities>
4
+ <capability>urn:ietf:params:netconf:base:1.0</capability>
5
+ </capabilities>
6
+ </hello>
7
+ ]]>]]>
8
+ <?xml version="1.0" encoding="UTF-8"?>
9
+ <rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
10
+ <get-xnm-information>
11
+ <type>xml-schema</type>
12
+ <namespace>junos-configuration</namespace>
13
+ </get-xnm-information>
14
+ </rpc>
15
+ ]]>]]>
16
+ <?xml version="1.0" encoding="UTF-8"?>
17
+ <rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="2">
18
+ <close-session/>
19
+ </rpc>