Пример #1
0
 def validate_data_tree(self):
     try:
         self._validate_data(self.root, self.ctx)
     except Exception as e:
         print("Failed to validate data tree")
         raise SonicYangException("Failed to validate data tree\n{}".\
             format(str(e)))
Пример #2
0
    def find_data_dependencies(self, data_xpath):
        ref_list = []
        node = self.root
        try:
            data_node = self._find_data_node(data_xpath)
        except Exception as e:
            print("find_data_dependencies(): Failed to find data node from xpath: {}".format(data_xapth))
            return ref_list

        try:
            value = str(self._find_data_node_value(data_xpath))

            schema_node = ly.Schema_Node_Leaf(data_node.schema())
            backlinks = schema_node.backlinks()
            if backlinks.number() > 0:
                for link in backlinks.schema():
                     node_set = node.find_path(link.path())
                     for data_set in node_set.data():
                          data_set.schema()
                          casted = data_set.subtype()
                          if value == casted.value_str():
                              ref_list.append(data_set.path())
        except Exception as e:
            print('Failed to find node or dependencies for {}'.format(data_xpath))
            raise SonicYangException("Failed to find node or dependencies for \
                {}\n{}".format(data_xpath, str(e)))

        return ref_list
Пример #3
0
 def validate_data_tree(self):
     try:
         self._validate_data(self.root, self.ctx)
     except Exception as e:
         self.sysLog(msg="Failed to validate data tree\n{",
                     debug=syslog.LOG_ERR,
                     doPrint=True)
         raise SonicYangException("Failed to validate data tree\n{}".\
             format(str(e)))