20 lines
821 B
Python
20 lines
821 B
Python
#!/usr/bin/env python3
|
|
"""Read-only lab client. Membership writes belong to the durable controller.
|
|
|
|
Legacy add/del/drop-chain commands have been retired; they bypassed ownership.
|
|
"""
|
|
import argparse
|
|
import json
|
|
from pathlib import Path
|
|
import sys
|
|
sys.path[:0]=[str(Path(__file__).resolve().parents[1]/'controller'),'/opt/leaf-controller/controller']
|
|
from leaf_controller.ops import configured_client,redact
|
|
|
|
def main():
|
|
p=argparse.ArgumentParser(description=__doc__)
|
|
p.add_argument('command',choices=['members','forward-rule'],default='members',nargs='?')
|
|
a=p.parse_args();cfg,c=configured_client()
|
|
if a.command=='members':print(json.dumps(c.group_members(cfg.get('block_group'))))
|
|
else:print(json.dumps(redact(c.retrieve('showConfig',['firewall','ipv4','forward']))))
|
|
if __name__=='__main__':main()
|