Netbox Update Device Facts Task¤
task api name:
update_device_facts
Limitations¤
Datasource nornir
uses NAPALM get_facts
getter and as such only supports these device platforms:
- Arista EOS
- Cisco IOS
- Cisco IOSXR
- Cisco NXOS
- Juniper JUNOS
Branching Support¤
Update device facts task is branch aware and can push updates to the branch. Netbox Branching Plugin need to be installed on Netbox instance.
Update Device Facts Sample Usage¤
NORFAB Netbox Update Device Facts Command Shell Reference¤
NorFab shell supports these command options for Netbox update_device_facts
task:
nf# man tree netbox.update.device.facts
root
└── netbox: Netbox service
└── update: Update Netbox data
└── device: Update device data
└── facts: Update device serial, OS version
├── timeout: Job timeout
├── workers: Filter worker to target, default 'any'
├── verbose-result: Control output details, default 'False'
├── progress: Display progress events, default 'True'
├── instance: Netbox instance name to target
├── dry-run: Return information that would be pushed to Netbox but do not push it
├── devices: List of Netbox devices to update
├── batch-size: Number of devices to process at a time, default '10'
├── datasource: Service to use to retrieve device data, default 'nornir'
│ └── nornir: Use Nornir service to retrieve data from devices
│ ├── FO: Filter hosts using Filter Object
│ ├── FB: Filter hosts by name using Glob Patterns
│ ├── FH: Filter hosts by hostname
│ ├── FC: Filter hosts containment of pattern in name
│ ├── FR: Filter hosts by name using Regular Expressions
│ ├── FG: Filter hosts by group
│ ├── FP: Filter hosts by hostname using IP Prefix
│ ├── FL: Filter hosts by names list
│ ├── FX: Filter hosts excluding them by name
│ ├── FN: Negate the match
│ ├── add-details: Add task details to results, default 'False'
│ ├── num-workers: RetryRunner number of threads for tasks execution
│ ├── num-connectors: RetryRunner number of threads for device connections
│ ├── connect-retry: RetryRunner number of connection attempts
│ ├── task-retry: RetryRunner number of attempts to run task
│ ├── reconnect-on-fail: RetryRunner perform reconnect to host on task failure
│ ├── connect-check: RetryRunner test TCP connection before opening actual connection
│ ├── connect-timeout: RetryRunner timeout in seconds to wait for test TCP connection to establish
│ ├── creds-retry: RetryRunner list of connection credentials and parameters to retry
│ ├── tf: File group name to save task results to on worker file system
│ ├── tf-skip-failed: Save results to file for failed tasks
│ ├── diff: File group name to run the diff for
│ ├── diff-last: File version number to diff, default is 1 (last)
│ └── progress: Display progress events, default 'True'
└── branch: Branching plugin branch name to use
nf#
Python API Reference¤
Updates the device facts in NetBox:
- serial number
Parameters:
Name | Type | Description | Default |
---|---|---|---|
job
|
Job
|
NorFab Job object containing relevant metadata |
required |
instance
|
str
|
The NetBox instance to use. |
None
|
dry_run
|
bool
|
If True, no changes will be made to NetBox. |
False
|
datasource
|
str
|
The data source to use. Supported datasources:
|
'nornir'
|
timeout
|
int
|
The timeout for the job execution. Defaults to 60. |
60
|
devices
|
list
|
The list of devices to update. |
None
|
batch_size
|
int
|
The number of devices to process in each batch. |
10
|
branch
|
str
|
Branch name to use, need to have branching plugin installed, automatically creates branch if it does not exist in Netbox. |
None
|
**kwargs
|
Additional keyword arguments to pass to the job. |
{}
|
Returns:
Name | Type | Description |
---|---|---|
dict |
Result
|
A dictionary containing the results of the update operation. |
Raises:
Type | Description |
---|---|
Exception
|
If a device does not exist in NetBox. |
UnsupportedServiceError
|
If the specified datasource is not supported. |
Source code in norfab\workers\netbox_worker.py
1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 |
|