def get_name_leaf_data(self): leaf_name_data = LeafDataList() for name in self._leafs: value = self.__dict__[name] leaf = self._leafs[name] if isinstance(value, _YFilter): leaf.yfilter = value if isinstance(leaf, _YLeaf): leaf_name_data.append(leaf.get_name_leafdata()) elif isinstance(leaf, _YLeafList): leaf_name_data.extend(leaf.get_name_leafdata()) elif (type(value) not in (list, type(None), Bits) or (isinstance(value, Bits) and len(value.get_bitmap()) > 0)): leaf.set(value) leaf_name_data.append(leaf.get_name_leafdata()) elif isinstance(value, list) and len(value) > 0: l = _YLeafList(YType.str, leaf.name) # l = self._leafs[name] # Above results in YModelError: # Duplicate leaf-list item detected: # /ydktest-sanity:runner/ytypes/built-in-t/enum-llist[.='local'] : # No resolvents found for leafref "../config/id".. # Path: /ydktest-sanity:runner/one-list/identity-list/id-ref for item in value: l.append(item) leaf_name_data.extend(l.get_name_leafdata()) return leaf_name_data
def get_name_leaf_data(self): leaf_name_data = LeafDataList() for name in self._leafs: value = self.__dict__[name] leaf = _get_leaf_object(self._leafs[name]) if isinstance(value, YFilter): self._logger.debug('YFilter assigned to "%s", "%s"' % (name, value)) leaf.yfilter = value if isinstance(leaf, _YLeaf): leaf_name_data.append(leaf.get_name_leafdata()) elif isinstance(leaf, _YLeafList): leaf_name_data.extend(leaf.get_name_leafdata()) elif (value is not None and not isinstance(value, list) and not isinstance(value, Bits)) or \ (isinstance(value, Bits) and len(value.get_bitmap()) > 0): leaf.set(value) leaf_name_data.append(leaf.get_name_leafdata()) elif isinstance(value, list) and len(value) > 0: leaf_list = _YLeafList(YType.str, leaf.name) # leaf_list = self._leafs[name] # Above results in YModelError: # Duplicate leaf-list item detected: # /ydktest-sanity:runner/ytypes/built-in-t/enum-llist[.='local'] : # No resolvents found for leafref "../config/id".. # Path: /ydktest-sanity:runner/one-list/identity-list/id-ref for item in value: _validate_value(self._leafs[name], name, item, self._logger) leaf_list.append(item) leaf_name_data.extend(leaf_list.get_name_leafdata()) self._logger.debug('Get name leaf data for "%s". Count: %s' % (self.yang_name, len(leaf_name_data))) for leaf in leaf_name_data: leaf_value = leaf[1].value if "'" in leaf_value: leaf_value.replace("'", "\'") self._logger.debug( 'Leaf data name: "%s", value: "%s", yfilter: "%s", is_set: "%s"' % (leaf[0], leaf_value, leaf[1].yfilter, leaf[1].is_set)) return leaf_name_data
def get_name_leaf_data(self): leaf_name_data = LeafDataList() for name in self._leafs: value = self.__dict__[name] leaf = self._leafs[name] if isinstance(value, _YFilter): self.logger.debug('YFilter assigned to "%s", "%s"' % (name, value)) leaf.yfilter = value if isinstance(leaf, _YLeaf): leaf_name_data.append(leaf.get_name_leafdata()) elif isinstance(leaf, _YLeafList): leaf_name_data.extend(leaf.get_name_leafdata()) elif (type(value) not in (list, type(None), Bits) or (isinstance(value, Bits) and len(value.get_bitmap()) > 0)): leaf.set(value) leaf_name_data.append(leaf.get_name_leafdata()) elif isinstance(value, list) and len(value) > 0: l = _YLeafList(YType.str, leaf.name) # l = self._leafs[name] # Above results in YModelError: # Duplicate leaf-list item detected: # /ydktest-sanity:runner/ytypes/built-in-t/enum-llist[.='local'] : # No resolvents found for leafref "../config/id".. # Path: /ydktest-sanity:runner/one-list/identity-list/id-ref for item in value: l.append(item) leaf_name_data.extend(l.get_name_leafdata()) self.logger.debug('Get name leaf data for "%s". Count: %s' % (self.yang_name, len(leaf_name_data))) for l in leaf_name_data: self.logger.debug( 'Leaf data name: "%s", value: "%s", yfilter: "%s", is_set: "%s"' % (l[0], l[1].value, l[1].yfilter, l[1].is_set)) return leaf_name_data
def get_name_leaf_data(self): leaf_name_data = LeafDataList() for name in self._leafs: value = self.__dict__[name] leaf = _get_leaf_object(self._leafs[name]) if isinstance(value, _YFilter): self.logger.debug('YFilter assigned to "%s", "%s"' % (name, value)) leaf.yfilter = value if isinstance(leaf, _YLeaf): leaf_name_data.append(leaf.get_name_leafdata()) elif isinstance(leaf, _YLeafList): leaf_name_data.extend(leaf.get_name_leafdata()) elif (type(value) not in (list, type(None), Bits) or (isinstance(value, Bits) and len(value.get_bitmap()) > 0)): leaf.set(value) leaf_name_data.append(leaf.get_name_leafdata()) elif isinstance(value, list) and len(value) > 0: l = _YLeafList(YType.str, leaf.name) # l = self._leafs[name] # Above results in YModelError: # Duplicate leaf-list item detected: # /ydktest-sanity:runner/ytypes/built-in-t/enum-llist[.='local'] : # No resolvents found for leafref "../config/id".. # Path: /ydktest-sanity:runner/one-list/identity-list/id-ref for item in value: l.append(item) leaf_name_data.extend(l.get_name_leafdata()) self.logger.debug('Get name leaf data for "%s". Count: %s'%(self.yang_name, len(leaf_name_data))) for l in leaf_name_data: leaf_value = l[1].value if "'" in leaf_value: leaf_value.replace("'", "\'") self.logger.debug('Leaf data name: "%s", value: "%s", yfilter: "%s", is_set: "%s"' % ( l[0], leaf_value, l[1].yfilter, l[1].is_set)) return leaf_name_data