Created
October 7, 2020 15:13
-
-
Save metabsd/7ff85d47158baf725cfaed25374c9415 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_ip(tor): | |
try: | |
return str(ip_interface(tor["primary_ip"]["address"]).ip) | |
except Exception: | |
return "NO_IP" | |
tors_list = [ | |
{ | |
"name": tor["name"], | |
"device_role": tor["device_role"]["name"], | |
"site_id": tor["config_context"]["alias"]["site_id"], | |
"ip": get_ip(tor), | |
} | |
for tor in self.get_devices_filter_by( | |
role="abc", tag="tag", cf_owner=5, status="active" | |
) | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment