@@ -0,0 +1,2343 @@
+#    vytree.reference_node: Interface definition storage classes for VyConf configuration management backend%0A#%0A#    Copyright (C) 2014 VyOS Development Group %3Cmaintainers@vyos.net%3E%0A#%0A#    This library is free software; you can redistribute it and/or%0A#    modify it under the terms of the GNU Lesser General Public%0A#    License as published by the Free Software Foundation; either%0A#    version 2.1 of the License, or (at your option) any later version.%0A#%0A#    This library is distributed in the hope that it will be useful,%0A#    but WITHOUT ANY WARRANTY; without even the implied warranty of%0A#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU%0A#    Lesser General Public License for more details.%0A#%0A#    You should have received a copy of the GNU Lesser General Public%0A#    License along with this library; if not, write to the Free Software%0A#    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301%0A#    USA%0A%0A%0Aimport vytree%0A%0Aclass ReferenceNode(vytree.Node):%0A    def __init__(self, name, parent=None):%0A        super(ReferenceNode, self).__init__(name, parent)%0A%0A        # Default flags%0A        self.set_property(%22leaf%22, False)%0A        self.set_property(%22tag%22, False)%0A        self.set_property(%22multi%22, False)%0A        self.set_property(%22constraint%22, None)%0A%0A    def set_leaf(self, value):%0A        if not isinstance(value, bool):%0A            raise TypeError(%22Leaf property value must be True or False%22)%0A        self.set_property(%22leaf%22, True)%0A%0A    def is_leaf(self):%0A        return self.get_property(%22leaf%22)%0A%0A    def set_tag(self, value):%0A        if not isinstance(value, bool):%0A            raise TypeError(%22Tag property value must be True or False%22)%0A        self.set_property(%22tag%22, value)%0A%0A    def is_tag(self):%0A        return self.get_property(%22tag%22)%0A%0A    def set_multi(self, value):%0A       %09if not isinstance(value, bool):%0A       %09    raise TypeError(%22Multi property value must be True or False%22)%0A        self.set_property(%22multi%22, value)%0A%0A    def%09is_multi(self):%0A       %09return self.get_property(%22multi%22)%0A%0A    def add_value_constraint(self, type, constraint):%0A        if (not isinstance(type, str)) and (not isinstance(constraint, str)):%0A            raise TypeError(%22Type and constraint must be strings%22)%0A        self.get_property(%22value_constraints%22).append(%7B%22type%22: type, %22constraint%22: constraint%7D)%0A%0A

Add ReferenceNode draft.