def _get_dasd_pim(): """ Return a dictionary with bus ids of DASD devices as keys and number of paths as values """ pim_dict = {} # execute lscss -d command = ['lscss', '-d'] out, err, rc = run_command(command) if rc: raise OperationFailed("GINDASD0012E", {'err': err}) if out: try: output_lines = out.splitlines() for line in output_lines[2:]: clms = line.split() pim = clms[-5] bus_id = clms[0] chipid = clms[-2]+" "+clms[-1] binaryval_pam = _hex_to_binary(pim) enabled_chipids = _get_paths(binaryval_pam, chipid) pim_dict[bus_id] = len(enabled_chipids) except Exception as err: raise OperationFailed("GINDASD0013E", {'err': err.message}) return pim_dict
def _get_dasd_pim(): """ Return a dictionary with bus ids of DASD devices as keys and number of paths as values """ pim_dict = {} # execute lscss -d command = ['lscss', '-d'] out, err, rc = run_command(command) if rc: raise OperationFailed("GINDASD0012E", {'err': err}) if out: try: output_lines = out.splitlines() for line in output_lines[2:]: clms = line.split() pim = clms[-5] bus_id = clms[0] chipid = clms[-2]+" "+clms[-1] binaryval_pam = _hex_to_binary(pim) enabled_chipids = _get_paths(binaryval_pam, chipid) pim_dict[bus_id] = len(enabled_chipids) except Exception as err: raise OperationFailed("GINDASD0013E", {'err': err.message}) return pim_dict
def test_hex_to_binary_failure(self): """ unit test to test the conversion of a hexadecimal value to binary for a valid hexadecimal value to fetch the the corresponding invalid binary value """ val = 'e0' binaryval = '10000000' out = utils._hex_to_binary(val) self.assertNotEqual(binaryval, out)
def test_hex_to_binary_failure(self): """ unit test to test the conversion of a hexadecimal value to binary for a valid hexadecimal value to fetch the the corresponding invalid binary value """ val = 'e0' binaryval = '10000000' out = utils._hex_to_binary(val) self.assertNotEqual(binaryval, out)