def storageport_update_uri(self, spuri, tzuri, varraysToAdd, varrayToRemove, port_nw_id): # varray changes varray_obj = VirtualArray(self.__ipAddr, self.__port) addvarrayList = varray_obj.convertNamesToUris(varraysToAdd) removevarrayList = varray_obj.convertNamesToUris(varrayToRemove) parms = { 'varray_assignment_changes': { 'add': { 'varrays': addvarrayList }, 'remove': { 'varrays': removevarrayList } } } # Network to be associated if (tzuri): parms['network'] = tzuri if (port_nw_id): parms['port_network_id'] = port_nw_id body = json.dumps(parms) (s, h) = common.service_json_request( self.__ipAddr, self.__port, "PUT", Storageport.URI_STORAGEPORT_UPDATE.format(spuri), body) return common.json_decode(s)
def storageport_update_uri( self, spuri, tzuri, varraysToAdd, varrayToRemove, port_nw_id): # varray changes varray_obj = VirtualArray(self.__ipAddr, self.__port) addvarrayList = varray_obj.convertNamesToUris(varraysToAdd) removevarrayList = varray_obj.convertNamesToUris(varrayToRemove) parms = { 'varray_assignment_changes': {'add': {'varrays': addvarrayList}, 'remove': {'varrays': removevarrayList} } } # Network to be associated if(tzuri): parms['network'] = tzuri if(port_nw_id): parms['port_network_id'] = port_nw_id body = json.dumps(parms) (s, h) = common.service_json_request( self.__ipAddr, self.__port, "PUT", Storageport.URI_STORAGEPORT_UPDATE.format(spuri), body) return common.json_decode(s)
def getVarrayList(self, varrays): varray_obj = VirtualArray(self.__ipAddr, self.__port) return varray_obj.convertNamesToUris(varrays)
def ps_update(self, name, deviceip, deviceport, username, type, clusterid, varraysToAdd, varraysToRemove): ''' This is the function will create the RecoverPoint with given name and type. It will send REST API request to ViPR instance. parameters: name : Name of the protection system. type : Type of the protection system { 'rp' } username : Username to access protection system (usually "admin") deviceip : IP address of management access of protection system deviceport : Port to access protection system clusterid : ID of cluster (RecoverPoint specific) varraysToAdd : Assign virtual arrays to cluster varraysToRemove : Unassign virtual arrays to cluster Note: If clusterid is used, CLI supports changing only one cluster virtual array assignments per command. return returns with protection system object with all details. ''' # check for existance of Protection system. passwd = None if (username and len(username) > 0): if sys.stdin.isatty(): passwd = getpass.getpass( prompt="Enter password of the protection system: ") else: passwd = sys.stdin.readline().rstrip() if (len(passwd) > 0): if sys.stdin.isatty(): confirm_passwd = getpass.getpass( prompt="Retype password: "******" " + sys.argv[1] + " " + sys.argv[2] + ": error: Passwords mismatch") else: raise SOSError( SOSError.CMD_LINE_ERR, sys.argv[0] + " " + sys.argv[1] + " " + sys.argv[2] + ": error: Invalid password") parms = dict() if (deviceip): parms['ip_address'] = deviceip if (deviceport): parms['port_number'] = deviceport if (username): parms['user_name'] = username if (passwd): parms['password'] = passwd if (clusterid): # varray changes varray_obj = VirtualArray(self.__ipAddr, self.__port) addvarrayList = varray_obj.convertNamesToUris(varraysToAdd) removevarrayList = varray_obj.convertNamesToUris(varraysToRemove) parms = { 'varray_assignment_changes': [{ 'add': { 'varrays': addvarrayList }, 'remove': { 'varrays': removevarrayList }, 'cluster_id': clusterid }] } uri = self.ps_query(name) body = json.dumps(parms) (s, h) = common.service_json_request( self.__ipAddr, self.__port, "PUT", self.URI_PROTECTION_SYSTEM_UPDATE.format(uri), body) o = common.json_decode(s) return o
def ps_update(self, name, deviceip, deviceport, username, type, clusterid, varraysToAdd, varraysToRemove): """ This is the function will create the RecoverPoint with given name and type. It will send REST API request to ViPR instance. parameters: name : Name of the protection system. type : Type of the protection system { 'rp' } username : Username to access protection system (usually "admin") deviceip : IP address of management access of protection system deviceport : Port to access protection system clusterid : ID of cluster (RecoverPoint specific) varraysToAdd : Assign virtual arrays to cluster varraysToRemove : Unassign virtual arrays to cluster Note: If clusterid is used, CLI supports changing only one cluster virtual array assignments per command. return returns with protection system object with all details. """ # check for existance of Protection system. passwd = None if username and len(username) > 0: if sys.stdin.isatty(): passwd = getpass.getpass(prompt="Enter password of the protection system: ") else: passwd = sys.stdin.readline().rstrip() if len(passwd) > 0: if sys.stdin.isatty(): confirm_passwd = getpass.getpass(prompt="Retype password: "******" " + sys.argv[1] + " " + sys.argv[2] + ": error: Passwords mismatch", ) else: raise SOSError( SOSError.CMD_LINE_ERR, sys.argv[0] + " " + sys.argv[1] + " " + sys.argv[2] + ": error: Invalid password", ) parms = dict() if deviceip: parms["ip_address"] = deviceip if deviceport: parms["port_number"] = deviceport if username: parms["user_name"] = username if passwd: parms["password"] = passwd if clusterid: # varray changes varray_obj = VirtualArray(self.__ipAddr, self.__port) addvarrayList = varray_obj.convertNamesToUris(varraysToAdd) removevarrayList = varray_obj.convertNamesToUris(varraysToRemove) parms = { "varray_assignment_changes": [ { "add": {"varrays": addvarrayList}, "remove": {"varrays": removevarrayList}, "cluster_id": clusterid, } ] } uri = self.ps_query(name) body = json.dumps(parms) (s, h) = common.service_json_request( self.__ipAddr, self.__port, "PUT", self.URI_PROTECTION_SYSTEM_UPDATE.format(uri), body ) o = common.json_decode(s) return o