junoser 0.4.1 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test-linux.yaml +30 -0
- data/.pre-commit-config.yaml +7 -0
- data/CHANGELOG.md +30 -1
- data/Gemfile.lock +9 -9
- data/README.md +1 -1
- data/Rakefile +10 -1
- data/commitlint.config.js +5 -0
- data/example/mx-19.3R3-S1.3.rb +161 -297
- data/example/vsrx-18.3R1.9.rb +1305 -1305
- data/lib/junoser/js_ruler.rb +2 -0
- data/lib/junoser/parser.rb +172 -308
- data/lib/junoser/ruler.rb +11 -0
- data/lib/junoser/version.rb +1 -1
- data/lib/junoser/xsd/base.rb +4 -2
- metadata +6 -4
- data/.travis.yml +0 -15
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,7 +214,16 @@ 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
|
224
|
+
|
225
|
+
# Fix .xsd: "snmp system-name" should be "snmp name"
|
226
|
+
str.gsub! '"system-name" arg', '"name" (quote | arg)'
|
216
227
|
end
|
217
228
|
|
218
229
|
def format(str, offset = OFFSET)
|
data/lib/junoser/version.rb
CHANGED
data/lib/junoser/xsd/base.rb
CHANGED
@@ -34,14 +34,16 @@ module Junoser
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def oneliner?
|
37
|
-
|
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
|
-
|
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.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shintaro Kojima
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parslet
|
@@ -89,8 +89,9 @@ executables:
|
|
89
89
|
extensions: []
|
90
90
|
extra_rdoc_files: []
|
91
91
|
files:
|
92
|
+
- ".github/workflows/test-linux.yaml"
|
92
93
|
- ".gitignore"
|
93
|
-
- ".
|
94
|
+
- ".pre-commit-config.yaml"
|
94
95
|
- CHANGELOG.md
|
95
96
|
- Gemfile
|
96
97
|
- Gemfile.lock
|
@@ -99,6 +100,7 @@ files:
|
|
99
100
|
- Rakefile
|
100
101
|
- bin/console
|
101
102
|
- bin/setup
|
103
|
+
- commitlint.config.js
|
102
104
|
- example/get-schema.xml
|
103
105
|
- example/junos-18.1R3-S9.rb
|
104
106
|
- example/mx-19.3R3-S1.3.rb
|
@@ -153,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
155
|
- !ruby/object:Gem::Version
|
154
156
|
version: '0'
|
155
157
|
requirements: []
|
156
|
-
rubygems_version: 3.2.
|
158
|
+
rubygems_version: 3.2.22
|
157
159
|
signing_key:
|
158
160
|
specification_version: 4
|
159
161
|
summary: PEG parser for JUNOS configuration.
|