简体   繁体   English

使用布尔容器的替代方法

[英]alternative way to use boolean container

container first{       
        container second{
            type boolean;
        }
}

how can i do something like this.(My error:i can't boolean a container/error: unexpected keyword "type") I don't want to use leaf.我怎么能做这样的事情。(我的错误:我不能布尔一个容器/错误:意外的关键字“类型”)我不想使用叶子。 Is there an alternative ?有替代方案吗?

As per RFC 6020. For storing single data we have to use leaf.根据 RFC 6020。为了存储单个数据,我们必须使用叶子。 Using containers to store boolean data, I don't think would be possible.使用容器来存储布尔数据,我认为这是不可能的。

As per RFC6020 section 7.5.1 , Containers are used to organize the hierarchy of data nodes, and those whose presence in the configuration has an explicit meaning.It means we can't use container to store the data.根据RFC6020第7.5.1节,Containers用于组织数据节点的层次结构,那些出现在配置中的具有明确的含义。这意味着我们不能使用容器来存储数据。

If you don't want to use boolean then you can try to use "enum" like this:如果您不想使用布尔值,那么您可以尝试使用“枚举”,如下所示:

 leaf myenum {
     type enumeration {
         enum zero {
              value 0;
         }   
         enum one {
             value 1;
         }
     }
 }

. .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM