def __init__(self, array_id, rest_client): """__init__.""" self.provisioning = ProvisioningFunctions(array_id, rest_client) self.common = CommonFunctions(rest_client) self.get_resource = self.common.get_resource self.create_resource = self.common.create_resource self.modify_resource = self.common.modify_resource self.delete_resource = self.common.delete_resource self.array_id = array_id
def __init__(self, username=None, password=None, server_ip=None, port=None, verify=None, u4v_version=constants.UNIVMAX_VERSION, interval=5, retries=200, array_id=None): """__init__.""" self.end_date = int(round(time.time() * 1000)) self.start_date = (self.end_date - 3600000) self.array_id = array_id if not self.array_id: try: self.array_id = CFG.get('setup', 'array') except Exception: LOG.warning("No array id specified. Please set " "array ID using the 'set_array_id(array_id)' " "function.") if CFG is not None: if not username: username = CFG.get('setup', 'username') if not password: password = CFG.get('setup', 'password') if not server_ip: server_ip = CFG.get('setup', 'server_ip') if not port: port = CFG.get('setup', 'port') if verify is None: try: verify = CFG.get('setup', 'verify') if verify.lower() == 'false': verify = False elif verify.lower() == 'true': verify = True except Exception: verify = True base_url = "https://%s:%s/univmax/restapi" % (server_ip, port) self.rest_client = RestRequests(username, password, verify, base_url) self.request = self.rest_client.rest_request self.U4V_VERSION = u4v_version self.common = CommonFunctions(self.request, interval, retries, u4v_version) self.provisioning = ProvisioningFunctions(self.array_id, self.request, self.common, self.U4V_VERSION) self.performance = PerformanceFunctions(self.array_id, self.request, self.common, self.provisioning, self.U4V_VERSION) self.replication = ReplicationFunctions(self.array_id, self.request, self.common, self.provisioning, self.U4V_VERSION) self.migration = MigrationFunctions(self.array_id, self.request, self.common, self.U4V_VERSION)
def __init__(self, username=None, password=None, server_ip=None, port=None, verify=None, u4v_version=constants.UNISPHERE_VERSION, interval=5, retries=200, array_id=None, application_type=None, remote_array=None, remote_array_2=None): """__init__.""" config = config_handler.set_logger_and_config(file_path) self.end_date = int(round(time.time() * 1000)) self.start_date = (self.end_date - 3600000) self.array_id = array_id # Set array ID if not self.array_id: try: self.array_id = config.get(SETUP, ARRAY) except Exception: LOG.warning( 'No array id specified. Please set array ID using ' 'U4VConn.set_array_id(array_id).') # Set environment config if config is not None: if not username: username = config.get(SETUP, USERNAME) if not password: password = config.get(SETUP, PASSWORD) if not server_ip: server_ip = config.get(SETUP, SERVER_IP) if not port: port = config.get(SETUP, PORT) # Optional Parameters for SRDF Remote array configurations if config.has_option(SETUP, R_ARRAY): if not remote_array: self.remote_array = config.get(SETUP, R_ARRAY) else: self.remote_array = None if config.has_option(SETUP, R_ARRAY_2): if not remote_array_2: self.remote_array_2 = config.get(SETUP, R_ARRAY_2) else: self.remote_array_2 = None # Set verification if verify is None: try: verify = config.get(SETUP, VERIFY) if verify.lower() == 'false': verify = False elif verify.lower() == 'true': verify = True except Exception: verify = True if None in [username, password, server_ip, port]: raise exception.MissingConfigurationException # Initialise REST session base_url = 'https://{server_ip}:{port}/univmax/restapi'.format( server_ip=server_ip, port=port) self.rest_client = RestRequests( username, password, verify, base_url, interval, retries, application_type) self.request = self.rest_client.rest_request self.common = CommonFunctions(self.rest_client) self.provisioning = ProvisioningFunctions(self.array_id, self.rest_client) self.performance = PerformanceFunctions(self.array_id, self.rest_client) self.replication = ReplicationFunctions(self.array_id, self.rest_client) self.metro_dr = MetroDRFunctions(self.array_id, self.rest_client) self.migration = MigrationFunctions(self.array_id, self.rest_client) self.wlp = WLPFunctions(self.array_id, self.rest_client) self.snapshot_policy = SnapshotPolicyFunctions(self.array_id, self.rest_client) self.system = SystemFunctions(self.array_id, self.rest_client) self.validate_unisphere()