lib/junoser/ruler.rb in junoser-0.5.0 vs lib/junoser/ruler.rb in junoser-0.5.1

- old
+ new

@@ -136,11 +136,11 @@ str.gsub!(/"icmp"(.*\s*.*)"icmp6"/) { %["icmp6"#{$1}"icmp"] } str.gsub!(/"icmp"(.*\s*.*)"icmpv6"/) { %["icmpv6"#{$1}"icmp"] } str.gsub!(/"snmp"(.*\s*.*)"snmptrap"/) { %["snmptrap"#{$1}"snmp"] } str.gsub!(/"ospf"(.*\s*.*)"ospf3"/) { %["ospf3"#{$1}"ospf"] } str.gsub! '"tls1" | "tls11" | "tls12"', '"tls11" | "tls12" | "tls1"' - str.gsub!(/("group1" \| "group2" \| "group5") \| ([^)]+)/) { "#{$2} | #{$1}"} + str.gsub!(/("group1" \| "group2" \| "group5") \| ([^)]+)/) { "#{$2} | #{$1}" } %w[ccc ethernet-over-atm tcc vpls bridge].each do |encap| str.gsub!(/"ethernet"(.*)"ethernet-#{encap}"/) { %["ethernet-#{encap}"#{$1}"ethernet"] } end @@ -224,19 +224,33 @@ # Fix .xsd: "snmp system-name" should be "snmp name" str.gsub! '"system-name" arg', '"name" (quote | arg)' # Fix .xsd: argument of "system license keys key" can be quoted - str.gsub!(/^(rule\(:license_object\) do.*?"key") arg/m) { "#{$1} (quote | arg)"} + str.gsub!(/^(rule\(:license_object\) do.*?"key") arg/m) { "#{$1} (quote | arg)" } # Fix .xsd: "prefix-limit teardown" str.gsub!(/^(\s*)"teardown" (\(.*?as\(:oneline\)\s*\)\s*\))/m) do "#{$1}\"teardown\" arg #{$2},\n#{$1}\"teardown\"" end # Fix .xsd: faster interface speed support str.gsub! '"400g" | "oc', '"400g" | "800g" | "oc' str.gsub! '"400G"', '"400G" | "800G"' + + # Fix .xsd: "poe" + str.gsub!(/^(\s*"interface" \("all" \| "all-extended" \| arg\) \(\s*)c\(/) { "#{$1}sc(" } + str.gsub!(/^(\s*)\)(,\s*"fpc" enum\(\("all" \| "fpc-slot-number"\)\) \(\s*)c\((.*"lldp-priority"\s*\)\s*\))/m) do + "#{$1}).as(:oneline)#{$2}sc(#{$3}.as(:oneline)" + end + + # Fix .xsd: support "set protocols iccp peer xxx liveness-detection single-hop" + str.gsub!(/(^rule\(:peer_group\) do.*?\n(\s*)"detection-time" \(\s*c\(\s*"threshold" arg\s*\)\s*\))/m) do + "#{$1},\n#{format('"single-hop"', $2)}" + end + + # Fix .xsd: support "set interfaces xxx ether-options speed" + str.gsub! '"ethernet-1', '"1' str end def format(str, offset = OFFSET)