Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused code and fix validation service to use libyang validation #352

Merged
1 commit merged into from Jan 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion sdk/cpp/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ set(libydk_src
src/path/root_schema_node.cpp
src/path/rpc.cpp
src/path/schema_node.cpp
src/path/schema_value_type.cpp
src/path/statement.cpp)

set(libydk_install_headers
Expand Down
94 changes: 49 additions & 45 deletions sdk/cpp/core/docsgen/api/services/netconf_service.rst
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
NetconfService
==============

.. toctree::
:maxdepth: 2

.. cpp:namespace:: ydk

.. cpp:enum-class:: Datastore

:param candidate: Enum representing candidate datastore
:param running: Enum representing running datastore
:param startup: Enum representing startup datastore
:param url: Enum representing url datastore
:param config: Enum representing config datastore
Type of datastore to perform operation on

.. cpp:enumerator:: candidate
.. cpp:enumerator:: running
.. cpp:enumerator:: startup
.. cpp:enumerator:: url

.. cpp:class:: NetconfService : public Service

Expand All @@ -25,16 +29,16 @@ Netconf Service class for supporting encoding and decoding C++ model API objects

:param provider: An instance of :cpp:class:`NetconfServiceProvider<ydk::NetconfServiceProvider>`
:param persist_id: Cancels a persistent confirmed commit.
:return: The result of the operation as bool
:raises:
:return: true if the operation succeeds, else false
:raises YCPPError: If an error has occurred

.. cpp:function:: bool close_session(NetconfServiceProvider & provider)

Request graceful termination of a NETCONF session

:param provider: An instance of :cpp:class:`NetconfServiceProvider<ydk::NetconfServiceProvider>`
:return: The result of the operation as bool
:raises:
:return: true if the operation succeeds, else false
:raises YCPPError: If an error has occurred

.. cpp:function:: bool commit(NetconfServiceProvider & provider, std::string confirmed = "", std::string confirm_timeout = "", std::string persist = "", std::string persist_id = "")

Expand All @@ -45,68 +49,68 @@ Netconf Service class for supporting encoding and decoding C++ model API objects
:param confirm_timeout: An optional argument
:param persist: An optional argument
:param persist_id: An optional argument
:return: The result of the operation as bool
:raises:
:return: true if the operation succeeds, else false
:raises YCPPError: If an error has occurred

.. cpp:function:: 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.

:param provider: An instance of :cpp:class:`NetconfServiceProvider<ydk::NetconfServiceProvider>`
:param target: The configuration being used as the destination of type :cpp:enum-class:`Datastore`
:param source: The configuration being used as the source of type :cpp:enum-class:`Datastore`
:return: The result of the operation as bool
:raises:
:param target: The configuration being used as the destination of type :cpp:class:`Datastore`
:param source: The configuration being used as the source of type :cpp:class:`Datastore`
:return: true if the operation succeeds, else false
:raises YCPPError: If an error has occurred

.. cpp:function:: 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.

:param provider: An instance of :cpp:class:`NetconfServiceProvider<ydk::NetconfServiceProvider>`
:param target: The configuration being used as the destination of type :cpp:enum-class:`Datastore`
:param target: The configuration being used as the destination of type :cpp:class:`Datastore`
:param source: The configuration being used as the source of type :cpp:class:`Entity<ydk::Entity>`
:return: The result of the operation as bool
:raises:
:return: true if the operation succeeds, else false
:raises YCPPError: If an error has occurred

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

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

:param provider: An instance of :cpp:class:`NetconfServiceProvider<ydk::NetconfServiceProvider>`
:param target: The configuration of type :cpp:enum-class:`Datastore` to be deleted
:param url: Required only when target is set to :cpp:enum-class:`Datastore`.:cpp:enum:`url`
:return: The result of the operation as bool
:raises:
:param target: The configuration of type :cpp:class:`Datastore` to be deleted
:param url: Required only when target is set to :cpp:enumerator:`url<Datastore::url>`
:return: true if the operation succeeds, else false
:raises YCPPError: If an error has occurred

.. cpp:function:: bool discard_changes(NetconfServiceProvider & provider)

Used to revert the candidate configuration to the current running configuration

:param provider: An instance of :cpp:class:`NetconfServiceProvider<ydk::NetconfServiceProvider>`
:return: The result of the operation as bool
:raises:
:return: true if the operation succeeds, else false
:raises YCPPError: If an error has occurred

.. cpp:function:: 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.

:param provider: An instance of :cpp:class:`NetconfServiceProvider<ydk::NetconfServiceProvider>`
:param target: The configuration being edited of type :cpp:enum-class:`Datastore`
:param target: The configuration being edited of type :cpp:class:`Datastore`
:param config: An instance of :cpp:class:`Entity<ydk::Entity>` that is a hierarchy configuration of data as defined by one of the device's data models
:param default_operation: Selects the default operation (merge, replace, or none). The default value for this parameter is "merge".
:param test_option: Optionally set to "test-then-set", "set", or "test-only" if the device advertises the :validate:1.1 capability
:param error_option: Optionally set to "stop-on-error", "continue-on-error", or "rollback-on-error"
:return: The result of the operation as bool.
:raises:
:return: true if the operation succeeds, else false.
:raises YCPPError: If an error has occurred

.. cpp:function:: std::unique_ptr<Entity> get_config(NetconfServiceProvider & provider, DataStore source, Entity& filter);
.. cpp:function:: std::unique_ptr<Entity> get_config(NetconfServiceProvider & provider, DataStore source, Entity& filter)

Retrieve all or part of a specified configuration datastore

:param provider: An instance of :cpp:class:`NetconfServiceProvider<ydk::NetconfServiceProvider>`
:param source: The configuration being queried of type :cpp:enum-class:`Datastore`
:param source: The configuration being queried of type :cpp:class:`Datastore`
:return: The requested data as :cpp:class:`Entity<ydk::Entity>`
:raises:
:raises YCPPError: If an error has occurred

.. cpp:function:: std::unique_ptr<Entity> get(NetconfServiceProvider & provider, Entity& filter)

Expand All @@ -115,49 +119,49 @@ Netconf Service class for supporting encoding and decoding C++ model API objects
:param provider: An instance of :cpp:class:`NetconfServiceProvider<ydk::NetconfServiceProvider>`
:param filter: An instance of :cpp:class:`Entity<ydk::Entity>` that specifies the portion of the system configuration and state data to retrieve
:return: The requested data as :cpp:class:`Entity<ydk::Entity>`
:raises:
:raises YCPPError: If an error has occurred

.. cpp:function:: bool kill_session(NetconfServiceProvider & provider, int session_id)

Force the termination of a NETCONF session

:param provider: An instance of :cpp:class:`NetconfServiceProvider<ydk::NetconfServiceProvider>`
:param session_id: An instance of int that is the session identifier of the NETCONF session to be terminated
:return: The result of the operation as bool
:raises:
:return: true if the operation succeeds, else false
:raises YCPPError: If an error has occurred

.. cpp:function:: bool lock(NetconfServiceProvider & provider, DataStore target)

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

:param provider: An instance of :cpp:class:`NetconfServiceProvider<ydk::NetconfServiceProvider>`
:param target: The configuration of type :cpp:enum-class:`Datastore` to lock
:return: The result of the operation as bool
:raises:
:param target: The configuration of type :cpp:class:`Datastore` to lock
:return: true if the operation succeeds, else false
:raises YCPPError: If an error has occurred

.. cpp:function:: bool unlock(NetconfServiceProvider & provider, DataStore target)

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

:param provider: An instance of :cpp:class:`NetconfServiceProvider<ydk::NetconfServiceProvider>`
:param target: The configuration of type DATASTORE to unlock
:return: The result of the operation as bool
:raises:
:param target: The configuration of type :cpp:class:`Datastore` to unlock
:return: true if the operation succeeds, else false
:raises YCPPError: If an error has occurred

.. cpp:function:: bool validate(NetconfServiceProvider & provider, DataStore source)

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

:param provider: An instance of :cpp:class:`NetconfServiceProvider<ydk::NetconfServiceProvider>`
:param source: An instance of :cpp:enum-class:`Datastore`
:return: The result of the operation as bool
:raises:
:param source: An instance of :cpp:class:`Datastore`
:return: true if the operation succeeds, else false
:raises YCPPError: If an error has occurred

.. cpp:function:: bool validate(NetconfServiceProvider & provider, Entity& source)
.. cpp:function:: bool validate(NetconfServiceProvider & provider, Entity& source_config)

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

:param provider: An instance of :cpp:class:`NetconfServiceProvider<ydk::NetconfServiceProvider>`
:param source: An instance of :cpp:class:`Entity<ydk::Entity>`
:return: The result of the operation as bool
:raises:
:return: true if the operation succeeds, else false
:raises YCPPError: If an error has occurred
1 change: 1 addition & 0 deletions sdk/cpp/core/docsgen/api/services/service.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Base class for YDK service
:maxdepth: 2

crud_service.rst
netconf_service.rst
codec_service.rst
validation_service.rst
core_codec_service.rst
2 changes: 1 addition & 1 deletion sdk/cpp/core/src/errors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ ydk::YCPPOperationNotSupportedError::YCPPOperationNotSupportedError(const std::s
//////////////////////////////////////////////////////////////////////////
/// YCPPDataValidationError
//////////////////////////////////////////////////////////////////////////
ydk::path::YCPPDataValidationError::YCPPDataValidationError() : ydk::path::YCPPCoreError{"Data Validation Error"}
ydk::path::YCPPDataValidationError::YCPPDataValidationError() : ydk::path::YCPPCoreError{ly_errmsg()}
{

}
Expand Down
8 changes: 8 additions & 0 deletions sdk/cpp/core/src/errors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ struct YCPPServiceProviderError : public YCPPError
}
};

struct YCPPServiceError : public YCPPError
{
YCPPServiceError(const std::string& msg) : YCPPError{msg}
{

}
};

///
/// @brief Illegal State Error.
///
Expand Down
Loading