add enable secret support for sync device and sync device data onboaring job#482
Conversation
|
Definitely a miss just for that "sync_devices" job. It would have worked natively for the second "sync network data" job. I'll have to look through this closely as the entire "on demand" nature of the nornir inventory has been on my mind lately. Largely I'd say this seems something specific to your environment being more locked down then we tend to see. Meaning its not as common to have to do enable mode for show commands. |
We’re onboarding Eltek (https://www.eltek.com/) devices in our network, and due to our security policy, certain commands must be executed in privileged mode. Specifically, show running-config, which is used by the mgmt_interface command mapper, is only permitted in enable mode. Because of this requirement, we need to implement the enable feature to properly support this device platform. This isn’t so much about the general workflow of the jobs, but rather about complying with the access restrictions enforced in our environment for Eltek devices. |
af33327 to
ae174fc
Compare
|
Hi team 👋 Gentle ping on this PR! This adds enable secret support for device onboarding (issue #480), which is needed for devices with strict privilege mode requirements. The implementation is backward compatible and follows existing Secrets Group patterns. Would appreciate a review when you have time! Thanks! 🙏 |
ae174fc to
281162b
Compare
jeffkala
left a comment
There was a problem hiding this comment.
Looks good to me, thank you so much for your contribution.
|
@latuannetnam what version of NB are you running? This PR is going into Also please get the rest of the test passing. And a change fragment added. |
|
@jeffkala Thanks for the review and approval! I've addressed the remaining items: ✅ Tests passing - All 173 unit tests now pass successfully The PR is ready for merge. Let me know if you need anything else! |
|
@jeffkala I’m already running this PR on Nautobot 3.0+ in my production environment and it’s working well 👍 |
…om command mappers.
…iko-enable-secret-support
|
Could you please fix the changelog fragment to match the expected format and fix the docs build errors. Thanks! |
…iko-enable-secret-support
- Remove YAML frontmatter from changes/482.added (plain text format required) - Add custom_command_mapper_per_platform.md to mkdocs.yml nav (strict mode error) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@cdtomkins Thanks for the feedback! I've just pushed the fixes:
Let me know if anything else needs adjustment! |
Closes: #480
What's Changed
This PR adds support for enable secrets (privileged mode passwords) during device onboarding via the
sync_devicesjob. Devices requiring privileged mode (e.g., Cisco IOS) can now automatically enter enable mode using secrets stored in Nautobot Secrets Groups.Summary of Changes
Credential Handling:
_parse_credentials()now retrievesTYPE_SECRETfrom Secrets Groups in addition to username and password(username, password, secret)instead of 2-tupleTYPE_SECRETis not definedConnection Setup:
_set_inventory()accepts optionalsecretparameterCommand Execution:
enable=Trueparameter tonetmiko_send_commandtask callsConfiguration Example
Create a Secrets Group with three secrets:
Assign to devices in Nautobot. The
sync_devicesjob will automatically use the enable secret to enter privileged mode.Backward Compatibility
✅ Fully backward compatible:
TYPE_SECRETis defined, the password is used as the enable secretTo Do
test_inventory_creator.py: 7/7 tests passedtest_parse_user_pass_and_secretfor enable secret parsingtest_set_inventory_with_secretfor connection optionstest_set_inventory_without_secretfor fallback behaviorFiles Modified
nornir_plays/command_getter.pynornir_plays/inventory_creator.pytests/test_command_getter.pytests/test_inventory_creator.pyRemaining Work