NetconfService

enum class Datastore

Type of datastore to perform operation on

enumerator candidate
enumerator running
enumerator startup
enumerator url
class NetconfService : public Service

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 session that issued the confirmed commit.

Parameters:
Returns:

true if the operation succeeds, else false

Raises YCPPError:
 

If an error has occurred

bool close_session(NetconfServiceProvider &provider)

Request graceful termination of a NETCONF session

Parameters:provider – An instance of NetconfServiceProvider
Returns:true if the operation succeeds, else false
Raises YCPPError:
 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, else false

Raises YCPPError:
 

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 the target datastore exists, it is overwritten. Otherwise, a new one 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, else false

Raises YCPPError:
 

If an error has occurred

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

Create or replace an entire configuration datastore with the contents of another complete configuration datastore. If the target datastore exists, it is overwritten. Otherwise, a new one 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, else false

Raises YCPPError:
 

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, else false

Raises YCPPError:
 

If an error has occurred

bool discard_changes(NetconfServiceProvider &provider)

Used to revert the candidate configuration to the current running configuration

Parameters:provider – An instance of NetconfServiceProvider
Returns:true if the operation succeeds, else false
Raises YCPPError:
 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 all or part of a specified configuration to the specified target configuration datastore. Allows the new configuration to be expressed using a local file, a remote file, or inline. If the 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, else false.

Raises YCPPError:
 

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

Parameters:
Returns:

The requested data as Entity

Raises YCPPError:
 

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 specifies the portion of the system configuration and state data to retrieve
Returns:

The requested data as Entity

Raises YCPPError:
 

If an error has occurred

bool kill_session(NetconfServiceProvider &provider, int session_id)

Force the termination of a NETCONF session

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

true if the operation succeeds, else false

Raises YCPPError:
 

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:
Returns:

true if the operation succeeds, else false

Raises YCPPError:
 

If an error has occurred

bool unlock(NetconfServiceProvider &provider, DataStore target)

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

Parameters:
Returns:

true if the operation succeeds, else false

Raises YCPPError:
 

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:
Returns:

true if the operation succeeds, else false

Raises YCPPError:
 

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:
Returns:

true if the operation succeeds, else false

Raises YCPPError:
 

If an error has occurred