Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P7957
Example for netbox script
Active
Public
Actions
Authored by
Volans
on Jan 3 2019, 7:22 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Referenced Files
F27785279: Example for netbox script
Jan 3 2019, 7:22 PM
2019-01-03 19:22:47 (UTC+0)
Subscribers
None
@property
def
interfaces
(
self
):
if
self
.
_interfaces
:
# those are the formatted ones
return
self
.
_interfaces
if
not
self
.
_device_interfaces
:
# to cache them
with
self
.
connect
():
self
.
_device_interfaces
=
self
.
device
.
get_interfaces
()
interfaces
=
{}
# all the code for mangling the interfaces calling self.optics, etc...
# if this is getting too large it can be moved to something like
# def _get_formatted_interfaces(self)
self
.
_interfaces
=
interfaces
# or self._get_formatted_interfaces()
return
self
.
_interfaces
Event Timeline
Volans
created this paste.
Jan 3 2019, 7:22 PM
2019-01-03 19:22:47 (UTC+0)
Log In to Comment