def test_parse_normal(self): info = [ 'opnstk1: FCP device number: B83D', 'opnstk1: Status: Free', 'opnstk1: NPIV world wide port number: NONE', 'opnstk1: Channel path ID: 59', 'opnstk1: Physical world wide port number: 20076D8500005181' ] fcp = volumeop.FCP(info) self.assertEqual('B83D', fcp._dev_no.upper()) self.assertIsNone(fcp._npiv_port) self.assertEqual('59', fcp._chpid.upper()) self.assertEqual('20076D8500005181', fcp._physical_port.upper())
def test_add_fcp_active(self, db_new): info = [ 'opnstk1: FCP device number: 1234', 'opnstk1: Status: Active', 'opnstk1: NPIV world wide port number: 20076D8500005182', 'opnstk1: Channel path ID: 59', 'opnstk1: Physical world wide port number: 20076D8500005181' ] try: self.fcpops._fcp_pool['1234'] = volumeop.FCP(info) self.fcpops._add_fcp('1234', 1) self.assertFalse(db_new.called) finally: self.fcpops._fcp_pool.pop('1234')
def test_add_fcp_free(self, db_new): # case1, status is free info = ['opnstk1: FCP device number: 1234', 'opnstk1: Status: Free', 'opnstk1: NPIV world wide port number: 20076D8500005182', 'opnstk1: Channel path ID: 59', 'opnstk1: Physical world wide port number: 20076D8500005181'] try: self.fcpops._fcp_pool['1234'] = volumeop.FCP(info) self.fcpops._add_fcp('1234', 0) db_new.assert_called_once_with('1234', 0) finally: self.db_op.delete('1234') self.fcpops._fcp_pool.pop('1234')