diff --git a/confluent_client/bin/nodediscover b/confluent_client/bin/nodediscover index 41ecf8b3..83eadd9d 100755 --- a/confluent_client/bin/nodediscover +++ b/confluent_client/bin/nodediscover @@ -50,7 +50,13 @@ columnmapping = { } #TODO: add chassis uuid - +def subscribe_discovery(options, session, subscribe): + keyn = 'subscribe' if subscribe else 'unsubscribe' + payload = {keyn: options.node} + for rsp in session.update('/discovery/subscription', payload): + if 'status' in rsp: + print(rsp['status']) + def print_disco(options, session, currmac, outhandler, columns): procinfo = {} for tmpinfo in session.read('/discovery/by-mac/{0}'.format(currmac)): @@ -361,7 +367,7 @@ def main(): parser.add_option('-o', '--order', dest='order', help='Order output by given field', metavar='ORDER') (options, args) = parser.parse_args() - if len(args) == 0 or args[0] not in ('list', 'assign', 'reassign', 'rescan', 'clear'): + if len(args) == 0 or args[0] not in ('list', 'assign', 'reassign', 'rescan', 'clear', 'subscribe', 'unsubscribe'): parser.print_help() sys.exit(1) session = client.Command() @@ -373,6 +379,10 @@ def main(): assign_discovery(options, session) if args[0] == 'reassign': assign_discovery(options, session, False) + if args[0] == 'subscribe': + subscribe_discovery(options, session, True) + if args[0] == 'unsubscribe': + subscribe_discovery(options, session, False) if args[0] == 'rescan': blocking_scan(session) print("Rescan complete") diff --git a/confluent_client/doc/man/nodediscover.ronn b/confluent_client/doc/man/nodediscover.ronn index 08b24370..2d79c676 100644 --- a/confluent_client/doc/man/nodediscover.ronn +++ b/confluent_client/doc/man/nodediscover.ronn @@ -5,9 +5,11 @@ nodediscover(8) -- List or manage confluent node discovery `nodediscover rescan` `nodediscover [options] list` -`nodediscover [options] assign` -`nodediscover [options] rescan` -`nodediscover [options] clear` +`nodediscover [options] assign` +`nodediscover [options] rescan` +`nodediscover [options] clear` +`nodediscover [options] subscribe` +`nodediscover [options] unsubscribe` ## DESCRIPTION @@ -35,6 +37,9 @@ scan is the best approach to catch something that appears to be missing. **nodedsicover clear** requests the server forget about a selection of detected device. It takes the same arguments as **nodediscover list**. +**nodediscover subscribe** and **unsubscribe** instructs confluent to subscribe to or +unsubscribe from the designated (-n) node running affluent with system discovery support. + ## CSV FORMAT The CSV format used by nodediscover consists of one header describing the