Commit graph

51 commits

Author SHA1 Message Date
13b84b4da1
feat: Run formatters 2024-10-21 12:55:54 +02:00
Grégoire Compagnon
9d496c6854
Check if it's a VM before running lldp related actions 2024-10-21 12:30:09 +02:00
59ce76fc29 Merge pull request 'feat(network): Batch requests when filtering on interfaces' (#297) from Tom-Hubrecht/master into master
Reviewed-on: #297
2024-10-21 10:01:35 +02:00
clbu
de88ca85b9
fix(network): use netifaces2 2024-10-17 10:46:05 +02:00
clbu
e44fd2fe78
fix(network): retrieve switch interface using id instead of name 2024-10-16 10:44:08 +02:00
clbu
1429fedb9d
fix(network): cable
https://github.com/netbox-community/netbox/issues/9102
2024-10-10 23:15:55 +02:00
Tom Hubrecht
e04d0c6d59 feat(network): Batch requests when filtering on interfaces
This avoids an issue where the requested URI is too long when many
interfaces are present
2024-05-07 13:54:27 +02:00
Clay Sweetser
dc224e209b Make IPMI information gathering optional. 2023-02-27 19:06:14 -05:00
François Blondel
221ac16e87 feat: Retrieve and manage MTU for the interfaces 2023-02-14 23:32:26 +01:00
ChrNic
838ffd8e41 using dynamic ref to NIC 2022-07-21 08:32:24 +02:00
Christophe Simon
3b8917aaf3 Fixed virtual network cards creation
This patch fixes a mismatch between the way network interfaces are
looked for from network cards, and the way they are created:

- If a network card has a NAC address, it used in the search criteria to
  find the network interface
- When creating virtual interfaces, the MAC address is not specified in
  the creation parameters

This raises an exception when a virtual card has a MAC address:

- The virtual interface has been created without MAC address
- But the network card has one, so the interface is looked for using it
- The network interface is not found, so it's created
- An error is risen because an interface with the same name already
  exists

This patch sets the MAC address on the interface if it exists, no matter if
it is virtual or not.
2022-03-08 17:27:06 +01:00
Christophe Simon
e789619b34 Added disks extended attributes
This patch brings some of the physical and virtual drive attributes as
`custom_fields` to the disks inventory.

The goal is to have this information present to ease disks maintenance
when a drive becomes unavailable and its attributes can't be read anymore
from the RAID controller.

It also helps to standardize the extended disk attributes across the
different manufacturers.

As the disk physical identifers were not available under the correct
format (hexadecimal format using the `xml` output as opposed as `X:Y:Z` format
using the default `list` format), the command line parser has been
refactored to read the `list` format, rather than `xml` one in the
`omreport` raid controller parser.

As the custom fields have to be created prior being able to register
the disks extended attributes, this feature is only activated using the
`--process-virtual-drives` command line parameter, or by setting
`process_virtual_drives` to `true` in the configuration file.

The custom fields to create as `DCIM > inventory item` `Text` are described
below.

    NAME            LABEL                      DESCRIPTION
    mount_point     Mount point                Device mount point(s)
    pd_identifier   Physical disk identifier   Physical disk identifier in the RAID controller
    vd_array        Virtual drive array        Virtual drive array the disk is member of
    vd_consistency  Virtual drive consistency  Virtual disk array consistency
    vd_device       Virtual drive device       Virtual drive system device
    vd_raid_type    Virtual drive RAID         Virtual drive array RAID type
    vd_size         Virtual drive size         Virtual drive array size

In the current implementation, the disks attributes ore not updated: if
a disk with the correct serial number is found, it's sufficient to
consider it as up to date.

To force the reprocessing of the disks extended attributes, the
`--force-disk-refresh` command line option can be used: it removes all
existing disks to before populating them with the correct parsing.
Unless this option is specified, the extended attributes won't be
modified unless a disk is replaced.

It is possible to dump the physical/virtual disks map on the filesystem under
the JSON notation to ease or automate disks management. The file path has to
be provided using the `--dump-disks-map` command line parameter.
2022-03-02 15:53:38 +01:00
Christophe Simon
305d4d41ec Various changes
- Added an option to specify an SSL CA certificates file to talk to the
  Netbox API
- Enhanced GPU expansion bays inventory: internal GPU (VGA) goes into
  the blade, external GPU (3D) goes into the expansion bay
- Unified the way expansion bays are managed (GPU and drive exansion
  bays)
- Started to refactor `network` module to make it more readable
- Dependencies in `setup.py` now reads its requirements from
  `requirements.txt` to avoid double maintenance
2022-02-22 14:51:58 +01:00
Solvik Blum
86527af1c0 lint 2021-05-18 13:59:04 +02:00
Solvik Blum
b738f4bfef fix last few bugs due to pynetbox 6 upgrade 2021-05-14 10:00:50 +02:00
Solvik Blum
aaea0a2477 fix ipv6 cleanup on interface with only one ipv6 and not ipv4 2021-05-12 20:11:20 +02:00
Solvik Blum
9eafcbf215 this MR will drop compatibility with versions < 2.9 2021-05-12 19:41:35 +02:00
Solvik Blum
337e272eea fix ipv6 deletion with regex 2021-05-12 19:41:01 +02:00
Solvik Blum
58c18fc2da add more compatibility, now to netbox 2.10 2021-05-12 19:41:01 +02:00
Solvik Blum
1d98d3c8e9 fix ip association 2021-05-12 19:41:01 +02:00
Solvik Blum
dc582b5de6 change .interface foreignkey with .assigned_object 2021-05-12 19:41:01 +02:00
Solvik
c4eb8f34ac
add 25G compatibility (#185) 2021-05-12 15:50:16 +02:00
ThomasADavis
a60c0cd70c
Add tags,device roles,tenants.. (#110)
* Adds support for:

* sets the tenant for IP addresses and Devices.
* setting device tags
* setting the blade, chassis, and server roles.

Co-authored-by: Thomas Davis <tdavis@nersc.gov>
Co-authored-by: Solvik <solvik@solvik.fr>
2020-07-01 18:54:58 +02:00
Cyrinux
754a284fd1
Add openvpn TUN and TAP interfaces support, change type to Virtual and remove mac address (#132)
* Add Tun and Tap support, change type to Virtual and remove mac address

* Simplify

* Resimplify
2020-06-14 18:18:13 +02:00
Cyrinux
9dedbea47a
Some fixes that prevent crash on register and update (#128) 2020-06-08 14:16:50 +02:00
Solvik
28fc87c9e2
handle netbox 2.8 deprecation of _choices method (#127) 2020-05-23 13:23:51 +02:00
Solvik
f06da32fc3
Virtual Machine feature (#122)
Add ability to create Virtual Machine in netbox with an auto-detecting feature (currently VirtualBox, Xen, Hyper-V, VMWare, GCP)

One caveat, I made the choice not to report the disk as Netbox model allow only one size but VM often have multiples.

Also, lot of code refactoring to be able to use create_or_update function style, fixing a lot of corner case
2020-04-19 12:28:49 +02:00
ramnes
bab2d26ad0 Setup tests 2020-02-02 20:24:01 +01:00
ThomasADavis
2280169cd9 Use choices api (#107)
* Ask netbox for choices using the API
2020-01-28 11:18:56 +01:00
Solvik
f68fed18b4
handle multiple vlans in lldp (#66) 2019-09-09 15:32:14 +02:00
Solvik
fb68907efd
parse lldp only if configuration says so (#63) 2019-09-09 12:25:11 +02:00
Solvik
8d0168acb5
Add power supply support (#56) 2019-09-05 13:47:10 +02:00
Solvik
d12ac49d50
new config system (#53) 2019-09-03 13:16:37 +02:00
Solvik
c5707e8413
do not make netbox call if lldp doesnt return switch ip and interface (#54) 2019-09-03 11:57:17 +02:00
Solvik
197a8babaf
Handle anycast IP (#51) 2019-08-30 11:06:16 +02:00
ThomasADavis
6ec08e8669 Several minor fixes (#47)
Several minor fixes:
- raid_array check should return an empty array, not NoneType
- not all systems will have IPv6 defined, handle this case
- Vendor Supermicro was incomplete.
2019-08-29 17:33:27 +02:00
Solvik
8de682f46d
add ipv6 addresses (#43) 2019-08-26 14:02:07 +02:00
Solvik
33c55340b7
Add LLDP auto cabling (#41) 2019-08-26 11:05:41 +02:00
Solvik
955579df0d
make sure to update IPMI interface when mac changed (#32) 2019-08-12 17:21:46 +02:00
Solvik
980f14236f
Fix late comments (#29)
* more fixes
* add external binary requirements
* better error handling for bonding
2019-08-09 13:26:51 +02:00
Solvik
2988a8bd6a
Rework all network part (#21)
* rework network part by ignoring devices and ip from config file

* update config file

* associate slave device to bond device with Netbox LAG

* update README

* make sure every interface attribute is ok

* some fixes after  test

* tox

* add ipmi feature

* fix bug in LAG

* ipmi class

* update README

* network update

* delete print

* update README
2019-08-09 12:08:11 +02:00
Solvik Blum
d7af66b325
fix bug while testing debug with an interface not existing while updating 2019-08-07 15:36:24 +02:00
Solvik Blum
e8a9d318cc
simpler logging, log_level from config file 2019-08-07 10:32:23 +02:00
Solvik Blum
cc08300fee
add some logging 2019-08-06 18:11:26 +02:00
Solvik Blum
c5226b288d
hotfix - assign interface to ip while updating server 2019-08-05 17:41:03 +02:00
Solvik Blum
69a9327b18
flake8 fixes 2019-08-05 16:55:37 +02:00
Solvik Blum
165f911631
handle network update 2019-08-05 16:51:01 +02:00
Solvik Blum
0c5ca003a6
handle ethtool not installed and add known limitations to README 2019-08-04 23:24:51 +02:00
Solvik Blum
15faf59182
better ethool and device type guessing 2019-08-04 21:48:06 +02:00
Solvik Blum
d5673d4992
WIP - create netbox interfaces with IP 2019-08-04 15:14:36 +02:00