diff --git a/.gitignore b/.gitignore
index d08f38313..ac06ad8bf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+.idea/*
*.log
.settings/
.pydevproject
diff --git a/README.md b/README.md
index 312a6985e..0508a840e 100644
--- a/README.md
+++ b/README.md
@@ -41,7 +41,7 @@ YANG Development Kit (Generator)
# Overview
-**ydk-gen** is a developer tool that can generate API's that are modeled in YANG. Currently, it generates language binding for Python and C++ with planned support for other language bindings in the future.
+**ydk-gen** is a developer tool that can generate API's that are modeled in YANG. Currently, it generates language binding for Python and C++ with planned support for other language bindings in the future.
Other tools and libraries are used to deliver `ydk-gen`'s functionality. In particular:
@@ -54,32 +54,35 @@ The output of ydk-gen is either a core package, that defines services and provid
# System requirements
+Please follow the below instructions to install the system requirements before installing YDK-Py/YDK-Cpp:
## Linux
-Ubuntu (Debian-based): The following packages must be present in your system before installing YDK-Py/YDK-Cpp:
+Ubuntu (Debian-based):
```
-$ sudo apt-get install python-pip zlib1g-dev python-lxml libxml2-dev libxslt1-dev python-dev libssh-dev libcurl4-openssl-dev libtool-bin libpcre3-dev libpcre++-dev libtool pkg-config python3-dev python3-lxml cmake clang
+ $ sudo apt-get install gdebi-core
+ $ wget https://devhub.cisco.com/artifactory/debian-ydk/0.6.0/libydk_0.6.0-1_amd64.deb
+ $ sudo gdebi libydk_0.6.0-1_amd64.deb
```
-Centos (Fedora-based): The following packages must be present in your system before installing YDK-Py/YDK-Cpp:
+Centos (Fedora-based):
```
-$ sudo yum install epel-release
-$ sudo yum install python-pip python-devel libxml2-devel libxslt-devel libssh-devel libcurl-devel libtool clang cmake3 pcre-devel
-$ sudo ln -fs /usr/bin/cmake3 /usr/bin/cmake
+ $ sudo yum install epel-release
+ $ sudo yum install https://devhub.cisco.com/artifactory/rpm-ydk/0.6.0/libydk-0.6.0-1.x86_64.rpm
+ $ sudo ln –s /usr/bin/cmake3 /usr/bin/cmake && export PATH=/usr/bin/cmake:$PATH
```
## macOS
It is recommended to install [homebrew](http://brew.sh) and Xcode command line tools on your system before installing YDK-Py/YDK-Cpp:
```
-$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
-$ xcode-select --install
-$ brew install pkg-config cmake libssh xml2 curl pcre
+ $ xcode-select --install
+ $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
+ $ brew install python pkg-config libssh xml2 curl pcre cmake
+ $ curl -O https://devhub.cisco.com/artifactory/osx-ydk/0.6.0/libydk_0.6.0_Darwin.pkg
+ $ sudo installer -pkg libydk_0.6.0_Darwin.pkg -target /
```
## Windows
-You must install the following requirements::
-* [Python Releases for Windows](https://www.python.org/downloads/windows)
-* [Visual C++ Build Tools](http://landinghub.visualstudio.com/visual-cpp-build-tools)
+Currently, ``YDK-Py`` and ``YDK-Cpp`` from release ``0.6.0`` onwards is not supported on Windows.
# Installation
## Setting up your environment
@@ -133,7 +136,7 @@ The below steps specify how to use `ydk-gen` to generate the core and a bundle.
The first step in using ydk-gen is either using one of the already existing [bundle profiles](https://github.com/CiscoDevNet/ydk-gen/tree/master/profiles/bundles) or constructing your own bundle profile, consisting of the YANG models you are interested in:
-Construct a bundle profile file, such as [```ietf_0_1_1.json```](profiles/bundles/ietf_0_1_1.json) and specify its dependencies
+Construct a bundle profile file, such as [```ietf_0_1_1.json```](profiles/bundles/ietf_0_1_1.json) and specify its dependencies.
### Details
@@ -272,8 +275,8 @@ When run in this way, we will generate a bundle that only contains tje files spe
```
README - install and usage notes
gen-api - generated bundle/core
- - python (Python SDK)
- - cpp (C++ SDK)
+ - python (Python SDK)
+ - cpp (C++ SDK)
generate.py - script used to generate SDK for yang models
profiles - profile files used during generation
diff --git a/profiles/bundles/yang/ietf/ietf-interfaces-ext.yang b/profiles/bundles/yang/ietf/ietf-interfaces-ext.yang
index 39f1044ec..fa851f87a 100644
--- a/profiles/bundles/yang/ietf/ietf-interfaces-ext.yang
+++ b/profiles/bundles/yang/ietf/ietf-interfaces-ext.yang
@@ -1,48 +1,48 @@
module ietf-interfaces-ext {
- namespace "urn:ietf:params:xml:ns:yang:ietf-interfaces-ext";
- prefix if-ext;
- import ietf-yang-types {
- prefix yang;
- }
- import ietf-interfaces {
- prefix if;
- }
- organization
- "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
+ namespace "urn:ietf:params:xml:ns:yang:ietf-interfaces-ext";
+ prefix if-ext;
+ import ietf-yang-types {
+ prefix yang;
+ }
+ import ietf-interfaces {
+ prefix if;
+ }
+ organization
+ "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
- contact
- "WG Web:
- WG List:
+ contact
+ "WG Web:
+ WG List:
- WG Chair: David Kessens
-
+ WG Chair: David Kessens
+
- WG Chair: Juergen Schoenwaelder
-
+ WG Chair: Juergen Schoenwaelder
+
- Editor: Martin Bjorklund
- ";
- description
- "augments needed for IOS-XE platform show interface command";
+ Editor: Martin Bjorklund
+ ";
+ description
+ "augments needed for IOS-XE platform show interface command";
- augment "/if:interfaces-state/if:interface/if:statistics" {
- description
- "this adds a leaf called total input packets as we have no way of doing arithmetic in RPL";
+ augment "/if:interfaces-state/if:interface/if:statistics" {
+ description
+ "this adds a leaf called total input packets as we have no way of doing arithmetic in RPL";
- leaf in-pkts {
- type yang:counter64;
- description
- "total packets input";
- }
+ leaf in-pkts {
+ type yang:counter64;
+ description
+ "total packets input";
+ }
- leaf out-pkts {
- type yang:counter64;
- description
- "total packets output";
- }
- }
+ leaf out-pkts {
+ type yang:counter64;
+ description
+ "total packets output";
+ }
+ }
augment "/if:interfaces-state/if:interface" {
description
diff --git a/profiles/bundles/yang/openconfig/bgp-operational@2015-05-15.yang b/profiles/bundles/yang/openconfig/bgp-operational@2015-05-15.yang
index b8ddf43a6..52731dbb0 100644
--- a/profiles/bundles/yang/openconfig/bgp-operational@2015-05-15.yang
+++ b/profiles/bundles/yang/openconfig/bgp-operational@2015-05-15.yang
@@ -242,7 +242,7 @@ module bgp-operational {
}
leaf-list supported-capabilities {
- type string;
+ type string;
/* type identityref {
base bgp-types:bgp-capability;
}*/
diff --git a/profiles/bundles/yang/openconfig/bgp-types@2015-05-15.yang b/profiles/bundles/yang/openconfig/bgp-types@2015-05-15.yang
index a2dff8555..3acd920d9 100644
--- a/profiles/bundles/yang/openconfig/bgp-types@2015-05-15.yang
+++ b/profiles/bundles/yang/openconfig/bgp-types@2015-05-15.yang
@@ -1,14 +1,14 @@
module bgp-types {
- yang-version "1";
+ yang-version "1";
- namespace "http://openconfig.net/yang/bgp-types";
+ namespace "http://openconfig.net/yang/bgp-types";
- prefix "bgp-types";
+ prefix "bgp-types";
- import ietf-inet-types { prefix inet; }
+ import ietf-inet-types { prefix inet; }
- // meta
- organization
+ // meta
+ organization
"OpenConfig working group";
contact
@@ -210,7 +210,7 @@ module bgp-types {
}
typedef bgp-well-known-community-type {
- type string;
+ type string;
/* type identityref {
base bgp-well-known-std-community;
} */
@@ -354,4 +354,4 @@ module bgp-types {
}
-}
\ No newline at end of file
+}
diff --git a/profiles/bundles/yang/openconfig/policy-types@2015-05-15.yang b/profiles/bundles/yang/openconfig/policy-types@2015-05-15.yang
index 052b25988..72c9e1981 100644
--- a/profiles/bundles/yang/openconfig/policy-types@2015-05-15.yang
+++ b/profiles/bundles/yang/openconfig/policy-types@2015-05-15.yang
@@ -101,7 +101,7 @@ module policy-types {
condition statements";
leaf operator {
- type string;
+ type string;
/* type identityref {
base attribute-comparison;
}*/
diff --git a/profiles/bundles/yang/openconfig/routing-policy@2015-05-15.yang b/profiles/bundles/yang/openconfig/routing-policy@2015-05-15.yang
index b44b239df..7d0d276c8 100644
--- a/profiles/bundles/yang/openconfig/routing-policy@2015-05-15.yang
+++ b/profiles/bundles/yang/openconfig/routing-policy@2015-05-15.yang
@@ -227,7 +227,7 @@ module routing-policy {
characteristic of a route";
leaf install-protocol-eq {
- type string;
+ type string;
/*type identityref {
base pt:install-protocol-type;
}*/
diff --git a/profiles/test/bgp.json b/profiles/test/bgp.json
index c491d516f..faeb4c614 100644
--- a/profiles/test/bgp.json
+++ b/profiles/test/bgp.json
@@ -7,81 +7,81 @@
"models": {
- "_descr_git": "Each element on the list has details on git repositories to source models from, including commit ids and relative paths inside the repositories. If no commit id is specified, HEAD is taken. This is unwise. The nested dir and file references are interpreted the same way as specific dir and file references above.",
- "git": [
- {
- "url": "https://github.com/YangModels/yang.git",
- "commits": [
+ "_descr_git": "Each element on the list has details on git repositories to source models from, including commit ids and relative paths inside the repositories. If no commit id is specified, HEAD is taken. This is unwise. The nested dir and file references are interpreted the same way as specific dir and file references above.",
+ "git": [
+ {
+ "url": "https://github.com/YangModels/yang.git",
+ "commits": [
- {
+ {
- "commitid": "a5e3d7f27e0e846cac6b6357ff460b8facc810a8",
- "file": [
- "standard/ietf/RFC/ietf-inet-types.yang",
- "standard/ietf/RFC/ietf-interfaces.yang",
- "standard/ietf/RFC/ietf-netconf-acm.yang",
- "standard/ietf/RFC/ietf-yang-smiv2.yang",
- "standard/ietf/RFC/ietf-yang-types.yang",
- "standard/ietf/RFC/iana-if-type.yang"
+ "commitid": "a5e3d7f27e0e846cac6b6357ff460b8facc810a8",
+ "file": [
+ "standard/ietf/RFC/ietf-inet-types.yang",
+ "standard/ietf/RFC/ietf-interfaces.yang",
+ "standard/ietf/RFC/ietf-netconf-acm.yang",
+ "standard/ietf/RFC/ietf-yang-smiv2.yang",
+ "standard/ietf/RFC/ietf-yang-types.yang",
+ "standard/ietf/RFC/iana-if-type.yang"
- ]
- },
+ ]
+ },
- {
+ {
- "commitid": "be8ff2197e1179c2193433c38ba766a65aca5828",
- "file": [
- "standard/ietf/RFC/iana-crypt-hash.yang"
+ "commitid": "be8ff2197e1179c2193433c38ba766a65aca5828",
+ "file": [
+ "standard/ietf/RFC/iana-crypt-hash.yang"
- ]
- },
+ ]
+ },
- {
+ {
- "commitid": "f6b4e2d59d4eedf31ae8b2fa3119468e4c38259c",
- "file": [
- "experimental/openconfig/bgp/bgp.yang",
- "experimental/openconfig/bgp/bgp-multiprotocol.yang",
- "experimental/openconfig/bgp/bgp-operational.yang",
- "experimental/openconfig/bgp/bgp-types.yang",
- "experimental/openconfig/policy/policy-types.yang",
- "experimental/openconfig/policy/routing-policy.yang",
- "experimental/openconfig/structure/model-structure.yang"
+ "commitid": "f6b4e2d59d4eedf31ae8b2fa3119468e4c38259c",
+ "file": [
+ "experimental/openconfig/bgp/bgp.yang",
+ "experimental/openconfig/bgp/bgp-multiprotocol.yang",
+ "experimental/openconfig/bgp/bgp-operational.yang",
+ "experimental/openconfig/bgp/bgp-types.yang",
+ "experimental/openconfig/policy/policy-types.yang",
+ "experimental/openconfig/policy/routing-policy.yang",
+ "experimental/openconfig/structure/model-structure.yang"
- ]
- }
+ ]
+ }
- ]
- },
+ ]
+ },
- {
- "url": "https://github.com/openconfig/public.git",
- "commits": [
- {
- "commitid": "4ab22755c2484e893b2c2b6d88f800b8dd41bb09",
- "dir": [
+ {
+ "url": "https://github.com/openconfig/public.git",
+ "commits": [
+ {
+ "commitid": "4ab22755c2484e893b2c2b6d88f800b8dd41bb09",
+ "dir": [
- "release/models/interfaces",
- "release/models/inventory",
- "release/models/mpls",
- "release/models/optical-transport",
- "release/models/rpc",
- "release/models/telemetry",
- "release/models/vlan"
+ "release/models/interfaces",
+ "release/models/inventory",
+ "release/models/mpls",
+ "release/models/optical-transport",
+ "release/models/rpc",
+ "release/models/telemetry",
+ "release/models/vlan"
- ],
- "file": [
- "release/models/openconfig-extensions.yang",
- "release/models/openconfig-types.yang"
+ ],
+ "file": [
+ "release/models/openconfig-extensions.yang",
+ "release/models/openconfig-types.yang"
- ]
- }
- ]
+ ]
+ }
+ ]
}
]
diff --git a/profiles/test/bgp_ydk_dev.json b/profiles/test/bgp_ydk_dev.json
index c32e3ba74..b137a2fa6 100644
--- a/profiles/test/bgp_ydk_dev.json
+++ b/profiles/test/bgp_ydk_dev.json
@@ -7,82 +7,82 @@
"models": {
- "_descr_git": "Each element on the list has details on git repositories to source models from, including commit ids and relative paths inside the repositories. If no commit id is specified, HEAD is taken. This is unwise. The nested dir and file references are interpreted the same way as specific dir and file references above.",
- "git": [
- {
- "url": "http://gitlab.cisco.com/ydk-dev/ydk-models.git",
- "commits": [
+ "_descr_git": "Each element on the list has details on git repositories to source models from, including commit ids and relative paths inside the repositories. If no commit id is specified, HEAD is taken. This is unwise. The nested dir and file references are interpreted the same way as specific dir and file references above.",
+ "git": [
+ {
+ "url": "http://gitlab.cisco.com/ydk-dev/ydk-models.git",
+ "commits": [
- {
+ {
- "commitid": "73f7569cbc062bdae06ffe37fdae9dae15087d53",
- "file": [
- "yang/ietf/ietf-inet-types@2013-07-15.yang",
- "yang/ietf/ietf-interfaces@2014-05-08.yang",
- "yang/ietf/ietf-netconf-acm@2012-02-22.yang",
- "yang/ietf/ietf-yang-smiv2@2012-06-22.yang",
- "yang/ietf/ietf-yang-types@2013-07-15.yang"
+ "commitid": "73f7569cbc062bdae06ffe37fdae9dae15087d53",
+ "file": [
+ "yang/ietf/ietf-inet-types@2013-07-15.yang",
+ "yang/ietf/ietf-interfaces@2014-05-08.yang",
+ "yang/ietf/ietf-netconf-acm@2012-02-22.yang",
+ "yang/ietf/ietf-yang-smiv2@2012-06-22.yang",
+ "yang/ietf/ietf-yang-types@2013-07-15.yang"
- ]
- },
+ ]
+ },
- {
+ {
- "commitid": "73f7569cbc062bdae06ffe37fdae9dae15087d53",
- "file": [
+ "commitid": "73f7569cbc062bdae06ffe37fdae9dae15087d53",
+ "file": [
"yang/iana/iana-if-type@2015-06-12.yang",
- "yang/iana/iana-crypt-hash@2014-04-04.yang"
-
- ]
- },
-
- {
-
- "commitid": "73f7569cbc062bdae06ffe37fdae9dae15087d53",
- "file": [
- "yang/openconfig/bgp@2015-05-15.yang",
- "yang/openconfig/bgp-multiprotocol@2015-05-15.yang",
- "yang/openconfig/bgp-operational@2015-05-15.yang",
- "yang/openconfig/bgp-types@2015-05-15.yang",
- "yang/openconfig/policy-types@2015-05-15.yang",
- "yang/openconfig/routing-policy@2015-05-15.yang",
- "yang/openconfig/model-structure@2015-03-06.yang",
+ "yang/iana/iana-crypt-hash@2014-04-04.yang"
+
+ ]
+ },
+
+ {
+
+ "commitid": "73f7569cbc062bdae06ffe37fdae9dae15087d53",
+ "file": [
+ "yang/openconfig/bgp@2015-05-15.yang",
+ "yang/openconfig/bgp-multiprotocol@2015-05-15.yang",
+ "yang/openconfig/bgp-operational@2015-05-15.yang",
+ "yang/openconfig/bgp-types@2015-05-15.yang",
+ "yang/openconfig/policy-types@2015-05-15.yang",
+ "yang/openconfig/routing-policy@2015-05-15.yang",
+ "yang/openconfig/model-structure@2015-03-06.yang",
"yang/openconfig/oc-xr-mapping@2015-02-10.yang"
- ]
- }
-
- ]
- },
-
- {
- "url": "https://github.com/openconfig/public.git",
- "commits": [
- {
- "commitid": "4ab22755c2484e893b2c2b6d88f800b8dd41bb09",
- "dir": [
-
- "release/models/interfaces",
- "release/models/inventory",
- "release/models/mpls",
- "release/models/optical-transport",
- "release/models/rpc",
- "release/models/telemetry",
- "release/models/vlan"
-
- ],
- "file": [
- "release/models/openconfig-extensions.yang",
- "release/models/openconfig-types.yang"
-
- ]
- }
- ]
+ ]
+ }
+
+ ]
+ },
+
+ {
+ "url": "https://github.com/openconfig/public.git",
+ "commits": [
+ {
+ "commitid": "4ab22755c2484e893b2c2b6d88f800b8dd41bb09",
+ "dir": [
+
+ "release/models/interfaces",
+ "release/models/inventory",
+ "release/models/mpls",
+ "release/models/optical-transport",
+ "release/models/rpc",
+ "release/models/telemetry",
+ "release/models/vlan"
+
+ ],
+ "file": [
+ "release/models/openconfig-extensions.yang",
+ "release/models/openconfig-types.yang"
+
+ ]
+ }
+ ]
}
]
diff --git a/profiles/test/opendaylight.json b/profiles/test/opendaylight.json
index 73e15f416..e407da228 100644
--- a/profiles/test/opendaylight.json
+++ b/profiles/test/opendaylight.json
@@ -1,5 +1,5 @@
{
- "name": "network-topology",
+ "name": "opendaylight",
"version": "0.0.1",
"ydk_version":"0.5.3",
"author": "Cisco",
diff --git a/profiles/test/ydktest-augmentation.json b/profiles/test/ydktest-augmentation.json
index 8bed80f71..e111d6586 100644
--- a/profiles/test/ydktest-augmentation.json
+++ b/profiles/test/ydktest-augmentation.json
@@ -15,7 +15,8 @@
"yang/ydktest-augmentation/ietf-aug-base-2@2016-07-01.yang",
"yang/ydktest-augmentation/ydktest-aug-ietf-1@2016-06-17.yang",
"yang/ydktest-augmentation/ydktest-aug-ietf-2@2016-06-22.yang",
- "yang/ydktest-augmentation/ydktest-aug-ietf-4@2016-06-27.yang"
+ "yang/ydktest-augmentation/ydktest-aug-ietf-4@2016-06-27.yang",
+ "yang/ydktest-augmentation/ydktest-aug-ietf-5@2017-07-26.yang"
]
}
}
diff --git a/profiles/test/ydktest-cpp.json b/profiles/test/ydktest-cpp.json
index 0ae544414..49bf88be4 100644
--- a/profiles/test/ydktest-cpp.json
+++ b/profiles/test/ydktest-cpp.json
@@ -6,7 +6,7 @@
"copyright": "Cisco",
"description": "YDK Test Profile",
"models": {
- "file": [
+ "file": [
"sdk/cpp/core/tests/models/ietf-interfaces@2014-05-08.yang",
"sdk/cpp/core/tests/models/main@2015-11-17.yang",
"sdk/cpp/core/tests/models/main-aug1@2015-11-17.yang",
diff --git a/profiles/test/ydktest.json b/profiles/test/ydktest.json
index b0f72885e..ed14e7b33 100644
--- a/profiles/test/ydktest.json
+++ b/profiles/test/ydktest.json
@@ -6,9 +6,9 @@
"copyright": "Cisco",
"description": "YDK Test Profile",
"models": {
- "dir": [
- "/yang/ydktest",
- "/yang/ietf"
+ "dir": [
+ "/yang/ydktest",
+ "/yang/ietf"
]
}
}
diff --git a/requirements.txt b/requirements.txt
index 4223789b8..ae52b6f5c 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,9 +1,6 @@
-enum34==1.1.3
-lxml>=3.4.4
pyang==1.6
Sphinx==1.4a1
sphinx-rtd-theme==0.1.9
GitPython==1.0.1
-ncclient>=0.4.7
rstr==2.2.6
diff --git a/sdk/cpp/.gitignore b/sdk/cpp/.gitignore
index d348ec1d6..620bcf91b 100644
--- a/sdk/cpp/.gitignore
+++ b/sdk/cpp/.gitignore
@@ -1,2 +1,2 @@
-builds
+build*
diff --git a/sdk/cpp/core/CMakeLists.txt b/sdk/cpp/core/CMakeLists.txt
index 948fa0fce..5067df079 100644
--- a/sdk/cpp/core/CMakeLists.txt
+++ b/sdk/cpp/core/CMakeLists.txt
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 2.8.9)
cmake_policy(SET CMP0048 NEW)
-project(ydk VERSION 0.5.5 LANGUAGES C CXX)
+project(ydk VERSION 0.6.0 LANGUAGES C CXX)
set(YDK_DESCRIPTION "YANG Development Kit Library. The library for YDK API.")
@@ -114,7 +114,7 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE debug)
endif()
-configure_file("${CMAKE_SOURCE_DIR}/core_info.hpp.in" "${CMAKE_SOURCE_DIR}/src/path/core_info.hpp" ESCAPE_QUOTES @ONLY)
+set(HOME_DIRECTORY $ENV{HOME})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
@@ -144,7 +144,10 @@ set(libydk_src
src/executor_service.cpp
src/ietf_parser.cpp
src/leaf_data.cpp
- src/netconf_client.cpp
+ src/logging_callback.cpp
+ src/netconf_client.cpp
+ src/netconf_ssh_client.cpp
+ src/netconf_tcp_client.cpp
src/netconf_model_provider.cpp
src/netconf_provider.cpp
src/netconf_service.cpp
@@ -156,6 +159,7 @@ set(libydk_src
src/validation_service.cpp
src/value.cpp
src/value_list.cpp
+ src/xml_subtree_codec.cpp
src/ydk_operation.cpp
src/ydk_yang.cpp
src/path/annotation.cpp
@@ -191,8 +195,11 @@ set(libydk_install_headers
src/entity_util.hpp
src/errors.hpp
src/executor_service.hpp
+ src/filters.hpp
+ src/logging_callback.hpp
src/netconf_provider.hpp
src/network_topology.hpp
+ src/netconf_client.hpp
src/netconf_service.hpp
src/opendaylight_parser.hpp
src/opendaylight_provider.hpp
@@ -201,6 +208,7 @@ set(libydk_install_headers
src/service.hpp
src/service.hpp
src/types.hpp
+ src/xml_subtree_codec.hpp
src/validation_service.hpp)
# Set LibNetconf variables
@@ -327,7 +335,6 @@ find_library(pthread_location pthread)
find_library(dl_location dl)
find_package(LibXml2 REQUIRED)
find_package(LibSSH REQUIRED)
-find_package(PythonLibs REQUIRED)
# Add LibNetconf
set(libnetconf_include_location include/libnetconf)
@@ -413,7 +420,6 @@ include_directories(
${libyang_headers_location}
${libyang_location}/headers
${PROJECT_SOURCE_DIR}/src
- ${PYTHON_INCLUDE_PATH}
)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
@@ -431,7 +437,6 @@ target_link_libraries(ydk
${dl_location}
libnetconf
libyang
- ${PYTHON_LIBRARIES}
)
set_property(TARGET ydk PROPERTY CXX_STANDARD 11)
diff --git a/sdk/cpp/core/CMakeModules/FindLibSSH.cmake b/sdk/cpp/core/CMakeModules/FindLibSSH.cmake
index 9b23c1cec..18e80faa8 100644
--- a/sdk/cpp/core/CMakeModules/FindLibSSH.cmake
+++ b/sdk/cpp/core/CMakeModules/FindLibSSH.cmake
@@ -82,17 +82,17 @@ else (LIBSSH_LIBRARIES AND LIBSSH_INCLUDE_DIRS)
# Older versions of libssh like libssh-0.2 have LIBSSH_VERSION but not LIBSSH_VERSION_MAJOR
if (LIBSSH_VERSION_MAJOR)
string(REGEX MATCH "[0-9]+" LIBSSH_VERSION_MAJOR ${LIBSSH_VERSION_MAJOR})
- file(STRINGS ${LIBSSH_INCLUDE_DIR}/libssh/libssh.h LIBSSH_VERSION_MINOR
+ file(STRINGS ${LIBSSH_INCLUDE_DIR}/libssh/libssh.h LIBSSH_VERSION_MINOR
REGEX "#define[ ]+LIBSSH_VERSION_MINOR[ ]+[0-9]+")
- string(REGEX MATCH "[0-9]+" LIBSSH_VERSION_MINOR ${LIBSSH_VERSION_MINOR})
- file(STRINGS ${LIBSSH_INCLUDE_DIR}/libssh/libssh.h LIBSSH_VERSION_PATCH
+ string(REGEX MATCH "[0-9]+" LIBSSH_VERSION_MINOR ${LIBSSH_VERSION_MINOR})
+ file(STRINGS ${LIBSSH_INCLUDE_DIR}/libssh/libssh.h LIBSSH_VERSION_PATCH
REGEX "#define[ ]+LIBSSH_VERSION_MICRO[ ]+[0-9]+")
- string(REGEX MATCH "[0-9]+" LIBSSH_VERSION_PATCH ${LIBSSH_VERSION_PATCH})
+ string(REGEX MATCH "[0-9]+" LIBSSH_VERSION_PATCH ${LIBSSH_VERSION_PATCH})
- set(LibSSH_VERSION ${LIBSSH_VERSION_MAJOR}.${LIBSSH_VERSION_MINOR}.${LIBSSH_VERSION_PATCH})
+ set(LibSSH_VERSION ${LIBSSH_VERSION_MAJOR}.${LIBSSH_VERSION_MINOR}.${LIBSSH_VERSION_PATCH})
- include(FindPackageVersionCheck)
- find_package_version_check(LibSSH DEFAULT_MSG)
+ include(FindPackageVersionCheck)
+ find_package_version_check(LibSSH DEFAULT_MSG)
else (LIBSSH_VERSION_MAJOR)
message(STATUS "LIBSSH_VERSION_MAJOR not found in ${LIBSSH_INCLUDE_DIR}/libssh/libssh.h, assuming libssh is too old")
set(LIBSSH_FOUND FALSE)
diff --git a/sdk/cpp/core/docsgen/Makefile b/sdk/cpp/core/docsgen/Makefile
index 3149d71ee..dbaa787ae 100644
--- a/sdk/cpp/core/docsgen/Makefile
+++ b/sdk/cpp/core/docsgen/Makefile
@@ -22,171 +22,171 @@ I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext
help:
- @echo "Please use \`make ' where is one of"
- @echo " html to make standalone HTML files"
- @echo " dirhtml to make HTML files named index.html in directories"
- @echo " singlehtml to make a single large HTML file"
- @echo " pickle to make pickle files"
- @echo " json to make JSON files"
- @echo " htmlhelp to make HTML files and a HTML help project"
- @echo " qthelp to make HTML files and a qthelp project"
- @echo " applehelp to make an Apple Help Book"
- @echo " devhelp to make HTML files and a Devhelp project"
- @echo " epub to make an epub"
- @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
- @echo " latexpdf to make LaTeX files and run them through pdflatex"
- @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
- @echo " text to make text files"
- @echo " man to make manual pages"
- @echo " texinfo to make Texinfo files"
- @echo " info to make Texinfo files and run them through makeinfo"
- @echo " gettext to make PO message catalogs"
- @echo " changes to make an overview of all changed/added/deprecated items"
- @echo " xml to make Docutils-native XML files"
- @echo " pseudoxml to make pseudoxml-XML files for display purposes"
- @echo " linkcheck to check all external links for integrity"
- @echo " doctest to run all doctests embedded in the documentation (if enabled)"
- @echo " coverage to run coverage check of the documentation (if enabled)"
+ @echo "Please use \`make ' where is one of"
+ @echo " html to make standalone HTML files"
+ @echo " dirhtml to make HTML files named index.html in directories"
+ @echo " singlehtml to make a single large HTML file"
+ @echo " pickle to make pickle files"
+ @echo " json to make JSON files"
+ @echo " htmlhelp to make HTML files and a HTML help project"
+ @echo " qthelp to make HTML files and a qthelp project"
+ @echo " applehelp to make an Apple Help Book"
+ @echo " devhelp to make HTML files and a Devhelp project"
+ @echo " epub to make an epub"
+ @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+ @echo " latexpdf to make LaTeX files and run them through pdflatex"
+ @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
+ @echo " text to make text files"
+ @echo " man to make manual pages"
+ @echo " texinfo to make Texinfo files"
+ @echo " info to make Texinfo files and run them through makeinfo"
+ @echo " gettext to make PO message catalogs"
+ @echo " changes to make an overview of all changed/added/deprecated items"
+ @echo " xml to make Docutils-native XML files"
+ @echo " pseudoxml to make pseudoxml-XML files for display purposes"
+ @echo " linkcheck to check all external links for integrity"
+ @echo " doctest to run all doctests embedded in the documentation (if enabled)"
+ @echo " coverage to run coverage check of the documentation (if enabled)"
clean:
- rm -rf $(BUILDDIR)/*
+ rm -rf $(BUILDDIR)/*
html:
- $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
- @echo
- @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+ $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+ @echo
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
dirhtml:
- $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
- @echo
- @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
+ $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
+ @echo
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
singlehtml:
- $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
- @echo
- @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
+ $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
+ @echo
+ @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
pickle:
- $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
- @echo
- @echo "Build finished; now you can process the pickle files."
+ $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
+ @echo
+ @echo "Build finished; now you can process the pickle files."
json:
- $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
- @echo
- @echo "Build finished; now you can process the JSON files."
+ $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
+ @echo
+ @echo "Build finished; now you can process the JSON files."
htmlhelp:
- $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
- @echo
- @echo "Build finished; now you can run HTML Help Workshop with the" \
- ".hhp project file in $(BUILDDIR)/htmlhelp."
+ $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
+ @echo
+ @echo "Build finished; now you can run HTML Help Workshop with the" \
+ ".hhp project file in $(BUILDDIR)/htmlhelp."
qthelp:
- $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
- @echo
- @echo "Build finished; now you can run "qcollectiongenerator" with the" \
- ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
- @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/YangDevelopmentKit.qhcp"
- @echo "To view the help file:"
- @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/YangDevelopmentKit.qhc"
+ $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
+ @echo
+ @echo "Build finished; now you can run "qcollectiongenerator" with the" \
+ ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
+ @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/YangDevelopmentKit.qhcp"
+ @echo "To view the help file:"
+ @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/YangDevelopmentKit.qhc"
applehelp:
- $(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
- @echo
- @echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
- @echo "N.B. You won't be able to view it unless you put it in" \
- "~/Library/Documentation/Help or install it in your application" \
- "bundle."
+ $(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
+ @echo
+ @echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
+ @echo "N.B. You won't be able to view it unless you put it in" \
+ "~/Library/Documentation/Help or install it in your application" \
+ "bundle."
devhelp:
- $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
- @echo
- @echo "Build finished."
- @echo "To view the help file:"
- @echo "# mkdir -p $$HOME/.local/share/devhelp/YangDevelopmentKit"
- @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/YangDevelopmentKit"
- @echo "# devhelp"
+ $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
+ @echo
+ @echo "Build finished."
+ @echo "To view the help file:"
+ @echo "# mkdir -p $$HOME/.local/share/devhelp/YangDevelopmentKit"
+ @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/YangDevelopmentKit"
+ @echo "# devhelp"
epub:
- $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
- @echo
- @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
+ $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
+ @echo
+ @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
latex:
- $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
- @echo
- @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
- @echo "Run \`make' in that directory to run these through (pdf)latex" \
- "(use \`make latexpdf' here to do that automatically)."
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo
+ @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
+ @echo "Run \`make' in that directory to run these through (pdf)latex" \
+ "(use \`make latexpdf' here to do that automatically)."
latexpdf:
- $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
- @echo "Running LaTeX files through pdflatex..."
- $(MAKE) -C $(BUILDDIR)/latex all-pdf
- @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo "Running LaTeX files through pdflatex..."
+ $(MAKE) -C $(BUILDDIR)/latex all-pdf
+ @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
latexpdfja:
- $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
- @echo "Running LaTeX files through platex and dvipdfmx..."
- $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
- @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo "Running LaTeX files through platex and dvipdfmx..."
+ $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
+ @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
text:
- $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
- @echo
- @echo "Build finished. The text files are in $(BUILDDIR)/text."
+ $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
+ @echo
+ @echo "Build finished. The text files are in $(BUILDDIR)/text."
man:
- $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
- @echo
- @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
+ $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
+ @echo
+ @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
texinfo:
- $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
- @echo
- @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
- @echo "Run \`make' in that directory to run these through makeinfo" \
- "(use \`make info' here to do that automatically)."
+ $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+ @echo
+ @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
+ @echo "Run \`make' in that directory to run these through makeinfo" \
+ "(use \`make info' here to do that automatically)."
info:
- $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
- @echo "Running Texinfo files through makeinfo..."
- make -C $(BUILDDIR)/texinfo info
- @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
+ $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+ @echo "Running Texinfo files through makeinfo..."
+ make -C $(BUILDDIR)/texinfo info
+ @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
gettext:
- $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
- @echo
- @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
+ $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
+ @echo
+ @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
changes:
- $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
- @echo
- @echo "The overview file is in $(BUILDDIR)/changes."
+ $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
+ @echo
+ @echo "The overview file is in $(BUILDDIR)/changes."
linkcheck:
- $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
- @echo
- @echo "Link check complete; look for any errors in the above output " \
- "or in $(BUILDDIR)/linkcheck/output.txt."
+ $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
+ @echo
+ @echo "Link check complete; look for any errors in the above output " \
+ "or in $(BUILDDIR)/linkcheck/output.txt."
doctest:
- $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
- @echo "Testing of doctests in the sources finished, look at the " \
- "results in $(BUILDDIR)/doctest/output.txt."
+ $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
+ @echo "Testing of doctests in the sources finished, look at the " \
+ "results in $(BUILDDIR)/doctest/output.txt."
coverage:
- $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
- @echo "Testing of coverage in the sources finished, look at the " \
- "results in $(BUILDDIR)/coverage/python.txt."
+ $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
+ @echo "Testing of coverage in the sources finished, look at the " \
+ "results in $(BUILDDIR)/coverage/python.txt."
xml:
- $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
- @echo
- @echo "Build finished. The XML files are in $(BUILDDIR)/xml."
+ $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
+ @echo
+ @echo "Build finished. The XML files are in $(BUILDDIR)/xml."
pseudoxml:
- $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
- @echo
- @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
+ $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
+ @echo
+ @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
diff --git a/sdk/cpp/core/docsgen/api/class_hierarchy.rst b/sdk/cpp/core/docsgen/api/class_hierarchy.rst
index 5078bc39f..bce3d4432 100644
--- a/sdk/cpp/core/docsgen/api/class_hierarchy.rst
+++ b/sdk/cpp/core/docsgen/api/class_hierarchy.rst
@@ -7,6 +7,7 @@ YDK API
services/service.rst
providers/provider.rst
+ filters.rst
types.rst
exceptions/exception.rst
diff --git a/sdk/cpp/core/docsgen/api/edit_operations.rst b/sdk/cpp/core/docsgen/api/filters.rst
similarity index 58%
rename from sdk/cpp/core/docsgen/api/edit_operations.rst
rename to sdk/cpp/core/docsgen/api/filters.rst
index cd0c34842..6ef14d7e9 100644
--- a/sdk/cpp/core/docsgen/api/edit_operations.rst
+++ b/sdk/cpp/core/docsgen/api/filters.rst
@@ -1,11 +1,11 @@
-Edit Operations
+YDK Filters
=================
.. cpp:namespace:: ydk
-.. cpp:enum-class:: EditOperation
+.. cpp:enum-class:: YFilter
-Operations as defined under netconf edit-config operation attribute in `RFC 6241 `_ to be used with various :cpp:class:`YDK services` and :cpp:class:`entities`.
+Filters as defined under netconf edit-config operation attribute in `RFC 6241 `_ and read filters by leaf to be used with various :cpp:class:`YDK services` and :cpp:class:`entities`.
.. cpp:enumerator:: merge
@@ -52,38 +52,62 @@ Operations as defined under netconf edit-config operation attribute in `RFC 6241
operation, which replaces the entire target
configuration, only the configuration actually present in
the parameter is affected.
-
+
+ .. cpp:enumerator:: read
+
+ When reading configuration or operational data from a network device and a specific leaf is desired to be read, the operation can be set to `read` on that leaf. See example below
+
.. cpp:enumerator:: not_set
- Default value to which all configuration data is initialized to, indicating no operation has been selected. If no operation is selected, ``merge`` is performed
+ Default value to which all configuration data is initialized to, indicating no filter has been selected. If no operation is selected, ``merge`` is performed
Example usage
~~~~~~~~~~~~~~~
-An example of setting the operation for an :cpp:class:`entity` (address family) under :cpp:class:`openconfig BGP` is shown below
+An example of setting the filter for an :cpp:class:`entity` (address family) under :cpp:class:`openconfig BGP` is shown below
.. code-block:: c++
:linenos:
- // Instantiate a bgp smart pointer object representing the bgp container from the openconfig-bgp YANG model
- auto bgp = std::make_unique();
+ // Instantiate a bgp object representing the bgp container from the openconfig-bgp YANG model
+ ydk::openconfig_bgp::Bgp bgp{};
// Instantiate an af-safi object representing the af-safi list from the openconfig-bgp YANG model
- auto afi_safi = make_unique();
-
- // Set the operation to delete, which will delete this instance of the address family
- afi_safi->operation = EditOperation::delete_;
+ auto afi_safi = make_shared();
// Set the key
- afi_safi->afi_safi_name = L3VpnIpv4UnicastIdentity();
- // Set afi-safis as the parent of the list instance
- afi_safi->parent = bgp->global->afi_safis.get();
+ afi_safi->afi_safi_name = L3VpnIpv4Unicast();
+
+ // Set the filter to delete, which will delete this instance of the address family
+ afi_safi->filter = YFilter::delete_;
+
//Append the list instance to afi-safis's afi-safi field
- bgp->global->afi_safis->afi_safi.push_back(std::move(afi_safi));
+ bgp.global->afi_safis->afi_safi.push_back(afi_safi);
// Instantiate the CRUD service and Netconf provider to connect to a device with address 10.0.0.1
CrudService crud_service{};
NetconfServiceProvider provider{"10.0.0.1", "test", "test", 830};
// Invoke the CRUD Update method
- crud_service.update(provider, *bgp);
+ crud_service.update(provider, bgp);
+
+
+An example of setting the read filter for an :cpp:class:`leaf` (specifically, the `as number` leaf) under :cpp:class:`openconfig BGP` is shown below
+
+.. code-block:: c++
+ :linenos:
+
+ // Instantiate a bgp object representing the bgp container from the openconfig-bgp YANG model
+ ydk::openconfig_bgp::Bgp bgp{};
+
+ // Indicate that the `as number` is desired to be read
+ bgp.config->as->filter = YFilter::read;
+
+
+ // Instantiate the CRUD service and Netconf provider to connect to a device with address 10.0.0.1
+ CrudService crud_service{};
+ NetconfServiceProvider provider{"10.0.0.1", "test", "test", 830};
+
+ // Invoke the CRUD Read method
+ crud_service.read(provider, bgp);
+
diff --git a/sdk/cpp/core/docsgen/api/nodes/core_node_data.rst b/sdk/cpp/core/docsgen/api/nodes/core_node_data.rst
index e08f05a4e..0e317ad66 100644
--- a/sdk/cpp/core/docsgen/api/nodes/core_node_data.rst
+++ b/sdk/cpp/core/docsgen/api/nodes/core_node_data.rst
@@ -18,19 +18,19 @@ Class represents the :cpp:class:`DataNode`.
A :cpp:class:`DataNode` represents a containment hierarchy. So invocation of the destructor will lead to the children of this node being destroyed.
- .. cpp:function:: virtual const SchemaNode& schema() const
+ .. cpp:function:: virtual const SchemaNode& get_schema_node() const
Returns the :cpp:class:`SchemaNode` associated with this :cpp:class:`DataNode`.
:return: :cpp:class:`SchemaNode` associated with this :cpp:class:`DataNode`.
- .. cpp:function:: virtual std::string path() const
+ .. cpp:function:: virtual std::string get_path() const
Returns the path expression representing this Node in in the NodeTree.
:return: ``std::string`` representing the path to this Node.
- .. cpp:function:: virtual DataNode& create(const std::string& path)
+ .. cpp:function:: virtual DataNode& create_datanode(const std::string& path)
Creates a :cpp:class:`DataNode` corresponding to the path and set its value.
@@ -50,7 +50,7 @@ Class represents the :cpp:class:`DataNode`.
:raises: :cpp:class:`YCPPInvalidArgumentError` In case the argument is invalid.
:raises: :cpp:class:`YCPPPathError` In case the path is invalid.
- .. cpp:function:: virtual DataNode& create(const std::string& path, const std::string& value)
+ .. cpp:function:: virtual DataNode& create_datanode(const std::string& path, const std::string& value)
Create a :cpp:class:`DataNode` corresponding to the path and set its value.
@@ -69,7 +69,7 @@ Class represents the :cpp:class:`DataNode`.
:raises: :cpp:class:`YCPPInvalidArgumentError` In case the argument is invalid.
:raises: :cpp:class:`YCPPPathError` In case the path is invalid.
- .. cpp:function:: virtual void set(const std::string& value)
+ .. cpp:function:: virtual void set_value(const std::string& value)
Set the value of this :cpp:class:`DataNode`.
@@ -81,7 +81,7 @@ Class represents the :cpp:class:`DataNode`.
:param value: The value to set. This should be the string representation of the YANG type.
:raises: :cpp:class:`YCPPInvalidArgumentError` if the :cpp:class:`DataNode`'s value cannot be set (for example it represents a container)
- .. cpp:function:: virtual std::string get() const
+ .. cpp:function:: virtual std::string get_value() const
Returns a copy of the value of this :cpp:class:`DataNode`.
@@ -94,15 +94,15 @@ Class represents the :cpp:class:`DataNode`.
:param path: The path expression.
:return: Vector of :cpp:class:`DataNode` that satisfy the path expression supplied.
- .. cpp:function:: virtual DataNode* parent() const
+ .. cpp:function:: virtual DataNode* get_parent() const
:return: Pointer to the parent of this :cpp:class:`DataNode` or ``nullptr`` if None exist.
- .. cpp:function:: virtual std::vector> children() const
+ .. cpp:function:: virtual std::vector> get_children() const
:return: Pointer to the children of this :cpp:class:`DataNode`.
- .. cpp:function:: virtual const DataNode& root() const
+ .. cpp:function:: virtual const DataNode& get_root() const
:return: Pointer to the root :cpp:class:`DataNode` of this tree.
diff --git a/sdk/cpp/core/docsgen/api/nodes/core_node_rootschema.rst b/sdk/cpp/core/docsgen/api/nodes/core_node_rootschema.rst
index f6fa9a39b..57e35a209 100644
--- a/sdk/cpp/core/docsgen/api/nodes/core_node_rootschema.rst
+++ b/sdk/cpp/core/docsgen/api/nodes/core_node_rootschema.rst
@@ -14,7 +14,7 @@ Instances of this class represent the Root of the :cpp:class:`SchemaNode`
- .. cpp:function:: std::string path() const
+ .. cpp:function:: std::string get_path() const
Get the path expression representing this Node in in the NodeTree.
@@ -31,25 +31,25 @@ Instances of this class represent the Root of the :cpp:class:`SchemaNode` if the path expression in invalid, See error code for details.
:raises: :cpp:class:`YCPPInvalidArgumentError` if the argument is invalid.
- .. cpp:function:: virtual SchemaNode* parent() const noexcept
+ .. cpp:function:: virtual SchemaNode* get_parent() const noexcept
Get the parent node of this :cpp:class:`SchemaNode` in the tree.
:return: Pointer to the parent node or ``nullptr`` in case this is the root.
- .. cpp:function:: virtual std::vector children() const
+ .. cpp:function:: virtual std::vector get_children() const
Get the children of this :cpp:class:`SchemaNode` in the NodeTree.
:return: The children of this node.
- .. cpp:function:: virtual const SchemaNode* root() const noexcept
+ .. cpp:function:: virtual const SchemaNode* get_root() const noexcept
Get the root of NodeTree this node is part of.
:return: The pointer to the root.
- .. cpp:function:: virtual DataNode* create(const std::string& path, const std::string& value) const
+ .. cpp:function:: virtual DataNode* create_datanode(const std::string& path, const std::string& value) const
Create a :cpp:class:`DataNode` corresponding to the path and set its value.
@@ -67,7 +67,7 @@ Instances of this class represent the Root of the :cpp:class:`SchemaNode` In case the argument is invalid.
:raises: :cpp:class:`YCPPPathError` In case the path is invalid.
- .. cpp:function:: virtual DataNode* create(const std::string& path, const std::string& value) const
+ .. cpp:function:: virtual DataNode* create_datanode(const std::string& path, const std::string& value) const
Create a :cpp:class:`DataNode` corresponding to the path and set its value.
@@ -84,7 +84,7 @@ Instances of this class represent the Root of the :cpp:class:`SchemaNode` In case the argument is invalid.
:raises: :cpp:class:`YCPPPathError` In case the path is invalid.
- .. cpp:function:: virtual Statement statement() const
+ .. cpp:function:: virtual Statement get_statement() const
Return the :cpp:class:`Statement` representing this :cpp:class:`SchemaNode`.
@@ -94,7 +94,13 @@ Instances of this class represent the Root of the :cpp:class:`SchemaNode get_keys() const
+
+ Returns vector of YANG statement corresponding the the keys.
+
+ :return: Vector of :cpp:class:`Statement` that represent keys.
+
+ .. cpp:function:: virtual Rpc* create_rpc(const std::string& path) const
Create an :cpp:class:`Rpc` instance.
diff --git a/sdk/cpp/core/docsgen/api/nodes/core_node_schema.rst b/sdk/cpp/core/docsgen/api/nodes/core_node_schema.rst
index 4aaef3adf..2d93da010 100644
--- a/sdk/cpp/core/docsgen/api/nodes/core_node_schema.rst
+++ b/sdk/cpp/core/docsgen/api/nodes/core_node_schema.rst
@@ -24,7 +24,7 @@ Represents a Node in the SchemaTree.
A :cpp:class:`SchemaNode` represents a containment hierarchy. So invocation of the destructor will lead to the children of this node being destroyed.
- .. cpp:function:: virtual std::string path() const
+ .. cpp:function:: virtual std::string get_path() const
Get the path expression representing this Node in in the NodeTree.
@@ -41,31 +41,31 @@ Represents a Node in the SchemaTree.
:raises: :cpp:class:`YCPPPathError` if the path expression in invalid, see error code for details.
:raises: :cpp:class:`YCPPInvalidArgumentError` if the argument is invalid.
- .. cpp:function:: virtual const SchemaNode* parent() const noexcept
+ .. cpp:function:: virtual const SchemaNode* get_parent() const noexcept
Get the Parent Node of this SchemaNode in the tree.
:return: ``SchemaNode*`` the children of this node.
- .. cpp:function:: virtual std::vector> & children() const
+ .. cpp:function:: virtual std::vector> & get_children() const
Returns the children of this :cpp:class:`SchemaNode ` in the NodeTree.
:return: Child schema nodes.
- .. cpp:function:: virtual const SchemaNode& root() const noexcept
+ .. cpp:function:: virtual const SchemaNode& get_root() const noexcept
Get the root of NodeTree this node is part of
:return: The pointer to the root.
- .. cpp:function:: virtual Statement statement() const
+ .. cpp:function:: virtual Statement get_statement() const
Returns the YANG statement associated with this :cpp:class:`SchemaNode`
:return: The pointer to the yang statement for this :cpp:class:`SchemaNode`
- .. cpp:function:: virtual std::vector keys() const
+ .. cpp:function:: virtual std::vector get_keys() const
Returns vector of YANG statement corresponding the the keys.
diff --git a/sdk/cpp/core/docsgen/api/rpc.rst b/sdk/cpp/core/docsgen/api/rpc.rst
index 47a662208..6be8b0ce8 100644
--- a/sdk/cpp/core/docsgen/api/rpc.rst
+++ b/sdk/cpp/core/docsgen/api/rpc.rst
@@ -23,12 +23,12 @@ if any. The Callable takes as a parameter the :cpp:class:`ServiceProvider` or ``nullptr`` if none exists.
- .. cpp:function:: virtual DataNode& input() const
+ .. cpp:function:: virtual DataNode& get_input_node() const
Get the input data tree.
:return: Pointer to the input :cpp:class:`DataNode` or ``nullptr`` if the rpc does not have an input element in the schema.
- .. cpp:function:: virtual SchemaNode& schema() const
+ .. cpp:function:: virtual SchemaNode& get_schema_node() const
:return: Pointer to the :cpp:class:`SchemaNode` associated with this rpc.
diff --git a/sdk/cpp/core/docsgen/api/services/codec_service.rst b/sdk/cpp/core/docsgen/api/services/codec_service.rst
index 3d779e8d4..ad1a3b6d7 100644
--- a/sdk/cpp/core/docsgen/api/services/codec_service.rst
+++ b/sdk/cpp/core/docsgen/api/services/codec_service.rst
@@ -1,5 +1,5 @@
-CodecService
-==============
+Codec Service
+=============
.. cpp:namespace:: ydk
@@ -19,7 +19,17 @@ Codec Service class for supporting encoding and decoding C++ model API objects o
:param entity: An instance of :cpp:class:`Entity` class defined under a bundle
:param pretty: Optionally produce formatted output
:return: Encoded payload in the form of ``std::string``
- :raises YCPPError: If an error has occurred
+ :raises YCPPError: If an error has occurred
+
+ .. cpp:function:: std::map encode(CodecServiceProvider & provider, std::map> & entity, bool pretty=false)
+
+ Perform encoding
+
+ :param provider: An instance of :cpp:class:`CodecServiceProvider`
+ :param entity: A ``std::map`` of :cpp:class:`Entity` class defined under a bundle
+ :param pretty: Optionally produce formatted output
+ :return: A ``std::map`` of ``std::string`` representing encoded payload
+ :raises YCPPError: If an error has occurred
.. cpp:function:: std::unique_ptr decode(CodecServiceProvider & provider, const std::string & payload)
@@ -29,3 +39,12 @@ Codec Service class for supporting encoding and decoding C++ model API objects o
:param payload: Payload to be decoded
:return: A pointer to an instance of the decoded :cpp:class:`Entity`
:raises YCPPError: If an error has occurred
+
+ .. cpp:function:: std::map> decode(CodecServiceProvider & provider, std::map & payload_map, std::map> entity_map)
+
+ Decode the payload to produce an instance of `Entity`
+
+ :param provider: An instance of :cpp:class:`CodecServiceProvider`
+ :param payload: A ``std::map`` of payload to be decoded
+ :return: A ``std::map`` of the decoded :cpp:class:`Entity`
+ :raises YCPPError: If an error has occurred
diff --git a/sdk/cpp/core/docsgen/api/services/core_codec_service.rst b/sdk/cpp/core/docsgen/api/services/core_codec_service.rst
index 3ad0e2849..c94f132be 100644
--- a/sdk/cpp/core/docsgen/api/services/core_codec_service.rst
+++ b/sdk/cpp/core/docsgen/api/services/core_codec_service.rst
@@ -1,14 +1,14 @@
.. _ref-codecservice:
-path::CodecService
+path::Codec
===================
.. cpp:namespace:: ydk::path
-.. cpp:class:: ydk::path::CodecService
+.. cpp:class:: ydk::path::Codec
-Codec Service, part of YDK path API, which deals with generic path-based YANG data nodes
+Codec, part of YDK path API, which deals with generic path-based YANG data nodes
.. cpp:function:: virtual std::string encode(const std::unique_ptr datanode, EncodingFormat format, bool pretty)
@@ -30,4 +30,4 @@ Codec Service, part of YDK path API, which deals with generic path-based YANG da
:return: The :cpp:class:`DataNode` instantiated or ``nullptr`` in case of error.
:raises: :cpp:class:`YCPPInvalidArgumentError` if the arguments are invalid.
- .. cpp:function:: virtual ~CodecService()
+ .. cpp:function:: virtual ~Codec()
diff --git a/sdk/cpp/core/docsgen/api/services/crud_service.rst b/sdk/cpp/core/docsgen/api/services/crud_service.rst
index ae4c53618..5db0d1690 100644
--- a/sdk/cpp/core/docsgen/api/services/crud_service.rst
+++ b/sdk/cpp/core/docsgen/api/services/crud_service.rst
@@ -1,5 +1,5 @@
-CrudService
-===========
+CRUD Service
+============
.. cpp:namespace:: ydk
@@ -13,24 +13,6 @@ CRUD Service class for supporting CRUD operations on entities.
Create the entity.
- :param provider: An instance of :cpp:class:`ServiceProvider`
- :param entity: An instance of :cpp:class:`Entity` class defined under a bundle
- :return: ``true`` if successful, ``false`` if not
- :raises YCPPError: If an error has occurred
-
- .. cpp:function:: bool update(path::ServiceProvider & provider, Entity & entity)
-
- Update the entity.
-
- :param provider: An instance of :cpp:class:`ServiceProvider`
- :param entity: An instance of :cpp:class:`Entity` class defined under a bundle
- :return: ``true`` if successful, ``false`` if not
- :raises YCPPError: If an error has occurred
-
- .. cpp:function:: bool delete\_(path::ServiceProvider & provider, Entity & entity)
-
- Delete the entity.
-
:param provider: An instance of :cpp:class:`ServiceProvider`
:param entity: An instance of :cpp:class:`Entity` class defined under a bundle
:return: ``true`` if successful, ``false`` if not
@@ -53,4 +35,21 @@ CRUD Service class for supporting CRUD operations on entities.
:param filter: An instance of :cpp:class:`entity` class defined under a bundle
:return: A pointer to an instance of :cpp:class:`Entity` as identified by the ``filter`` if successful, ``nullptr`` if not
:raises YCPPError: If an error has occurred
+
+ .. cpp:function:: bool update(path::ServiceProvider & provider, Entity & entity)
+
+ Update the entity.
+
+ :param provider: An instance of :cpp:class:`ServiceProvider`
+ :param entity: An instance of :cpp:class:`Entity` class defined under a bundle
+ :return: ``true`` if successful, ``false`` if not
+ :raises YCPPError: If an error has occurred
+
+ .. cpp:function:: bool delete\_(path::ServiceProvider & provider, Entity & entity)
+
+ Delete the entity.
+ :param provider: An instance of :cpp:class:`ServiceProvider`
+ :param entity: An instance of :cpp:class:`Entity` class defined under a bundle
+ :return: ``true`` if successful, ``false`` if not
+ :raises YCPPError: If an error has occurred
diff --git a/sdk/cpp/core/docsgen/api/services/executor_service.rst b/sdk/cpp/core/docsgen/api/services/executor_service.rst
index 63cb0ef77..f10bf9320 100644
--- a/sdk/cpp/core/docsgen/api/services/executor_service.rst
+++ b/sdk/cpp/core/docsgen/api/services/executor_service.rst
@@ -1,5 +1,5 @@
-ExecutorService
-===============
+Executor Service
+================
.. cpp:namespace:: ydk
diff --git a/sdk/cpp/core/docsgen/api/services/netconf_service.rst b/sdk/cpp/core/docsgen/api/services/netconf_service.rst
index 4963c4dfd..6ee4b6d90 100644
--- a/sdk/cpp/core/docsgen/api/services/netconf_service.rst
+++ b/sdk/cpp/core/docsgen/api/services/netconf_service.rst
@@ -1,8 +1,5 @@
-NetconfService
-==============
-
-.. toctree::
- :maxdepth: 2
+Netconf Service
+===============
.. cpp:namespace:: ydk
@@ -17,7 +14,7 @@ Type of datastore to perform operation on
.. cpp:class:: NetconfService : public Service
-Netconf Service class for supporting encoding and decoding C++ model API objects of type :cpp:class:`Entity`
+ Netconf Service class for supporting encoding and decoding C++ model API objects of type :cpp:class:`Entity`
.. cpp:function:: NetconfService()
diff --git a/sdk/cpp/core/docsgen/api/services/service.rst b/sdk/cpp/core/docsgen/api/services/service.rst
index ab883c9e6..d8991be4b 100644
--- a/sdk/cpp/core/docsgen/api/services/service.rst
+++ b/sdk/cpp/core/docsgen/api/services/service.rst
@@ -7,13 +7,14 @@ Service
.. cpp:class:: Service
-Base class for YDK service
+Base class for YDK services
.. toctree::
:maxdepth: 2
+ codec_service.rst
+ core_codec_service.rst
crud_service.rst
+ executor_service.rst
netconf_service.rst
- codec_service.rst
validation_service.rst
- core_codec_service.rst
diff --git a/sdk/cpp/core/docsgen/api/types.rst b/sdk/cpp/core/docsgen/api/types.rst
index 95021fc10..3b6a0ea49 100644
--- a/sdk/cpp/core/docsgen/api/types.rst
+++ b/sdk/cpp/core/docsgen/api/types.rst
@@ -1,14 +1,12 @@
.. _ref-types:
Types
-============
+=====
.. contents::
.. toctree::
:maxdepth: 2
- edit_operations.rst
-
The C++ types present in ydk namespace corresponding to YANG types. See below for example usage.
.. cpp:namespace:: ydk
@@ -43,9 +41,9 @@ The C++ types present in ydk namespace corresponding to YANG types. See below fo
Super class of all classes that represents containers in YANG. YANG lists are represented as ``std::vector`` of Entity objects, with support for hanging a parent
- .. cpp:member:: EditOperation operation
+ .. cpp:member:: YFilter filter
- Optional attribute of the Entity class which can be set to perform various :cpp:class:`operations`
+ Optional attribute of the Entity class which can be set to perform various :cpp:class:`filtering`
YANG container and list
@@ -55,9 +53,9 @@ YANG container and list
Super class of all classes that represents containers in YANG. YANG lists are represented as ``std::vector`` of Entity objects, with support for hanging a parent
- .. cpp:member:: EditOperation operation
+ .. cpp:member:: YFilter filter
- Optional attribute of the Entity class which can be set to perform various :cpp:class:`operations`
+ Optional attribute of the Entity class which can be set to perform various :cpp:class:`filtering`
YANG leaf and leaf-list
~~~~~~~~~~~~~~~~~~~~~~~~
@@ -66,17 +64,17 @@ YANG leaf and leaf-list
Concrete class that represents a YANG leaf to which data can be assigned.
- .. cpp:member:: EditOperation operation
+ .. cpp:member:: YFilter filter
- Optional attribute of the YLeaf class which can be set to perform various :cpp:class:`operations`
+ Optional attribute of the YLeaf class which can be set to perform various :cpp:class:`filtering`
.. cpp:class:: YLeafList
Concrete class that represents a YANG leaf-list to which multiple instances of data can be appended to.
- .. cpp:member:: EditOperation operation
+ .. cpp:member:: YFilter filter
- Optional attribute of the YLeafList class which can be set to perform various :cpp:class:`operations`
+ Optional attribute of the YLeafList class which can be set to perform various :cpp:class:`filtering`
YANG type
~~~~~~~~~~
@@ -128,9 +126,9 @@ Examples of assigning values to leafs are shown below
bgp->global->config->as = 65172; // uint32
bgp->global->config->router_id = "1.2.3.4"; //ip-address
- afi_safi->afi_safi_name = L3VpnIpv4UnicastIdentity(); //identityref
+ afi_safi->afi_safi_name = L3VpnIpv4Unicast(); //identityref
afi_safi->config->enabled = false; //boolean
- neighbor->config->peer_type = PeerTypeEnum::INTERNAL // enum
+ neighbor->config->peer_type = PeerType::INTERNAL // enum
Decimal64 deci{"1.2"};
node->decimal_value = deci; //decimal64
node->empty_value = Empty(); // empty
@@ -146,10 +144,10 @@ Examples of appending values to leaf-lists are shown below
config->as_list.append(65172); // uint32
config->router_id.append("1.2.3.4"); //ip-address
- L3VpnIpv4UnicastIdentity id{}; //identityref
+ L3VpnIpv4Unicast id{}; //identityref
config->types_list.append(id); //identityref
config->enabled_list.append(false); //boolean
- config->peer_types.append(PeerTypeEnum::INTERNAL) // enum
+ config->peer_types.append(PeerType::INTERNAL) // enum
Decimal64 deci{"1.2"};
node->decimal_values.append(deci); //decimal64
diff --git a/sdk/cpp/core/docsgen/guides/howto_path.rst b/sdk/cpp/core/docsgen/guides/howto_path.rst
index 6a15e8310..5b95d21d2 100644
--- a/sdk/cpp/core/docsgen/guides/howto_path.rst
+++ b/sdk/cpp/core/docsgen/guides/howto_path.rst
@@ -8,18 +8,6 @@ Path Syntax
Full XPath notation is supported for find operations on :cpp:class:`DataNode`\(s\). This XPath conforms to the YANG specification \(`RFC 6020 section 6.4 `_\). Some useful examples:
-- Get all top-level nodes of the ``module-name``
-
-.. code-block:: bash
-
- /module-name:*
-
-- Get all the descendants of ``container`` \(excluding ``container``\)
-
-.. code-block:: bash
-
- /module-name:container//*
-
- Get ``list`` instance with ``key1`` of value ``1`` and ``key2`` of value ``2`` \(this can return more ``list`` instances if there are more keys than ``key1`` and ``key2``\)
.. code-block:: bash
diff --git a/sdk/cpp/core/docsgen/icon.ico b/sdk/cpp/core/docsgen/icon.ico
index ac84d6556..eb4d1422b 100644
Binary files a/sdk/cpp/core/docsgen/icon.ico and b/sdk/cpp/core/docsgen/icon.ico differ
diff --git a/sdk/cpp/core/docsgen/logo.png b/sdk/cpp/core/docsgen/logo.png
index 2d8946efe..1a534a15c 100644
Binary files a/sdk/cpp/core/docsgen/logo.png and b/sdk/cpp/core/docsgen/logo.png differ
diff --git a/sdk/cpp/core/docsgen/make.bat b/sdk/cpp/core/docsgen/make.bat
index bbe963889..ec50b9655 100644
--- a/sdk/cpp/core/docsgen/make.bat
+++ b/sdk/cpp/core/docsgen/make.bat
@@ -3,48 +3,48 @@
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
- set SPHINXBUILD=sphinx-build
+ set SPHINXBUILD=sphinx-build
)
set BUILDDIR=_build
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
set I18NSPHINXOPTS=%SPHINXOPTS% .
if NOT "%PAPER%" == "" (
- set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
- set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
+ set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
+ set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
)
if "%1" == "" goto help
if "%1" == "help" (
- :help
- echo.Please use `make ^` where ^ is one of
- echo. html to make standalone HTML files
- echo. dirhtml to make HTML files named index.html in directories
- echo. singlehtml to make a single large HTML file
- echo. pickle to make pickle files
- echo. json to make JSON files
- echo. htmlhelp to make HTML files and a HTML help project
- echo. qthelp to make HTML files and a qthelp project
- echo. devhelp to make HTML files and a Devhelp project
- echo. epub to make an epub
- echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
- echo. text to make text files
- echo. man to make manual pages
- echo. texinfo to make Texinfo files
- echo. gettext to make PO message catalogs
- echo. changes to make an overview over all changed/added/deprecated items
- echo. xml to make Docutils-native XML files
- echo. pseudoxml to make pseudoxml-XML files for display purposes
- echo. linkcheck to check all external links for integrity
- echo. doctest to run all doctests embedded in the documentation if enabled
- echo. coverage to run coverage check of the documentation if enabled
- goto end
+ :help
+ echo.Please use `make ^` where ^ is one of
+ echo. html to make standalone HTML files
+ echo. dirhtml to make HTML files named index.html in directories
+ echo. singlehtml to make a single large HTML file
+ echo. pickle to make pickle files
+ echo. json to make JSON files
+ echo. htmlhelp to make HTML files and a HTML help project
+ echo. qthelp to make HTML files and a qthelp project
+ echo. devhelp to make HTML files and a Devhelp project
+ echo. epub to make an epub
+ echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
+ echo. text to make text files
+ echo. man to make manual pages
+ echo. texinfo to make Texinfo files
+ echo. gettext to make PO message catalogs
+ echo. changes to make an overview over all changed/added/deprecated items
+ echo. xml to make Docutils-native XML files
+ echo. pseudoxml to make pseudoxml-XML files for display purposes
+ echo. linkcheck to check all external links for integrity
+ echo. doctest to run all doctests embedded in the documentation if enabled
+ echo. coverage to run coverage check of the documentation if enabled
+ goto end
)
if "%1" == "clean" (
- for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
- del /q /s %BUILDDIR%\*
- goto end
+ for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
+ del /q /s %BUILDDIR%\*
+ goto end
)
@@ -58,206 +58,206 @@ goto sphinx_ok
set SPHINXBUILD=python -m sphinx.__init__
%SPHINXBUILD% 2> nul
if errorlevel 9009 (
- echo.
- echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
- echo.installed, then set the SPHINXBUILD environment variable to point
- echo.to the full path of the 'sphinx-build' executable. Alternatively you
- echo.may add the Sphinx directory to PATH.
- echo.
- echo.If you don't have Sphinx installed, grab it from
- echo.http://sphinx-doc.org/
- exit /b 1
+ echo.
+ echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
+ echo.installed, then set the SPHINXBUILD environment variable to point
+ echo.to the full path of the 'sphinx-build' executable. Alternatively you
+ echo.may add the Sphinx directory to PATH.
+ echo.
+ echo.If you don't have Sphinx installed, grab it from
+ echo.http://sphinx-doc.org/
+ exit /b 1
)
:sphinx_ok
if "%1" == "html" (
- %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished. The HTML pages are in %BUILDDIR%/html.
- goto end
+ %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The HTML pages are in %BUILDDIR%/html.
+ goto end
)
if "%1" == "dirhtml" (
- %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
- goto end
+ %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
+ goto end
)
if "%1" == "singlehtml" (
- %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
- goto end
+ %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
+ goto end
)
if "%1" == "pickle" (
- %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished; now you can process the pickle files.
- goto end
+ %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; now you can process the pickle files.
+ goto end
)
if "%1" == "json" (
- %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished; now you can process the JSON files.
- goto end
+ %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; now you can process the JSON files.
+ goto end
)
if "%1" == "htmlhelp" (
- %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished; now you can run HTML Help Workshop with the ^
+ %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; now you can run HTML Help Workshop with the ^
.hhp project file in %BUILDDIR%/htmlhelp.
- goto end
+ goto end
)
if "%1" == "qthelp" (
- %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished; now you can run "qcollectiongenerator" with the ^
+ %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; now you can run "qcollectiongenerator" with the ^
.qhcp project file in %BUILDDIR%/qthelp, like this:
- echo.^> qcollectiongenerator %BUILDDIR%\qthelp\YangDevelopmentKit.qhcp
- echo.To view the help file:
- echo.^> assistant -collectionFile %BUILDDIR%\qthelp\YangDevelopmentKit.ghc
- goto end
+ echo.^> qcollectiongenerator %BUILDDIR%\qthelp\YangDevelopmentKit.qhcp
+ echo.To view the help file:
+ echo.^> assistant -collectionFile %BUILDDIR%\qthelp\YangDevelopmentKit.ghc
+ goto end
)
if "%1" == "devhelp" (
- %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished.
- goto end
+ %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished.
+ goto end
)
if "%1" == "epub" (
- %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished. The epub file is in %BUILDDIR%/epub.
- goto end
+ %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The epub file is in %BUILDDIR%/epub.
+ goto end
)
if "%1" == "latex" (
- %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
- goto end
+ %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
+ goto end
)
if "%1" == "latexpdf" (
- %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
- cd %BUILDDIR%/latex
- make all-pdf
- cd %~dp0
- echo.
- echo.Build finished; the PDF files are in %BUILDDIR%/latex.
- goto end
+ %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
+ cd %BUILDDIR%/latex
+ make all-pdf
+ cd %~dp0
+ echo.
+ echo.Build finished; the PDF files are in %BUILDDIR%/latex.
+ goto end
)
if "%1" == "latexpdfja" (
- %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
- cd %BUILDDIR%/latex
- make all-pdf-ja
- cd %~dp0
- echo.
- echo.Build finished; the PDF files are in %BUILDDIR%/latex.
- goto end
+ %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
+ cd %BUILDDIR%/latex
+ make all-pdf-ja
+ cd %~dp0
+ echo.
+ echo.Build finished; the PDF files are in %BUILDDIR%/latex.
+ goto end
)
if "%1" == "text" (
- %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished. The text files are in %BUILDDIR%/text.
- goto end
+ %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The text files are in %BUILDDIR%/text.
+ goto end
)
if "%1" == "man" (
- %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished. The manual pages are in %BUILDDIR%/man.
- goto end
+ %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The manual pages are in %BUILDDIR%/man.
+ goto end
)
if "%1" == "texinfo" (
- %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
- goto end
+ %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
+ goto end
)
if "%1" == "gettext" (
- %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
- goto end
+ %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
+ goto end
)
if "%1" == "changes" (
- %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
- if errorlevel 1 exit /b 1
- echo.
- echo.The overview file is in %BUILDDIR%/changes.
- goto end
+ %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.The overview file is in %BUILDDIR%/changes.
+ goto end
)
if "%1" == "linkcheck" (
- %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
- if errorlevel 1 exit /b 1
- echo.
- echo.Link check complete; look for any errors in the above output ^
+ %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Link check complete; look for any errors in the above output ^
or in %BUILDDIR%/linkcheck/output.txt.
- goto end
+ goto end
)
if "%1" == "doctest" (
- %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
- if errorlevel 1 exit /b 1
- echo.
- echo.Testing of doctests in the sources finished, look at the ^
+ %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Testing of doctests in the sources finished, look at the ^
results in %BUILDDIR%/doctest/output.txt.
- goto end
+ goto end
)
if "%1" == "coverage" (
- %SPHINXBUILD% -b coverage %ALLSPHINXOPTS% %BUILDDIR%/coverage
- if errorlevel 1 exit /b 1
- echo.
- echo.Testing of coverage in the sources finished, look at the ^
+ %SPHINXBUILD% -b coverage %ALLSPHINXOPTS% %BUILDDIR%/coverage
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Testing of coverage in the sources finished, look at the ^
results in %BUILDDIR%/coverage/python.txt.
- goto end
+ goto end
)
if "%1" == "xml" (
- %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished. The XML files are in %BUILDDIR%/xml.
- goto end
+ %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The XML files are in %BUILDDIR%/xml.
+ goto end
)
if "%1" == "pseudoxml" (
- %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml.
- goto end
+ %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml.
+ goto end
)
:end
diff --git a/sdk/cpp/core/samples/bgp.cpp b/sdk/cpp/core/samples/bgp.cpp
index 191cfd907..2c034edba 100644
--- a/sdk/cpp/core/samples/bgp.cpp
+++ b/sdk/cpp/core/samples/bgp.cpp
@@ -16,8 +16,8 @@
void print_paths(ydk::path::SchemaNode & sn)
{
- std::cout << sn.path() << std::endl;
- for(auto const& p : sn.children())
+ std::cout << sn.get_path() << std::endl;
+ for(auto const& p : sn.get_children())
print_paths(*p);
}
@@ -30,35 +30,35 @@ void test_bgp_create()
ydk::path::RootSchemaNode& schema = sp.get_root_schema();
print_paths(schema);
- auto & bgp = schema.create("openconfig-bgp:bgp", "");
+ auto & bgp = schema.create_datanode("openconfig-bgp:bgp", "");
// get the root
- // std::unique_ptr data_root{bgp->root()};
+ // std::unique_ptr data_root{bgp->get_root()};
- bgp.create("global/config/as", "65172");
+ bgp.create_datanode("global/config/as", "65172");
- auto & l3vpn_ipv4_unicast = bgp.create("global/afi-safis/afi-safi[afi-safi-name='openconfig-bgp-types:L3VPN_IPV4_UNICAST']", "");
- l3vpn_ipv4_unicast.create("config/afi-safi-name", "openconfig-bgp-types:L3VPN_IPV4_UNICAST");
+ auto & l3vpn_ipv4_unicast = bgp.create_datanode("global/afi-safis/afi-safi[afi-safi-name='openconfig-bgp-types:L3VPN_IPV4_UNICAST']", "");
+ l3vpn_ipv4_unicast.create_datanode("config/afi-safi-name", "openconfig-bgp-types:L3VPN_IPV4_UNICAST");
// set the enable flag
- l3vpn_ipv4_unicast.create("config/enabled","true");
+ l3vpn_ipv4_unicast.create_datanode("config/enabled","true");
// bgp/neighbors/neighbor
- auto & neighbor = bgp.create("neighbors/neighbor[neighbor-address='172.16.255.2']", "");
- neighbor.create("config/neighbor-address", "172.16.255.2");
- neighbor.create("config/peer-as","65172");
+ auto & neighbor = bgp.create_datanode("neighbors/neighbor[neighbor-address='172.16.255.2']", "");
+ neighbor.create_datanode("config/neighbor-address", "172.16.255.2");
+ neighbor.create_datanode("config/peer-as","65172");
// bgp/neighbors/neighbor/afi-safis/afi-safi
- auto & neighbor_af = neighbor.create("afi-safis/afi-safi[afi-safi-name='openconfig-bgp-types:L3VPN_IPV4_UNICAST']", "");
- neighbor_af.create("config/afi-safi-name" , "openconfig-bgp-types:L3VPN_IPV4_UNICAST");
- neighbor_af.create("config/enabled","true");
+ auto & neighbor_af = neighbor.create_datanode("afi-safis/afi-safi[afi-safi-name='openconfig-bgp-types:L3VPN_IPV4_UNICAST']", "");
+ neighbor_af.create_datanode("config/afi-safi-name" , "openconfig-bgp-types:L3VPN_IPV4_UNICAST");
+ neighbor_af.create_datanode("config/enabled","true");
- ydk::path::CodecService s {};
+ ydk::path::Codec s {};
auto xml = s.encode(bgp, ydk::EncodingFormat::XML, true);
- // auto json = s.encode(bgp, ydk::path::CodecService::Format::JSON, true);
+ // auto json = s.encode(bgp, ydk::path::Codec::Format::JSON, true);
std::cout << "Testing encoding" << std::endl;
@@ -90,8 +90,8 @@ void test_bgp_create()
// TODO fix rpc
- std::shared_ptr create_rpc { schema.rpc("ydk:create") };
- create_rpc->input().create("entity", xml);
+ std::shared_ptr create_rpc { schema.create_rpc("ydk:create") };
+ create_rpc->get_input_node().create_datanode("entity", xml);
// call create
(*create_rpc)(sp);
@@ -100,7 +100,7 @@ void test_bgp_create()
//void test_read(ydk::ServiceProvider *sp, ydk::SchemaNode* schema)
//{
// const char *bgp_xml = "\
-// \
+// \
// \
// \
// 65172\
@@ -144,5 +144,5 @@ int main() {
//begin read
- return 0;
+ return 0;
}
diff --git a/sdk/cpp/core/src/bits.cpp b/sdk/cpp/core/src/bits.cpp
index 9787e11aa..92620b6ee 100644
--- a/sdk/cpp/core/src/bits.cpp
+++ b/sdk/cpp/core/src/bits.cpp
@@ -41,12 +41,12 @@ Bits::~Bits()
bool & Bits::operator [] (std::string key)
{
- return bitmap[key];
+ return bitmap[key];
}
const std::map & Bits::get_bitmap() const
{
- return bitmap;
+ return bitmap;
}
}
diff --git a/sdk/cpp/core/src/capabilities_parser.hpp b/sdk/cpp/core/src/capabilities_parser.hpp
index 634e71e61..ac876f15b 100644
--- a/sdk/cpp/core/src/capabilities_parser.hpp
+++ b/sdk/cpp/core/src/capabilities_parser.hpp
@@ -29,20 +29,20 @@ struct Capability;
class CapabilitiesXmlParser
{
- public:
- CapabilitiesXmlParser();
- virtual ~CapabilitiesXmlParser();
+ public:
+ CapabilitiesXmlParser();
+ virtual ~CapabilitiesXmlParser();
- virtual std::vector parse(const std::string & capabilities_xml) = 0;
+ virtual std::vector parse(const std::string & capabilities_xml) = 0;
};
class CapabilitiesParser
{
- public:
- CapabilitiesParser();
- virtual ~CapabilitiesParser();
+ public:
+ CapabilitiesParser();
+ virtual ~CapabilitiesParser();
- virtual std::vector parse(std::vector & capabilities) const =0;
+ virtual std::vector parse(std::vector & capabilities) const = 0;
};
}
diff --git a/sdk/cpp/core/src/codec_provider.hpp b/sdk/cpp/core/src/codec_provider.hpp
index 8be2ed430..6a1202ec7 100644
--- a/sdk/cpp/core/src/codec_provider.hpp
+++ b/sdk/cpp/core/src/codec_provider.hpp
@@ -36,24 +36,24 @@ typedef void (*augment_capabilities_function)();
class CodecServiceProvider
{
public:
- CodecServiceProvider(EncodingFormat encoding);
- CodecServiceProvider(path::Repository & repo, EncodingFormat encoding);
- ~CodecServiceProvider();
+ CodecServiceProvider(EncodingFormat encoding);
+ CodecServiceProvider(path::Repository & repo, EncodingFormat encoding);
+ ~CodecServiceProvider();
- void initialize(const std::string & bundle_name, const std::string & models_path, augment_capabilities_function get_caps_func);
- path::RootSchemaNode& get_root_schema_for_bundle(const std::string & bundle_name);
+ void initialize(const std::string & bundle_name, const std::string & models_path, augment_capabilities_function get_caps_func);
+ path::RootSchemaNode& get_root_schema_for_bundle(const std::string & bundle_name);
private:
- void initialize_root_schema(const std::string & bundle_name, path::Repository & repo);
+ void initialize_root_schema(const std::string & bundle_name, path::Repository & repo);
public:
- EncodingFormat m_encoding;
+ EncodingFormat m_encoding;
private:
- std::map> m_root_schema_table;
- bool user_provided_repo;
- bool capabilities_augmented;
- path::Repository m_repo;
+ std::map> m_root_schema_table;
+ bool user_provided_repo;
+ bool capabilities_augmented;
+ path::Repository m_repo;
};
}
diff --git a/sdk/cpp/core/src/codec_service.cpp b/sdk/cpp/core/src/codec_service.cpp
index d5fd784ed..c74f2d63a 100644
--- a/sdk/cpp/core/src/codec_service.cpp
+++ b/sdk/cpp/core/src/codec_service.cpp
@@ -29,6 +29,7 @@
#include "path_api.hpp"
#include "types.hpp"
#include "logger.hpp"
+#include "xml_subtree_codec.hpp"
namespace ydk
{
@@ -52,16 +53,26 @@ CodecService::~CodecService()
}
std::string
-CodecService::encode(CodecServiceProvider & provider, Entity & entity, bool pretty)
+CodecService::encode(CodecServiceProvider & provider, Entity & entity, bool pretty, bool subtree)
{
path::RootSchemaNode& root_schema = get_root_schema(provider, entity);
+ if(subtree)
+ {
+ if(provider.m_encoding != EncodingFormat::XML)
+ {
+ YLOG_ERROR("Subtree option can only be used with XML encoding");
+ throw(YCPPServiceProviderError("Subtree option can only be used with XML encoding"));
+ }
+ XmlSubtreeCodec codec{};
+ return codec.encode(entity, root_schema);
+ }
try
{
path::DataNode& datanode = get_data_node_from_entity(entity, root_schema);
const path::DataNode* dn = &datanode;
- while(dn!= nullptr && dn->parent()!=nullptr)
- dn = dn->parent();
- path::CodecService core_codec_service{};
+ while(dn!= nullptr && dn->get_parent()!=nullptr)
+ dn = dn->get_parent();
+ path::Codec core_codec_service{};
std::string result = core_codec_service.encode(*dn, provider.m_encoding, pretty);
YLOG_INFO("Performing encode operation, resulting in {}", result);
return result;
@@ -87,23 +98,34 @@ CodecService::encode(CodecServiceProvider & provider, std::map
-CodecService::decode(CodecServiceProvider & provider, const std::string & payload, std::shared_ptr entity)
+CodecService::decode(CodecServiceProvider & provider, const std::string & payload, std::shared_ptr entity, bool subtree)
{
+ if(subtree)
+ {
+ if(provider.m_encoding != EncodingFormat::XML)
+ {
+ YLOG_ERROR("Subtree option can only be used with XML encoding");
+ throw(YCPPServiceProviderError("Subtree option can only be used with XML encoding"));
+ }
+ XmlSubtreeCodec codec{};
+ return codec.decode(payload, entity);
+ }
+
path::RootSchemaNode& root_schema = get_root_schema(provider, *entity);
YLOG_INFO("Performing decode operation on {}", payload);
- path::CodecService core_codec_service{};
+ path::Codec core_codec_service{};
auto root_data_node = core_codec_service.decode(root_schema, payload, provider.m_encoding);
- if (root_data_node->children().size() != 1)
+ if (root_data_node->get_children().size() != 1)
{
- YLOG_ERROR(PAYLOAD_ERROR_MSG);
+ YLOG_ERROR(PAYLOAD_ERROR_MSG);
throw(YCPPServiceProviderError(PAYLOAD_ERROR_MSG));
}
else
{
- for (auto data_node: root_data_node->children())
+ for (auto data_node: root_data_node->get_children())
{
get_entity_from_data_node(data_node.get(), entity);
// Required for validation of decoded entity
@@ -115,7 +137,7 @@ CodecService::decode(CodecServiceProvider & provider, const std::string & payloa
std::map>
CodecService::decode(CodecServiceProvider & provider, std::map & payload_map,
- std::map> entity_map)
+ std::map> entity_map)
{
for (auto it: payload_map)
{
diff --git a/sdk/cpp/core/src/codec_service.hpp b/sdk/cpp/core/src/codec_service.hpp
index 6c436486b..e74585f04 100644
--- a/sdk/cpp/core/src/codec_service.hpp
+++ b/sdk/cpp/core/src/codec_service.hpp
@@ -38,10 +38,10 @@ class CodecService
CodecService();
~CodecService();
- std::string encode(CodecServiceProvider & provider, Entity & entity, bool pretty=false);
+ std::string encode(CodecServiceProvider & provider, Entity & entity, bool pretty=false, bool subtree=false);
std::map encode(CodecServiceProvider & provider, std::map> & entity, bool pretty=false);
- std::shared_ptr decode(CodecServiceProvider & provider, const std::string & payload, std::shared_ptr entity);
+ std::shared_ptr decode(CodecServiceProvider & provider, const std::string & payload, std::shared_ptr entity, bool subtree=false);
std::map> decode(CodecServiceProvider & provider,
std::map & payload_map,
std::map> entity_map);
diff --git a/sdk/cpp/core/src/crud_service.cpp b/sdk/cpp/core/src/crud_service.cpp
index 2458b1aba..75527102b 100644
--- a/sdk/cpp/core/src/crud_service.cpp
+++ b/sdk/cpp/core/src/crud_service.cpp
@@ -27,15 +27,21 @@
#include "path_api.hpp"
#include "entity_data_node_walker.hpp"
#include "validation_service.hpp"
+#include "xml_subtree_codec.hpp"
#include "logger.hpp"
+#include
+#include
+#include
+#include
using namespace std;
namespace ydk {
-static string get_data_payload(Entity & entity, path::ServiceProvider & provider);
+static string get_config_data_payload(Entity & entity, path::ServiceProvider & provider);
+static string get_xml_subtree_filter_payload(Entity & entity, path::ServiceProvider & provider);
static std::shared_ptr execute_rpc(path::ServiceProvider & provider, Entity & entity,
- const string & operation, const string & data_tag, bool set_config_flag);
+ const string & operation, const string & data_tag, bool set_config_flag);
static shared_ptr get_top_entity_from_filter(Entity & filter);
static bool operation_succeeded(shared_ptr node);
@@ -45,38 +51,38 @@ CrudService::CrudService()
bool CrudService::create(path::ServiceProvider & provider, Entity & entity)
{
- YLOG_INFO("Executing CRUD create operation");
- return operation_succeeded(
- execute_rpc(provider, entity, "ydk:create", "entity", false)
- );
+ YLOG_INFO("Executing CRUD create operation");
+ return operation_succeeded(
+ execute_rpc(provider, entity, "ydk:create", "entity", false)
+ );
}
bool CrudService::update(path::ServiceProvider & provider, Entity & entity)
{
- YLOG_INFO("Executing CRUD update operation");
- return operation_succeeded(
- execute_rpc(provider, entity, "ydk:update", "entity", false)
- );
+ YLOG_INFO("Executing CRUD update operation");
+ return operation_succeeded(
+ execute_rpc(provider, entity, "ydk:update", "entity", false)
+ );
}
bool CrudService::delete_(path::ServiceProvider & provider, Entity & entity)
{
- YLOG_INFO("Executing CRUD delete operation");
- return operation_succeeded(
- execute_rpc(provider, entity, "ydk:delete", "entity", false)
- );
+ YLOG_INFO("Executing CRUD delete operation");
+ return operation_succeeded(
+ execute_rpc(provider, entity, "ydk:delete", "entity", false)
+ );
}
shared_ptr CrudService::read(path::ServiceProvider & provider, Entity & filter)
{
- YLOG_INFO("Executing CRUD read operation");
- return read_datanode(filter, execute_rpc(provider, filter, "ydk:read", "filter", false));
+ YLOG_INFO("Executing CRUD read operation");
+ return read_datanode(filter, execute_rpc(provider, filter, "ydk:read", "filter", false));
}
shared_ptr CrudService::read_config(path::ServiceProvider & provider, Entity & filter)
{
- YLOG_INFO("Executing CRUD config read operation");
- return read_datanode(filter, execute_rpc(provider, filter, "ydk:read", "filter", true));
+ YLOG_INFO("Executing CRUD config read operation");
+ return read_datanode(filter, execute_rpc(provider, filter, "ydk:read", "filter", true));
}
shared_ptr CrudService::read_datanode(Entity & filter, shared_ptr read_data_node)
@@ -84,14 +90,14 @@ shared_ptr CrudService::read_datanode(Entity & filter, shared_ptr top_entity = get_top_entity_from_filter(filter);
- get_entity_from_data_node(read_data_node->children()[0].get(), top_entity);
+ get_entity_from_data_node(read_data_node->get_children()[0].get(), top_entity);
return top_entity;
}
static bool operation_succeeded(shared_ptr node)
{
- YLOG_INFO("Operation {}", ((node == nullptr)?"succeeded":"failed"));
- return node == nullptr;
+ YLOG_INFO("Operation {}", ((node == nullptr)?"succeeded":"failed"));
+ return node == nullptr;
}
static shared_ptr get_top_entity_from_filter(Entity & filter)
@@ -111,25 +117,42 @@ static shared_ptr execute_rpc(path::ServiceProvider & provider,
// validation.validate(provider, entity, ValidationService::Option::DATASTORE);
// }
path::RootSchemaNode& root_schema = provider.get_root_schema();
- shared_ptr ydk_rpc { root_schema.rpc(operation) };
- string data = get_data_payload(entity, provider);
+ shared_ptr ydk_rpc { root_schema.create_rpc(operation) };
+ string data;
+ if(data_tag == "filter" && provider.get_encoding() == EncodingFormat::XML)
+ {
+ data = get_xml_subtree_filter_payload(entity, provider);
+ }
+ else
+ {
+ data = get_config_data_payload(entity, provider);
+ }
if(set_config_flag)
{
- ydk_rpc->input().create("only-config");
+ ydk_rpc->get_input_node().create_datanode("only-config");
}
- ydk_rpc->input().create(data_tag, data);
+ ydk_rpc->get_input_node().create_datanode(data_tag, data);
return (*ydk_rpc)(provider);
}
-static string get_data_payload(Entity & entity, path::ServiceProvider & provider)
+static string get_config_data_payload(Entity & entity, path::ServiceProvider & provider)
{
- const ydk::path::DataNode& datanode = get_data_node_from_entity(entity, provider.get_root_schema());
+ const ydk::path::DataNode& datanode = get_data_node_from_entity(entity, provider.get_root_schema());
+
const path::DataNode* dn = &datanode;
- while(dn!= nullptr && dn->parent()!=nullptr)
- dn = dn->parent();
- path::CodecService codec{};
- return codec.encode(*dn, provider.get_encoding(), false);
+ while(dn!= nullptr && dn->get_parent()!=nullptr)
+ dn = dn->get_parent();
+ path::Codec codec{};
+ YLOG_DEBUG("Encoding the subtree filter request using path API DataNode");
+ string payload = codec.encode(*dn, provider.get_encoding(), false);
+ return payload;
}
+static string get_xml_subtree_filter_payload(Entity & entity, path::ServiceProvider & provider)
+{
+ XmlSubtreeCodec xml_subtree_codec{};
+ YLOG_DEBUG("Encoding the subtree filter request using XML subtree codec");
+ return xml_subtree_codec.encode(entity, provider.get_root_schema());
+}
}
diff --git a/sdk/cpp/core/src/entity.cpp b/sdk/cpp/core/src/entity.cpp
index eab19fafa..78205da3b 100644
--- a/sdk/cpp/core/src/entity.cpp
+++ b/sdk/cpp/core/src/entity.cpp
@@ -25,6 +25,7 @@
//
//////////////////////////////////////////////////////////////////
+#include "logger.hpp"
#include "types.hpp"
#include
#include
@@ -38,7 +39,7 @@ namespace ydk
/// Entity
//////////////////////////////////////////////////////////////////
Entity::Entity()
- : parent(nullptr), operation(EditOperation::not_set)
+ : parent(nullptr), yfilter(YFilter::not_set), is_presence_container(false)
{
}
@@ -76,6 +77,11 @@ std::string Entity::get_bundle_name() const
return "";
}
+std::map, std::string> Entity::get_namespace_identity_lookup() const
+{
+ return {};
+}
+
bool Entity::operator == (Entity & other) const
{
if(!has_data() && !other.has_data())
@@ -97,6 +103,7 @@ bool Entity::operator == (Entity & other) const
{
if(*(rit->second) != *(lit->second))
{
+ YLOG_DEBUG("Children not equal {} and {}", rit->first, lit->first);
return false;
}
}
@@ -104,6 +111,7 @@ bool Entity::operator == (Entity & other) const
}
else
{
+ YLOG_DEBUG("Entity path not equal {} and {}", yang_name, other.yang_name);
return false;
}
diff --git a/sdk/cpp/core/src/entity_data_node_walker.cpp b/sdk/cpp/core/src/entity_data_node_walker.cpp
index 18d9d08b3..9b2023fae 100644
--- a/sdk/cpp/core/src/entity_data_node_walker.cpp
+++ b/sdk/cpp/core/src/entity_data_node_walker.cpp
@@ -48,51 +48,48 @@ static bool data_node_is_list(path::DataNode & data_node);
static string get_segment_path(const string & path);
static void add_annotation_to_datanode(const Entity & entity, path::DataNode & data_node);
static void add_annotation_to_datanode(const std::pair & name_value, path::DataNode & data_node);
-static path::Annotation get_annotation(EditOperation operation);
+static path::Annotation get_annotation(YFilter yfilter);
//////////////////////////////////////////////////////////////////////////
// DataNode* from Entity
//////////////////////////////////////////////////////////////////////////
-path::DataNode& get_data_node_from_entity(Entity & entity, ydk::path::RootSchemaNode & root_schema)
+path::DataNode& get_data_node_from_entity(Entity & entity, path::RootSchemaNode & root_schema)
{
EntityPath root_path = entity.get_entity_path(nullptr);
- auto & root_data_node = root_schema.create(root_path.path);
- if(is_set(entity.operation))
+ auto & root_data_node = root_schema.create_datanode(root_path.path);
+ if(is_set(entity.yfilter))
{
add_annotation_to_datanode(entity, root_data_node);
}
YLOG_DEBUG("Root entity: {}", root_path.path);
populate_name_values(root_data_node, root_path);
- walk_children(entity, root_data_node)
-;
+ walk_children(entity, root_data_node);
return root_data_node;
}
static void walk_children(Entity & entity, path::DataNode & data_node)
{
- std::map> children = entity.get_children();
- YLOG_DEBUG("Children count for: {} : {}",entity.get_entity_path(entity.parent).path, children.size());
- for(auto const& child : children)
- {
- YLOG_DEBUG("==================");
- YLOG_DEBUG("Looking at child '{}': {}",child.first, child.second->get_entity_path(child.second->parent).path);
- if(child.second->has_operation() || child.second->has_data())
- populate_data_node(*(child.second), data_node);
- else
- YLOG_DEBUG("Child has no data and no operations");
- }
+ std::map> children = entity.get_children();
+ YLOG_DEBUG("Children count for: {} : {}",entity.get_entity_path(entity.parent).path, children.size());
+ for(auto const& child : children)
+ {
+ YLOG_DEBUG("==================");
+ YLOG_DEBUG("Looking at child '{}': {}",child.first, child.second->get_entity_path(child.second->parent).path);
+ if(child.second->has_operation() || child.second->has_data() || child.second->is_presence_container)
+ populate_data_node(*(child.second), data_node);
+ else
+ YLOG_DEBUG("Child has no data and no operations");
+ }
}
static void populate_data_node(Entity & entity, path::DataNode & parent_data_node)
{
EntityPath path = entity.get_entity_path(entity.parent);
- path::DataNode* data_node = nullptr;
-
- data_node = &parent_data_node.create(path.path);
+ path::DataNode* data_node = &parent_data_node.create_datanode(path.path);
- if(is_set(entity.operation))
+ if(is_set(entity.yfilter))
{
add_annotation_to_datanode(entity, *data_node);
}
@@ -103,49 +100,57 @@ static void populate_data_node(Entity & entity, path::DataNode & parent_data_nod
static void populate_name_values(path::DataNode & data_node, EntityPath & path)
{
- YLOG_DEBUG("Leaf count: {}", path.value_paths.size());
- for(const std::pair & name_value : path.value_paths)
- {
- path::DataNode* result = nullptr;
- LeafData leaf_data = name_value.second;
- YLOG_DEBUG("Creating child {} of {} with value: '{}', is_set: {}", name_value.first, data_node.path(),
- leaf_data.value, leaf_data.is_set);
+ YLOG_DEBUG("Leaf count: {}", path.value_paths.size());
+ for(const std::pair & name_value : path.value_paths)
+ {
+ path::DataNode* result = nullptr;
+ LeafData leaf_data = name_value.second;
+ YLOG_DEBUG("Creating child {} of {} with value: '{}', is_set: {}", name_value.first, data_node.get_path(),
+ leaf_data.value, leaf_data.is_set);
if(leaf_data.is_set)
{
- result = &data_node.create(name_value.first, leaf_data.value);
- }
+ result = &data_node.create_datanode(name_value.first, leaf_data.value);
+ YLOG_DEBUG("Result: {}", (result?"success":"failure"));
- if(is_set(leaf_data.operation))
- {
- add_annotation_to_datanode(name_value, *result);
- }
-
- YLOG_DEBUG("Result: {}", (result?"success":"failure"));
+ if(is_set(leaf_data.yfilter))
+ {
+ add_annotation_to_datanode(name_value, *result);
+ }
}
+ }
}
static void add_annotation_to_datanode(const Entity & entity, path::DataNode & data_node)
{
- YLOG_DEBUG("Got operation '{}' for {}", to_string(entity.operation), entity.yang_name);
- data_node.add_annotation(
- get_annotation(entity.operation)
- );
+ YLOG_DEBUG("Got yfilter '{}' for {}", to_string(entity.yfilter), entity.yang_name);
+ if (entity.yfilter != YFilter::read)
+ {
+ data_node.add_annotation(
+ get_annotation(entity.yfilter)
+ );
+ YLOG_DEBUG("Set yfilter '{}' for {}", to_string(entity.yfilter), entity.yang_name);
+
+ }
}
static void add_annotation_to_datanode(const std::pair & name_value, path::DataNode & data_node)
{
- YLOG_DEBUG("Got operation '{}' for {}", to_string(name_value.second.operation), name_value.first);
- data_node.add_annotation(
- get_annotation(name_value.second.operation)
- );
+ YLOG_DEBUG("Got yfilter '{}' for {}", to_string(name_value.second.yfilter), name_value.first);
+ if (name_value.second.yfilter != YFilter::read)
+ {
+ data_node.add_annotation(
+ get_annotation(name_value.second.yfilter)
+ );
+ YLOG_DEBUG("Set yfilter '{}' for {}", to_string(name_value.second.yfilter), name_value.first);
+ }
}
-static path::Annotation get_annotation(EditOperation operation)
+static path::Annotation get_annotation(YFilter yfilter)
{
- if(operation == EditOperation::not_set)
- throw(YCPPInvalidArgumentError{"Invalid operation"});
- return {IETF_NETCONF_MODULE_NAME, "operation", to_string(operation)};
+ if(yfilter == YFilter::not_set)
+ throw(YCPPInvalidArgumentError{"Invalid yfilter"});
+ return {IETF_NETCONF_MODULE_NAME, "operation", to_string(yfilter)};
}
//////////////////////////////////////////////////////////////////////////
@@ -153,50 +158,50 @@ static path::Annotation get_annotation(EditOperation operation)
//////////////////////////////////////////////////////////////////////////
void get_entity_from_data_node(path::DataNode * node, std::shared_ptr entity)
{
- if (entity == nullptr || node == nullptr)
- return;
-
- for(auto & child_data_node:node->children())
- {
- std::string child_name = child_data_node->schema().statement().arg;
- if(data_node_is_leaf(*child_data_node))
- {
- YLOG_DEBUG("Creating leaf {} of value '{}' in parent {}", child_name,
- child_data_node->get(), node->path());
- entity->set_value(child_name, child_data_node->get());
- }
- else
- {
- YLOG_DEBUG("Going into child {} in parent {}", child_name, node->path());
- std::shared_ptr child_entity;
- if(data_node_is_list(*child_data_node))
- {
- child_entity = entity->get_child_by_name(child_name, get_segment_path(child_data_node->path()));
- }
- else
- {
- child_entity = entity->get_child_by_name(child_name);
- }
- child_entity->parent = entity.get();
-
- if(child_entity == nullptr)
- {
- YLOG_ERROR("Couldn't fetch child entity {} in parent {}!", child_name, node->path());
- }
- get_entity_from_data_node(child_data_node.get(), child_entity);
- }
- }
+ if (entity == nullptr || node == nullptr)
+ return;
+
+ for(auto & child_data_node:node->get_children())
+ {
+ std::string child_name = child_data_node->get_schema_node().get_statement().arg;
+ if(data_node_is_leaf(*child_data_node))
+ {
+ YLOG_DEBUG("Creating leaf {} of value '{}' in parent {}", child_name,
+ child_data_node->get_value(), node->get_path());
+ entity->set_value(child_name, child_data_node->get_value());
+ }
+ else
+ {
+ YLOG_DEBUG("Going into child {} in parent {}", child_name, node->get_path());
+ std::shared_ptr child_entity;
+ if(data_node_is_list(*child_data_node))
+ {
+ child_entity = entity->get_child_by_name(child_name, get_segment_path(child_data_node->get_path()));
+ }
+ else
+ {
+ child_entity = entity->get_child_by_name(child_name);
+ }
+ child_entity->parent = entity.get();
+
+ if(child_entity == nullptr)
+ {
+ YLOG_ERROR("Couldn't fetch child entity {} in parent {}!", child_name, node->get_path());
+ }
+ get_entity_from_data_node(child_data_node.get(), child_entity);
+ }
+ }
}
static bool data_node_is_leaf(path::DataNode & data_node)
{
- return (data_node.schema().statement().keyword == "leaf"
- || data_node.schema().statement().keyword == "leaf-list");
+ return (data_node.get_schema_node().get_statement().keyword == "leaf"
+ || data_node.get_schema_node().get_statement().keyword == "leaf-list");
}
static bool data_node_is_list(path::DataNode & data_node)
{
- return (data_node.schema().statement().keyword == "list");
+ return (data_node.get_schema_node().get_statement().keyword == "list");
}
static string get_segment_path(const string & path)
diff --git a/sdk/cpp/core/src/entity_data_node_walker.hpp b/sdk/cpp/core/src/entity_data_node_walker.hpp
index 7bb9dd86d..e07da5f72 100644
--- a/sdk/cpp/core/src/entity_data_node_walker.hpp
+++ b/sdk/cpp/core/src/entity_data_node_walker.hpp
@@ -36,7 +36,7 @@ namespace ydk {
class Entity;
-path::DataNode& get_data_node_from_entity(Entity & entity, path::RootSchemaNode & root);
+path::DataNode& get_data_node_from_entity(Entity & entity, path::RootSchemaNode & root_schema);
void get_entity_from_data_node(path::DataNode * node, std::shared_ptr entity);
diff --git a/sdk/cpp/core/src/entity_util.cpp b/sdk/cpp/core/src/entity_util.cpp
index d02213619..4f0a65b3e 100644
--- a/sdk/cpp/core/src/entity_util.cpp
+++ b/sdk/cpp/core/src/entity_util.cpp
@@ -69,9 +69,9 @@ std::string get_relative_entity_path(const Entity* current_node, const Entity* a
}
-bool is_set(const EditOperation & operation)
+bool is_set(const YFilter & yfilter)
{
- return operation != EditOperation::not_set;
+ return yfilter != YFilter::not_set;
}
}
diff --git a/sdk/cpp/core/src/entity_util.hpp b/sdk/cpp/core/src/entity_util.hpp
index fca562de0..ac72114dd 100644
--- a/sdk/cpp/core/src/entity_util.hpp
+++ b/sdk/cpp/core/src/entity_util.hpp
@@ -31,7 +31,7 @@ namespace ydk
class Entity;
std::string get_relative_entity_path(const Entity* current_node, const Entity* ancestor, std::string path);
-bool is_set(const EditOperation & operation);
+bool is_set(const YFilter & yfilter);
}
diff --git a/sdk/cpp/core/src/errors.hpp b/sdk/cpp/core/src/errors.hpp
index aa45037e4..171131a69 100644
--- a/sdk/cpp/core/src/errors.hpp
+++ b/sdk/cpp/core/src/errors.hpp
@@ -49,7 +49,7 @@ struct YCPPError : public std::exception
struct YCPPClientError : public YCPPError
{
- YCPPClientError(const std::string& msg);
+ YCPPClientError(const std::string& msg);
};
struct YCPPServiceProviderError : public YCPPError
@@ -87,7 +87,7 @@ struct YCPPInvalidArgumentError : public YCPPError
///
/// @brief Operation Not Supported Error
///
-/// Thrown when an operation is not supported.
+/// Thrown when an yfilter is not supported.
///
struct YCPPOperationNotSupportedError : public YCPPError
{
diff --git a/sdk/cpp/core/src/executor_service.cpp b/sdk/cpp/core/src/executor_service.cpp
index eddebf815..30fe37d67 100644
--- a/sdk/cpp/core/src/executor_service.cpp
+++ b/sdk/cpp/core/src/executor_service.cpp
@@ -33,33 +33,34 @@ using namespace std;
namespace ydk{
-static void walk_children(std::shared_ptr entity, path::DataNode & rpc_input,
- path::RootSchemaNode & root_schema, std::string path);
-static void create_from_entity_path(std::shared_ptr entity,
- path::DataNode & rpc_input, std::string path);
-static void create_from_children(std::map> & children,
- path::DataNode & rpc_input, path::RootSchemaNode & root_schema);
+static void walk_children(std::shared_ptr entity, path::DataNode & rpc_input, std::string path);
+static void create_from_entity_path(std::shared_ptr entity, path::DataNode & rpc_input, const std::string & path);
+static void create_from_children(std::map> & children, path::DataNode & rpc_input);
shared_ptr get_top_entity_from_filter(Entity & filter);
ExecutorService::ExecutorService()
{
+}
+
+ExecutorService::~ExecutorService()
+{
}
shared_ptr ExecutorService::execute_rpc(NetconfServiceProvider & provider,
Entity & rpc_entity, std::shared_ptr top_entity)
{
- // Get the operation - RPC Name
- auto const & operation = rpc_entity.get_segment_path();
+ // Get the yfilter - RPC Name
+ auto const & yfilter = rpc_entity.get_segment_path();
// Create RPC instance
path::RootSchemaNode & root_schema = provider.get_root_schema();
- shared_ptr rpc = root_schema.rpc(operation);
- path::DataNode & rpc_input = rpc->input();
+ shared_ptr rpc = root_schema.create_rpc(yfilter);
+ path::DataNode & rpc_input = rpc->get_input_node();
// Handle input
auto input = rpc_entity.get_child_by_name("input", "");
- walk_children(input, rpc_input, root_schema, "");
+ walk_children(input, rpc_input, "");
// Execute
auto result_datanode = (*rpc)(provider);
@@ -68,7 +69,7 @@ shared_ptr ExecutorService::execute_rpc(NetconfServiceProvider & provide
auto output = rpc_entity.get_child_by_name("output", "");
if (output != nullptr && result_datanode != nullptr)
{
- auto filter = result_datanode->children()[0].get();
+ auto filter = result_datanode->get_children()[0].get();
get_entity_from_data_node(filter, top_entity);
return top_entity;
@@ -77,8 +78,7 @@ shared_ptr ExecutorService::execute_rpc(NetconfServiceProvider & provide
return nullptr;
}
-static void walk_children(std::shared_ptr entity, path::DataNode & rpc_input,
- path::RootSchemaNode & root_schema, std::string path)
+static void walk_children(std::shared_ptr entity, path::DataNode & rpc_input, std::string path)
{
if (entity != nullptr)
{
@@ -95,18 +95,17 @@ static void walk_children(std::shared_ptr entity, path::DataNode & rpc_i
YLOG_DEBUG("Path: {}", path);
for( auto const & child : children )
- walk_children(child.second, rpc_input, root_schema, path);
+ walk_children(child.second, rpc_input, path);
// if there are leafs, create from entity path
if (entity_path.value_paths.size() != 0)
create_from_entity_path(entity, rpc_input, path);
- create_from_children(children, rpc_input, root_schema);
+ create_from_children(children, rpc_input);
}
}
-static void create_from_entity_path(std::shared_ptr entity,
- path::DataNode & rpc_input, std::string path)
+static void create_from_entity_path(std::shared_ptr entity, path::DataNode & rpc_input, const std::string & path)
{
auto entity_path = entity->get_entity_path(entity->parent);
@@ -118,12 +117,11 @@ static void create_from_entity_path(std::shared_ptr entity,
if (path != "")
temp_path = path + '/';
temp_path = temp_path + child.first;
- rpc_input.create(temp_path, child.second.value);
+ rpc_input.create_datanode(temp_path, child.second.value);
}
}
-static void create_from_children(std::map> & children,
- path::DataNode & rpc_input, path::RootSchemaNode & root_schema)
+static void create_from_children(std::map> & children, path::DataNode & rpc_input)
{
for( auto const & child : children )
{
@@ -132,7 +130,7 @@ static void create_from_children(std::map> & chi
YLOG_DEBUG("Creating child '{}': {}",child.first,
child.second->get_entity_path(child.second->parent).path);
- rpc_input.create(child.first);
+ rpc_input.create_datanode(child.first);
}
}
}
diff --git a/sdk/cpp/core/src/executor_service.hpp b/sdk/cpp/core/src/executor_service.hpp
index 3b2e39176..ec42ad04b 100644
--- a/sdk/cpp/core/src/executor_service.hpp
+++ b/sdk/cpp/core/src/executor_service.hpp
@@ -47,10 +47,11 @@ class Entity;
class ExecutorService : public Service
{
- public:
- ExecutorService();
- std::shared_ptr execute_rpc(NetconfServiceProvider & provider,
- Entity & rpc_entity, std::shared_ptr top_entity = nullptr);
+ public:
+ ExecutorService();
+ ~ExecutorService();
+ std::shared_ptr execute_rpc(NetconfServiceProvider & provider,
+ Entity & rpc_entity, std::shared_ptr top_entity = nullptr);
};
}
diff --git a/sdk/cpp/core/core_info.hpp.in b/sdk/cpp/core/src/filters.hpp
similarity index 79%
rename from sdk/cpp/core/core_info.hpp.in
rename to sdk/cpp/core/src/filters.hpp
index 901201d35..03a17e381 100644
--- a/sdk/cpp/core/core_info.hpp.in
+++ b/sdk/cpp/core/src/filters.hpp
@@ -1,4 +1,8 @@
-/// YANG Development Kit
+//
+// @file types.hpp
+// @brief Header for ydk entity
+//
+// YANG Development Kit
// Copyright 2016 Cisco Systems. All rights reserved
//
////////////////////////////////////////////////////////////////
@@ -21,13 +25,22 @@
//
//////////////////////////////////////////////////////////////////
-#ifndef _BUNDLE_INFO_HPP_
-#define _BUNDLE_INFO_HPP_
-
+#ifndef _FILTERS_HPP_
+#define _FILTERS_HPP_
namespace ydk
{
-#define ydk_models_path "@CMAKE_INSTALL_PREFIX@/share/ydk"
+enum class YFilter
+{
+ merge,
+ create,
+ remove,
+ delete_,
+ replace,
+ read,
+ not_set
+};
}
-#endif /* _BUNDLE_INFO_HPP_ */
+#endif /* _FILTERS_HPP_ */
+
diff --git a/sdk/cpp/core/src/ietf_parser.cpp b/sdk/cpp/core/src/ietf_parser.cpp
index cde8bd956..c96275b7d 100644
--- a/sdk/cpp/core/src/ietf_parser.cpp
+++ b/sdk/cpp/core/src/ietf_parser.cpp
@@ -27,60 +27,76 @@ using namespace std;
namespace ydk
{
+
+static xmlNodePtr drop_hello_tag(xmlNodePtr root)
+{
+ auto cur = root->xmlChildrenNode;
+ while (cur != NULL)
+ {
+ if ((!xmlStrcmp(cur->name, (const xmlChar *) "capabilities")))
+ return cur;
+ cur = cur->next;
+ }
+ return root;
+}
//////////////////////////////////////////
//// IetfCapabilitiesXmlParser
//////////////////////////////////////////
IetfCapabilitiesXmlParser::IetfCapabilitiesXmlParser()
- : doc (NULL)
+ : doc (NULL)
{
}
IetfCapabilitiesXmlParser::~IetfCapabilitiesXmlParser()
{
- if(doc != NULL)
- {
- xmlFreeDoc(doc);
- }
+ if(doc != NULL)
+ {
+ xmlFreeDoc(doc);
+ }
}
vector IetfCapabilitiesXmlParser::parse(const string & capabilities_buffer)
{
- doc = xmlReadMemory(capabilities_buffer.c_str(), capabilities_buffer.size(), "noname.xml", NULL, 0);
-
- vector capabilities{};
- if (doc == NULL)
- {
- YLOG_INFO("Empty capabilities");
- return {};
- }
- xmlNodePtr cur = xmlDocGetRootElement(doc);
- if (cur == NULL)
- {
- YLOG_INFO("Empty capabilities");
- return {};
- }
- if (xmlStrcmp(cur->name, (const xmlChar *) "capabilities") != 0)
- {
- YLOG_INFO("Unexpected XML");
- return {};
- }
- cur = cur->xmlChildrenNode;
- while(cur != NULL)
- {
- if (xmlStrcmp(cur->name, (const xmlChar *) "capability") == 0)
- {
- xmlChar * capability_buffer = xmlNodeGetContent(cur);
- if(capability_buffer != NULL)
- {
- ostringstream capability;
- capability << capability_buffer;
- xmlFree(capability_buffer);
- capabilities.push_back(capability.str());
- }
- }
- cur = cur->next;
- }
- return capabilities;
+ doc = xmlReadMemory(capabilities_buffer.c_str(), capabilities_buffer.size(), "noname.xml", NULL, 0);
+
+ vector capabilities{};
+ if (doc == NULL)
+ {
+ YLOG_INFO("Empty capabilities");
+ return {};
+ }
+ xmlNodePtr cur = xmlDocGetRootElement(doc);
+ if (cur == NULL)
+ {
+ YLOG_INFO("Empty capabilities");
+ return {};
+ }
+
+ // drop hello
+ cur = drop_hello_tag(cur);
+
+ if (xmlStrcmp(cur->name, (const xmlChar *) "capabilities") != 0)
+ {
+ YLOG_INFO("Unexpected XML");
+ return {};
+ }
+ cur = cur->xmlChildrenNode;
+ while(cur != NULL)
+ {
+ if (xmlStrcmp(cur->name, (const xmlChar *) "capability") == 0)
+ {
+ xmlChar * capability_buffer = xmlNodeGetContent(cur);
+ if(capability_buffer != NULL)
+ {
+ ostringstream capability;
+ capability << capability_buffer;
+ xmlFree(capability_buffer);
+ capabilities.push_back(capability.str());
+ }
+ }
+ cur = cur->next;
+ }
+ return capabilities;
}
//////////////////////////////////////////
@@ -96,104 +112,144 @@ IetfCapabilitiesParser::~IetfCapabilitiesParser()
}
+std::vector>
+IetfCapabilitiesParser::get_lookup_tables(vector& capabilities) const
+{
+ unordered_map name_lookup;
+ unordered_map namespace_lookup;
+
+ auto segs = segmentalize_capabilities(capabilities);
+
+ for (auto &c: segs)
+ {
+ name_lookup.insert(make_pair(c.second.module, c.second));
+ namespace_lookup.insert(make_pair(c.first, c.second));
+ }
+
+ return {name_lookup, namespace_lookup};
+}
+
+vector> IetfCapabilitiesParser::segmentalize_capabilities(vector& capabilities) const
+{
+ vector> segs;
+
+ for( string &c : capabilities )
+ {
+ if(c.find("calvados") != string::npos || c.find("tailf") != string::npos || c.find("tail-f") != string::npos)
+ {
+ continue;
+ }
+
+ auto p = find(c.begin(), c.end(),'?');
+
+ if(p == c.end())
+ continue;
+
+ auto ns_end = c.find("?");
+
+ if (ns_end == string::npos)
+ continue;
+
+ auto c_ns = c.substr(0, ns_end);
+
+ auto module_start = c.find("module=");
+
+ if(module_start == string::npos)
+ continue;
+
+ auto revision_start = c.find("revision=");
+ if(revision_start == string::npos)
+ continue;
+
+ vector c_features{};
+ vector c_deviations{};
+
+ auto module_end = c.find("&", module_start);
+
+ module_start+=sizeof("module=");
+ auto size = module_end;
+ if(size != string::npos ){
+ size = module_end - module_start + 1;
+ }
+
+ string c_module = c.substr( module_start - 1, size );
+
+
+ auto revision_end = c.find("&", revision_start);
+ revision_start+=sizeof("revision=");
+ size = revision_end;
+ if(size!= string::npos) {
+ size= revision_end - revision_start + 1;
+ }
+ string c_revision = c.substr(revision_start - 1, size);
+
+ auto features_start = c.find("features=");
+ if(features_start != string::npos){
+ auto features_end = c.find("&", features_start);
+ features_start+=sizeof("features=");
+ size=features_end;
+ if(size!=string::npos){
+ size = features_end - features_start + 1;
+ }
+ string features = c.substr(features_start - 1 , size);
+ istringstream iss{features};
+ string feature;
+ while(getline(iss, feature, ',')) {
+ c_features.push_back(move(feature));
+ }
+
+ }
+
+ auto deviations_start = c.find("deviations=");
+ if(deviations_start != string::npos){
+ auto deviations_end = c.find("&", deviations_start);
+ deviations_start+=sizeof("deviations=");
+ size=deviations_end;
+ if(size!=string::npos){
+ size = deviations_end - deviations_start + 1;
+ }
+ string deviations = c.substr(deviations_start - 1, size);
+ istringstream iss{deviations};
+ string deviation;
+ while(getline(iss, deviation, ',')) {
+ c_deviations.push_back(move(deviation));
+ }
+
+ }
+ if(c_module.find("tailf") != string::npos) {
+ continue;
+ }
+
+ segs.emplace_back(make_pair(c_ns, path::Capability{c_module, c_revision, c_features, c_deviations}));
+ }
+
+ return segs;
+}
+
vector IetfCapabilitiesParser::parse(vector & capabilities) const
{
- vector yang_caps {};
- for(string c : capabilities )
- {
- if(c.find("calvados") != string::npos || c.find("tailf") != string::npos || c.find("tail-f") != string::npos)
- {
- continue;
- }
-
- auto p = find(c.begin(), c.end(),'?');
-
- if(p == c.end())
- continue;
-
- auto module_start = c.find("module=");
-
- if(module_start == string::npos)
- continue;
-
- auto revision_start = c.find("revision=");
- if(revision_start == string::npos)
- continue;
-
- vector c_features{};
- vector c_deviations{};
-
- auto module_end = c.find("&", module_start);
-
- module_start+=sizeof("module=");
- auto size = module_end;
- if(size != string::npos ){
- size = module_end - module_start + 1;
- }
-
- string c_module = c.substr( module_start - 1, size );
-
-
- auto revision_end = c.find("&", revision_start);
- revision_start+=sizeof("revision=");
- size = revision_end;
- if(size!= string::npos) {
- size= revision_end - revision_start + 1;
- }
- string c_revision = c.substr(revision_start - 1, size);
-
- auto features_start = c.find("features=");
- if(features_start != string::npos){
- auto features_end = c.find("&", features_start);
- features_start+=sizeof("features=");
- size=features_end;
- if(size!=string::npos){
- size = features_end - features_start + 1;
- }
- string features = c.substr(features_start - 1 , size);
- istringstream iss{features};
- string feature;
- while(getline(iss, feature, ',')) {
- c_features.push_back(move(feature));
- }
-
- }
-
- auto deviations_start = c.find("deviations=");
- if(deviations_start != string::npos){
- auto deviations_end = c.find("&", deviations_start);
- deviations_start+=sizeof("deviations=");
- size=deviations_end;
- if(size!=string::npos){
- size = deviations_end - deviations_start + 1;
- }
- string deviations = c.substr(deviations_start - 1, size);
- istringstream iss{deviations};
- string deviation;
- while(getline(iss, deviation, ',')) {
- c_deviations.push_back(move(deviation));
- }
-
- }
- if(c_module.find("tailf") != string::npos) {
- continue;
- }
- path::Capability core_cap{c_module, c_revision, c_features, c_deviations};
- yang_caps.emplace_back(core_cap);
- }
-
- //add ydk capability
- path::Capability ydk_cap{ydk::path::YDK_MODULE_NAME, ydk::path::YDK_MODULE_REVISION, {}, {}};
- auto result = find(yang_caps.begin(), yang_caps.end(), ydk_cap);
- if(result == yang_caps.end()){
- yang_caps.push_back(ydk_cap);
- }
- //add ietf-netconf capability
- path::Capability ietf_netconf_cap{ydk::IETF_NETCONF_MODULE_NAME, ydk::IETF_NETCONF_MODULE_REVISION, {}, {}};
- result = find(yang_caps.begin(), yang_caps.end(), ietf_netconf_cap);
- if(result == yang_caps.end()){
- yang_caps.push_back(ietf_netconf_cap);
- }
- return yang_caps;
+ auto segs = segmentalize_capabilities(capabilities);
+
+ vector yang_caps;
+ for (auto &c: segs)
+ {
+ yang_caps.emplace_back(c.second);
+ }
+
+ //add ydk capability
+ path::Capability ydk_cap{ydk::path::YDK_MODULE_NAME, ydk::path::YDK_MODULE_REVISION, {}, {}};
+ auto result = find(yang_caps.begin(), yang_caps.end(), ydk_cap);
+ if(result == yang_caps.end()) {
+ yang_caps.push_back(ydk_cap);
+ }
+ //add ietf-netconf capability
+ path::Capability ietf_netconf_cap{ydk::IETF_NETCONF_MODULE_NAME, ydk::IETF_NETCONF_MODULE_REVISION, {}, {}};
+ result = find(yang_caps.begin(), yang_caps.end(), ietf_netconf_cap);
+ if(result == yang_caps.end()) {
+ yang_caps.push_back(ietf_netconf_cap);
+ }
+
+ return yang_caps;
}
+
}
diff --git a/sdk/cpp/core/src/ietf_parser.hpp b/sdk/cpp/core/src/ietf_parser.hpp
index bdf1518e9..5c57897df 100644
--- a/sdk/cpp/core/src/ietf_parser.hpp
+++ b/sdk/cpp/core/src/ietf_parser.hpp
@@ -17,6 +17,8 @@
#ifndef _IETF_PARSER_H_
#define _IETF_PARSER_H_
+#include
+
#include "capabilities_parser.hpp"
struct _xmlDoc;
@@ -29,24 +31,26 @@ namespace ydk
class IetfCapabilitiesXmlParser : public CapabilitiesXmlParser
{
- public:
- IetfCapabilitiesXmlParser();
- ~IetfCapabilitiesXmlParser();
+ public:
+ IetfCapabilitiesXmlParser();
+ ~IetfCapabilitiesXmlParser();
- std::vector parse(const std::string & buffer);
+ std::vector parse(const std::string & buffer);
- private:
- xmlDocPtr doc;
+ private:
+ xmlDocPtr doc;
};
class IetfCapabilitiesParser : public CapabilitiesParser
{
- public:
- IetfCapabilitiesParser();
- ~IetfCapabilitiesParser();
+ public:
+ IetfCapabilitiesParser();
+ ~IetfCapabilitiesParser();
- std::vector parse(std::vector & capabilities) const;
+ std::vector parse(std::vector & capabilities) const;
+ std::vector> get_lookup_tables(std::vector& capabilities) const;
+ std::vector> segmentalize_capabilities(std::vector& capabilities) const;
};
}
diff --git a/sdk/cpp/core/src/leaf_data.cpp b/sdk/cpp/core/src/leaf_data.cpp
index 4a73fc33c..8ea79be6f 100644
--- a/sdk/cpp/core/src/leaf_data.cpp
+++ b/sdk/cpp/core/src/leaf_data.cpp
@@ -25,16 +25,16 @@
//
//////////////////////////////////////////////////////////////////
+#include
#include "types.hpp"
using namespace std;
namespace ydk
{
-LeafData::LeafData(std::string value, EditOperation operation, bool is_set)
- : value(value), operation(operation), is_set(is_set)
+LeafData::LeafData(const string & value, YFilter yfilter, bool is_set, const string & name_space, const string & name_space_prefix)
+ : value(value), name_space(name_space), name_space_prefix(name_space_prefix), yfilter(yfilter), is_set(is_set)
{
-
}
LeafData::~LeafData()
@@ -43,12 +43,12 @@ LeafData::~LeafData()
bool LeafData::operator == (LeafData & other) const
{
- return value == other.value && operation == other.operation && is_set == other.is_set;
+ return value == other.value && yfilter == other.yfilter && is_set == other.is_set;
}
bool LeafData::operator == (const LeafData & other) const
{
- return value == other.value && operation == other.operation && is_set == other.is_set;
+ return value == other.value && yfilter == other.yfilter && is_set == other.is_set;
}
std::ostream& operator<< (std::ostream& stream, const LeafData& value)
@@ -57,4 +57,5 @@ std::ostream& operator<< (std::ostream& stream, const LeafData& value)
return stream;
}
+
}
diff --git a/sdk/cpp/core/src/logger.hpp b/sdk/cpp/core/src/logger.hpp
index b920a572e..c8ce8f062 100644
--- a/sdk/cpp/core/src/logger.hpp
+++ b/sdk/cpp/core/src/logger.hpp
@@ -18,10 +18,11 @@
#define _LOGGER_H_
#include
-#include
-#include "Python.h"
+#include
#include "spdlog/spdlog.h"
+#include "logging_callback.hpp"
+
namespace spdlog
{
@@ -31,141 +32,46 @@ class logger;
namespace ydk
{
-
-class PyLogger
-{
-public:
- PyLogger()
- {
- }
-
- ~PyLogger()
- {
- if (py_logger != nullptr)
- {
- Py_DECREF(py_logger);
- }
- }
-
- void set_logger()
- {
- PyObject* py_logging = PyImport_ImportModule("logging");
- PyObject* ydk_arg = Py_BuildValue("s", "ydk");
- const char* method = "getLogger";
- const char* fmt = "O";
- py_logger = PyObject_CallMethod(py_logging, (char *)method, (char *)fmt, ydk_arg);
- Py_DECREF(ydk_arg);
- Py_DECREF(py_logging);
- }
-
- template void py_fmt_log(const std::string& name, const char* fmt, spdlog::level::level_enum lvl, const char* py_lvl, const Args&... args)
- {
- spdlog::details::log_msg log_msg(&name, lvl);
- log_msg.raw.write(fmt, args...);
- py_log(log_msg.raw.c_str(), py_lvl);
- }
-
- template void trace(const std::string& name, const char* fmt, const Args&... args) {
- const char* py_lvl = "debug";
- py_fmt_log(name, fmt, spdlog::level::trace, py_lvl, args...);
- }
- template void debug(const std::string& name, const char* fmt, const Args&... args) {
- const char* py_lvl = "debug";
- py_fmt_log(name, fmt, spdlog::level::trace, py_lvl, args...);
- }
- template