diff --git a/data/crac-creation/crac-creator-csa-profiles/src/main/java/com/powsybl/openrao/data/craccreation/creator/csaprofile/craccreator/remedialaction/CsaProfileRemedialActionsCreator.java b/data/crac-creation/crac-creator-csa-profiles/src/main/java/com/powsybl/openrao/data/craccreation/creator/csaprofile/craccreator/remedialaction/CsaProfileRemedialActionsCreator.java index f2a03f124c..f480b633e8 100644 --- a/data/crac-creation/crac-creator-csa-profiles/src/main/java/com/powsybl/openrao/data/craccreation/creator/csaprofile/craccreator/remedialaction/CsaProfileRemedialActionsCreator.java +++ b/data/crac-creation/crac-creator-csa-profiles/src/main/java/com/powsybl/openrao/data/craccreation/creator/csaprofile/craccreator/remedialaction/CsaProfileRemedialActionsCreator.java @@ -254,7 +254,7 @@ private Set createRemedialActionGroups() { } NetworkAction refNetworkAction = crac.getNetworkAction(refRemedialActionDependency.remedialAction()); - if (refRemedialActionDependency.remedialAction() == null) { + if (refNetworkAction == null) { standaloneRasImplicatedIntoAGroup.addAll(dependingEnabledRemedialActions.stream().map(RemedialActionDependency::remedialAction).collect(Collectors.toSet())); throw new OpenRaoImportException(ImportStatus.INCONSISTENCY_IN_DATA, "Remedial action group " + remedialActionGroup.mrid() + " will not be imported because the remedial action " + refRemedialActionDependency.remedialAction() + " does not exist or not imported. All RA's depending in that group will be ignored: " + printRaIds(dependingEnabledRemedialActions)); } diff --git a/data/crac-creation/crac-creator-csa-profiles/src/test/java/com/powsybl/openrao/data/craccreation/creator/csaprofile/craccreator/remedialaction/GroupRemedialActionTest.java b/data/crac-creation/crac-creator-csa-profiles/src/test/java/com/powsybl/openrao/data/craccreation/creator/csaprofile/craccreator/remedialaction/GroupRemedialActionTest.java index 0ac3bb7dcc..da43cc56e7 100644 --- a/data/crac-creation/crac-creator-csa-profiles/src/test/java/com/powsybl/openrao/data/craccreation/creator/csaprofile/craccreator/remedialaction/GroupRemedialActionTest.java +++ b/data/crac-creation/crac-creator-csa-profiles/src/test/java/com/powsybl/openrao/data/craccreation/creator/csaprofile/craccreator/remedialaction/GroupRemedialActionTest.java @@ -131,4 +131,10 @@ private boolean hasTopologicalAction(Set elementaryActions, St .anyMatch(action -> ((TopologicalAction) action).getNetworkElement().getId().equals(elementId) && ((TopologicalAction) action).getActionType().equals(actionType)); } + @Test + void testImportRemedialActionGroupFromInvalidTopologyAction() { + CsaProfileCracCreationContext cracCreationContext = getCsaCracCreationContext("/profiles/remedialactions/RemedialActionGroupFromInvalidTopologyAction.zip", NETWORK); + assertTrue(cracCreationContext.getCrac().getNetworkActions().isEmpty()); + } + } diff --git a/data/crac-creation/crac-creator-csa-profiles/src/test/resources/profiles/remedialactions/RemedialActionGroupFromInvalidTopologyAction.zip b/data/crac-creation/crac-creator-csa-profiles/src/test/resources/profiles/remedialactions/RemedialActionGroupFromInvalidTopologyAction.zip new file mode 100644 index 0000000000..f56a0686e4 Binary files /dev/null and b/data/crac-creation/crac-creator-csa-profiles/src/test/resources/profiles/remedialactions/RemedialActionGroupFromInvalidTopologyAction.zip differ