import com.google.common.collect.ImmutableSet;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.List;
import java.util.Objects;
import java.util.Optional;
import org.opendaylight.yangtools.yang.common.Empty;
@Override
public void apply(final InferenceContext ctx) {
+ if (!augmentNode.isSupportedToBuildEffective()) {
+ // We are not building effective model, hence we should not be performing any effects
+ return;
+ }
+
final var augmentTargetCtx = target.resolve(ctx);
if (!isSupportedAugmentTarget(augmentTargetCtx)
|| StmtContextUtils.isInExtensionBody(augmentTargetCtx)) {
* Do not fail, if it is an uses-augment to an unknown node.
*/
if (YangStmtMapping.USES == augmentNode.coerceParentContext().publicDefinition()) {
+ if (!augmentNode.isSupportedToBuildEffective()) {
+ // We are not supported, hence the uses is not effective and we should bail
+ return;
+ }
+
final SchemaNodeIdentifier augmentArg = augmentNode.getArgument();
final Optional<StmtContext<?, ?, ?>> targetNode = SchemaTreeNamespace.findNode(
AbstractAugmentStatementSupport.getSearchRoot(augmentNode), augmentArg);
throw new InferenceException(augmentNode, "Augment target '%s' not found", augmentNode.argument());
}
+ @Override
+ public void prerequisiteUnavailable(final Prerequisite<?> unavail) {
+ if (target.equals(unavail)) {
+ augmentNode.setUnsupported();
+ } else {
+ prerequisiteFailed(List.of(unavail));
+ }
+ }
+
private void copyFromSourceToTarget(final StmtContext<?, ?, ?> sourceCtx, final Mutable<?, ?, ?> targetCtx) {
final CopyType typeOfCopy = sourceCtx.coerceParentContext().producesDeclared(UsesStatement.class)
? CopyType.ADDED_BY_USES_AUGMENTATION : CopyType.ADDED_BY_AUGMENTATION;