diff --git a/sdk/go/core/docsgen/api/types/ydk_types.rst b/sdk/go/core/docsgen/api/types/ydk_types.rst index f8f3b6396..12627cc84 100644 --- a/sdk/go/core/docsgen/api/types/ydk_types.rst +++ b/sdk/go/core/docsgen/api/types/ydk_types.rst @@ -324,12 +324,12 @@ These are how YANG types are represented in Go. .. function:: GetSegmentPath(entity Entity) string :param entity: An instance of :ref:`Entity ` - :return: The entity's `SegmentPath` value + :return: The entity's segment path value .. function:: GetAbsolutePath(entity Entity) string :param entity: An instance of :ref:`Entity ` - :return: The entity's `AbsolutePath` value + :return: The entity's absolute path value **Note:** The parent-child relations must be set before calling this function. As an advice the `SetAllParents` on the top level entity must be called to set the references. @@ -406,10 +406,11 @@ These are how YANG types are represented in Go. .. function:: EntityToDict(entity Entity) map[string]string - Utility function to get dictionary of all leaves recursively in this entity and its children. + Utility function to get dictionary of all leaves and presence containers recursively in this entity and its children. :param entity: An instance of :ref:`Entity ` - :return: A `map[string]string`, where key represent leaf absolute path and value represents string value of the leaf + :return: A `map[string]string`, where key represents leaf absolute path and value represents string value of the leaf; + In case of presence container the key represents the container absolute path and value is empty string. .. _string-pair: @@ -427,14 +428,17 @@ These are how YANG types are represented in Go. Compared are presence containers and all leaves recursively. :param entity: An instance of :ref:`Entity ` - :return: A `map[string]StringPair`, map of differences between two entities, where key represents leaf or presence container absolute path and value represents string value of the leaf. + :return: A `map[string]StringPair`, map of differences between two entities, where key represents leaf or presence + container absolute path and value :ref:`StringPair ` represents difference in string values of the leaves. .. _entity-collection: .. go:struct:: EntityCollection - Type `EntityCollection` along with its methods implements ordered map collection of entities. The string value of entity `SegmentPath` serves as a map key for the entity. Ordered means, the collection retains order of entities, in which they were added to collection. + Type `EntityCollection` along with its methods implements ordered map collection of entities. The string value of + entity `SegmentPath` serves as a map key for the entity. Ordered means, the collection retains order of entities, + in which they were added to collection. The `EntityCollection` type has two aliases - `Config` and `Filter`. diff --git a/sdk/python/core/docsgen/api/types.rst b/sdk/python/core/docsgen/api/types.rst index 22e480ed5..2c12c42fa 100644 --- a/sdk/python/core/docsgen/api/types.rst +++ b/sdk/python/core/docsgen/api/types.rst @@ -391,6 +391,35 @@ YDK types uint8 type. +Utility functions +----------------- + +.. function:: absolute_path(entity) + + Utility function to get absolute path of the entity. + + :param entity: An instance of :py:class:`Entity`. + :return: A ``str`` representing entity's absolute path. + +.. function:: entity_to_dict(entity) + + Utility function to get dictionary of all leaves and presence containers recursively in this entity and its children. + + :param entity: An instance of :py:class:`Entity`. + :return: A dictionary, where key represents leaf absolute path and value represents string value of the leaf; + In case of presence container the key represents the container's absolute path and value is empty string. + +.. function:: entity_diff(entity1, entity2) + + Utility function to compare two entities of the same underlying type. + Compared are presence containers and all leaves recursively. + + :param entity1: An instance of :py:class:`Entity`. + :param entity2: An instance of :py:class:`Entity`. + :return: A dictionary of differences between two entities, where key of type `str` represents leaf or presence + container absolute path and value of type `tuple` represents difference in `str` values of the leaves. + :raises: Exception :py:exc:`YInvalidArgumentError`, if supplied entities are None or have different types. + Examples --------