From c6079a1ee60ec28b5b0d40e19fa3af8c381c98ec Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 11 Nov 2022 12:16:41 -0500 Subject: [PATCH] Add ability to register remote systems in discovery To start with, support Lenovo XCC systems --- confluent_server/confluent/discovery/core.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/confluent_server/confluent/discovery/core.py b/confluent_server/confluent/discovery/core.py index ee31104c..26646cee 100644 --- a/confluent_server/confluent/discovery/core.py +++ b/confluent_server/confluent/discovery/core.py @@ -475,7 +475,17 @@ def handle_api_request(configmanager, inputdata, operation, pathcomponents): return (msg.KeyValueData({'status': 'unsubscribed'}),) elif operation in ('update', 'create'): if pathcomponents == ['discovery', 'register']: - return + if 'address' not in inputdata: + raise exc.InvalidArgumentException('Missing address in input') + nd = { + 'addresses': [(inputdata['address'], 443)] + } + sd = ssdp.check_fish(('/DeviceDescription.json', nd)) + sd['hwaddr'] = sd['attributes']['mac-address'] + if not sd: + raise exc.Unsupported('Target address is not a supported device for remote discovery registration') + detected(sd) + return msg.CreatedResource(inputdata['address']) if 'node' not in inputdata: raise exc.InvalidArgumentException('Missing node name in input') mac = _get_mac_from_query(pathcomponents)