OpenConfig defines two extensions to deal with pattern statements.
The first is a semantic marker to tell the parser that OpenConfig's
interpretation of what is 'pattern' is used within that source file,
i.e. patterns are some variant of POSIX regular expression.
The second one is a properly-defined YANG extension which carries
the POSIX RE. This extension is a sibling to pattern statement,
whose argument is a YANG-compliant XSD regular expression.
JIRA: YANGTOOLS-1132
Change-Id: I6bd1c074eda2a02eea59913c939b9c236fdf8e8c
Signed-off-by: Martin Bobak <martin.bobak@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
// Revised extension, renames openconfig-encrypted-value to openconfig-hashed-value
private static final Revision HASHED_VALUE_REVISION = Revision.of("2017-04-11");
+ // Revised extension, adds extension for POSIX pattern statements
+ private static final Revision REGEXP_POSIX_REVISION = Revision.of("2020-06-16");
+
+ /**
+ * Runtime identity of model which exposed regexp-posix.
+ */
+ public static final QNameModule REGEXP_POSIX_MODULE = QNameModule.create(MODULE_NAMESPACE, REGEXP_POSIX_REVISION)
+ .intern();
/**
* Runtime identity of initial model.
*/
public static final SourceIdentifier HASHED_VALUE_SOURCE = RevisionSourceIdentifier.create(MODULE_NAME,
HASHED_VALUE_REVISION);
+ /**
+ * Original model source name.
+ */
+ public static final SourceIdentifier REGEXP_POSIX_SOURCE = RevisionSourceIdentifier.create(MODULE_NAME,
+ REGEXP_POSIX_REVISION);
/**
* Normative prefix to use when importing {@link #SEMVER_SOURCE} and later.
*/
--- /dev/null
+/*
+ * Copyright (c) 2020 PANTHEON.tech, s.r.o and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.openconfig.model.api;
+
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+
+/**
+ * Effective statement corresponding to openconfig's "posix-pattern".
+ *
+ * @author Martin Bobak
+ */
+public interface OpenConfigPosixPatternEffectiveStatement
+ extends EffectiveStatement<String, OpenConfigPosixPatternStatement> {
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.openconfig.model.api;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.UnknownStatement;
+
+/**
+ * Declared statement corresponding to config's "posix-pattern" .
+ *
+ * @author Martin Bobak
+ */
+public interface OpenConfigPosixPatternStatement extends UnknownStatement<String> {
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.openconfig.model.api;
+
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+
+/**
+ * Effective statement corresponding to config's "regexp-posix" .
+ */
+public interface OpenConfigRegexpPosixEffectiveStatement
+ extends EffectiveStatement<Void, OpenConfigRegexpPosixStatement> {
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.openconfig.model.api;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.UnknownStatement;
+
+/**
+ * Declared statement corresponding to config's "regexp-posix" .
+ *
+ * @author Martin Bobak
+ */
+public interface OpenConfigRegexpPosixStatement extends UnknownStatement<Void> {
+
+}
null, OpenConfigHashedValueStatement.class, OpenConfigHashedValueEffectiveStatement.class),
OPENCONFIG_HASHED_VALUE(QName.create(OpenConfigConstants.HASHED_VALUE_MODULE, "openconfig-hashed-value"), null,
OpenConfigHashedValueStatement.class, OpenConfigHashedValueEffectiveStatement.class),
+ OPENCONFIG_POSIX_PATTERN(QName.create(OpenConfigConstants.REGEXP_POSIX_MODULE, "posix-pattern"), "pattern",
+ OpenConfigPosixPatternStatement.class, OpenConfigPosixPatternEffectiveStatement.class),
+ OPENCONFIG_REGEXP_POSIX(QName.create(OpenConfigConstants.REGEXP_POSIX_MODULE, "regexp-posix"), null,
+ OpenConfigRegexpPosixStatement.class, OpenConfigRegexpPosixEffectiveStatement.class),
OPENCONFIG_VERSION(QName.create(OpenConfigConstants.MODULE_NAMESPACE, "openconfig-version"), "semver",
OpenConfigVersionStatement.class, OpenConfigVersionEffectiveStatement.class);