Skip to content

Export Module-Type #1343

Answered by danner26
ciroiriarte asked this question in Q&A
May 13, 2023 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Alright so I have done some digging. Using pynetbox you can pull the module type/device type like so:

  1. You can acquire the specific module like so: netbox.dcim.module_types.filter(model='<MODULE_MODEL>) where MODULE_MODEL is the slug of the module/device. Let save that to a variable such as module
  2. Then, we can store the RecordSet as a list like so: mod_var = list(module) where mod_var is an arbitrary variable name
  3. Lastly, we can then print out the module representiation (or store them in a var) like so: mod_var[0].__dict__

This will give you a JSON dataset. You can then either use this or convert it to YAML and it should be importable.

**WARNING**: The import part is not tested. You are …

Replies: 1 comment 1 reply

Comment options

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

Answer selected by ciroiriarte
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
status: acknowledged An acknowledged question/issue for easy sorting by maintainers
2 participants