use of org.opendaylight.netconf.util.mapping.AbstractNetconfOperation.OperationNameAndNamespace in project netconf by opendaylight.
the class SubtreeFilter method applyRpcSubtreeFilter.
public static Document applyRpcSubtreeFilter(final Document requestDocument, final Document rpcReply) throws DocumentedException {
OperationNameAndNamespace operationNameAndNamespace = new OperationNameAndNamespace(requestDocument);
if (XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0.equals(operationNameAndNamespace.getNamespace()) && XmlNetconfConstants.GET.equals(operationNameAndNamespace.getOperationName()) || XmlNetconfConstants.GET_CONFIG.equals(operationNameAndNamespace.getOperationName())) {
// process subtree filtering here, in case registered netconf operations do
// not implement filtering.
Optional<XmlElement> maybeFilter = operationNameAndNamespace.getOperationElement().getOnlyChildElementOptionally(XmlNetconfConstants.FILTER, XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);
if (maybeFilter.isEmpty()) {
return rpcReply;
}
XmlElement filter = maybeFilter.get();
if (isSupported(filter)) {
// do
return filtered(maybeFilter.get(), rpcReply);
}
}
// return identical document
return rpcReply;
}
Aggregations