0
votes

Does Opendaylight(Beryllium) support YANG RPC data modelling types like anyxml/anydata ?

I have been involved in developing an Opendaylight Controller App, in which i have to publish a dynamic JSON data as part of RPC(NorthBound API).

Here is my YANG RPC definition:

rpc service_discovery{
    input {
        leaf service_account_id{
            type string;
        }
        leaf action{
            type string;
        }
    }
    output {
        list discoveryList{
            anyxml service_element;
        }
    }
}

Referred this YANG IETF documentation for defining anyxml/anydata types

When I build this YANG, I couldn't see JAVA interfaces/classes generated against anyxml type and am not sure on how to do the JAVA implementation corresponding to this types. This blocks me in publishing the dynamic JSON which i received from SouthBound API.

Here is the sample data which i want to publish in the output. The difficulty here is, the JSON attributes are dynamic so it is not possible to define them statically in YANG. So i opted for anyxml type.

[ {
    "id_1": "123245",
    "name_1": "test1",
    "deployment_1": "prod",
    "type_1": "cloud"
  },
  {
    "id_2": "33455",
    "name_2": "Test2",
    "deployment_2": "QA",
    "type_2": "container"
  } ]

Please suggest me the YANG model for the above data to be published in output.

1

1 Answers

0
votes

Since you have put "anyxml service_element" as an output type for the "list discoveryList", hence you can't expect it to be generated as any class/interface.

You can modify your output to be like:

output {
    anyxml service_element {
        description: .........
    }
}