codeout / junoser

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

replace tags not supported #29

Closed gcotone closed 2 years ago

gcotone commented 2 years ago

Configuration validation fails when it contains replace: tags used in load replace operations.

E.g.:

# test.conf
groups {
    INTERFACE_SETTINGS {
        replace: interfaces {
            "<[xg]e*>" {
                hold-time up 5000 down 0;
            }
        }
    }
}
shell> junoser -c test.conf                  
Invalid syntax:  set groups INTERFACE_SETTINGS replace: interfaces "<[xg]e*>" hold-time up 5000 down 0
codeout commented 2 years ago

Thanks for your report. I haven't cared about replace: tag, but let me take a look. We just need to remove them before processing probably.

gcotone commented 2 years ago

thanks @codeout Yes that should work. I'm doing a sed -i 's/replace: //g' config.file before running junoser and it works.

codeout commented 2 years ago

@gcotone Just published v0.4.5 with the fix. Hoping it works for you.

$ junoser -c <<EOS
groups {
    INTERFACE_SETTINGS {
        replace: interfaces {
            "<[xg]e*>" {
                hold-time up 5000 down 0;
            }
        }
    }
}
EOS

If you see any further problems, please re-open this issue. Thanks again for your bug report.