question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Juniper SRX exit the configuration mode before committing

See original GitHub issue

Is below code correct for Juniper SRX? This works for MX’s but with SRX, what I see is in debug mode, code exists the configuration mode without committing the changes. Workaround is to send a commit CLI as part of configuration commands sent along configuration items.

net_connect.config_mode()
if net_connect.check_config_mode():
    print("Successfully in config mode")
    net_connect.send_config_set(config_cmds)
    net_connect.commit()
    net_connect.exit_config_mode()

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ktbyerscommented, Jul 11, 2017

@tee-lake You should be able to do the following then:

net_connect.send_config_set(config_commands, exit_config_mode=False)
net_connect.commit(and_quit=True)

Basically, don’t exit config mode on the changes. Then use the commit() method to commit the changes (and_quit just causes it to exit config mode after the commit).

1reaction
tee-lakecommented, Jul 11, 2017

I’ll have to test if the above provides the desired result. However a quick look into “exit configuration-mode”. I do not think this works as demonstrated above for high-end srx device. Please see below {primary:node0} srx-5800-01> edit warning: Clustering enabled; using private edit warning: uncommitted changes will be discarded on exit Entering configuration mode {primary:node0}[edit] srx-5800-01# set security zones security-zone zoneA address-book address 10.10.10.10/32 10.10.10.10/32

{primary:node0}[edit] srx-5800-01# sh|compare [edit security zones security-zone zoneA address-book] address 10.12.19.0/18 { … } + address 10.10.10.10/32 10.10.10.10/32;

{primary:node0}[edit] srx-5800-01# exit configuration-mode The configuration has been changed but not committed Exiting configuration mode

{primary:node0} srx-5800-01> configure warning: Clustering enabled; using private edit warning: uncommitted changes will be discarded on exit Entering configuration mode

{primary:node0}[edit] srx-5800-01# sh|compare

{primary:node0}[edit] srx-5800-01#

Thus I believe the config pasted is discarded once you leave config mode.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Committing a Junos OS Configuration and Exiting ...
To save Junos OS configuration changes, activate the configuration on the device and exit configuration mode, using the commit and-quit configuration mode ......
Read more >
Juniper configuration basics.Commit\Rollback. - isp-tech.ru
In this mode, everyone can edit config at the same time. When configuration is committed by any user, all changes are applied. If...
Read more >
Discard configuration changes for a Juniper SRX router/firewall
If you've been entering commands for configuration changes on a Juniper Neworks SRX router/firewall, which runs the Juniper Network ...
Read more >
Commit command Juniper Junos OS - YouTube
... (Optional)— Commit the configuration and, if the configuration contains no errors and the commit succeeds, exit from configuration mode.
Read more >
6. Junos commit and rollback commands
Junos “commit” command apply configuration changes to active configuration. Up to 50 configuration changes are stored in juniper devices.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found