From fac1d5e5e226290ff67c83a13d3be4da6a317c57 Mon Sep 17 00:00:00 2001 From: Solvik Blum Date: Mon, 26 Aug 2019 13:56:01 +0200 Subject: [PATCH 1/3] Add Supermicro as a vendor --- netbox_agent/cli.py | 6 ++++-- netbox_agent/hp/__init__.py | 0 netbox_agent/{dell => vendors}/__init__.py | 0 netbox_agent/{dell => vendors}/dell.py | 0 netbox_agent/{hp => vendors}/hp.py | 0 netbox_agent/vendors/supermicro.py | 25 ++++++++++++++++++++++ 6 files changed, 29 insertions(+), 2 deletions(-) delete mode 100644 netbox_agent/hp/__init__.py rename netbox_agent/{dell => vendors}/__init__.py (100%) rename netbox_agent/{dell => vendors}/dell.py (100%) rename netbox_agent/{hp => vendors}/hp.py (100%) create mode 100644 netbox_agent/vendors/supermicro.py diff --git a/netbox_agent/cli.py b/netbox_agent/cli.py index d7ee2bb..6d2fc80 100644 --- a/netbox_agent/cli.py +++ b/netbox_agent/cli.py @@ -1,14 +1,16 @@ import argparse -from netbox_agent.dell.dell import DellHost +from netbox_agent.vendors.dell import DellHost import netbox_agent.dmidecode as dmidecode -from netbox_agent.hp.hp import HPHost +from netbox_agent.vendors.hp import HPHost +from netbox_agent.vendors.supermicro import SupermicroHost from netbox_agent.logging import logging # NOQA MANUFACTURERS = { 'Dell Inc.': DellHost, 'HP': HPHost, 'HPE': HPHost, + 'Supermicro': SupermicroHost, } diff --git a/netbox_agent/hp/__init__.py b/netbox_agent/hp/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/netbox_agent/dell/__init__.py b/netbox_agent/vendors/__init__.py similarity index 100% rename from netbox_agent/dell/__init__.py rename to netbox_agent/vendors/__init__.py diff --git a/netbox_agent/dell/dell.py b/netbox_agent/vendors/dell.py similarity index 100% rename from netbox_agent/dell/dell.py rename to netbox_agent/vendors/dell.py diff --git a/netbox_agent/hp/hp.py b/netbox_agent/vendors/hp.py similarity index 100% rename from netbox_agent/hp/hp.py rename to netbox_agent/vendors/hp.py diff --git a/netbox_agent/vendors/supermicro.py b/netbox_agent/vendors/supermicro.py new file mode 100644 index 0000000..115ab4a --- /dev/null +++ b/netbox_agent/vendors/supermicro.py @@ -0,0 +1,25 @@ +from netbox_agent.server import ServerBase + + +class SupermicroHost(ServerBase): + def is_blade(self): + return self.get_product_name().startswith('SBI') + + def get_blade_slot(self): + # No supermicro on hands + return None + + def get_chassis_name(self): + if not self.is_blade(): + return None + return 'Chassis {}'.format(self.get_service_tag()) + + def get_chassis(self): + if self.is_blade(): + return self.dmi.get_by_type('Chassis')[0]['Version'] + return self.get_product_name() + + def get_chassis_service_tag(self): + if self.is_blade(): + return self.dmi.get_by_type('Chassis')[0]['Serial Number'] + return self.get_service_tag() -- 2.47.0 From 0685554cedc90c35a79b5228186a1016fd83a828 Mon Sep 17 00:00:00 2001 From: Solvik Date: Mon, 26 Aug 2019 14:04:04 +0200 Subject: [PATCH 2/3] Update README.md --- README.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 73c2fdb..7f2dea5 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ Tested on: * DSS7500 -## HP +## HP / HPE ### Blades @@ -97,10 +97,20 @@ Tested on: ### Pizzas * ProLiant DL380p Gen8 +* ProLiant SL4540 Gen8 +* ProLiant SL4540 Gen9 +* ProLiant XL450 Gen10 -## HPE +## Supermicro -* HPE ProLiant XL450 Gen10 +### Blades + +TODO + +### Pizzas + +* SSG-6028R +* SYS-6018R # TODO -- 2.47.0 From a8c890b39476c753a953f8d1973c0d3cd9f7a4a8 Mon Sep 17 00:00:00 2001 From: Solvik Date: Mon, 26 Aug 2019 15:30:05 +0200 Subject: [PATCH 3/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7f2dea5..583b39d 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,7 @@ Tested on: ### Blades -TODO +Feel free to send me a dmidecode output for Supermicro's blade! ### Pizzas -- 2.47.0