netbox-agent/netbox_agent/vendors/supermicro.py

26 lines
729 B
Python
Raw Normal View History

from netbox_agent.server import ServerBase
2019-08-26 15:38:44 +02:00
class SupermicroHost(ServerBase):
def is_blade(self):
2019-08-26 15:38:44 +02:00
return self.get_product_name().startswith('SBI')
def get_blade_slot(self):
2019-08-26 15:38:44 +02:00
# No supermicro on hands
return None
2019-08-08 14:37:02 +02:00
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():
2019-08-20 13:50:38 +02:00
return self.dmi.get_by_type('Chassis')[0]['Serial Number']
return self.get_service_tag()