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 –
NetconfServiceProvider
instance. - persist_id – An
int
that cancels a persistent confirmed commit.
Returns: True
if the operation succeeds,False
- otherwise.Raises: YServiceProviderError
, if error has occurred.- provider –
-
close_session
(provider)¶ Request graceful termination of a NETCONF session.
Parameters: provider – NetconfServiceProvider
instance.Returns: True
if 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 –
NetconfServiceProvider
instance. - confirmed – A
bool
that signals a confirmed commit operation. - confirm_timeout – An
int
representing timeout interval for a confirmed commit. - persist – An
int
that makes the confirmed commit persistent. - persist_id – An
int
that is given in order to commit a persistent confirmed commit.
Returns: True
if the operation succeeds,False
- otherwise.Raises: YServiceProviderError
, if error has occurred.- provider –
-
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 –
NetconfServiceProvider
instance. - target – An instance of
Datastore
representing configuration being used as destination. - source – An instance of
Datastore
representing configuration being used as source. - url – A
str
representing the configuration URL. - source-config –
Entity
instance, which represents single container in device supported model.For multiple containers the
Entity
instances must be encapsulate in Pythonlist
orConfig
.
Returns: True
if the operation succeeds,False
- otherwise.Raises: YServiceProviderError
, if error has occurred.- provider –
-
delete_config
(provider, target, url="")¶ Delete a configuration Datastore. The RUNNING configuration Datastore cannot be deleted.
Parameters: - provider –
NetconfServiceProvider
instance. - target – An instance of
Datastore
representing configuration to be deleted. - url – A
str
representing the configuration URL. Optional parameter required only when target is set tourl
.
Returns: True
if the operation succeeds,False
- otherwise.Raises: YServiceProviderError
, if error has occurred.- provider –
-
discard_changes
(provider)¶ Used to revert the candidate configuration to the current running configuration.
Parameters: provider – NetconfServiceProvider
instance.Returns: True
if 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 –
NetconfServiceProvider
instance. - target – An instance of
Datastore
representing the configuration being edited. - config –
An instance of
Entity
, which represents single container in device supported model.For multiple containers the
Entity
instances must be encapsulate in Pythonlist
orConfig
. - default_operation – A
str
that changes default frommerge
to eithermerge
,replace
, ornone
; this parameter is optional. - error_option – A
str
that can be set totest-then-set
,set
, ortest-only
if the device advertises the :validate:1.1 capability; this parameter is optional. - test_option – A
str
that can be set tostop-on-error
,continue-on-error
, orrollback-on-error
; this parameter is optional.
Returns: True
if the operation succeeds,False
- otherwise.Raises: YServiceProviderError
, if error has occurred.- provider –
-
get_config
(provider, source, filter)¶ Retrieve all or part of a specified configuration datastore.
Parameters: - provider –
NetconfServiceProvider
instance. - source – An instance of
Datastore
representing source configuration. - filter –
An instance of
Entity
, which represents single container in device supported model.For multiple containers the
Entity
instances must be encapsulate in Pythonlist
orFilter
.
Returns: For single entity filter - an instance of
Entity
as identified by the filter orNone
, if operation fails.For multiple filters - collection of
Entity
instances encapsulated into Pythonlist
orConfig
accordingly to the type of filter.Raises: YServiceProviderError
, if error has occurred.- provider –
-
get
(provider, filter)¶ Retrieve running configuration and device state information.
Parameters: - provider –
NetconfServiceProvider
instance. - filter –
An instance of
Entity
, which represents single container in device supported model.For multiple containers the
Entity
instances must be encapsulate in Pythonlist
orFilter
.
Returns: For single entity filter - an instance of
Entity
as identified by the filter orNone
, if operation fails.For multiple filters - collection of
Entity
instances encapsulated into Pythonlist
orConfig
accordingly to the type of filter.Raises: YServiceProviderError
, if error has occurred.- provider –
-
kill_session
(provider, session_id)¶ Force the termination of a NETCONF session.
Parameters: - provider –
NetconfServiceProvider
instance. - session_id – An
int
- session identifier of the NETCONF session to be terminated.
Returns: True
if the operation succeeds,False
- otherwise.Raises: YServiceProviderError
, if error has occurred.- provider –
-
lock
(provider, target)¶ Allows the client to lock the entire configuration datastore system of a device.
Parameters: - provider –
NetconfServiceProvider
instance. - target – An instance of
Datastore
representing the configuration to lock.
Returns: True
if the operation succeeds,False
- otherwise.Raises: YServiceProviderError
, if error has occurred.- provider –
-
unlock
(provider, target)¶ Used to release a configuration lock, previously obtained with the LOCK operation.
Parameters: - provider –
NetconfServiceProvider
instance. - target – An instance of
Datastore
representing the configuration to unlock.
Returns: True
if the operation succeeds,False
- otherwise.Raises: YServiceProviderError
, if error has occurred.- provider –
-
validate
(provider, source=None, url='', source_config=None)¶ Execute a validate operation to validate the contents of the specified configuration.
Parameters: - provider –
NetconfServiceProvider
instance. - source – An instance of
Datastore
representing the configuration datastore to validate. - url – A
str
representing the configuration url. - source_config –
Entity
An instance ofEntity
representing the configuration to validate.
Returns: True
if the operation succeeds,False
- otherwise.Raises: YServiceProviderError
, if error has occurred.- provider –
-