codeout / junoser

PEG parser for JUNOS configuration.
MIT License
69 stars 11 forks source link

static route xx/x preference xxx makes NoMethodError #2

Closed ghost closed 9 years ago

ghost commented 9 years ago

Our MX has below config.

set routing-options rib inet6.0 static route ::/0 preference 250
set routing-options static route 0.0.0.0/0 preference 250

this configuration makes NoMethodError.

$ junoser -s config/Border/TY2-bord-core1 
/Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/junoser-0.1.2/lib/junoser/transformer.rb:38:in `block in <class:Transformer>': undefined method `gsub' for "250"@61:Parslet::Slice (NoMethodError)
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:216:in `instance_eval'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:216:in `call_on_match'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:234:in `block in transform_elt'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:231:in `each'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:231:in `transform_elt'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:184:in `apply'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:246:in `block in recurse_hash'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:245:in `each'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:245:in `inject'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:245:in `recurse_hash'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:187:in `apply'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:253:in `block in recurse_array'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:253:in `map'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:253:in `recurse_array'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:189:in `apply'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:246:in `block in recurse_hash'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:245:in `each'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:245:in `inject'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:245:in `recurse_hash'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:187:in `apply'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:246:in `block in recurse_hash'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:245:in `each'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:245:in `inject'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:245:in `recurse_hash'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:187:in `apply'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:253:in `block in recurse_array'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:253:in `map'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:253:in `recurse_array'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:189:in `apply'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:246:in `block in recurse_hash'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:245:in `each'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:245:in `inject'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:245:in `recurse_hash'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:187:in `apply'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:253:in `block in recurse_array'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:253:in `map'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:253:in `recurse_array'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:189:in `apply'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:246:in `block in recurse_hash'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:245:in `each'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:245:in `inject'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:245:in `recurse_hash'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:187:in `apply'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:253:in `block in recurse_array'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:253:in `map'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:253:in `recurse_array'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:189:in `apply'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:246:in `block in recurse_hash'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:245:in `each'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:245:in `inject'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:245:in `recurse_hash'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:187:in `apply'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:253:in `block in recurse_array'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:253:in `map'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:253:in `recurse_array'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:189:in `apply'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:246:in `block in recurse_hash'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:245:in `each'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:245:in `inject'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:245:in `recurse_hash'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/parslet-1.7.0/lib/parslet/transform.rb:187:in `apply'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/junoser-0.1.2/lib/junoser/display/structure.rb:20:in `block in transform'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/junoser-0.1.2/lib/junoser/display/structure.rb:19:in `each'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/junoser-0.1.2/lib/junoser/display/structure.rb:19:in `transform'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/junoser-0.1.2/lib/junoser/cli.rb:28:in `struct'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/junoser-0.1.2/exe/junoser:47:in `<top (required)>'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/bin/junoser:23:in `load'
    from /Users/junpei.yoshino/.rbenv/versions/2.1.3/bin/junoser:23:in `<main>'
codeout commented 9 years ago

This was fixed in #1

$ bundle exec junoser -s configfile
routing-options {
    rib inet6.0 {
        static {
            route ::/0 {
                preference {
                    250;
                }
            }
        }
    }
    static {
        route 0.0.0.0/0 {
            preference {
                250;
            }
        }
    }
}