import org.opendaylight.yangtools.yang.parser.spi.validation.ValidationBundlesNamespace;
import org.opendaylight.yangtools.yang.parser.spi.validation.ValidationBundlesNamespace.ValidationBundleType;
import org.opendaylight.yangtools.yang.parser.stmt.reactor.StatementContextBase;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public final class GroupingUtils {
+ private static final Logger LOG = LoggerFactory.getLogger(GroupingUtils.class);
+
private GroupingUtils() {
throw new UnsupportedOperationException();
}
return true;
}
- private static final Set<Rfc6020Mapping> NOCOPY_DEF_SET = ImmutableSet.of(
- Rfc6020Mapping.USES, Rfc6020Mapping.TYPEDEF, Rfc6020Mapping.TYPE);
- private static final Set<Rfc6020Mapping> NOCOPY_FROM_GROUPING_SET = ImmutableSet.of(
- Rfc6020Mapping.DESCRIPTION, Rfc6020Mapping.REFERENCE);
- private static final Set<Rfc6020Mapping> REUSED_DEF_SET = ImmutableSet.of(
- Rfc6020Mapping.TYPEDEF, Rfc6020Mapping.TYPE, Rfc6020Mapping.USES);
- private static final Set<Rfc6020Mapping> TOP_REUSED_DEF_SET = ImmutableSet.of(
- Rfc6020Mapping.TYPEDEF, Rfc6020Mapping.TYPE);
+ private static final Set<Rfc6020Mapping> NOCOPY_DEF_SET = ImmutableSet.of(Rfc6020Mapping.USES,
+ Rfc6020Mapping.TYPEDEF, Rfc6020Mapping.TYPE);
+ private static final Set<Rfc6020Mapping> NOCOPY_FROM_GROUPING_SET = ImmutableSet.of(Rfc6020Mapping.DESCRIPTION,
+ Rfc6020Mapping.REFERENCE, Rfc6020Mapping.STATUS);
+ private static final Set<Rfc6020Mapping> REUSED_DEF_SET = ImmutableSet.of(Rfc6020Mapping.TYPEDEF,
+ Rfc6020Mapping.TYPE, Rfc6020Mapping.USES);
+ private static final Set<Rfc6020Mapping> TOP_REUSED_DEF_SET = ImmutableSet.of(Rfc6020Mapping.TYPEDEF,
+ Rfc6020Mapping.TYPE);
public static boolean needToCopyByUses(final StmtContext<?, ?, ?> stmtContext) {
final StatementDefinition def = stmtContext.getPublicDefinition();
StatementContextBase<?, ?, ?> refineTargetNodeCtx = Utils.findNode(usesParentCtx, refineTargetNodeIdentifier);
Preconditions.checkArgument(refineTargetNodeCtx != null, "Refine target node %s not found. At %s",
refineTargetNodeIdentifier, refineCtx.getStatementSourceReference());
+ if (StmtContextUtils.isUnknownStatement(refineTargetNodeCtx)) {
+ LOG.warn("Refine node '{}' in uses '{}' has target node unknown statement '{}'. Refine has been skipped. At line: {}",
+ refineCtx.getStatementArgument(), refineCtx.getParentContext().getStatementArgument(), refineTargetNodeCtx.getStatementArgument(),
+ refineCtx.getStatementSourceReference());
+ refineCtx.addAsEffectOfStatement(refineTargetNodeCtx);
+ return;
+ }
addOrReplaceNodes(refineCtx, refineTargetNodeCtx);
refineCtx.addAsEffectOfStatement(refineTargetNodeCtx);
final StatementContextBase<?, ?, ?> refineTargetNodeCtx) {
StatementDefinition refineSubstatementDef = refineSubstatementCtx.getPublicDefinition();
- StatementDefinition refineTargetNodeDef = refineTargetNodeCtx.getPublicDefinition();
SourceException.throwIf(!isSupportedRefineTarget(refineSubstatementCtx, refineTargetNodeCtx),
refineSubstatementCtx.getStatementSourceReference(),