NETCONF Service
YDK NetconfService class provides API for various operations on device configuration.
All NetconfService operations performed on Datastore, which instance represents data storage of configuration on device, and/or Entity, which instance represents single container in one of the device supported models.
- class ydk.ext.services.Datastore
Type of data storage on device.
- candidate
- running
- startup
- url
- na
- class ydk.services.NetconfService
- cancel_commit(provider, persist_id=None)
Cancels an ongoing confirmed commit. If the persist_id parameter is None, the operation must be issued on the same session that issued the confirmed commit.
- Parameters
provider –
NetconfServiceProviderinstance.persist_id – An
intthat cancels a persistent confirmed commit.
- Returns
Trueif the operation succeeds,False- otherwise.- Raises
YServiceProviderError, if error has occurred.
- close_session(provider)
Request graceful termination of a NETCONF session.
- Parameters
provider –
NetconfServiceProviderinstance.- Returns
Trueif the operation succeeds,False- otherwise.- Raises
YServiceProviderError, if error has occurred.
- commit(provider, confirmed=False, confirm_timeout=None, persist=None, persist_id=None)
Instructs the device to implement the configuration data contained in the candidate configuration.
- Parameters
provider –
NetconfServiceProviderinstance.confirmed – A
boolthat signals a confirmed commit operation.confirm_timeout – An
intrepresenting timeout interval for a confirmed commit.persist – An
intthat makes the confirmed commit persistent.persist_id – An
intthat is given in order to commit a persistent confirmed commit.
- Returns
Trueif the operation succeeds,False- otherwise.- Raises
YServiceProviderError, if error has occurred.
- copy_config(provider, target, source=None, url='', source-config=None)
Create or replace an entire target configuration from one of another source of configuration: source, url, or source-config. Only one source of configuration must be specified. If target datastore exists, it is overwritten; otherwise - new datastore is created.
- Parameters
provider –
NetconfServiceProviderinstance.target – An instance of
Datastorerepresenting configuration being used as destination.source – An instance of
Datastorerepresenting configuration being used as source.url – A
strrepresenting the configuration URL.source-config –
Entityinstance, which represents single container in device supported model.For multiple containers the
Entityinstances must be encapsulate in PythonlistorConfig.
- Returns
Trueif the operation succeeds,False- otherwise.- Raises
YServiceProviderError, if error has occurred.
- delete_config(provider, target, url='')
Delete a configuration Datastore. The RUNNING configuration Datastore cannot be deleted.
- Parameters
provider –
NetconfServiceProviderinstance.target – An instance of
Datastorerepresenting configuration to be deleted.url – A
strrepresenting the configuration URL. Optional parameter required only when target is set tourl.
- Returns
Trueif the operation succeeds,False- otherwise.- Raises
YServiceProviderError, if error has occurred.
- discard_changes(provider)
Used to revert the candidate configuration to the current running configuration.
- Parameters
provider –
NetconfServiceProviderinstance.- Returns
Trueif the operation succeeds,False- otherwise.- Raises
YServiceProviderError, if error has occurred.
- edit_config(provider, target, config, default_operation='', error_option='', test_option='')
Loads all or part of a specified configuration to the specified target configuration datastore. Allows new configuration to be read from local file, remote file, or inline. If the target configuration datastore does not exist, it will be created.
- Parameters
provider –
NetconfServiceProviderinstance.target – An instance of
Datastorerepresenting the configuration being edited.config –
An instance of
Entity, which represents single container in device supported model.For multiple containers the
Entityinstances must be encapsulate in PythonlistorConfig.default_operation – A
strthat changes default frommergeto eithermerge,replace, ornone; this parameter is optional.error_option – A
strthat can be set totest-then-set,set, ortest-onlyif the device advertises the :validate:1.1 capability; this parameter is optional.test_option – A
strthat can be set tostop-on-error,continue-on-error, orrollback-on-error; this parameter is optional.
- Returns
Trueif the operation succeeds,False- otherwise.- Raises
YServiceProviderError, if error has occurred.
- get_config(provider, source, filter)
Retrieve all or part of a specified configuration datastore.
- Parameters
provider –
NetconfServiceProviderinstance.source – An instance of
Datastorerepresenting source configuration.filter –
An instance of
Entity, which represents single container in device supported model.For multiple containers the
Entityinstances must be encapsulate in PythonlistorFilter.
- Returns
For single entity filter - an instance of
Entityas identified by the filter orNone, if operation fails.For multiple filters - collection of
Entityinstances encapsulated into PythonlistorConfigaccordingly to the type of filter.- Raises
YServiceProviderError, if error has occurred.
- get(provider, filter)
Retrieve running configuration and device state information.
- Parameters
provider –
NetconfServiceProviderinstance.filter –
An instance of
Entity, which represents single container in device supported model.For multiple containers the
Entityinstances must be encapsulate in PythonlistorFilter.
- Returns
For single entity filter - an instance of
Entityas identified by the filter orNone, if operation fails.For multiple filters - collection of
Entityinstances encapsulated into PythonlistorConfigaccordingly to the type of filter.- Raises
YServiceProviderError, if error has occurred.
- kill_session(provider, session_id)
Force the termination of a NETCONF session.
- Parameters
provider –
NetconfServiceProviderinstance.session_id – An
int- session identifier of the NETCONF session to be terminated.
- Returns
Trueif the operation succeeds,False- otherwise.- Raises
YServiceProviderError, if error has occurred.
- lock(provider, target)
Allows the client to lock the entire configuration datastore system of a device.
- Parameters
provider –
NetconfServiceProviderinstance.target – An instance of
Datastorerepresenting the configuration to lock.
- Returns
Trueif the operation succeeds,False- otherwise.- Raises
YServiceProviderError, if error has occurred.
- unlock(provider, target)
Used to release a configuration lock, previously obtained with the LOCK operation.
- Parameters
provider –
NetconfServiceProviderinstance.target – An instance of
Datastorerepresenting the configuration to unlock.
- Returns
Trueif the operation succeeds,False- otherwise.- Raises
YServiceProviderError, if error has occurred.
- validate(provider, source=None, url='', source_config=None)
Execute a validate operation to validate the contents of the specified configuration.
- Parameters
provider –
NetconfServiceProviderinstance.source – An instance of
Datastorerepresenting the configuration datastore to validate.url – A
strrepresenting the configuration url.source_config –
EntityAn instance ofEntityrepresenting the configuration to validate.
- Returns
Trueif the operation succeeds,False- otherwise.- Raises
YServiceProviderError, if error has occurred.