Ask Your Question
0

How to return list value in Yang?

asked 2015-05-13 03:17:33 -0700

rmohamed gravatar image

updated 2015-05-13 03:18:16 -0700

Hi,

I am writing one module to expose REST API using ODL helium stable version. I want to expose REST API which should return list of values. 
 rpc  getList{
   output{
        leaf id{
            type uint32;
        }
        leaf name{
            type string;
        }
        leaf SETTIME {
            type string;
        }
       } 
 }

But yang generated service class with Future<RpcResult<GetListOutput>> as return type. Here i want to return list of values. How can i achieve this in yang. Any pointer or sample would be helpful for us. I followed as like Toaster example.

Thanks, rmohamed

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2015-05-13 08:23:45 -0700

gyanesh gravatar image

updated 2015-05-13 08:25:32 -0700

You need to specify the output data type as a list:

 rpc  getList{
   output{
      list nodeList{
         leaf id{ type uint32; } 
         leaf name{ type string; } 
         leaf SETTIME { type string; } 
       } 
   }
 }
edit flag offensive delete publish link more
0

answered 2015-05-13 23:26:35 -0700

rmohamed gravatar image

Thanks gyanesh. I resolved this issue by below code,

grouping usr{ leaf id{ type uint32; } leaf name{ type string; } leaf SETTIME { type string; } } rpc get-list {
output{ list usrList{ uses usr; } } }

Thanks, rmohamed

edit flag offensive delete publish link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools

Follow
1 follower

Stats

Asked: 2015-05-13 03:17:33 -0700

Seen: 40 times

Last updated: May 13 '15