diff --git a/src/pathcomp/frontend/service/algorithms/tools/ComposeConfigRules.py b/src/pathcomp/frontend/service/algorithms/tools/ComposeConfigRules.py
index 91367e23f29a02aa3e9605fcd0d2864b9191d800..c6621773b8b45230358eebff2c60b95aacdda31f 100644
--- a/src/pathcomp/frontend/service/algorithms/tools/ComposeConfigRules.py
+++ b/src/pathcomp/frontend/service/algorithms/tools/ComposeConfigRules.py
@@ -19,7 +19,8 @@ from common.tools.object_factory.ConfigRule import json_config_rule_set
 
 SETTINGS_RULE_NAME = '/settings'
 
-DEV_EP_SETTINGS = re.compile(r'\/device\[([^\]]+)\]\/endpoint\[([^\]]+)\]\/settings')
+DEVICE_SETTINGS = re.compile(r'\/device\[([^\]]+)\]\/settings')
+ENDPOINT_SETTINGS = re.compile(r'\/device\[([^\]]+)\]\/endpoint\[([^\]]+)\]\/settings')
 
 L2NM_SETTINGS_FIELD_DEFAULTS = {
     'encapsulation_type': 'dot1q',
@@ -76,26 +77,37 @@ def compose_device_config_rules(
     device_name_mapping : Dict[str, str], endpoint_name_mapping : Dict[Tuple[str, str], str]
 ) -> None:
 
+    devices_traversed = set()
     endpoints_traversed = set()
     for path_hop in path_hops:
         device_uuid_or_name = path_hop['device']
+        devices_traversed.add(device_uuid_or_name)
         endpoints_traversed.add((device_uuid_or_name, path_hop['ingress_ep']))
         endpoints_traversed.add((device_uuid_or_name, path_hop['egress_ep']))
 
     for config_rule in config_rules:
         if config_rule.WhichOneof('config_rule') != 'custom': continue
-        match = DEV_EP_SETTINGS.match(config_rule.custom.resource_key)
-        if match is None: continue
 
-        device_uuid_or_name = match.group(1)
-        device_name_or_uuid = device_name_mapping[device_uuid_or_name]
-        device_keys = {device_uuid_or_name, device_name_or_uuid}
-
-        endpoint_uuid_or_name = match.group(2)
-        endpoint_name_or_uuid_1 = endpoint_name_mapping[(device_uuid_or_name, endpoint_uuid_or_name)]
-        endpoint_name_or_uuid_2 = endpoint_name_mapping[(device_name_or_uuid, endpoint_uuid_or_name)]
-        endpoint_keys = {endpoint_uuid_or_name, endpoint_name_or_uuid_1, endpoint_name_or_uuid_2}
-
-        device_endpoint_keys = set(itertools.product(device_keys, endpoint_keys))
-        if len(device_endpoint_keys.intersection(endpoints_traversed)) == 0: continue
-        subservice_config_rules.append(config_rule)
+        match = DEVICE_SETTINGS.match(config_rule.custom.resource_key)
+        if match is not None:
+            device_uuid_or_name = match.group(1)
+            device_name_or_uuid = device_name_mapping[device_uuid_or_name]
+            device_keys = {device_uuid_or_name, device_name_or_uuid}
+
+            if len(device_keys.intersection(devices_traversed)) == 0: continue
+            subservice_config_rules.append(config_rule)
+
+        match = ENDPOINT_SETTINGS.match(config_rule.custom.resource_key)
+        if match is not None:
+            device_uuid_or_name = match.group(1)
+            device_name_or_uuid = device_name_mapping[device_uuid_or_name]
+            device_keys = {device_uuid_or_name, device_name_or_uuid}
+
+            endpoint_uuid_or_name = match.group(2)
+            endpoint_name_or_uuid_1 = endpoint_name_mapping[(device_uuid_or_name, endpoint_uuid_or_name)]
+            endpoint_name_or_uuid_2 = endpoint_name_mapping[(device_name_or_uuid, endpoint_uuid_or_name)]
+            endpoint_keys = {endpoint_uuid_or_name, endpoint_name_or_uuid_1, endpoint_name_or_uuid_2}
+
+            device_endpoint_keys = set(itertools.product(device_keys, endpoint_keys))
+            if len(device_endpoint_keys.intersection(endpoints_traversed)) == 0: continue
+            subservice_config_rules.append(config_rule)