add QCT as vendor (#45)

This commit is contained in:
Solvik 2019-08-26 16:39:36 +02:00 committed by GitHub
parent 0e8b470062
commit 1902b24c13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 0 deletions

View file

@ -112,6 +112,16 @@ Feel free to send me a dmidecode output for Supermicro's blade!
* SSG-6028R
* SYS-6018R
## QCT
### Blades
* QuantaMicro X10E-9N
### Pizzas
* Nothing ATM, feel free to send me a dmidecode or make a PR!
# TODO
- [ ] CPU, RAID Card(s), RAM, Disks in `Device`'s `Inventory`

View file

@ -3,6 +3,7 @@ import argparse
from netbox_agent.vendors.dell import DellHost
import netbox_agent.dmidecode as dmidecode
from netbox_agent.vendors.hp import HPHost
from netbox_agent.vendors.qct import QCTHost
from netbox_agent.vendors.supermicro import SupermicroHost
from netbox_agent.logging import logging # NOQA
@ -11,6 +12,7 @@ MANUFACTURERS = {
'HP': HPHost,
'HPE': HPHost,
'Supermicro': SupermicroHost,
'Quanta Cloud Technology Inc.': QCTHost,
}

28
netbox_agent/vendors/qct.py vendored Normal file
View file

@ -0,0 +1,28 @@
from netbox_agent.server import ServerBase
class QCTHost(ServerBase):
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(
self.dmi.get_by_type('Baseboard')[0].get('Location In Chassis')
)
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()