junoser 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/junoser/ruler.rb CHANGED
@@ -137,6 +137,8 @@ module Junoser
137
137
  str.gsub!(/"icmp"(.*\s*.*)"icmpv6"/) { %["icmpv6"#$1"icmp"] }
138
138
  str.gsub!(/"snmp"(.*\s*.*)"snmptrap"/) { %["snmptrap"#$1"snmp"] }
139
139
  str.gsub!(/"ospf"(.*\s*.*)"ospf3"/) { %["ospf3"#$1"ospf"] }
140
+ str.gsub! '"tls1" | "tls11" | "tls12"', '"tls11" | "tls12" | "tls1"'
141
+ str.gsub!(/("group1" \| "group2" \| "group5") \| ([^\)]+)/) { "#{$2} | #{$1}"}
140
142
 
141
143
  %w[ccc ethernet-over-atm tcc vpls bridge].each do |encap|
142
144
  str.gsub!(/"ethernet"(.*)"ethernet-#{encap}"/) { %["ethernet-#{encap}"#$1"ethernet"] }
@@ -212,6 +214,12 @@ module Junoser
212
214
  # Fix .xsd: "members" accepts [ foo bar ]
213
215
  str.gsub! '"members" arg', '"members" any'
214
216
 
217
+ # Fix .xsd: "term_object" accepts multiple conditions
218
+ str.gsub!(/^(rule\(:term_object\) do\s*arg\.as\(:arg\) \(\s*)c\(/) { "#{$1}sc(" }
219
+
220
+ # Fix .xsd: keywords "dest-nat-rule-match", "src-nat-rule-match", "static-nat-rule-match" are wrong
221
+ str.gsub!(/"(dest|src|static)-nat-rule-match"/) { '"match"' }
222
+
215
223
  str
216
224
  end
217
225
 
@@ -1,3 +1,3 @@
1
1
  module Junoser
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
@@ -34,14 +34,16 @@ module Junoser
34
34
  end
35
35
 
36
36
  def oneliner?
37
- @oneliner ||= !xml.xpath('./xsd:annotation/xsd:appinfo/flag[text()="oneliner"]').empty?
37
+ # don't use "/flag" as xsd manipulation automatically add "xsd:" prefix
38
+ @oneliner ||= !xml.xpath('./xsd:annotation/xsd:appinfo/*[local-name()="flag" and text()="oneliner"]').empty?
38
39
  end
39
40
 
40
41
 
41
42
  private
42
43
 
43
44
  def nokeyword?
44
- @nokeyword ||= !xml.xpath('./xsd:annotation/xsd:appinfo/flag[text()="nokeyword"]').empty?
45
+ # don't use "/flag" as xsd manipulation automatically add "xsd:" prefix
46
+ @nokeyword ||= !xml.xpath('./xsd:annotation/xsd:appinfo/*[local-name()="flag" and text()="nokeyword"]').empty?
45
47
  end
46
48
 
47
49
  def has_single_child_of?(klass)
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.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shintaro Kojima
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-13 00:00:00.000000000 Z
11
+ date: 2021-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parslet
@@ -153,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
153
153
  - !ruby/object:Gem::Version
154
154
  version: '0'
155
155
  requirements: []
156
- rubygems_version: 3.2.15
156
+ rubygems_version: 3.2.22
157
157
  signing_key:
158
158
  specification_version: 4
159
159
  summary: PEG parser for JUNOS configuration.