CRUD Service

YDK CrudService class provides API for Create/Read/Update/Delete operations on device configuration.

All CRUD operations performed on entities, where Entity instance represents single container in one of the device supported models.

class ydk.services.CRUDService

Supports CRUD operations on model API entities.

create(provider, entities)

Create one or more entities in device configuration.

Parameters
  • providerServiceProvider - Provider instance.

  • entities

    Entity instance for single container in device model.

    For multiple entities encapsulate Entity instances in Python list or Config.

Returns

True, if configuration created successfully; False otherwise.

Raises

Exception YServiceProviderError, if an error has occurred.

read(provider, filter)

Read one or more entities from device (configuration and state).

Parameters
  • providerServiceProvider - Provider instance.

  • filter

    Entity instance for single container in device model.

    For multiple containers the Entity instances must be encapsulate in Python list or Filter.

Returns

For single entity filter - an instance of Entity as identified by the filter or None, if operation fails.

For multiple filters - collection of Entity instances encapsulated into Python list or Config accordingly to the type of filter.

Raises

Exception YServiceProviderError, if an error has occurred.

read_config(provider, filter)

Read one or more entities from device running configuration.

Parameters
  • providerServiceProvider - Provider instance.

  • filter

    Entity instance for single container in device model.

    For multiple containers the Entity instances must be encapsulate in Python list or Filter.

Returns

For single entity filter - an instance of Entity as identified by the filter or None, if operation fails.

For multiple filters - collection of Entity instances encapsulated into Python list or Config accordingly to the type of filter.

Raises

Exception YServiceProviderError, if an error has occurred.

update(provider, entities)

Update one or more entities in device configuration.

Parameters
  • providerServiceProvider - Provider instance.

  • entities

    Entity instance for single container in device model.

    For multiple containers encapsulate Entity instances in Python list or Config.

Returns

True if successful, False - otherwise.

Raises

Exception YServiceProviderError, if an error has occurred.

delete(provider, entities)

Delete one or more entities in device configuration.

Parameters
  • providerServiceProvider - Provider instance.

  • entities

    Entity instance for single container in device model.

    For multiple containers encapsulate Entity instances in Python list or Config.

Returns

True if successful, False - otherwise.

Raises

Exception YServiceProviderError, if an error has occurred.