netbox-agent/netbox_agent/main.py
Solvik Blum 8960df61dc * new dmidecode code
* move netbox creation server to ServerBase class
* HP blades support
2019-08-03 15:46:21 +02:00

26 lines
710 B
Python

import sys
from pprint import pprint
import netbox_agent.dmidecode as dmidecode
from netbox_agent.dell.dell import DellHost
from netbox_agent.hp.hp import HPHost
MANUFACTURERS = {
'Dell Inc.': DellHost,
'HP': HPHost,
'HPE': HPHost,
}
def main():
manufacturer = dmidecode.get_by_type('Chassis')[0].get('Manufacturer')
server = MANUFACTURERS[manufacturer](dmidecode)
pprint(dmidecode.parse())
print(server.get_product_name())
print(server.get_blade_slot())
print(server.get_chassis())
print(server.get_service_tag())
print(server.get_chassis_service_tag())
server.netbox_create()
# print(server.get_network_cards())
if __name__ == '__main__':
main()