Example #1
0
 def test_s004_format_partition(self):
     """
     Format the disk partition with the filesystem type specified in the config file
     :return:
     """
     try:
         self.logging.info('--> TestPartitions.test_format_partition()')
         fstype = utils.readconfig(self, 'config', 'PARTITIONS', 'fstype')
         partname = utils.readconfig(self, 'config', 'PARTITIONS', 'format_part')
         part_data = {'fstype' : fstype}
         resp = self.session.request_post_json(TestPartitions.uri_partitions + '/' + partname + '/format', body=part_data)
         if resp is not None:
             self.validator.validate_json(resp, TestPartitions.default_task_schema)
             task_status = resp["status"]
             task_id = resp["id"]
             while task_status == "running":
                 time.sleep(5)
                 task_resp = self.session.request_get_json(
                     TestPartitions.uri_task + '/' + task_id, [200])
                 task_status = task_resp["status"]
                 continue
             if task_status == "finished":
                 self.logging.debug('Format partition is successful')
             else:
                 self.assertFalse(True)
     except Exception, err:
         self.logging.error(str(err))
         raise Exception(str(err))
Example #2
0
 def test_S001_format_dasd(self):
     """
     Format DASD device by passing the bus_id and block size specified in the config file
     :return:
     """
     self.logging.info('--> TestDASDdevs.test_format_dasd()')
     try:
         bus_id = utils.readconfig(self, 'config', 'DASDdevs', 'bus_id')
         blk_size = utils.readconfig(self, 'config', 'DASDdevs', 'blk_size')
         format_data = {'blk_size': blk_size}
         resp_fmt = self.session.request_post_json(uri=self.uri_dasddevs + '/' + bus_id + '/' + 'format', body=format_data, expected_status_values=[202])
         task_status = resp_fmt["status"]
         task_id = resp_fmt["id"]
         while task_status == "running":
             time.sleep(5)
             task_resp = self.session.request_get_json(
                     self.task_uri + '/' + task_id)
             task_status = task_resp["status"]
             print "Status: %s" % (task_status)
             continue
         if task_status == "finished":
             self.logging.debug('Format of DASD device Successful : %s' % bus_id)
         else:
             self.logging.error('Format of DASD device is failed')
     except Exception, err:
         self.logging.error(str(err))
         raise Exception(str(err))
Example #3
0
 def setUpClass(self):
     super(TestNwdevices, self).setUpClass()
     self.logging.info('--> TestNwdevices.setUpClass()')
     self.logging.debug(
         'Reading network i/o devices information from config file')
     self.configured_device = utils.readconfig(
         self.session, CONFIGFILE, NWDEVICES_SECTION,
         CONFIGURED_DEVICE_OPT)
     self.unconfigured_device = utils.readconfig(
         self.session, CONFIGFILE, NWDEVICES_SECTION,
         UNCONFIGURED_DEVICE_OPT)
     self.logging.debug(
         'Successfully read network i/o devices information from config'
         ' file. Configured Device: %s, Un-Configured Device: %s'
         % (self.configured_device, self.unconfigured_device))
     self.logging.debug('prepare network device using utils')
     if utils.configure_nwdevice(self.session, self.configured_device):
         #if failed to configure network device, make it None
         self.configured_device = None
     else:
         # if successfully configured, use first device id of triplet
         self.configured_device = 'enccw' + self.configured_device.split(',')[0]
     if self.unconfigured_device:
         self.unconfigured_device = self.unconfigured_device.split(',')[0]
     self.logging.info('<-- TestNwdevices.setUpClass()')
Example #4
0
 def test_S003_get_single_lun(self):
     try:
         self.logging.info('--> TestFCLuns.test_get_single_lun()')
         hba_id = utils.readconfig(self, 'config', 'FCLUNs', 'hba_id')
         remote_wwpn = utils.readconfig(self, 'config', 'FCLUNs', 'remote_wwpn')
         lun_id = utils.readconfig(self, 'config', 'FCLUNs', 'lun_id')
         lun = hba_id + ':' + remote_wwpn + ':' + lun_id
         resp_lun = self.session.request_get_json(self.uri_fcluns + '/' + lun,[200])
         self.validator.validate_json(resp_lun, self.default_schema)
     except Exception, err:
         self.logging.error(str(err))
         raise Exception(str(err))
Example #5
0
 def setUpClass(self):
     super(TestNwdevices, self).setUpClass()
     self.logging.info('--> TestNwdevices.setUpClass()')
     self.logging.debug(
         'Reading network i/o devices information from config file')
     self.configured_device = utils.readconfig(self.session, CONFIGFILE,
                                NWDEVICES_SECTION, CONFIGURED_DEVICE_OPT)
     self.unconfigured_device = utils.readconfig(self.session, CONFIGFILE,
                                NWDEVICES_SECTION, UNCONFIGURED_DEVICE_OPT)
     self.logging.debug(
         'Successfully read network i/o devices information from config'
         ' file. Configured Device: %s, Un-Configured Device: %s'
         % (self.configured_device, self.unconfigured_device))
     self.logging.info('<-- TestNwdevices.setUpClass()')
Example #6
0
 def test_s001_add_lun(self):
     """
     Add lun by passing the hbaID, remoteWWPN and lunID specified in the config file
     """
     try:
         self.logging.info('--> TestFCLuns.test_add_lun()')
         hba_id = utils.readconfig(self, 'config', 'FCLUNs', 'hba_id')
         remote_wwpn = utils.readconfig(self, 'config', 'FCLUNs', 'remote_wwpn')
         lun_id = utils.readconfig(self, 'config', 'FCLUNs', 'lun_id')
         lun_data = {"hbaId" : hba_id, "remoteWwpn" : remote_wwpn, "lunId" : lun_id}
         self.session.request_post(uri=self.uri_fcluns,body=lun_data,expected_status_values=[201])
     except Exception, err:
         self.logging.error(str(err))
         raise Exception(str(err))
Example #7
0
 def test_s005_change_part_type(self):
     """
     Change the partition type with the type specified in the config file
     :return:
     """
     try:
         self.logging.info('--> TestPartitions.test_change_part_type()')
         part_type = utils.readconfig(self, 'config', 'PARTITIONS', 'part_type_code')
         partname = utils.readconfig(self, 'config', 'PARTITIONS', 'part_name')
         part_data = {'type' : part_type}
         self.session.request_post(uri=self.uri_partitions + '/' + partname + '/change_type', body=part_data, expected_status_values=[200])
     except Exception, err:
         self.logging.error(str(err))
         raise Exception(str(err))
Example #8
0
 def test_s001_create_part(self):
     """
     Create disk partition by reading the device name and partition size from the config file
     :return:
     """
     try:
         self.logging.info('--> TestPartitions.test_create_part()')
         devname = utils.readconfig(self, 'config', 'PARTITIONS', 'devname')
         part_size = int(utils.readconfig(self, 'config', 'PARTITIONS', 'part_size'))
         part_data = {'devname' : devname, 'partsize': part_size}
         self.session.request_post(uri=self.uri_partitions, body=part_data, expected_status_values=[201])
     except Exception, err:
         self.logging.error(str(err))
         raise Exception(str(err))
Example #9
0
 def test_S004_delete_lun(self):
     """
     Delete the lun specified in the config file
     :return:
     """
     try:
         self.logging.info('--> TestFCLuns.test_delete_lun()')
         hba_id = utils.readconfig(self, 'config', 'FCLUNs', 'hba_id')
         remote_wwpn = utils.readconfig(self, 'config', 'FCLUNs', 'remote_wwpn')
         lun_id = utils.readconfig(self, 'config', 'FCLUNs', 'lun_id')
         lun = hba_id + ':' + remote_wwpn + ':' + lun_id
         self.session.request_delete(uri=self.uri_fcluns + '/' + lun, expected_status_values=[204])
     except Exception, err:
         self.logging.error(str(err))
         raise Exception(str(err))
Example #10
0
 def test_S001_create_lv(self):
     """
     Create LV by passing the VG name and Size specified in the config file
     :return:
     """
     try:
         self.logging.info('--> TestLogicalVols.test_create_lv()')
         size = utils.readconfig(self, 'config', 'LV', 'size')
         lv_data = {'vg_name' : self.vgname, 'size' : size}
         resp = self.session.request_post_json(uri=self.uri_lvs, body=lv_data, expected_status_values=[202])
         if resp is not None:
             self.validator.validate_json(resp, self.default_task_schema)
             task_status = resp["status"]
             task_id = resp["id"]
             while task_status == "running":
                 time.sleep(5)
                 task_resp = self.session.request_get_json(
                     self.uri_task + '/' + task_id, [200])
                 task_status = task_resp["status"]
                 continue
             if task_status == "finished":
             else:
                 self.assertFalse(True)
     except Exception, err:
         self.logging.error(str(err))
         raise Exception(str(err))
Example #11
0
def write_tasks(tasks):
    config = utils.readconfig("trello2misc.ini")
    fileName = config.get("todotxt", "fileName")
    theFile = open(fileName, "w")
    for task in tasks:
        theFile.write(repr(task) + "\n")
    theFile.close()
Example #12
0
 def setUpClass(self):
     super(TestPartitions, self).setUpClass()
     self.logging.info('--> TestPartitions.setUpClass()')
     self.logging.debug('enable the fcp adapter and lun'
                        'specified in config file')
     self.hba_id = utils.readconfig(self, 'config', 'PARTITIONS', 'hba_id')
     self.remote_wwpn = utils.readconfig(self, 'config', 'PARTITIONS', 'remote_wwpn')
     self.lun_id = utils.readconfig(self, 'config', 'PARTITIONS', 'lun_id')
     self.lun_id_2 = utils.readconfig(self, 'config', 'PARTITIONS', 'lun_id_2')
     try:
         utils.enable_eckd(self.hba_id)
         utils.add_lun(self.hba_id, self.remote_wwpn, self.lun_id)
         utils.add_lun(self.hba_id, self.remote_wwpn, self.lun_id_2)
     except Exception, err:
         self.logging.error(str(err))
         raise Exception(str(err))
Example #13
0
def write_tasks(tasks):
    config = utils.readconfig("trello2misc.ini")
    fileName = config.get("todotxt", "fileName")
    theFile = open(fileName, "w")
    for task in tasks:
        theFile.write(repr(task) + "\n")
    theFile.close()
Example #14
0
 def test_s003_get_single_partition(self):
     self.logging.info('--> TestPartitions.test_get_single_partition()')
     partname = utils.readconfig(self, 'config', 'PARTITIONS', 'part_name')
     try:
         resp_part = self.session.request_get_json(self.uri_partitions + '/' + partname,[200])
         self.validator.validate_json(resp_part, self.default_schema)
     except Exception, err:
         self.logging.error(str(err))
         raise Exception(str(err))
Example #15
0
 def setUpClass(self):
     super(TestStorageIODevices, self).setUpClass()
     self.logging.info('--> TestStorageIODevices.setUpClass()')
     self.logging.debug('Reading storage i/o devices information from config file')
     self.online_dasdeckd_device = utils.readconfig(self.session, CONFIGFILE,
                                STORAGE_DEVICES_SECTION, ONLINE_DASDECKD_OPT)
     self.offline_dasdeckd_device = utils.readconfig(self.session, CONFIGFILE,
                                STORAGE_DEVICES_SECTION, OFFLINE_DASDECKD_OPT)
     self.online_zfcp_device = utils.readconfig(self.session, CONFIGFILE,
                                STORAGE_DEVICES_SECTION, ONLINE_ZFCP_OPT)
     self.offline_zfcp_device = utils.readconfig(self.session, CONFIGFILE,
                                STORAGE_DEVICES_SECTION, OFFLINE_ZFCP_OPT)
     self.logging.debug('Successfully read storage i/o devices information'
                        ' from config file. Online dasd-eckd device: %s, offline dasd-eckd device: %s, '
                        'online zfcp device: %s, offline zfcp device: %s'
                        %(self.online_dasdeckd_device, self.offline_dasdeckd_device,
                          self.online_zfcp_device, self.offline_zfcp_device))
     self.logging.info('<-- TestStorageIODevices.setUpClass()()')
Example #16
0
 def setUpClass(self):
     super(TestLogicalVols, self).setUpClass()
     self.logging.info('--> TestLogicalVols.setUpClass()')
     self.logging.debug('creating pv and vg on the eckd'
                        'device specified in config file')
     bus_id = utils.readconfig(self, 'config', 'DASDdevs', 'bus_id')
     try:
         utils.enable_eckd(bus_id)
         self.dev = utils.fetch_dasd_dev(bus_id)
         #utils.format_eckd(self.dev)
         utils.partition_eckd(self.dev)
         time.sleep(5)
         utils.create_pv(self.dev+'1')
         self.vgname = utils.readconfig(self, 'config', 'LV', 'vgname')
         utils.create_vg(self.vgname, self.dev+'1')
     except Exception, err:
         self.logging.error(str(err))
         raise Exception(str(err))
Example #17
0
def get_json_response(url):
    config = utils.readconfig("trello2misc.ini")
    key = config.get("trello", "key")
    token = config.get("trello", "token")
    authorizedUrl = url + "?key=" + key + "&token=" + token
    response = urllib.request.urlopen(authorizedUrl)
    content = response.read()
    jsonList = json.loads(content.decode('utf-8'))
    return jsonList
Example #18
0
def get_json_response(url):
    config = utils.readconfig("trello2misc.ini")
    key = config.get("trello", "key")
    token = config.get("trello", "token")
    authorizedUrl = url + "?key=" + key + "&token=" + token
    response = urllib.request.urlopen(authorizedUrl)
    content = response.read()
    jsonList = json.loads(content.decode('utf-8'))
    return jsonList
Example #19
0
 def test_S003_get_single_lv(self):
     try:
         self.logging.info('--> TestLogicalVols.test_get_single_lv()')
         lvname = utils.readconfig(self, 'config', 'LV', 'lvname')
         lv = '%2Fdev' + '%2F' + self.vgname + '%2F' + lvname
         resp_lv = self.session.request_get_json(self.uri_lvs + '/' + lv,[200])
         self.validator.validate_json(resp_lv, self.default_schema)
     except Exception, err:
         self.logging.error(str(err))
         raise Exception(str(err))
Example #20
0
def read_todotxtfile():
    config = utils.readconfig("trello2misc.ini")
    fileName = config.get("todotxt", "fileName")
    theFile = open(fileName, "r")
    lines = theFile.readlines()
    theFile.close()
    tasks = []
    for line in lines:
        task = parse_todotxtline(line)
        tasks.append(task)
    return tasks
Example #21
0
 def setUpClass(self):
     super(TestCioIgnoreList, self).setUpClass()
     self.logging.info('--> TestCioIgnoreList.setUpClass()')
     self.logging.debug('Reading removable devices(from ignore list)'
                        ' information from config file')
     self.remove_devices = utils.readconfig(
         self.session, CONFIGFILE, CIO_IGNORE_SECTION, DEVICES_OPT)
     self.logging.debug(
         'Reading removable devices(from ignore list) information from'
         ' config file. Devices: %s' % self.remove_devices)
     self.logging.info('<-- TestCioIgnoreList.setUpClass()')
Example #22
0
 def setUpClass(self):
     super(TestFCLuns, self).setUpClass()
     self.logging.info('--> TestFCLuns.setUpClass()')
     self.logging.debug('enable the fcp adapter '
                        'specified in config file')
     self.hba_id = utils.readconfig(self, 'config', 'FCLUNs', 'hba_id')
     try:
         utils.bring_zfcp_online(self.session, self.hba_id)
     except Exception, err:
         self.logging.error(str(err))
         raise Exception(str(err))
Example #23
0
 def setUpClass(self):
     super(TestDASDdevs, self).setUpClass()
     self.logging.info('--> TestDASDdevs.setUpClass()')
     self.logging.debug('enabling the eckd specified'
                        'in the config file')
     bus_id = utils.readconfig(self, 'config', 'DASDdevs', 'bus_id')
     try:
         utils.enable_eckd(bus_id)
     except Exception, err:
         self.logging.error(str(err))
         raise Exception(str(err))
Example #24
0
def read_todotxtfile():
    config = utils.readconfig("trello2misc.ini")
    fileName = config.get("todotxt", "fileName")
    theFile = open(fileName, "r")
    lines = theFile.readlines()
    theFile.close()
    tasks = []
    for line in lines:
        task = parse_todotxtline(line)
        tasks.append(task)
    return tasks
Example #25
0
 def test_s006_delete_part(self):
     """
     Delete the partition specified in config file
     :return:
     """
     try:
         self.logging.info('--> TestPartitions.test_delete_part()')
         partname = utils.readconfig(self, 'config', 'PARTITIONS', 'part_name')
         self.session.request_delete(uri=self.uri_partitions + '/' + partname, expected_status_values=[204])
     except Exception, err:
         self.logging.error(str(err))
         raise Exception(str(err))
Example #26
0
 def test_S003_get_DASDdevice_details(self):
     """
     Retrieve the Information of a single DASD Device
     """
     self.logging.info('--> TestDASDdevs.test_get_DASDdevice_details() ')
     try:
         self.logging.debug('Get DASD Device information')
         bus_id = utils.readconfig(self, 'config', 'DASDdevs', 'bus_id')
         dev_details = self.session.request_get_json(self.uri_dasddevs + '/' + bus_id,[200])
         self.validator.validate_json(dev_details, self.default_dasd_devices_schema)
     except Exception, err:
         self.logging.error(str(err))
         raise Exception(str(err))
Example #27
0
 def test_f002_create_part_with_partsize_missing(self):
     """
     Create disk partition with partition size missing. Fails with 400.
     :return:
     """
     try:
         self.logging.info('--> TestPartitions.test_create_part_with_partsize_missing()')
         devname = utils.readconfig(self, 'config', 'PARTITIONS', 'devname')
         part_data = {'devname' : devname}
         self.session.request_post(uri=self.uri_partitions, body=part_data, expected_status_values=[400])
     except Exception, err:
         self.logging.error(str(err))
         raise Exception(str(err))
Example #28
0
 def test_S004_delete_lv(self):
     """
     Delete the LV specified in the config file
     :return:
     """
     try:
         self.logging.info('--> TestLogicalVols.test_delete_lv()')
         lvname = utils.readconfig(self, 'config', 'LV', 'lvname')
         lv = '%2Fdev' + '%2F' + self.vgname + '%2F' + lvname
         self.session.request_delete(uri=self.uri_lvs + '/' + lv, expected_status_values=[204])
     except Exception, err:
         self.logging.error(str(err))
         raise Exception(str(err))
Example #29
0
    def test_f001_create_dasdpart_with_devicename_missing(self):
        """
        Create DASD Partition without specifying the device name. Fails with 400
        """

        self.logging.info('--> TestDASDPartitions.test_create_dasdpart_with_devicename_missing()')
        try:
            size = utils.readconfig(self, 'config', 'DASDPartitions', 'size')
            part_data = {'size': size}
            self.session.request_post(uri=self.uri_dasdpartitions, body=part_data, expected_status_values=[400])
        except Exception, err:
            self.logging.error(str(err))
            raise Exception(str(err))
Example #30
0
 def setUpClass(self):
     super(TestDASDPartitions, self).setUpClass()
     self.logging.info('--> TestDASDPartitions.setUpClass()')
     self.logging.debug('enabling and formatting the eckd'
                        'device specified in config file')
     bus_id = utils.readconfig(self, 'config', 'DASDdevs', 'bus_id')
     try:
         utils.enable_eckd(bus_id)
         self.dev = utils.fetch_dasd_dev(bus_id)
         utils.format_eckd(self.dev)
     except Exception, err:
         self.logging.error(str(err))
         raise Exception(str(err))
Example #31
0
 def setUpClass(self):
     super(TestFilesystems, self).setUpClass()
     self.logging.info('--> TestFilesystems.setUpClass()')
     self.logging.debug('enabling and formatting the eckd'
                        'device specified in config file')
     bus_id = utils.readconfig(self, 'config', 'DASDdevs', 'bus_id')
     try:
         utils.enable_eckd(bus_id)
         self.dev = utils.fetch_dasd_dev(bus_id)
         #utils.format_eckd(self.dev)
         utils.partition_eckd(self.dev)
         time.sleep(5)
         utils.format_part_with_fs(self.dev+'1', 'ext4')
         self.mountpt = utils.readconfig(self, 'config', 'FILESYSTEM', 'mount_point')
         utils.create_mount_point(self.mountpt)
         self.server = 'localhost'
         self.nfs_share = utils.readconfig(self, 'config', 'FILESYSTEM', 'nfs_share')
         self.nfs_mount_pt = utils.readconfig(self, 'config', 'FILESYSTEM', 'nfs_mntpt')
         utils.nfs_setup(self.nfs_share, self.nfs_mount_pt)
     except Exception, err:
         self.logging.error(str(err))
         raise Exception(str(err))
Example #32
0
def filter_cards(cards, lists):
    config = utils.readconfig("trello2misc.ini")
    ignoredLists = config.get("trello", "ignoredLists")
    ignoredNames = []
    for name in ignoredLists.split(","):
        ignoredNames.append(name.replace("\"", "").strip())
    filteredIds = []
    for cardId in cards.keys():
        listId = cards[cardId].list
        if lists[listId] in ignoredNames:
            filteredIds.append(cardId)
    for cardId in filteredIds:
        del cards[cardId]
    return cards
Example #33
0
 def setUpClass(self):
     super(TestPhysicalVols, self).setUpClass()
     self.logging.info("--> TestPhysicalVols.setUpClass()")
     self.logging.debug("enable and partition the eckd" "device specified in config file")
     bus_id = utils.readconfig(self, "config", "DASDdevs", "bus_id")
     try:
         utils.enable_eckd(bus_id)
         self.dev = utils.fetch_dasd_dev(bus_id)
         # utils.format_eckd(self.dev)
         utils.partition_eckd(self.dev)
         time.sleep(5)
     except Exception, err:
         self.logging.error(str(err))
         raise Exception(str(err))
Example #34
0
def filter_cards(cards, lists):
    config = utils.readconfig("trello2misc.ini")
    ignoredLists = config.get("trello", "ignoredLists")
    ignoredNames = []
    for name in ignoredLists.split(","):
        ignoredNames.append(name.replace("\"","").strip())
    filteredIds = []
    for cardId in cards.keys():
        listId = cards[cardId].list
        if lists[listId] in ignoredNames:
            filteredIds.append(cardId)
    for cardId in filteredIds:
        del cards[cardId]
    return cards
Example #35
0
def sort_cards(cards, lists):
    config = utils.readconfig("trello2misc.ini")
    aLists = config.get("trello", "aLists")
    bLists = config.get("trello", "bLists")
    cLists = config.get("trello", "cLists")
    aList = []
    bList = []
    cList = []
    for name in aLists.split(","):
        aList.append(name.replace("\"", "").strip())
    for name in bLists.split(","):
        bList.append(name.replace("\"", "").strip())
    for name in cLists.split(","):
        cList.append(name.replace("\"", "").strip())
    listOrder = aList + bList + cList
    cardsByPriority = {}
    cardsByPriority["A"] = []
    cardsByPriority["B"] = []
    cardsByPriority["C"] = []
    otherCards = []
    sortedCards = []
    for cardId in cards.keys():
        card = cards[cardId]
        listId = card.list
        listName = lists[listId]
        if listName in aList:
            cardsByPriority["A"].append(card)
        elif listName in bList:
            cardsByPriority["B"].append(card)
        elif listName in cList:
            cardsByPriority["C"].append(card)
        else:
            otherCards.append(card)
    cardsByPriority["A"].sort(key=lambda x:
                              (x.due or str(datetime.MAXYEAR), x.pos),
                              reverse=False)
    cardsByPriority["B"].sort(key=lambda x:
                              (x.due or str(datetime.MAXYEAR), x.pos),
                              reverse=False)
    cardsByPriority["C"].sort(key=lambda x:
                              (x.due or str(datetime.MAXYEAR), x.pos),
                              reverse=False)
    sortedCards.extend(cardsByPriority["A"])
    sortedCards.extend(cardsByPriority["B"])
    sortedCards.extend(cardsByPriority["C"])
    sortedCards.extend(otherCards)
    return sortedCards