diff --git a/docs/changes.rst b/docs/changes.rst
index 3072f69..7b7c868 100644
--- a/docs/changes.rst
+++ b/docs/changes.rst
@@ -31,6 +31,8 @@ Released: not yet
 
 **Bug fixes:**
 
+* Added WWPN support in mocking framework (issue #212).
+
 **Enhancements:**
 
 **Known Issues:**
diff --git a/zhmcclient_mock/_hmc.py b/zhmcclient_mock/_hmc.py
index 961ee67..450855e 100644
--- a/zhmcclient_mock/_hmc.py
+++ b/zhmcclient_mock/_hmc.py
@@ -774,6 +774,9 @@ class FakedHbaManager(FakedBaseManager):
         if 'device-number' not in new_hba.properties:
             devno = partition.devno_alloc()
             new_hba.properties['device-number'] = devno
+        if 'wwpn' not in new_hba.properties:
+            wwpn = partition.wwpn_alloc()
+            new_hba.properties['wwpn'] = wwpn
         return new_hba
 
     def remove(self, oid):
@@ -793,6 +796,9 @@ class FakedHbaManager(FakedBaseManager):
         devno = hba.properties.get('device-number', None)
         if devno:
             partition.devno_free_if_allocated(devno)
+        wwpn = hba.properties.get('wwpn', None)
+        if wwpn:
+            partition.wwpn_free_if_allocated(wwpn)
         assert 'hba-uris' in partition.properties
         hba_uris = partition.properties['hba-uris']
         hba_uris.remove(hba.uri)
@@ -1049,6 +1055,7 @@ class FakedPartition(FakedBaseResource):
         self._virtual_functions = FakedVirtualFunctionManager(
             hmc=manager.hmc, partition=self)
         self._devno_pool = IdPool(0x8000, 0xFFFF)
+        self._wwpn_pool = IdPool(0x8000, 0xFFFF)
 
     @property
     def nics(self):
@@ -1118,6 +1125,51 @@ class FakedPartition(FakedBaseResource):
         devno_int = int(devno, 16)
         self._devno_pool.free_if_allocated(devno_int)
 
+    def wwpn_alloc(self):
+        """
+        Allocates a WWPN unique to this partition, in the range of
+        0xAFFEAFFE00008000 to 0xAFFEAFFE0000FFFF.
+
+        Returns:
+          string: The WWPN as 16 hexadecimal digits in upper case.
+
+        Raises:
+          ValueError: No more WWPNs available in that range.
+        """
+        wwpn_int = self._wwpn_pool.alloc()
+        wwpn = "AFFEAFFE0000" + "{:04X}".format(wwpn_int)
+        return wwpn
+
+    def wwpn_free(self, wwpn):
+        """
+        Free a WWPN allocated with :meth:`wwpn_alloc`.
+
+        The WWPN must be allocated.
+
+        Parameters:
+          WWPN (string): The WWPN as 16 hexadecimal digits.
+
+        Raises:
+          ValueError: WWPN not in pool range or not currently
+            allocated.
+        """
+        wwpn_int = int(wwpn[-4:], 16)
+        self._wwpn_pool.free(wwpn_int)
+
+    def wwpn_free_if_allocated(self, wwpn):
+
+        """
+        Free a WWPN allocated with :meth:`wwpn_alloc`.
+
+        If the WWPN is not currently allocated or not in the pool
+        range, nothing happens.
+
+        Parameters:
+          WWPN (string): The WWPN as 16 hexadecimal digits.
+        """
+        wwpn_int = int(wwpn[-4:], 16)
+        self._wwpn_pool.free_if_allocated(wwpn_int)
+
 
 class FakedPortManager(FakedBaseManager):
     """

WWPN is not attaching in mock frmework

In mock framework when we create hba then it should also attach 'wwpn'. But as of now it is not attaching.
self.partition.hbas[0].get_property('wwpn')


diff --git a/tests/unit/zhmcclient_mock/test_urihandler.py b/tests/unit/zhmcclient_mock/test_urihandler.py
index eecbb13..6febc10 100755
--- a/tests/unit/zhmcclient_mock/test_urihandler.py
+++ b/tests/unit/zhmcclient_mock/test_urihandler.py
@@ -453,7 +453,7 @@ def standard_test_hmc():
                                     'description': 'HBA #1 in Partition #1',
                                     'adapter-port-uri':
                                         '/api/adapters/2/storage-ports/1',
-                                    'wwpn': 'wwpn_1',
+                                    'wwpn': 'CFFEAFFE00008001',
                                     'device-number': '1001',
                                 },
                             },
@@ -782,7 +782,7 @@ class CpcExportPortNamesListHandlerTests(unittest.TestCase):
             ]
         }
         exp_wwpn_list = [
-            'partition_1,2,1001,wwpn_1',
+            'partition_1,2,1001,CFFEAFFE00008001',
         ]
 
         # the function to be tested:
@@ -1108,7 +1108,7 @@ class HbaHandlerTests(unittest.TestCase):
             'name': 'hba_1',
             'description': 'HBA #1 in Partition #1',
             'adapter-port-uri': '/api/adapters/2/storage-ports/1',
-            'wwpn': 'wwpn_1',
+            'wwpn': 'CFFEAFFE00008001',
             'device-number': '1001',
         }
         self.assertEqual(hba1, exp_hba1)
@@ -1138,6 +1138,7 @@ class HbaHandlerTests(unittest.TestCase):
             'name': 'hba_2',
             'adapter-port-uri': '/api/adapters/2/storage-ports/1',
             'device-number': hba2['device-number'],  # auto-generated
+            'wwpn': hba2['wwpn'],  # auto-generated
         }
 
         self.assertEqual(hba2, exp_hba2)

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest pytest-cov pytest-mock pytest-xdist pytest-asyncio mock
apt-get update apt-get install -y gcc
3.9
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
certifi==2025.1.31
charset-normalizer==3.4.1
click==8.1.8
click-repl==0.3.0
click-spinner==0.1.10
coverage==7.8.0
decorator==5.2.1
docopt==0.6.2
exceptiongroup==1.2.2
execnet==2.1.1
idna==3.10
iniconfig==2.1.0
mock==5.2.0
packaging==24.2
pbr==6.1.1
pluggy==1.5.0
progressbar2==4.5.0
prompt_toolkit==3.0.50
pytest==8.3.5
pytest-asyncio==0.26.0
pytest-cov==6.0.0
pytest-mock==3.14.0
pytest-xdist==3.6.1
python-utils==3.9.1
requests==2.32.3
six==1.17.0
stomp.py==8.2.0
tabulate==0.9.0
tomli==2.2.1
typing_extensions==4.13.0
urllib3==2.3.0
wcwidth==0.2.13
websocket-client==1.8.0
-e git+https://github.com/zhmcclient/python-zhmcclient.git@c52016859aae083f10ef7be7ebef87b60a54554c#egg=zhmcclient

name: python-zhmcclient
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - certifi==2025.1.31
      - charset-normalizer==3.4.1
      - click==8.1.8
      - click-repl==0.3.0
      - click-spinner==0.1.10
      - coverage==7.8.0
      - decorator==5.2.1
      - docopt==0.6.2
      - exceptiongroup==1.2.2
      - execnet==2.1.1
      - idna==3.10
      - iniconfig==2.1.0
      - mock==5.2.0
      - packaging==24.2
      - pbr==6.1.1
      - pluggy==1.5.0
      - progressbar2==4.5.0
      - prompt-toolkit==3.0.50
      - pytest==8.3.5
      - pytest-asyncio==0.26.0
      - pytest-cov==6.0.0
      - pytest-mock==3.14.0
      - pytest-xdist==3.6.1
      - python-utils==3.9.1
      - requests==2.32.3
      - six==1.17.0
      - stomp-py==8.2.0
      - tabulate==0.9.0
      - tomli==2.2.1
      - typing-extensions==4.13.0
      - urllib3==2.3.0
      - wcwidth==0.2.13
      - websocket-client==1.8.0
prefix: /opt/conda/envs/python-zhmcclient

tests/unit/zhmcclient_mock/test_urihandler.py::HbaHandlerTests::test_create_verify
tests/unit/zhmcclient_mock/test_urihandler.py::HTTPErrorTests::test_attributes tests/unit/zhmcclient_mock/test_urihandler.py::HTTPErrorTests::test_response tests/unit/zhmcclient_mock/test_urihandler.py::InvalidResourceErrorTests::test_attributes_no_handler tests/unit/zhmcclient_mock/test_urihandler.py::InvalidResourceErrorTests::test_attributes_with_handler tests/unit/zhmcclient_mock/test_urihandler.py::InvalidMethodErrorTests::test_attributes_no_handler tests/unit/zhmcclient_mock/test_urihandler.py::InvalidMethodErrorTests::test_attributes_with_handler tests/unit/zhmcclient_mock/test_urihandler.py::CpcNotInDpmErrorTests::test_attributes tests/unit/zhmcclient_mock/test_urihandler.py::CpcInDpmErrorTests::test_attributes tests/unit/zhmcclient_mock/test_urihandler.py::UriHandlerHandlerEmptyTests::test_uris_empty_1 tests/unit/zhmcclient_mock/test_urihandler.py::UriHandlerHandlerEmptyTests::test_uris_empty_2 tests/unit/zhmcclient_mock/test_urihandler.py::UriHandlerHandlerSimpleTests::test_err_begin_extra tests/unit/zhmcclient_mock/test_urihandler.py::UriHandlerHandlerSimpleTests::test_err_begin_missing tests/unit/zhmcclient_mock/test_urihandler.py::UriHandlerHandlerSimpleTests::test_err_end2_extra tests/unit/zhmcclient_mock/test_urihandler.py::UriHandlerHandlerSimpleTests::test_err_end2_missing tests/unit/zhmcclient_mock/test_urihandler.py::UriHandlerHandlerSimpleTests::test_err_end2_slash tests/unit/zhmcclient_mock/test_urihandler.py::UriHandlerHandlerSimpleTests::test_err_end_extra tests/unit/zhmcclient_mock/test_urihandler.py::UriHandlerHandlerSimpleTests::test_err_end_missing tests/unit/zhmcclient_mock/test_urihandler.py::UriHandlerHandlerSimpleTests::test_err_end_slash tests/unit/zhmcclient_mock/test_urihandler.py::UriHandlerHandlerSimpleTests::test_ok1 tests/unit/zhmcclient_mock/test_urihandler.py::UriHandlerHandlerSimpleTests::test_ok2 tests/unit/zhmcclient_mock/test_urihandler.py::UriHandlerHandlerSimpleTests::test_ok3 tests/unit/zhmcclient_mock/test_urihandler.py::UriHandlerMethodTests::test_delete_cpc2 tests/unit/zhmcclient_mock/test_urihandler.py::UriHandlerMethodTests::test_get_cpc1 tests/unit/zhmcclient_mock/test_urihandler.py::UriHandlerMethodTests::test_get_cpcs tests/unit/zhmcclient_mock/test_urihandler.py::UriHandlerMethodTests::test_post_cpcs tests/unit/zhmcclient_mock/test_urihandler.py::GenericGetPropertiesHandlerTests::test_get tests/unit/zhmcclient_mock/test_urihandler.py::GenericUpdatePropertiesHandlerTests::test_update_verify tests/unit/zhmcclient_mock/test_urihandler.py::VersionHandlerTests::test_get_version tests/unit/zhmcclient_mock/test_urihandler.py::CpcHandlersTests::test_get tests/unit/zhmcclient_mock/test_urihandler.py::CpcHandlersTests::test_list tests/unit/zhmcclient_mock/test_urihandler.py::CpcHandlersTests::test_update_verify tests/unit/zhmcclient_mock/test_urihandler.py::CpcStartStopHandlerTests::test_start_classic tests/unit/zhmcclient_mock/test_urihandler.py::CpcStartStopHandlerTests::test_stop_classic tests/unit/zhmcclient_mock/test_urihandler.py::CpcStartStopHandlerTests::test_stop_start_dpm tests/unit/zhmcclient_mock/test_urihandler.py::CpcExportPortNamesListHandlerTests::test_invoke_err_no_input tests/unit/zhmcclient_mock/test_urihandler.py::CpcExportPortNamesListHandlerTests::test_invoke_ok tests/unit/zhmcclient_mock/test_urihandler.py::AdapterHandlersTests::test_get tests/unit/zhmcclient_mock/test_urihandler.py::AdapterHandlersTests::test_list tests/unit/zhmcclient_mock/test_urihandler.py::AdapterHandlersTests::test_update_verify tests/unit/zhmcclient_mock/test_urihandler.py::NetworkPortHandlersTests::test_get tests/unit/zhmcclient_mock/test_urihandler.py::NetworkPortHandlersTests::test_update_verify tests/unit/zhmcclient_mock/test_urihandler.py::StoragePortHandlersTests::test_get tests/unit/zhmcclient_mock/test_urihandler.py::StoragePortHandlersTests::test_update_verify tests/unit/zhmcclient_mock/test_urihandler.py::PartitionHandlersTests::test_create_verify tests/unit/zhmcclient_mock/test_urihandler.py::PartitionHandlersTests::test_delete_verify tests/unit/zhmcclient_mock/test_urihandler.py::PartitionHandlersTests::test_get tests/unit/zhmcclient_mock/test_urihandler.py::PartitionHandlersTests::test_list tests/unit/zhmcclient_mock/test_urihandler.py::PartitionHandlersTests::test_update_verify tests/unit/zhmcclient_mock/test_urihandler.py::PartitionStartStopHandlerTests::test_start_stop tests/unit/zhmcclient_mock/test_urihandler.py::HbaHandlerTests::test_delete_verify tests/unit/zhmcclient_mock/test_urihandler.py::HbaHandlerTests::test_get tests/unit/zhmcclient_mock/test_urihandler.py::HbaHandlerTests::test_list tests/unit/zhmcclient_mock/test_urihandler.py::HbaHandlerTests::test_update_verify tests/unit/zhmcclient_mock/test_urihandler.py::NicHandlerTests::test_create_verify tests/unit/zhmcclient_mock/test_urihandler.py::NicHandlerTests::test_delete_verify tests/unit/zhmcclient_mock/test_urihandler.py::NicHandlerTests::test_get tests/unit/zhmcclient_mock/test_urihandler.py::NicHandlerTests::test_list tests/unit/zhmcclient_mock/test_urihandler.py::NicHandlerTests::test_update_verify tests/unit/zhmcclient_mock/test_urihandler.py::VirtualFunctionHandlerTests::test_create_verify tests/unit/zhmcclient_mock/test_urihandler.py::VirtualFunctionHandlerTests::test_delete_verify tests/unit/zhmcclient_mock/test_urihandler.py::VirtualFunctionHandlerTests::test_get tests/unit/zhmcclient_mock/test_urihandler.py::VirtualFunctionHandlerTests::test_list tests/unit/zhmcclient_mock/test_urihandler.py::VirtualFunctionHandlerTests::test_update_verify tests/unit/zhmcclient_mock/test_urihandler.py::VirtualSwitchHandlersTests::test_get tests/unit/zhmcclient_mock/test_urihandler.py::VirtualSwitchHandlersTests::test_list tests/unit/zhmcclient_mock/test_urihandler.py::LparHandlersTests::test_get tests/unit/zhmcclient_mock/test_urihandler.py::LparHandlersTests::test_list tests/unit/zhmcclient_mock/test_urihandler.py::LparActLoadDeactHandlerTests::test_start_stop tests/unit/zhmcclient_mock/test_urihandler.py::ResetActProfileHandlersTests::test_get tests/unit/zhmcclient_mock/test_urihandler.py::ResetActProfileHandlersTests::test_list tests/unit/zhmcclient_mock/test_urihandler.py::ImageActProfileHandlersTests::test_get tests/unit/zhmcclient_mock/test_urihandler.py::ImageActProfileHandlersTests::test_list tests/unit/zhmcclient_mock/test_urihandler.py::LoadActProfileHandlersTests::test_get tests/unit/zhmcclient_mock/test_urihandler.py::LoadActProfileHandlersTests::test_list
docs/changes.rst zhmcclient_mock/_hmc.py
docs/changes.rst zhmcclient_mock/_hmc.py