Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: stop using device name for interface sync #196

Merged
merged 1 commit into from
Aug 6, 2024
Merged

Conversation

cardoe
Copy link
Contributor

@cardoe cardoe commented Aug 5, 2024

Use the device ID / UUID which is a better identifier for us to use to find the device to sync the interfaces for. This saves us a trip to the Nautobot DB as well. In Nautobot the device name does not have to be unique so this avoids possible issues there. Added tests of the parser to make sure we get the correct data. Added types so we can have better tests in the future. Cleaned up the duplicate hostname usage in the workflow as well.

Use the device ID / UUID which is a better identifier for us to use to
find the device to sync the interfaces for. This saves us a trip to the
Nautobot DB as well. In Nautobot the device name does not have to be
unique so this avoids possible issues there. Added tests of the parser
to make sure we get the correct data. Added types so we can have better
tests in the future. Cleaned up the duplicate hostname usage in the
workflow as well.
@cardoe cardoe requested a review from a team August 5, 2024 19:48
Comment on lines +36 to +39
def do_sync(device_id: UUID, nb_url: str, nb_token: str, bmc_user: str, bmc_pass: str):
nautobot = Nautobot(nb_url, nb_token, logger=logger)
oob_ip = nautobot.device_oob_ip(device_name)
oob = oob_sushy_session(oob_ip, oob_username, oob_password)
oob_ip = nautobot.device_oob_ip(device_id)
oob = oob_sushy_session(oob_ip, bmc_user, bmc_pass)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we changing the terminology here (oob vs bmc)? It felt more consistent with oob everywhere

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah I didn't see your comment before I hit merge. I'm trying to follow the terminology used in industry which is BMC

Copy link
Collaborator

@skrobul skrobul Aug 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries - In my eyes BMC is just an "implementation" of OOB, or more specifically a name of hardware used to provide OOB services.

I don't mind using either, but let's keep it consistent, for example instead of this:

def do_sync(device_id: UUID, nb_url: str, nb_token: str, bmc_user: str, bmc_pass: str):
    nautobot = Nautobot(nb_url, nb_token, logger=logger)
    oob_ip = nautobot.device_oob_ip(device_id)
    oob = oob_sushy_session(oob_ip, bmc_user, bmc_pass)

do this:

def do_sync(device_id: UUID, nb_url: str, nb_token: str, bmc_user: str, bmc_pass: str):
    nautobot = Nautobot(nb_url, nb_token, logger=logger)
    bmc_ip = nautobot.device_bmc_ip(device_id)
    bmc = bmc_sushy_session(bmc_ip, bmc_user, bmc_pass)

</ocd>

@cardoe cardoe merged commit 6c108d3 into main Aug 6, 2024
12 checks passed
@cardoe cardoe deleted the inf-use-device-id branch August 6, 2024 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants