Skip to content

Commit

Permalink
feat(83): RSR-389 - ignore INACTIVE CompasFlow when creating Dataset
Browse files Browse the repository at this point in the history
Signed-off-by: massifben <[email protected]>
  • Loading branch information
massifben committed Nov 23, 2022
1 parent e956419 commit 4957b6b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -249,14 +249,19 @@ public List<SclReportItem> updateAllSourceDataSetsAndControlBlocks() {
return getExtRefs().stream()
.filter(this::areBindingAttributesPresent)
.filter(this::isExternalBound)
//TODO: replace filter below by criteria of issue #93 RSR-389
// - Active or Untested i.e /IED/LDevice/LN0/Inputs/Private/compas:Flow @FlowStatus="ACTIVE" OR "UNTESTED"
.filter(extRef -> !getMatchingCompasFlows(extRef, compasFlows).isEmpty())
.filter(extRef -> matchingCompasFlowIsActiveOrUntested(extRef, compasFlows))
.map(extRef -> updateSourceDataSetsAndControlBlocks(extRef, currentBayUuid))
.flatMap(Optional::stream)
.toList();
}

private boolean matchingCompasFlowIsActiveOrUntested(TExtRef extRef, List<TCompasFlow> compasFlows) {
return getMatchingCompasFlows(extRef, compasFlows).stream().findFirst()
.map(TCompasFlow::getFlowStatus)
.filter(flowStatus -> flowStatus == TCompasFlowStatus.ACTIVE || flowStatus == TCompasFlowStatus.UNTESTED)
.isPresent();
}

private boolean isExternalBound(TExtRef tExtRef) {
return !tExtRef.getIedName().equals(getIedAdapter().getName());
}
Expand Down Expand Up @@ -300,7 +305,9 @@ private Optional<SclReportItem> updateSourceDataSetsAndControlBlocks(TExtRef ext
}

Optional<SclReportItem> sclReportItem = removeFilteredSourceDas(extRef, sourceDas);
//TODO: map to FCDA in issue #84 RSR-433 and remove print to console
//TODO: #83 follow-up : grouping ExtRef by serviceType, iedName, ldInst, isBayInternal, and DA@fc
// will be done by calculating DataSet Name in #84 RSR-433
// TODO: map to FCDA in issue #84 RSR-433 and remove print to console
String daToPrint = sourceDas.stream()
.map(da -> da.getFc() + "#" + da.getDataAttributes())
.collect(Collectors.joining(","));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ public static Stream<Arguments> provideUpdateAllSourceDataSetsAndControlBlocksIg
Arguments.of(named("should ignore binding internal to IED",
new String[]{"test ignore internal binding"})),
Arguments.of(named("should ignore extref with missing binding attributes",
new String[]{"test ignore missing bindings attributes"}))
new String[]{"test ignore missing bindings attributes"})),
Arguments.of(named("should ignore extref when compas:Flow.FlowStatus is neither ACTIVE nor UNTESTED",
new String[]{"test ignore when compas:Flow.FlowStatus is neither ACTIVE nor UNTESTED"}))
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<compas:Flow dataStreamKey="test no daName and doName with instance number and SDO" FlowID="1" FlowKind="BAY_INTERNAL" ExtRefiedName="IED_NAME2" ExtReflnClass="ANCR" ExtRefldinst="LD_INST21" ExtReflnInst="1" ExtRefprefix="" FlowStatus="ACTIVE"/>
<compas:Flow dataStreamKey="test ignore internal binding" FlowID="1" FlowKind="BAY_INTERNAL" ExtRefiedName="IED_NAME1" ExtReflnClass="ANCR" ExtRefldinst="LD_INST12" ExtReflnInst="1" ExtRefprefix="" FlowStatus="ACTIVE"/>
<compas:Flow dataStreamKey="test ignore missing bindings attributes" FlowID="1" FlowKind="BAY_INTERNAL" ExtRefiedName="IED_NAME2" ExtReflnClass="ANCR" ExtRefldinst="LD_INST21" ExtReflnInst="1" ExtRefprefix="" FlowStatus="ACTIVE"/>
<compas:Flow dataStreamKey="test ignore when compas:Flow.FlowStatus is neither ACTIVE nor UNTESTED" FlowID="1" FlowKind="BAY_EXTERNAL" ExtRefiedName="IED_NAME3" ExtReflnClass="ANCR" ExtRefldinst="LD_INST31" ExtReflnInst="1" ExtRefprefix="" FlowStatus="INACTIVE"/>
</Private>
<!-- bay internal -->
<ExtRef desc="test bay internal" iedName="IED_NAME2" ldInst="LD_INST21" lnClass="ANCR" lnInst="1" doName="DoName" daName="daNameST" serviceType="GOOSE" intAddr="INT_ADDR11" pDO="Do11.sdo11" pDA="da11.bda111.bda112.bda113"/>
Expand All @@ -61,6 +62,9 @@
<ExtRef desc="test ignore internal binding" iedName="IED_NAME1" ldInst="LD_INST12" lnClass="ANCR" lnInst="1" doName="DoName" intAddr="INT_ADDR11" pDO="Do11.sdo11" pDA="da11.bda111.bda112.bda113"/>
<!-- ignore missing binding attributes -->
<ExtRef desc="test ignore missing bindings attributes" intAddr="INT_ADDR11" pDO="Do11.sdo11" pDA="da11.bda111.bda112.bda113"/>
<!-- ignore when compas:Flow.FlowStatus is INACTIVE -->
<ExtRef desc="test ignore when compas:Flow.FlowStatus is neither ACTIVE nor UNTESTED" iedName="IED_NAME3" ldInst="LD_INST31" lnClass="ANCR" lnInst="1" doName="DoName" daName="daNameST" serviceType="GOOSE" intAddr="INT_ADDR11" pDO="Do11.sdo11" pDA="da11.bda111.bda112.bda113"/>

</Inputs>
</LN0>
</LDevice>
Expand Down

0 comments on commit 4957b6b

Please sign in to comment.