junoser 0.6.0 → 0.7.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: a73208784003b23a9dc996cf06ef4941a3da1ad35143848885c3e37a0e921e84
4
- data.tar.gz: ae1ded9c7e208d3af98a96cf4c9fe5839b51d79447f1921fb36807f4202017ad
3
+ metadata.gz: d373ec94d7ebe3053b4f01d01d54beb15b49af4e2e8fbab4b29f9641632b5715
4
+ data.tar.gz: 046c510a4c5072759810abd68c8df4ce25c7cab976806182cdf0020dbd5b3f6c
5
5
  SHA512:
6
- metadata.gz: 8ac8d0ca12b3dada5bea555115c5ac172cc7dd3123c3fb5b85ab01e7f7e116daed5b2e9faebfc6237569719ad363c182522359a0cb1d1f1892f3bb85cfb5cc47
7
- data.tar.gz: c37c95e729cdbf60a517845c0561c80b5bbb6e43f5b1dfd0c6ed8a8f49e431028c12ffb6dd0b081e8ce15ce829af599e246635a60df8d7f528d567835271e154
6
+ metadata.gz: c8acdf3b078ddc961ba28f3be6f9c2b3870b2f3ee85a81b7bec28fee09a390709e0783e520c67ef3b30fe87b15a317d7dcb879bdadd3d3b3d3d101a3fdb05c32
7
+ data.tar.gz: 9f4ff9fda7f65b1a318dcd43858874e7823e0008028071a0a2b20c951cdbdf04b6665e521044a572fd46f34626a345d543f2df9366524f55d07cf99dbfb55064
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## [0.7.0] - 2024-12-19
2
+
3
+ ### Added
4
+
5
+ * Recreate parser based on MX 22.4R3-S2.11 xsd
6
+ * Newly supported syntax
7
+ * "groups xxx when"
8
+ * "snmp stats-cache-lifetime xxx"
9
+
10
+
1
11
  ## [0.6.0] - 2024-09-15
2
12
 
3
13
  ### Added
data/Gemfile.lock CHANGED
@@ -1,21 +1,21 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- junoser (0.6.0)
4
+ junoser (0.7.0)
5
5
  parslet
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- mini_portile2 (2.8.7)
11
- nokogiri (1.16.7)
10
+ mini_portile2 (2.8.8)
11
+ nokogiri (1.17.2)
12
12
  mini_portile2 (~> 2.8.2)
13
13
  racc (~> 1.4)
14
14
  parslet (2.0.0)
15
- power_assert (2.0.3)
15
+ power_assert (2.0.4)
16
16
  racc (1.8.1)
17
17
  rake (13.2.1)
18
- test-unit (3.6.2)
18
+ test-unit (3.6.7)
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.5.9
32
+ 2.5.16
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-21.2.xsd')
7
+ xsd_path = File.join(__dir__, 'tmp/junos-system-22.4.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/junos.js')
@@ -25,6 +25,50 @@ module Junoser
25
25
 
26
26
  private
27
27
 
28
+ def process_lines(str)
29
+ # set groups
30
+ str.gsub! /"groups" \(.*\s*s\(\s*any\s*\)\s*\)/, <<-EOS.strip
31
+ "groups" arg ( /* Configuration groups */
32
+ "when" ( /* Specify additional conditions for groups */
33
+ c(
34
+ "chassis" arg /* Chassis id */,
35
+ "member" arg /* Member of virtual chassis */,
36
+ "model" arg /* Model name */,
37
+ "node" arg /* Node of cluster */,
38
+ "peers" arg /* Hosts on which this group should be effective */,
39
+ "routing-engine" arg /* Routing Engine */,
40
+ "time" ( /* Time at which group should be effective */
41
+ "to" arg /* End time([yyyy-mm-dd.]hh:mm) */,
42
+ arg
43
+ )
44
+ )
45
+ )
46
+ )
47
+ EOS
48
+
49
+ # set protocols mpls path
50
+ str.gsub!(/("path" arg \(.*Route of a label-switched path.*)(\s*)c\(/) do
51
+ "#{$1}#{$2}s(#{$2}ipaddr,"
52
+ end
53
+
54
+ # set protocols iccp peer xxx liveness-detection single-hop
55
+ str.gsub!(/(^rule\(:peer_group\) do.*?\n(\s*)"detection-time" \(.*?c\(\s*"threshold" arg .*?\)\s*\))/m) do
56
+ "#{$1},\n#{format('"single-hop"', $2)}"
57
+ end
58
+
59
+ # set forwarding-options dhcp-relay server-group
60
+ str.gsub!(/^(rule\(:(?:v6_)?server_group_type\) do)\n(.*?)\nend/m) do
61
+ "#{$1}\n arg.as(:arg) (\n#{$2}\n )\nend"
62
+ end
63
+
64
+ # set interfaces xxx enable
65
+ str.gsub!(/^(rule\(:interfaces_type\) do\s*[^\n]*\s*c\()(\s*)/m) do
66
+ %[#{$1}#{$2}"enable",#{$2}]
67
+ end
68
+
69
+ str
70
+ end
71
+
28
72
  def process_line(str)
29
73
  str = remove_undefined_variables(str)
30
74
  str = process_common_syntax(str)
@@ -210,30 +254,6 @@ module Junoser
210
254
  str
211
255
  end
212
256
 
213
- def process_lines(str)
214
- # set protocols mpls path
215
- str.gsub!(/("path" arg \(.*Route of a label-switched path.*)(\s*)c\(/) do
216
- "#{$1}#{$2}s(#{$2}ipaddr,"
217
- end
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
-
229
- # set interfaces xxx enable
230
- str.gsub!(/^(rule\(:interfaces_type\) do\s*[^\n]*\s*c\()(\s*)/m) do
231
- %[#{$1}#{$2}"enable",#{$2}]
232
- end
233
-
234
- str
235
- end
236
-
237
257
  def finalize(lines)
238
258
  lines = balance_parenthesis(lines)
239
259
  objectize_arg_of_s(lines)