alexmaslenn: @matejart @anzoman updated commits and added tests as you had asked.
diff --git a/src/opera/parser/tosca/v_1_3/topology_template.py b/src/opera/parser/tosca/v_1_3/topology_template.py
index 1af5075..ce17793 100644
--- a/src/opera/parser/tosca/v_1_3/topology_template.py
+++ b/src/opera/parser/tosca/v_1_3/topology_template.py
@@ -64,3 +64,20 @@ class TopologyTemplate(Entity):
                 ),
             ) for name, definition in self.get("outputs", {}).items()
         }
+
+    def merge(self, other):
+        for key in (
+                "inputs",
+                "node_templates",
+                "data_types",
+                "relationship_templates",
+                "groups",
+                "policies",
+                "outputs"
+        ):
+            if key not in other.data:
+                continue
+            if key in self.data:
+                self.data[key].merge(other.data[key])
+            else:
+                self.data[key] = other.data[key]

node_templates section defined in imported service templates
## Description
In some cases, it would be useful to import a service template that already contains some node_templates defined. For example, in a situation, when a service template describing existing infastruture that cannot be modified externally (e.g. HPC nodes) is automatically generated by some service and later imported into other templates.  
## Prerequisites
- `opera` installed
- A valid TOSCA Service Template file `service.yaml` that contains an import definition of another valid TOSCA Service Template file with **topology_template** and **node_templates** sections defined.
## Steps
- User runs deploy `opera deploy service.yaml`
## Current behaviour
- xOpera returns an error `Duplicate keys 'node_templates' found in service.yml`
## Expected behavior
- Service template is deployed without error.

diff --git a/tests/unit/opera/parser/test_tosca.py b/tests/unit/opera/parser/test_tosca.py
index 88741eb..15607c7 100644
--- a/tests/unit/opera/parser/test_tosca.py
+++ b/tests/unit/opera/parser/test_tosca.py
@@ -140,3 +140,68 @@ class TestLoad:
         ))
 
         tosca.load(tmp_path, name)
+
+    def test_merge_topology_template(self, tmp_path, yaml_text):
+        name = pathlib.PurePath("template.yaml")
+        (tmp_path / name).write_text(yaml_text(
+            """
+            tosca_definitions_version: tosca_simple_yaml_1_3
+            imports:
+              - merge.yaml
+            topology_template:
+              inputs:
+                some-input:
+                  type: string
+              node_templates:
+                my_node:
+                  type: tosca.nodes.SoftwareComponent              
+            """
+        ))
+        (tmp_path / "merge.yaml").write_text(yaml_text(
+            """
+            tosca_definitions_version: tosca_simple_yaml_1_3
+            topology_template:
+              inputs:
+                other-input:
+                  type: string
+              node_templates:
+                other_node:
+                  type: tosca.nodes.SoftwareComponent 
+            """
+        ))
+        tosca.load(tmp_path, name)
+
+    def test_merge_duplicate_node_templates_invalid(self, tmp_path, yaml_text):
+        name = pathlib.PurePath("template.yaml")
+        (tmp_path / name).write_text(yaml_text(
+            """
+            tosca_definitions_version: tosca_simple_yaml_1_3
+            imports:
+              - merge1.yaml
+              - merge2.yaml
+            topology_template:
+              node_templates:
+                my_node:
+                  type: tosca.nodes.SoftwareComponent              
+            """
+        ))
+        (tmp_path / "merge1.yaml").write_text(yaml_text(
+            """
+            tosca_definitions_version: tosca_simple_yaml_1_3
+            topology_template:
+              node_templates:
+                other_node:
+                  type: tosca.nodes.SoftwareComponent 
+            """
+        ))
+        (tmp_path / "merge2.yaml").write_text(yaml_text(
+            """
+            tosca_definitions_version: tosca_simple_yaml_1_3
+            topology_template:
+              node_templates:
+                other_node:
+                  type: tosca.nodes.SoftwareComponent 
+            """
+        ))
+        with pytest.raises(ParseError):        
+            tosca.load(tmp_path, name)      
\ No newline at end of file

pip install -e .[openstack]
parse_log_pytest
requirements.txt
pytest selinux setuptools wheel twine
apt-get update apt-get install -y python3-venv python3-wheel python-wheel-common
3.7
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
ansible==4.10.0
ansible-core==2.11.12
bleach==6.0.0
certifi @ file:///croot/certifi_1671487769961/work/certifi
cffi==1.15.1
charset-normalizer==3.4.1
cryptography==44.0.2
decorator==5.1.1
distro==1.9.0
docutils==0.20.1
dogpile.cache==1.2.2
exceptiongroup==1.2.2
idna==3.10
importlib-metadata==6.7.0
importlib-resources==5.12.0
iniconfig==2.0.0
iso8601==2.1.0
jaraco.classes==3.2.3
jeepney==0.9.0
Jinja2==3.1.6
jmespath==1.0.1
jsonpatch==1.33
jsonpointer==3.0.0
keyring==24.1.1
keystoneauth1==5.1.3
markdown-it-py==2.2.0
MarkupSafe==2.1.5
mdurl==0.1.2
more-itertools==9.1.0
netifaces==0.11.0
openstacksdk==3.3.0
-e git+https://github.com/xlab-si/xopera-opera.git@ffe72a4dce9ac24f33304582577fed7b56ae34cd#egg=opera
os-service-types==1.7.0
packaging==24.0
pbr==6.1.1
pkginfo==1.10.0
platformdirs==4.0.0
pluggy==1.2.0
pycparser==2.21
Pygments==2.17.2
pytest==7.4.4
PyYAML==6.0.1
readme-renderer==37.3
requests==2.31.0
requests-toolbelt==1.0.0
requestsexceptions==1.4.0
resolvelib==0.5.4
rfc3986==2.0.0
rich==13.8.1
SecretStorage==3.3.3
selinux==0.2.1
six==1.17.0
stevedore==3.5.2
tomli==2.0.1
twine==4.0.2
typing_extensions==4.7.1
urllib3==2.0.7
webencodings==0.5.1
zipp==3.15.0

name: xopera-opera
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
  - certifi=2022.12.7=py37h06a4308_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=1.1.1w=h7f8727e_0
  - pip=22.3.1=py37h06a4308_0
  - python=3.7.16=h7a1cb2a_0
  - readline=8.2=h5eee18b_0
  - setuptools=65.6.3=py37h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.38.4=py37h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - ansible==4.10.0
      - ansible-core==2.11.12
      - bleach==6.0.0
      - cffi==1.15.1
      - charset-normalizer==3.4.1
      - cryptography==44.0.2
      - decorator==5.1.1
      - distro==1.9.0
      - docutils==0.20.1
      - dogpile-cache==1.2.2
      - exceptiongroup==1.2.2
      - idna==3.10
      - importlib-metadata==6.7.0
      - importlib-resources==5.12.0
      - iniconfig==2.0.0
      - iso8601==2.1.0
      - jaraco-classes==3.2.3
      - jeepney==0.9.0
      - jinja2==3.1.6
      - jmespath==1.0.1
      - jsonpatch==1.33
      - jsonpointer==3.0.0
      - keyring==24.1.1
      - keystoneauth1==5.1.3
      - markdown-it-py==2.2.0
      - markupsafe==2.1.5
      - mdurl==0.1.2
      - more-itertools==9.1.0
      - netifaces==0.11.0
      - openstacksdk==3.3.0
      - os-service-types==1.7.0
      - packaging==24.0
      - pbr==6.1.1
      - pkginfo==1.10.0
      - platformdirs==4.0.0
      - pluggy==1.2.0
      - pycparser==2.21
      - pygments==2.17.2
      - pytest==7.4.4
      - pyyaml==6.0.1
      - readme-renderer==37.3
      - requests==2.31.0
      - requests-toolbelt==1.0.0
      - requestsexceptions==1.4.0
      - resolvelib==0.5.4
      - rfc3986==2.0.0
      - rich==13.8.1
      - secretstorage==3.3.3
      - selinux==0.2.1
      - six==1.17.0
      - stevedore==3.5.2
      - tomli==2.0.1
      - twine==4.0.2
      - typing-extensions==4.7.1
      - urllib3==2.0.7
      - webencodings==0.5.1
      - zipp==3.15.0
prefix: /opt/conda/envs/xopera-opera

tests/unit/opera/parser/test_tosca.py::TestLoad::test_merge_topology_template
tests/unit/opera/parser/test_tosca.py::TestLoad::test_load_minimal_document tests/unit/opera/parser/test_tosca.py::TestLoad::test_empty_document_is_invalid tests/unit/opera/parser/test_tosca.py::TestLoad::test_stdlib_is_present[typ0] tests/unit/opera/parser/test_tosca.py::TestLoad::test_stdlib_is_present[typ1] tests/unit/opera/parser/test_tosca.py::TestLoad::test_stdlib_is_present[typ2] tests/unit/opera/parser/test_tosca.py::TestLoad::test_stdlib_is_present[typ3] tests/unit/opera/parser/test_tosca.py::TestLoad::test_stdlib_is_present[typ4] tests/unit/opera/parser/test_tosca.py::TestLoad::test_stdlib_is_present[typ5] tests/unit/opera/parser/test_tosca.py::TestLoad::test_stdlib_is_present[typ6] tests/unit/opera/parser/test_tosca.py::TestLoad::test_stdlib_is_present[typ7] tests/unit/opera/parser/test_tosca.py::TestLoad::test_custom_type_is_present[typ0] tests/unit/opera/parser/test_tosca.py::TestLoad::test_custom_type_is_present[typ1] tests/unit/opera/parser/test_tosca.py::TestLoad::test_custom_type_is_present[typ2] tests/unit/opera/parser/test_tosca.py::TestLoad::test_custom_type_is_present[typ3] tests/unit/opera/parser/test_tosca.py::TestLoad::test_custom_type_is_present[typ4] tests/unit/opera/parser/test_tosca.py::TestLoad::test_custom_type_is_present[typ5] tests/unit/opera/parser/test_tosca.py::TestLoad::test_custom_type_is_present[typ6] tests/unit/opera/parser/test_tosca.py::TestLoad::test_custom_type_is_present[typ7] tests/unit/opera/parser/test_tosca.py::TestLoad::test_loads_template_part tests/unit/opera/parser/test_tosca.py::TestLoad::test_load_from_csar_subfolder tests/unit/opera/parser/test_tosca.py::TestLoad::test_duplicate_import tests/unit/opera/parser/test_tosca.py::TestLoad::test_imports_from_multiple_levels tests/unit/opera/parser/test_tosca.py::TestLoad::test_merge_duplicate_node_templates_invalid
src/opera/parser/tosca/v_1_3/topology_template.py
src/opera/parser/tosca/v_1_3/topology_template.py