Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NetConf session create Subscription is not working for filter type=xpath #73

Open
mohit-telsiz opened this issue Oct 25, 2016 · 1 comment

Comments

@mohit-telsiz
Copy link

mohit-telsiz commented Oct 25, 2016

The createSubscription() creates a Malformed rpc request xml if filter argument is present.
[Found in JNC1.2 release]

`int encode_createSubscription(Transport out, String stream,
String filter, String startTime, String stopTime) {
final String prefix = Element.defaultPrefixes
.nsToPrefix(Capabilities.NS_NOTIFICATION);
final String ncn = mk_prefix_colon(prefix);
final String xmlnsAttr = mk_xmlns_attr(prefix,
Capabilities.NS_NOTIFICATION);

    final int mid = encode_rpc_begin(out);
    out.println("<" + ncn + "create-subscription " + xmlnsAttr + ">");
    if (stream != null) {
        out.print("<" + ncn + STREAM_GT);
        out.print(stream);
        out.println("</" + ncn + STREAM_GT);
    }
    **if (filter != null) {
        out.print("<" + ncn + FILTER + ncn + "type='xpath'>");
        out.print(filter);
        out.println("</" + ncn + FILTER_GT);
    }**
    if (startTime != null) {
        out.print("<" + ncn + START_TIME_GT);
        out.print(startTime);
        out.println("</" + ncn + START_TIME_GT);
    }
    if (stopTime != null) {
        out.print("<" + ncn + STOP_TIME_GT);
        out.print(stopTime);
        out.println("</" + ncn + STOP_TIME_GT);
    }
    out.println("</" + ncn + "create-subscription>");
    encode_rpc_end(out);
    return mid;
}`

Highlighted code snippet shows that if filter type is xpath then the 'filter' string should be used as value for 'select' attribute within element, which is missing here

@klacke
Copy link

klacke commented Oct 26, 2016

Ok, I guess no one has ever done this, it's not the most common
thing to do though, I've never done it.

Can you provide a proper patch maybe ??

/klacke

On 26/10/16 01:19, mohit-telsiz wrote:

The createSubscription() creates a Malformed rpc request xml if filter
argument is present.
`int encode_createSubscription(Transport out, String stream,
String filter, String startTime, String stopTime) {
final String prefix = Element.defaultPrefixes
.nsToPrefix(Capabilities.NS_NOTIFICATION);
final String ncn = mk_prefix_colon(prefix);
final String xmlnsAttr = mk_xmlns_attr(prefix,
Capabilities.NS_NOTIFICATION);

|final int mid = encode_rpc_begin(out); out.println("<" + ncn +
"create-subscription " + xmlnsAttr + ">"); if (stream != null) {
out.print("<" + ncn + STREAM_GT); out.print(stream); out.println("</" +
ncn + STREAM_GT); } **if (filter != null) { out.print("<" + ncn + FILTER

  • ncn + "type='xpath'>"); out.print(filter); out.println("</" + ncn +
    FILTER_GT); }** if (startTime != null) { out.print("<" + ncn +
    START_TIME_GT); out.print(startTime); out.println("</" + ncn +
    START_TIME_GT); } if (stopTime != null) { out.print("<" + ncn +
    STOP_TIME_GT); out.print(stopTime); out.println("</" + ncn +
    STOP_TIME_GT); } out.println("</" + ncn + "create-subscription>");
    encode_rpc_end(out); return mid; }` |

Highlighted code snippet shows that if filter type is xpath then the
'filter' string should be used as value for 'select' attribute within
element, which is missing here


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#73, or mute the thread
https://github.com/notifications/unsubscribe-auth/AADYIHVR3gDBuoBsNtR4UFA_6vctnI4Lks5q3o5ygaJpZM4Kgl4s.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants