Skip to content

Script to remove all interfaces, change tenant, change location #15144

Discussion options

You must be logged in to vote

Are there any functions or anything I should be aware of that can aide me in simply deleting all cables connected to interfaces on a given host? I'm sure I can figure out setting the tenant and location otherwise, but recursively removing cables is where I've been getting stuck.

You can iterate over the interfaces on a device, and then delete the cable attached to that interface (there can only ever be one per interface). I don't think there's any need for recursion, unless you want to follow a chain of cables through patch panels etc and delete all of those cables - is that the case?

A good way to try out Django ORM code interactively is within nbshell, which is most easily started using

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@candlerb
Comment options

@ZephyrusBlaze
Comment options

Comment options

You must be logged in to vote
1 reply
@domainzero
Comment options

Answer selected by domainzero
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants