Defining an RPC method with packed parameters

asked 2017-08-30 07:43:48 -0800

VincentJahjah gravatar image

updated 2017-09-06 11:36:06 -0800

I defined an RPC method like this, and it worked very well:

rpc get-all-relevant-flows {
    description "Get all large flows currently on the network";
    output {
        leaf-list src-ip {
            type inet:ipv4-prefix;
        }
        leaf-list dest-ip {
            type inet:ipv4-prefix;
        }
        leaf-list byte-per-second {
            type uint32;
        }
    }
}

But then I thought "this is not very readable, because each flow is split into 3 lists. It's also not very clean, because what I'm really doing is sending a list of flows." So I rewrote the rpc method like this:

rpc get-all-relevant-flows {
    description "Get all large flows currently on the network";
    output {
        leaf relevant-flows {
            leaf-list src-ip {
                type inet:ipv4-prefix;
            }
            leaf-list dest-ip {
                type inet:ipv4-prefix;
            }
            leaf-list byte-per-second {
                type uint32;
            }
        }
    }
}

And I thought I was good; the yang compiled and generated the classes necessary for me to code the RPC call. Everything worked.

But in the end I found that this very specific changes results in "RPC Not Implemented" errors.

So, what is the proper way to create a node of nodes in Yang?

Bonus question: why does this specific alteration work in yang, but causes the RPC implementation to never be registered?

EDIT: I tried this

typedef relevant-flows-id {
    type inet:uri;
}

rpc get-all-relevant-flows {
    output {
        list relevant-flows {
            key "id";
            leaf id {
                type relevant-flow-id;
            }
            ... data leaves
        }
    }
}

And while this compiles, again, this causes the "blueprint" to get destroyed (I even get an error in ODL telling me so) and the RPC methods in this plugin are not implemented as a result. This is strange to me, because this code appears in line with the yang documentation. Hrm.

edit retag flag offensive close merge delete

Comments

I will put this on hold. I can deal with formatted strings ("{dest} {serc} {bandwidth}", etc.) This is pretty annoying, though.

VincentJahjah ( 2017-09-06 12:03:33 -0800 )edit