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

Adds new relationship_association module #146

Merged
merged 6 commits into from
Jul 18, 2022

Conversation

joewesch
Copy link
Contributor

Closes: #143

@joewesch
Copy link
Contributor Author

@jvanderaa I have fixed all failing tests.

token: thisIsMyToken
relationship: 01234567-abcd-0123-abcd-012345678901
source_type: dcim.device
source_id: abcdefgh-0123-abcd-0123-abcdefghijkl
Copy link
Contributor

Choose a reason for hiding this comment

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

What we could potentially do to make it easier for the user is to find the ID for them by taking the source.type and kwargs under source and find it for them, but it is extra logic I don't know if we have currently.

Copy link
Contributor Author

@joewesch joewesch Jul 15, 2022

Choose a reason for hiding this comment

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

The source/destination ID is not the ID of the type, but rather the actual Device/IP Address/etc. object to relate to the other.

Copy link
Contributor

Choose a reason for hiding this comment

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

Correct. Here is an example:

    - name: Create relationship association
      networktocode.nautobot.relationship_association:
        url: http://nautobot.local
        token: thisIsMyToken
        relationship: 01234567-abcd-0123-abcd-012345678901
        source_type: dcim.device
        source:
          name: den-edge-01
          site: DEN
        destination_type: ipam.vrf
        destination_id: 01234567-abcd-0123-abcd-123456789012

We can split on the source_type that will provide us the correct app and endpoint to query against.

We would then search for that for them rather than them having to lookup the ID by using the lookup plugin.

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, yes. There are many places convenience logic like that could be added for sure.

@joewesch joewesch merged commit 1dc43a1 into nautobot:develop Jul 18, 2022
@joewesch joewesch deleted the 143-relationship-association branch May 3, 2023 21:08
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.

Add support for managing relationship associations to collection
3 participants