Yes, a container is encoded as an object.

/js

On Thu, Apr 28, 2022 at 08:08:52PM +0000, Ram P wrote:
> The Yang definition:
> container system {
>        description
>          "Contains various system parameters.";
>        container services {
>          description
>            "Configure externally available services.";
>          container "ssh" {
>            presence "Enables SSH";
>            description
>              "SSH service-specific configuration.";
>            // more leafs, containers, and stuff here...
>          }
>        }
>      }
> So for this XML:
>      <system>
>        <services>
>          <ssh/>
>        </services>
>      </system>
> Should the JSON encoding should be like below?
> "system" : {   "services" : {       "ssh": {}    }}
> 
> Regards,Ram    
> 
>     On Thursday, April 28, 2022, 11:03:04 PM GMT+5:30, Jürgen Schönwälder 
> <[email protected]> wrote:  
>  
>  On Thu, Apr 28, 2022 at 04:50:42PM +0000, Ram P wrote:
> > Hi,
> > As per: RFC 7950 - The YANG 1.1 Data Modeling Language
> > 
> > | 
> > | 
> > |  | 
> > RFC 7950 - The YANG 1.1 Data Modeling Language
> > 
> > The YANG 1.1 Data Modeling Language (RFC 7950)
> >  |
> > 
> >  |
> > 
> >  |
> > 
> >  <system>
> >        <services>
> >          <ssh/>
> >        </services>
> >      </system>
> > 
> > What is the JSON equivalent for <ssh/> above?
> > Should it be "ssh" : [null] or "ssh":{}? Looks like RFC 7951 does not 
> > specifically mention this.
> >
> 
> The answer depends on how <ssh/> is defined. If it is a YANG leaf of
> type empty, then section 6.9 applies. If it is defined as a container,
> then section 5.2 applies. Once you have the YANG definition, then RFC
> 7951 may have the answer.
> 
> /js
> 
> -- 
> Jürgen Schönwälder              Jacobs University Bremen gGmbH
> Phone: +49 421 200 3587        Campus Ring 1 | 28759 Bremen | Germany
> Fax:  +49 421 200 3103        <https://www.jacobs-university.de/>
>   

-- 
Jürgen Schönwälder              Jacobs University Bremen gGmbH
Phone: +49 421 200 3587         Campus Ring 1 | 28759 Bremen | Germany
Fax:   +49 421 200 3103         <https://www.jacobs-university.de/>

_______________________________________________
netmod mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/netmod

Reply via email to