Skip to content

Include "replace:" flag for conversion to set commands. #4

@thewhitehouse007

Description

@thewhitehouse007

Firstly, thank you for building this script. It's been a great time saver.

My suggestion is to add the following code to 'junos_converter.py' right before the inactive flag processing....

            if "replace" in clean_elem:
                clean_elem = clean_elem.replace("replace: ", "")
                linreplace = list(lres)
                linreplace[0] = "delete"
                print_set_command(linreplace, clean_elem)

The purpose of the Replace flag is to clear the branch and subbranches during a Load operation and load only the new configuration, essentially overriding the default loading mode which is "Merge". During set operations this is also helpful as some leafs can have multiple values and original entries will not be cleared unless it is deleted first.

Currently the converter script outputs the following example:

set replace: interfaces-damping interfaces <*> damping half-life 30
set replace: interfaces-damping interfaces <*> damping max-suppress 600
set replace: interfaces-damping interfaces <*> damping reuse 250
set replace: interfaces-damping interfaces <*> damping suppress 2000

As you can see, this is not valid 'set' syntax.

With the additional code, this now outputs the following example;

delete groups system-base interfaces-damping
set interfaces-damping interfaces <*> damping half-life 30
set interfaces-damping interfaces <*> damping max-suppress 600
set interfaces-damping interfaces <*> damping reuse 250
set interfaces-damping interfaces <*> damping suppress 2000

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions