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

virtual-chassis support #48

Open
amat3ur85 opened this issue Feb 22, 2021 · 1 comment
Open

virtual-chassis support #48

amat3ur85 opened this issue Feb 22, 2021 · 1 comment

Comments

@amat3ur85
Copy link

It would be really useful if we can see device as virtual chassis master and connect them together, rather then individual stack members, if logical scheme is needed.

If we have core-sw1 with 2 physical cisco devices in stack we will import followtin objects into netbox:

  • virtual-chassis object called core-sw1
  • core-sw1 (device type core switch) - master in virtual chassis
  • core-sw1_1 (device type core switch stack)
  • core-sw1_2 (device type core switch stack)

In virtual chassis object, core-sw1 device object will be denoted as master with only virtual interfaces created on it.
Individual members (core-sw1_1 and core-sw1_2) would have interfaces 1/0/1-48 and 2/0/1-48, respectively.

Logic could be something in line:

nb_devices = nb.dcim.devices.filter(site_id=site.id)

masters_checked = []
for device in nb_devices:
    if device.virtual_chassis:
        vc = nb.dcim.virtual_chassis.get(device.virtual_chassis.id)
        if vc.master.name not in masters_imported:
            masters_checked.append(vc.master.name)
            device_for_connection = nb.dcim.devices.get(vc.master.id)
     else:
         # as usual :)

Afterwards all interfaces will be present on device_for_connection. We just need to keep track of already connected device, so we don't check twice for all stack members.

virtual_chassis

@amat3ur85
Copy link
Author

One more note:
Since many users prepared scripts and are using plugin as is, maybe it would be good to add one more button on top to select "group with virtual chassis" if grouping is wanted or if that is not selected to work as is.

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

No branches or pull requests

1 participant