def show_igroup(svm_name) -> None: """Lists iGroup""" print() print("Getting Initiator Group Details") print("===============================") try: for igroup in Igroup.get_collection(**{"svm.name": svm_name}, fields="uuid"): print("Igroup Name = %s; Igroup UUID = %s" % (igroup.name, igroup.uuid)) except NetAppRestError as error: print("Error:- " % error.http_err_response.http_response.text) print("Exception caught :" + str(error))
def get_key_igroup(svm_name, igroup_name) -> None: """Gets the key for iGroup""" print() print("Getting Initiator Group Details") print("===============================") try: for igroup in Igroup.get_collection(**{"svm.name": svm_name}, name=igroup_name): print("Igroup Name = %s; Igroup UUID = %s" % (igroup.name, igroup.uuid)) return igroup.uuid except NetAppRestError as error: print("Error:- " % error.http_err_response.http_response.text) print("Exception caught :" + str(error))
def list_igroup() -> None: """Lists Initiator Group.""" show_svm() print() svm_name = input( "Enter the SVM from which the Volumes need to be listed:-") print() print("Getting Initiator Group Details") print("===============================") try: for igroup in Igroup.get_collection(**{"svm.name": svm_name}, fields="uuid"): print("Igroup Name = %s; Igroup UUID = %s" % (igroup.name, igroup.uuid)) except NetAppRestError as error: print("Exception caught :" + str(error)) igroup_name = input( "Enter the Igroup from which the Initiators need to be listed:-") igroup_uuid = get_key_igroup(svm_name, igroup_name) try: for ini in IgroupInitiator.get_collection(igroup_uuid): print("Initiator Name = %s " % (ini.name)) except NetAppRestError as error: print("Exception caught :" + str(error))