From 6c1f87aeb7d5d572b6f3e7ef1c5f69e0d52342ae Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 2 Sep 2022 13:32:05 -0400 Subject: [PATCH] Add mechanism for copernicus to request any confluent This can be used for network debug in a generic way, to identify vlan adjacency without regard to nodedoploy state or uuid matching. --- confluent_osdeploy/utils/copernicus.c | 4 ++++ confluent_server/confluent/discovery/protocols/ssdp.py | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/confluent_osdeploy/utils/copernicus.c b/confluent_osdeploy/utils/copernicus.c index bf54f853..9c8ace60 100644 --- a/confluent_osdeploy/utils/copernicus.c +++ b/confluent_osdeploy/utils/copernicus.c @@ -129,6 +129,10 @@ int main(int argc, char* argv[]) { inet_pton(AF_INET, "239.255.255.250", &dst4.sin_addr); strncpy(msg, "M-SEARCH * HTTP/1.1\r\nST: urn:xcat.org:service:confluent:", 1024); offset = strnlen(msg, 1024); + if (argc > 1 && strcmp(argv[1], "-a") == 0) { + strncpy(msg + offset, "/allconfluent=1", 1024 - offset); + offset = strnlen(msg, 1024); + } add_confluent_uuid(msg + offset, 1024 - offset); offset = strnlen(msg, 1024); add_uuid(msg + offset, 1024 - offset); diff --git a/confluent_server/confluent/discovery/protocols/ssdp.py b/confluent_server/confluent/discovery/protocols/ssdp.py index 85b5d7f1..e8a8b36e 100644 --- a/confluent_server/confluent/discovery/protocols/ssdp.py +++ b/confluent_server/confluent/discovery/protocols/ssdp.py @@ -218,6 +218,11 @@ def snoop(handler, byehandler=None, protocol=None, uuidlookup=None): if curruuid != myuuid: break forcereply = True + elif query.startswith('allconfluent=1'): + reply = 'HTTP/1.1 200 OK\r\n\r\nCONFLUENT: PRESENT\r\n' + if not isinstance(reply, bytes): + reply = reply.encode('utf8') + s.sendto(reply, peer) elif query.startswith('uuid='): curruuid = query.split('=', 1)[1].lower() node = uuidlookup(curruuid)