Ask is moving to Stack Overflow and Serverfault.com! Please use the "opendaylight" tag on either of these sites. This site is now in Read-Only mode

0

How to return list value in Yang?

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

rmohamed gravatar image

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

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 -0800

gyanesh gravatar image

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

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 -0800

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
Login/Signup to Answer

Question Tools

Follow
1 follower

Stats

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

Seen: 43 times

Last updated: May 13 '15