I prefer choice since a choice says clearly upfront that what follows
are N alternatives. With when statements, I have to keep all the when
statements in my mind to derive the conclusion that the model defines
alternatives. And the transport leaf in your when construction is
redundant.

/js

On Tue, Apr 02, 2019 at 01:13:52AM +0000, Qin Wu wrote:
> Hi, Folks:
> Choice case seems interchangeable with Container+when, here is the example of 
> Choice case
>      container system {
>        description
>          "Contains various system parameters.";
>        choice services {
>          description
>            "Configure externally available services.";
>          case ssh {
>            description
>              "SSH service-specific configuration.";
>            // more leafs, containers, and stuff here...
>          }
>          case tls {
>            description
>              "TLS service-specific configuration.";
>            // more leafs, containers, and stuff here...
>          }
>        }
>      }
> I think it can be replaced with container+when representation as follows:
>     container system {
>        description
>          "Contains various system parameters.";
>        container services {
>          description
>            "Configure externally available services.";
>          leaf transport {
>            enum ssh {
>             description
>              "ssh";
>           }
>            enum tls {
>            description
>             "tls";
>           }
>          }
>          container "ssh" {
>            when "../transport=ssh" {
>             description
>             "active only when the transport is ssh";
>            }
>            description
>              "SSH service-specific configuration.";
>            // more leafs, containers, and stuff here...
>          }
>          container "tls" {
>            when "../transport=tls" {
>             description
>             "active only when the transport is tls";
>            }
>            description
>              "TLS service-specific configuration.";
>            // more leafs, containers, and stuff here...
>          }
>        }
>      }
> However I didn't see any guidance on when to use Choice case or when to use 
> Container+when?
> Any thought about this?
> 
> -Qin

> _______________________________________________
> netmod mailing list
> netmod@ietf.org
> https://www.ietf.org/mailman/listinfo/netmod


-- 
Juergen Schoenwaelder           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
netmod@ietf.org
https://www.ietf.org/mailman/listinfo/netmod

Reply via email to