Added API call to list all ports FDB (#10020)

Add FDB API calls to resolve this [forum request](https://community.librenms.org/t/fdb-table-search-via-api-mac-ip-switch-port/1772/4) 

DO NOT DELETE THIS TEXT

#### Please note

> Please read this information carefully. You can run `./scripts/pre-commit.php` to check your code before submitting.

- [x] Have you followed our [code guidelines?](http://docs.librenms.org/Developing/Code-Guidelines/)

#### Testers

If you would like to test this pull request then please run: `./scripts/github-apply <pr_id>`, i.e `./scripts/github-apply 5926`
After you are done testing, you can remove the changes with `./scripts/github-remove`.  If there are schema changes, you can ask on discord how to revert.
This commit is contained in:
Misha Komarovskiy
2019-04-09 08:51:01 -04:00
committed by Neil Lathwood
parent e285a9268e
commit 7b4c63a2f4
4 changed files with 122 additions and 0 deletions

View File

@@ -445,6 +445,37 @@ Output:
]
}
```
### `get_device_fdb`
Get a list of FDB entries associated with a device.
Route: `/api/v0/devices/:hostname/fdb`
- hostname can be either the device hostname or id
Example:
```curl
curl -H 'X-Auth-Token: YOURAPITOKENHERE' https://librenms.org/api/v0/devices/localhost/fdb
```
Output:
```json
{
"status": "ok",
"ports_fdb": {
"ports_fdb_id": 10,
"port_id": 10000,
"mac_address": "1aaa2bbb3ccc",
"vlan_id": 20000,
"device_id": 1,
"created_at": "2019-01-1 01:01:01",
"updated_at": "2019-01-1 01:01:01"
}
}
```
### `get_device_ip_addresses`
Get a list of IP addresses (v4 and v6) associated with a device.