Netconf Service

enum class ydk::DataStore

Type of datastore to perform operation on.

enumerator candidate
enumerator running
enumerator startup
enumerator url
enumerator na
class NetconfService

Netconf Service class for supporting encoding and decoding C++ model API objects of type Entity.

NetconfService()

Constructs an instance of NetconfService.

bool cancel_commit(NetconfServiceProvider &provider, std::string persist_id = "")

Cancels an ongoing confirmed commit. If the persist_id parameter is not given, the operation MUST be issued on the same provider that issued the confirmed commit.

Parameters:
  • provider – An instance of NetconfServiceProvider.
  • persist_id – Cancels a persistent confirmed commit with persist_id.
Returns:

true, if the operation succeeds, false - otherwise.

Raises:

YError, if an error has occurred.

bool close_provider(NetconfServiceProvider &provider)

Request graceful termination of a NETCONF provider.

Parameters:provider – An instance of NetconfServiceProvider.
Returns:true, if the operation succeeds, false - otherwise.
Raises:YError, if an error has occurred.
bool commit(NetconfServiceProvider &provider, std::string confirmed = "", std::string confirm_timeout = "", std::string persist = "", std::string persist_id = "")

Instructs the device to implement the configuration data contained in the candidate configuration.

Parameters:
  • provider – An instance of NetconfServiceProvider.
  • confirmed – An optional argument.
  • confirm_timeout – An optional argument.
  • persist – An optional argument.
  • persist_id – An optional argument.
Returns:

true, if the operation succeeds, false - otherwise.

Raises:

YError, if an error has occurred.

bool copy_config(NetconfServiceProvider &provider, DataStore target, DataStore source)

Create or replace an entire configuration datastore with the contents of another complete configuration datastore. If target datastore exists, it gets overwritten. Otherwise, new datastore is created, if allowed.

Parameters:
  • provider – An instance of NetconfServiceProvider
  • target – The configuration being used as the destination of type DataStore
  • source – The configuration being used as the source of type DataStore
Returns:

true, if the operation succeeds, false - otherwise

Raises:

YError, if an error has occurred.

bool copy_config(NetconfServiceProvider &provider, DataStore target, Entity &source)

Create or replace part of target configuration datastore with content of source entity. If target datastore exists, it gets overwritten. Otherwise, new datastore is created, if allowed.

Parameters:
  • provider – An instance of NetconfServiceProvider.
  • target – The configuration being used as the destination of type DataStore.
  • source – The configuration being used as the source of type Entity.
Returns:

true, if the operation succeeds, false - otherwise.

Raises:

YError, if an error has occurred.

bool copy_config(NetconfServiceProvider &provider, DataStore target, std::vector<Entity *> &source)

Create or replace part of target configuration datastore with content of source multiple entities. If target datastore exists, it gets overwritten. Otherwise, new datastore is created, if allowed.

Parameters:
  • provider – An instance of NetconfServiceProvider.
  • target – The configuration being used as the destination of type DataStore.
  • source – The configuration being used as the source of type std::vector<Entity*> for multiple entities.
Returns:

true, if the operation succeeds, false - otherwise.

Raises:

YError, if an error has occurred.

bool delete_config(NetconfServiceProvider &provider, DataStore target, std::string url = "")

Delete a configuration datastore. The RUNNING configuration datastore cannot be deleted.

Parameters:
  • provider – An instance of NetconfServiceProvider.
  • target – The configuration of type DataStore to be deleted.
  • url – Required only when target is set to url.
Returns:

true, if the operation succeeds, false - otherwise.

Raises:

YError, if an error has occurred.

bool discard_changes(NetconfServiceProvider &provider)

Revert candidate configuration to the current running configuration.

Parameters:provider – An instance of NetconfServiceProvider
Returns:true, if the operation succeeds, false - otherwise.
Raises:YError, if an error has occurred.
bool edit_config(NetconfServiceProvider &provider, DataStore target, Entity &config, std::string default_operation = "", std::string test_option = "", std::string error_option = "")

Loads entity configuration to specified target configuration datastore. If target configuration datastore does not exist, it will be created.

Parameters:
  • provider – An instance of NetconfServiceProvider.
  • target – The configuration being edited of type DataStore.
  • config – An instance of Entity that is a hierarchy configuration of data as defined by one of the device’s data models.
  • default_operation – Selects the default operation (merge, replace, or none). The default value for this parameter is “merge”.
  • test_option – Optionally set to “test-then-set”, “set”, or “test-only” if the device advertises the :validate:1.1 capability.
  • error_option – Optionally set to “stop-on-error”, “continue-on-error”, or “rollback-on-error”.
Returns:

true, if the operation succeeds, false - otherwise.

Raises:

YError, if an error has occurred.

bool edit_config(NetconfServiceProvider &provider, DataStore target, std::vector<Entity *> &config, std::string default_operation = "", std::string test_option = "", std::string error_option = "")

Loads configuration of multiple entities to specified target configuration datastore. If target configuration datastore does not exist, it will be created.

Parameters:
  • provider – An instance of NetconfServiceProvider.
  • target – The configuration being edited of type DataStore.
  • config – An instance of std::vector<Entity*> for multiple entities. That is a hierarchy configuration of data as defined by one of the device’s data models.
  • default_operation – Selects the default operation (merge, replace, or none). The default value for this parameter is “merge”.
  • test_option – Optionally set to “test-then-set”, “set”, or “test-only” if the device advertises the :validate:1.1 capability.
  • error_option – Optionally set to “stop-on-error”, “continue-on-error”, or “rollback-on-error”.
Returns:

true, if the operation succeeds, false - otherwise.

Raises:

YError, if an error has occurred.

std::shared_ptr<Entity> get_config(NetconfServiceProvider &provider, DataStore source, Entity &filter)

Retrieve all or part of a specified configuration datastore for specified filter.

Parameters:
  • provider – An instance of NetconfServiceProvider.
  • source – The configuration being queried of type DataStore.
Returns:

The requested data as Entity.

Raises:

YError, if an error has occurred.

std::vector<std::shared_ptr<Entity>> get_config(NetconfServiceProvider &provider, DataStore source, std::vector<Entity *> &filter)

Retrieve all or part of a specified configuration datastore for specified in filter multiple entities.

Parameters:
  • provider – An instance of NetconfServiceProvider.
  • source – The configuration being queried of type std::vector<Entity*>.
Returns:

The requested data as std::vector<std::shared_ptr<Entity>> instance; if request fails - empty std::vector.

Raises:

YError, if an error has occurred.

std::shared_ptr<Entity> get(NetconfServiceProvider &provider, Entity &filter)

Retrieve running configuration and device state information.

Parameters:
  • provider – An instance of NetconfServiceProvider.
  • filter – An instance of Entity that contains requested part of the device configuration and state data to be retrieved as defined by one of the device’s data models.
Returns:

The requested data as Entity.

Raises:

YError, if an error has occurred.

std::vector<std::shared_ptr<Entity>> get(NetconfServiceProvider &provider, std::vector<Entity *> &filter)

Retrieve running configuration and device state information for multiple entities.

Parameters:
  • provider – An instance of NetconfServiceProvider.
  • filter – An instance of std::vector<Entity*> that contains requested part of device configuration and state data; if request fails - empty std::vector.
Returns:

The requested data as Entity.

Raises:

YError, if an error has occurred.

bool kill_provider(NetconfServiceProvider &provider, int provider_id)

Force the termination of a NETCONF provider

Parameters:
  • provider – An instance of NetconfServiceProvider.
  • provider_id – An instance of int that is the provider identifier of the NETCONF provider to be terminated.
Returns:

true, if the operation succeeds, false - otherwise.

Raises:

YError, if an error has occurred.

bool lock(NetconfServiceProvider &provider, DataStore target)

Allows the client to lock the entire configuration datastore system of a device.

Parameters:
  • provider – An instance of NetconfServiceProvider.
  • target – The configuration of type DataStore to lock.
Returns:

true, if the operation succeeds, false - otherwise.

Raises:

YError, if an error has occurred.

bool unlock(NetconfServiceProvider &provider, DataStore target)

Used to release a configuration lock, previously obtained with the LOCK operation.

Parameters:
  • provider – An instance of NetconfServiceProvider.
  • target – The configuration of type DataStore to unlock.
Returns:

true, if the operation succeeds, false - otherwise.

Raises:

YError, if an error has occurred.

bool validate(NetconfServiceProvider &provider, DataStore source)

Checks a complete configuration for syntactical and semantic errors before applying the configuration to the device.

Parameters:
  • provider – An instance of NetconfServiceProvider.
  • source – An instance of DataStore.
Returns:

true, if the operation succeeds, false - otherwise.

Raises:

YError, if an error has occurred.

bool validate(NetconfServiceProvider &provider, Entity &source_config)

Checks a complete configuration for syntactical and semantic errors before applying the configuration to the device.

Parameters:
  • provider – An instance of NetconfServiceProvider.
  • source – An instance of Entity.
Returns:

true, if the operation succeeds, false - otherwise.

Raises:

YError, if an error has occurred.