From 77bf9003bfe58d57a860164ffcfe7cf3deb8c1be Mon Sep 17 00:00:00 2001 From: Jan Hajnar Date: Thu, 28 May 2015 23:28:46 +0200 Subject: [PATCH] Bug 3427 - Websockets: Cannot create stream if path contains predicates or if target is a leaf * fixed registration of path containing nodes with predicates * added abillity to listen on leaves Change-Id: I2e74aa6bbc50137187a5f7ece8de6ca288a1ebbf Signed-off-by: Jan Hajnar (cherry picked from commit 2a5c10374e32ca292466c3a43a120bfc2df0de90) --- .../sal/restconf/impl/ControllerContext.java | 14 +++++++------- .../controller/sal/restconf/impl/RestconfImpl.java | 3 +-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/ControllerContext.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/ControllerContext.java index 6cc62e859c..8b5951197d 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/ControllerContext.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/ControllerContext.java @@ -281,12 +281,12 @@ public class ControllerContext implements SchemaContextListener { if (!(element instanceof AugmentationIdentifier)) { final QName _nodeType = element.getNodeType(); final DataSchemaNode potentialNode = ControllerContext.childByQName(node, _nodeType); - if (!(element instanceof NodeIdentifier && potentialNode instanceof ListSchemaNode)) { - if (!ControllerContext.isListOrContainer(potentialNode)) { - return null; + if (!(element instanceof NodeIdentifier && potentialNode instanceof ListSchemaNode) && + !(potentialNode instanceof ChoiceSchemaNode)) { + builder.append(convertToRestconfIdentifier(element, potentialNode, mount)); + if (potentialNode instanceof DataNodeContainer) { + node = (DataNodeContainer) potentialNode; } - builder.append(convertToRestconfIdentifier(element, (DataNodeContainer) potentialNode, mount)); - node = (DataNodeContainer) potentialNode; } } } @@ -867,8 +867,8 @@ public class ControllerContext implements SchemaContextListener { return null; } - private CharSequence convertToRestconfIdentifier(final PathArgument argument, final DataNodeContainer node, final DOMMountPoint mount) { - if (argument instanceof NodeIdentifier && node instanceof ContainerSchemaNode) { + private CharSequence convertToRestconfIdentifier(final PathArgument argument, final DataSchemaNode node, final DOMMountPoint mount) { + if (argument instanceof NodeIdentifier) { return convertToRestconfIdentifier((NodeIdentifier) argument, mount); } else if (argument instanceof NodeIdentifierWithPredicates && node instanceof ListSchemaNode) { return convertToRestconfIdentifierWithPredicates((NodeIdentifierWithPredicates) argument, (ListSchemaNode) node, mount); diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestconfImpl.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestconfImpl.java index c329f525a9..08ba91fe85 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestconfImpl.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestconfImpl.java @@ -568,8 +568,7 @@ public class RestconfImpl implements RestconfService { .withChild(ImmutableNodes.leafNode(streamNameQname, streamName)).build(); if (!Notificator.existListenerFor(streamName)) { - final YangInstanceIdentifier normalizedPathIdentifier = controllerContext.toNormalized(pathIdentifier); - Notificator.createListener(normalizedPathIdentifier, streamName); + Notificator.createListener(pathIdentifier, streamName); } final DOMRpcResult defaultDOMRpcResult = new DefaultDOMRpcResult(output); -- 2.36.6