Sorry, I meant to ask about an entry of a list, not a leaf node.
I mean, let's say I have this yang model:
"
container elan-instances {
        description
           "elan instances configuration parameters. Elan instances support 
both the VLAN and VNI based elans.";

        list elan-instance {
            max-elements "unbounded";
            min-elements "0";
            key "elan-instance-name";
            description
                "Specifies the name of the elan instance. It is a string of 1 
to 31
                 case-sensitive characters.";
            leaf elan-instance-name {
...
"
Can I convert a specific elan-instance ? Or do I have to convert something 
bigger?

-----Original Message-----
From: Sela, Guy 
Sent: Tuesday, August 23, 2016 4:49 PM
To: 'Robert Varga' <n...@hq.sk>; controller-dev@lists.opendaylight.org; 
mdsal-...@lists.opendaylight.org
Subject: RE: [mdsal-dev] Serialize/Deserialize DTOs to JSON

>From what I'm seeing so far, I can't convert a leaf node into a JSON string. 
>The only entities I can convert are container or list.
Is this correct?

I got this from:
    private SchemaTracker(final SchemaContext context, final SchemaPath path) {
        SchemaNode current = SchemaUtils.findParentSchemaOnPath(context, path);
        Preconditions.checkArgument(current instanceof 
DataNodeContainer,"Schema path must point to container or list or an rpc 
input/output. Supplied path %s pointed to: %s",path,current);
        root = (DataNodeContainer) current;
    }

When trying to create JSONNormalizedNodeStreamWriter

-----Original Message-----
From: Robert Varga [mailto:n...@hq.sk]
Sent: Sunday, July 24, 2016 4:52 PM
To: Sela, Guy <guy.s...@hpe.com>; controller-dev@lists.opendaylight.org; 
mdsal-...@lists.opendaylight.org
Subject: Re: [mdsal-dev] Serialize/Deserialize DTOs to JSON

On 07/24/2016 01:36 PM, Sela, Guy wrote:
> Hi,
> 
> Is there an API that I can call which gets a DataObject as input and 
> returns a JSON representation of it?

Not directly, as DataObject and related generated code is an access facade. 
Primary data representation is NormalizedNode, hence you need to transform the 
DTOs to NormalizedNodes (see mdsal-binding-dom-codec) and then use 
yang-data-codec-gson (or -xml) to get the representation you seek.

I think TTPUtils (in TTP) does exactly that.

Bye,
Robert

_______________________________________________
controller-dev mailing list
controller-dev@lists.opendaylight.org
https://lists.opendaylight.org/mailman/listinfo/controller-dev

Reply via email to