示例#1
0
    def _add_list_stmts(self, clazz):
        """Add list statements as well as its requisite statements."""
        while not is_pkg_element(clazz):
            if all((is_list_element(clazz), not is_pkg_element(clazz.owner))):
                self._add_declaration_stmt(clazz)
                self._add_list_key_stmts(clazz)
                self._add_append_stmt(clazz)

            clazz = clazz.owner
示例#2
0
    def _add_list_stmts(self, clazz):
        """Add list statements as well as its requisite statements."""
        while not is_pkg_element(clazz):
            if all((is_list_element(clazz),
                    not is_pkg_element(clazz.owner))):
                self._add_declaration_stmt(clazz)
                self._add_list_key_stmts(clazz)
                self._add_append_stmt(clazz)

            clazz = clazz.owner
示例#3
0
    def _add_requisite_stmts(self, clazz):
        """Add requisite statements.

        Requisite statements are statements for current statement that:
            - is a YANG list node
                - is a YANG key node for this node
            - is a YANG mandatory node
            - is a YANG presence node
            - is a node should be replaced with default value in _DEFAULTS
            - is a node referenced by its ancestors, which has been listed
              in _DEFAULT_LEAFREFS
        """
        while not is_pkg_element(clazz):
            self._add_requisite_clazz_stmts(clazz)
            for prop in clazz.properties():
                self._add_requisite_prop_stmts(prop)

            clazz = clazz.owner
示例#4
0
    def _add_requisite_stmts(self, clazz):
        """Add requisite statements.

        Requisite statements are statements for current statement that:
            - is a YANG list node
                - is a YANG key node for this node
            - is a YANG mandatory node
            - is a YANG presence node
            - is a node should be replaced with default value in _DEFAULTS
            - is a node referenced by its ancestors, which has been listed
              in _DEFAULT_LEAFREFS
        """
        while not is_pkg_element(clazz):
            self._add_requisite_clazz_stmts(clazz)
            for prop in clazz.properties():
                self._add_requisite_prop_stmts(prop)

            clazz = clazz.owner