summaryrefslogtreecommitdiffstats
path: root/netconf/restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/util/OperationsRestconfModule.java
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2023-01-31 16:57:11 -0500
committerDan Timoney <dtimoney@att.com>2023-01-31 16:57:11 -0500
commitd76e58f792700c96d864237efd4539505cbf2b60 (patch)
tree645019d6cbee581a30aba87c29305ba95e33e9d9 /netconf/restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/util/OperationsRestconfModule.java
parentd4d6fbd430eb502cce6cb01a667ec799d487a510 (diff)
Port Biermann-draft-02 API to Chlorine
Made changes to get a clean compile under Chlorine. NOTE: changes in Chlorine break the jUnit testing for this feature - mostly due to changes in yangtools making classes sealed, which prevents use of mockito to simulate these classes. There are other changes as well that caused breakage. For now, pom.xml has been changed to disable jUnit, but this should be corrected. Issue-ID: CCSDK-3843 Signed-off-by: Dan Timoney <dtimoney@att.com> Change-Id: Ic53c6d580d644fab069a06f033db515c05dff6f2
Diffstat (limited to 'netconf/restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/util/OperationsRestconfModule.java')
-rw-r--r--netconf/restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/util/OperationsRestconfModule.java62
1 files changed, 62 insertions, 0 deletions
diff --git a/netconf/restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/util/OperationsRestconfModule.java b/netconf/restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/util/OperationsRestconfModule.java
new file mode 100644
index 0000000..467db9b
--- /dev/null
+++ b/netconf/restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/util/OperationsRestconfModule.java
@@ -0,0 +1,62 @@
+/*
+ * 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.restconf.common.util;
+
+import static java.util.Objects.requireNonNull;
+
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.QNameModule;
+import org.opendaylight.yangtools.yang.common.XMLNamespace;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+
+final class OperationsRestconfModule extends AbstractOperationsModule {
+ // There is no need to intern this nor add a revision, as we are providing the corresponding context anyway
+ static final @NonNull QNameModule NAMESPACE =
+ QNameModule.create(XMLNamespace.of("urn:ietf:params:xml:ns:yang:ietf-restconf"));
+
+ private final OperationsContainerSchemaNode operations;
+
+ OperationsRestconfModule(final OperationsContainerSchemaNode operations) {
+ this.operations = requireNonNull(operations);
+ }
+
+ @Override
+ public String getName() {
+ return "ietf-restconf";
+ }
+
+ @Override
+ public QNameModule getQNameModule() {
+ return NAMESPACE;
+ }
+
+ @Override
+ public String getPrefix() {
+ return "rc";
+ }
+
+ @Override
+ public Collection<DataSchemaNode> getChildNodes() {
+ return List.of(operations);
+ }
+
+ @Override
+ public DataSchemaNode dataChildByName(final QName name) {
+ return operations.getQName().equals(requireNonNull(name)) ? operations : null;
+ }
+
+ @Override
+ public List<EffectiveStatement<?, ?>> effectiveSubstatements() {
+ // This is not accurate, but works for now
+ return List.of();
+ }
+}