Netbox Get Devices Task¤
task api name:
get_devices
Get Devices Sample Usage¤
NORFAB Netbox Get Devices Command Shell Reference¤
NorFab shell supports these command options for Netbox get_devices
task:
nf#man tree netbox.get.devices
root
└── netbox: Netbox service
└── get: Query data from Netbox
└── devices: Query Netbox devices data
├── instance: Netbox instance name to target
├── workers: Filter worker to target, default 'any'
├── timeout: Job timeout
├── filters: List of device filters dictionaries as a JSON string, examples: [{"q": "ceos1"}]
├── devices: Device names to query data for
├── dry-run: Only return query content, do not run it
└── cache: How to use cache, default 'True'
nf#
Python API Reference¤
Retrieves device data from Netbox using the GraphQL API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
job
|
Job
|
NorFab Job object containing relevant metadata |
required |
filters
|
list
|
A list of filter dictionaries to filter devices. |
None
|
instance
|
str
|
The Netbox instance name. |
None
|
dry_run
|
bool
|
If True, only returns the query content without executing it. Defaults to False. |
False
|
devices
|
list
|
A list of device names to query data for. |
None
|
cache
|
Union[bool, str]
|
Cache usage options:
|
None
|
Returns:
Name | Type | Description |
---|---|---|
dict |
Result
|
A dictionary keyed by device name with device data. |
Raises:
Type | Description |
---|---|
Exception
|
If the GraphQL query fails or if there are errors in the query result. |
Source code in norfab\workers\netbox_worker.py
813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 |
|