2019-08-02 18:39:05 +02:00
|
|
|
from netbox_agent.server import ServerBase
|
|
|
|
|
2019-08-04 00:00:22 +02:00
|
|
|
|
2019-08-02 18:39:05 +02:00
|
|
|
class DellHost(ServerBase):
|
|
|
|
def is_blade(self):
|
|
|
|
return self.get_product_name().startswith('PowerEdge M')
|
|
|
|
|
|
|
|
def get_blade_slot(self):
|
2019-08-04 00:00:22 +02:00
|
|
|
"""
|
2019-08-02 18:39:05 +02:00
|
|
|
Return blade slot
|
2019-08-04 00:00:22 +02:00
|
|
|
dmidecode output is:
|
2019-08-02 18:39:05 +02:00
|
|
|
` Location In Chassis: Slot 03`
|
2019-08-04 00:00:22 +02:00
|
|
|
"""
|
2019-08-02 18:39:05 +02:00
|
|
|
if self.is_blade():
|
2019-08-03 15:46:21 +02:00
|
|
|
return int(self.dmi.get_by_type('Baseboard')[0].get('Location In Chassis').split()[1])
|
2019-08-02 18:39:05 +02:00
|
|
|
return None
|
|
|
|
|
|
|
|
def get_chassis(self):
|
|
|
|
if self.is_blade():
|
2019-08-03 15:46:21 +02:00
|
|
|
return self.dmi.get_by_type('Chassis')[0]['Version']
|
2019-08-02 18:39:05 +02:00
|
|
|
return self.get_product_name()
|
|
|
|
|
|
|
|
def get_chassis_service_tag(self):
|
|
|
|
if self.is_blade():
|
2019-08-03 15:46:21 +02:00
|
|
|
return self.dmi.get_by_type('chassis')[0]['Serial Number']
|
|
|
|
return self.get_service_tag()
|