def main() -> None: """Main function""" arguments = [ Argument("-c", "--cluster", "API server IP:port details", required=True), Argument( "-p", "--port", "The port to open as an HTTP server to serve the ONTAP image from", default=7654, arg_type=int, ), Argument( "-i", "--image-path", "The path to an ONTAP image which will be downloaded by ONTAP", required=True, ) ] args = parse_args("This script will update the nodes of an ONTAP cluster.", arguments) setup_logging() setup_connection(args.cluster, args.api_user, args.api_pass) software = show_current_cluster_image() new_package = download_new_cluster_image(args) update_cluster_image(software, new_package) monitor_progress(software) software.get() print("Upgrade complete! Current version: %s" % software.version)
def main() -> None: """Main function""" arguments = [Argument("-c", "--cluster", "API server IP:port details")] args = parse_args("This script will list ONTAP System Power status", arguments) setup_logging() setup_connection(args.cluster, args.api_user, args.api_pass) system_power_status_cli_pycl()
def main() -> None: """Main function""" arguments = [Argument("-c", "--cluster", "API server IP:port details")] args = parse_args("This script will update system power status ON/OFF", arguments) setup_logging() setup_connection(args.cluster, args.api_user, args.api_pass) check_system_power()
def main() -> None: """Main function""" arguments = [Argument("-c", "--cluster", "API server IP:port details")] args = parse_args("This script will list the aggregates.", arguments) setup_logging() setup_connection(args.cluster, args.api_user, args.api_pass) list_aggregate_pycl()
def main() -> None: """Main function""" arguments = [Argument("-c", "--cluster", "API server IP:port details")] args = parse_args( "Demonstrates Aggregate Operations using REST API Python Client Library.", arguments, ) setup_logging() setup_connection(args.cluster, args.api_user, args.api_pass) aggr_ops()
def main() -> None: """Main function""" arguments = [ Argument("-c", "--cluster", "API server IP:port details")] args = parse_args( "Demonstrates Batch Deletion Operations using REST API Python Client Library.", arguments, ) setup_logging() setup_connection(args.cluster, args.api_user, args.api_pass) delete_collection_volume()
def main() -> None: """Main function""" arguments = [Argument("-c", "--cluster", "API server IP:port details")] args = parse_args( "Demonstrates ISCSI Setup using REST API Python Client Library", arguments, ) setup_logging() setup_connection(args.cluster, args.api_user, args.api_pass) iscsi_setup()
def main() -> None: """Main function""" arguments = [ Argument("-c", "--cluster", "API server IP:port details"), Argument("-v", "--volume_name", "Volume Name"), Argument("-a", "--path", "path"), Argument("-vs", "--svm_name", "SVM Name")] args = parse_args( "This script will list analytics of a volume in an SVM", arguments) setup_logging() setup_connection(args.cluster, args.api_user, args.api_pass) file_system_analytics_pycl(args.volume_name, args.svm_name, args.path)
def main() -> None: """Main function""" arguments = [ Argument("-c", "--cluster", "API server IP:port details"), Argument("-vs", "--svm_name", "SVM Name") ] args = parse_args("This script will list ONTAP volumes in an SVM", arguments) setup_logging() setup_connection(args.cluster, args.api_user, args.api_pass) list_volume_pycl(args.svm_name)
def main() -> None: """Main function""" arguments = [ Argument("-c", "--cluster", "API server IP:port details"), Argument("-v", "--volume_name", "Volume Name"), Argument("-vs", "--svm_name", "SVM Name"), Argument("-a", "--aggr_name", "Aggregate Name"), Argument("-sz", "--volume_size", "Size of the volume(MBs).") ] args = parse_args("This script will create a new volume.", arguments) setup_logging() setup_connection(args.cluster, args.api_user, args.api_pass) make_volume_pycl(args.volume_name, args.svm_name, args.aggr_name, args.volume_size)
def main() -> None: """Main function""" arguments = [ Argument("-c", "--cluster", "API server IP:port details"), Argument("-v", "--volume_name", "Volume Name"), Argument("-s", "--snapshot_name", "Snapshot Name"), Argument("-vs", "--svm_name", "SVM Name") ] args = parse_args( "This script will create a new snapshot for an existing ONTAP volume", arguments, ) setup_logging() setup_connection(args.cluster, args.api_user, args.api_pass) make_snap_pycl(args.volume_name, args.snapshot_name, args.svm_name)
def main() -> None: """Main function""" arguments = [ Argument("-c", "--cluster", "API server IP:port details", required=True), Argument( "-a", "--cert_account", "Account which be used for certificate authentication", default="admin", ), Argument( "-o", "--organization", "Organization name for the root certificate", default="MyCompany", ) ] args = parse_args( "This script will enable certificate authentication on the provided account (or admin)", arguments, ) setup_logging() setup_connection(args.cluster, args.api_user, args.api_pass) # make a temp directory for certs to live in dirpath = tempfile.mkdtemp() step("Install a root CA for %s" % args.organization) my_ca = install_cert(args) step("Sign a CSR for cert_user with our root") sign_domain(my_ca, dirpath, args) step("Install signed cert as client-ca") enable_cert_auth(args) step("Verify cert auth works for our user") test_cert_auth(args, dirpath)
def main() -> None: """Main function""" arguments = [ Argument("-c", "--cluster", "API server IP:port details")] args = parse_args( "Demonstrates enabling/disabling File system analytics using REST API.", arguments, ) setup_logging() headers = setup_connection(args.api_user, args.api_pass) vol_analytics_ops(args.cluster, headers)
def main() -> None: """Main function""" arguments = [Argument("-c", "--cluster", "API server IP:port details")] args = parse_args( "Demonstrates CIFS setup using REST API.", arguments, ) setup_logging() headers = setup_connection(args.api_user, args.api_pass) cifs_setup(args.cluster, headers)
def main() -> None: """Main function""" arguments = [Argument("-c", "--cluster", "API server IP:port details")] args = parse_args( "Demonstrates Qtree, Quota, Metrics workflow using REST API.", arguments, ) setup_logging() headers = setup_connection(args.api_user, args.api_pass) qr_ops(args.cluster, headers)
def main() -> None: """Main function""" arguments = [Argument("-c", "--cluster", "API server IP:port details")] args = parse_args( "Demonstrates file security Operations using REST API.", arguments, ) setup_logging() headers = setup_connection(args.api_user, args.api_pass) file_permissions(args.cluster, headers)
def main() -> None: """Main function""" arguments = [Argument("-c", "--cluster", "API server IP:port details")] args = parse_args( "Demonstrates Initiator Group Operations using REST API.", arguments, ) setup_logging() headers = setup_connection(args.api_user, args.api_pass) init_ops(args.cluster, headers)
def main() -> None: """Main function""" arguments = [Argument("-c", "--cluster", "API server IP:port details")] args = parse_args( "Demonstrates Schedules and Policies using ONTAP REST APIs.", arguments, ) setup_logging() headers = setup_connection(args.api_user, args.api_pass) schedule_policies(args.cluster, headers)
def main() -> None: """Main function""" arguments = [Argument("-c", "--cluster", "API server IP:port details")] args = parse_args( "Demonstrates ISCSI Setup using REST API.", arguments, ) setup_logging() headers = setup_connection(args.api_user, args.api_pass) iscsi_setup(args.cluster, headers) print("Script Complete")
def main() -> None: """Main function""" arguments = [Argument("-c", "--cluster", "API server IP:port details")] args = parse_args( "Demonstrates Volume Operations using REST API Python Client Library.", arguments, ) setup_logging() headers = setup_connection(args.api_user, args.api_pass) nfs_setup(args.cluster, headers) print("Script Complete")
nargs=2, help='server port') args = parser.parse_args() serv_addr = (args.server_ip, int(args.server_port)) input_file, output_file = args.files[0], args.files[1] sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.settimeout(1) try: # send NAME message intro = utils.introduce_myself(sock, serv_addr, utils.SENDER.encode()) while not intro: pass # send CONN message setup = utils.setup_connection(sock, serv_addr, utils.RECEIVER.encode()) while not setup: pass if intro == True and setup == True: print('setup and intro done') with open(input_file, mode='rb') as rdr: sender = ChatClientSender(sock, serv_addr, rdr, output_file) # send FILENAME sender.send_byte_stream() finally: # FIXME: close connection so receiver gracefully exits print('closing') sock.sendto(b'.', serv_addr) sock.sendto(b'QUIT', serv_addr)
self.fout.close() if __name__ == '__main__': parser = argparse.ArgumentParser(description='Receiver') parser.add_argument('-s', dest='server_ip', required=True, help='server ip address') parser.add_argument('-p', dest='server_port', required=True, help='server port') args = parser.parse_args() serv_addr = (args.server_ip, int(args.server_port)) sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) try: # send NAME message while not utils.introduce_myself(sock, serv_addr, utils.RECEIVER.encode()): pass # send CONN message while not utils.setup_connection(sock, serv_addr, utils.SENDER.encode()): pass receiver = ChatClientReceiver(sock, serv_addr) receiver.rdt_recv() finally: # FIXME: close connection so receiver gracefully exits sock.sendto(b'.', serv_addr) sock.sendto(b'QUIT', serv_addr)