def test_get_physical_wwpns(self): self.mock_vios_get.return_value = self.entries expected = {'21000024FF649104'} result = set(tpar.get_physical_wwpns(self.adpt)) self.assertSetEqual(expected, result) self.mock_vios_get.assert_called_once_with( self.adpt, xag=[c.XAG.VIO_STOR]) # Test caching self.mock_vios_get.reset_mock() result = set(tpar.get_physical_wwpns(self.adpt, force_refresh=False)) self.assertSetEqual(expected, result) self.mock_vios_get.assert_not_called() # Test force_refresh result = set(tpar.get_physical_wwpns(self.adpt, force_refresh=True)) self.assertSetEqual(expected, result) self.mock_vios_get.assert_called_once_with( self.adpt, xag=[c.XAG.VIO_STOR])
def wwpns(self): """Builds the WWPNs of the adapters that will connect the ports. :return: The list of WWPNs that need to be included in the zone set. """ # Use a global variable so this is pulled once when the process starts. global _vscsi_pfc_wwpns if _vscsi_pfc_wwpns is None: _vscsi_pfc_wwpns = pvm_tpar.get_physical_wwpns(self.adapter) return _vscsi_pfc_wwpns
def wwpns(adapter): """Builds the WWPNs of the adapters that will connect the ports. :return: The list of WWPNs that need to be included in the zone set. """ return pvm_tpar.get_physical_wwpns(adapter, force_refresh=False)
def test_get_physical_wwpns(self): self.mock_vios_get.return_value = self.entries expected = {'21000024FF649104'} result = set(tpar.get_physical_wwpns(self.adpt)) self.assertSetEqual(expected, result)