2019-08-26 16:39:36 +02:00
|
|
|
from netbox_agent.server import ServerBase
|
|
|
|
|
|
|
|
|
|
|
|
class QCTHost(ServerBase):
|
2019-08-28 12:06:45 +02:00
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
super(QCTHost, self).__init__(*args, **kwargs)
|
|
|
|
self.manufacturer = 'QCT'
|
|
|
|
|
2019-08-26 16:39:36 +02:00
|
|
|
def is_blade(self):
|
|
|
|
return 'Location In Chassis' in self.dmi.get_by_type('Baseboard')[0].keys()
|
|
|
|
|
|
|
|
def get_blade_slot(self):
|
|
|
|
if self.is_blade():
|
|
|
|
return 'Slot {}'.format(
|
2019-09-10 13:39:22 +02:00
|
|
|
self.dmi.get_by_type('Baseboard')[0].get('Location In Chassis').strip()
|
2019-08-26 16:39:36 +02:00
|
|
|
)
|
|
|
|
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():
|
2019-09-10 13:39:22 +02:00
|
|
|
return self.dmi.get_by_type('Chassis')[0]['Version'].strip()
|
2019-08-26 16:39:36 +02:00
|
|
|
return self.get_product_name()
|
|
|
|
|
|
|
|
def get_chassis_service_tag(self):
|
|
|
|
if self.is_blade():
|
2019-09-10 13:39:22 +02:00
|
|
|
return self.dmi.get_by_type('Chassis')[0]['Serial Number'].strip()
|
2019-08-26 16:39:36 +02:00
|
|
|
return self.get_service_tag()
|