From a3f56305359102b0f65bf749b15407cdc8073529 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 3 Sep 2019 15:49:27 -0400 Subject: [PATCH] Add SR635/SR655 detection Currently merely detects. A discover handler will be next step to populate UUID and do initial setup. --- confluent_server/confluent/discovery/core.py | 3 +++ .../confluent/discovery/protocols/slp.py | 21 +++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/confluent_server/confluent/discovery/core.py b/confluent_server/confluent/discovery/core.py index 0e6c5501..d12a2702 100644 --- a/confluent_server/confluent/discovery/core.py +++ b/confluent_server/confluent/discovery/core.py @@ -103,6 +103,7 @@ nodehandlers = { 'pxe-client': pxeh, 'service:io-device.Lenovo:management-module': None, 'service:thinkagile-storage': cpstorage, + 'service:lenovo-tsm': None, } servicenames = { @@ -112,6 +113,7 @@ servicenames = { 'service:management-hardware.IBM:integrated-management-module2': 'lenovo-imm2', 'service:io-device.Lenovo:management-module': 'lenovo-switch', 'service:thinkagile-storage': 'thinkagile-storagebmc', + 'service:lenovo-tsm': 'lenovo-tsm', } servicebyname = { @@ -121,6 +123,7 @@ servicebyname = { 'lenovo-imm2': 'service:management-hardware.IBM:integrated-management-module2', 'lenovo-switch': 'service:io-device.Lenovo:management-module', 'thinkagile-storage': 'service:thinkagile-storagebmc', + 'lenovo-tsm': 'service:lenovo-tsm', } discopool = eventlet.greenpool.GreenPool(500) diff --git a/confluent_server/confluent/discovery/protocols/slp.py b/confluent_server/confluent/discovery/protocols/slp.py index 145d6769..f70dcbf9 100644 --- a/confluent_server/confluent/discovery/protocols/slp.py +++ b/confluent_server/confluent/discovery/protocols/slp.py @@ -1,6 +1,6 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright 2017 Lenovo +# Copyright 2017-2019 Lenovo # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -28,6 +28,7 @@ _slp_services = set([ 'service:management-hardware.IBM:integrated-management-module2', 'service:lenovo-smm', 'service:ipmi', + 'service:lighttpd', 'service:management-hardware.Lenovo:lenovo-xclarity-controller', 'service:management-hardware.IBM:chassis-management-module', 'service:management-hardware.Lenovo:chassis-management-module', @@ -487,7 +488,14 @@ def snoop(handler, protocol=None): peerbymacaddress[mac]['protocol'] = protocol if 'service:ipmi' in peerbymacaddress[mac]['services']: if 'service:ipmi//Athena:623' in peerbymacaddress[mac]['urls']: - peerbymacaddress[mac]['services'] = ['thinkagile-storage'] + peerbymacaddress[mac]['services'] = ['service:thinkagile-storage'] + else: + continue + if 'service:lightttpd' in peerbymacaddress[mac]['services']: + currinf = peerbymacaddress[mac] + curratt = currinf.get('attributes', {}) + if curratt.get('System-Manufacturing', [None])[0] == 'Lenovo' and curratt.get('type', [None])[0] == 'LenovoThinkServer': + peerbymacaddress[mac]['services'] = ['service:lenovo-tsm'] else: continue handler(peerbymacaddress[mac]) @@ -565,6 +573,15 @@ def scan(srvtypes=_slp_services, addresses=None, localonly=False): else: continue _add_attributes(rsps[id]) + if 'service:lighttpd' in rsps[id]['services']: + currinf = rsps[id] + curratt = currinf.get('attributes', {}) + if curratt.get('System-Manufacturing', [None])[0] == 'Lenovo' and curratt.get('type', [None])[0] == 'LenovoThinkServer': + currinf['services'] = ['service:lenovo-tsm'] + curratt['enclosure-serial-number'] = curratt['Product-Serial'] + curratt['enclosure-machinetype-model'] = curratt['Machine-Type'] + else: + continue del rsps[id]['payload'] del rsps[id]['function'] del rsps[id]['xid']