Skip to content

Commit

Permalink
Added release notes and restconf sample (#368)
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhi Keshav authored Jan 31, 2017
1 parent 9171124 commit c2e1358
Show file tree
Hide file tree
Showing 9 changed files with 164 additions and 38 deletions.
30 changes: 24 additions & 6 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents**
**2017-01-30 version 0.5.3:**

- [Python](#python)
- [C++ (alpha)](#c-alpha)
### Python

* Fixed issues with netconf service ([#323](https://github.com/CiscoDevNet/ydk-gen/issues/323), [#305](https://github.com/CiscoDevNet/ydk-gen/issues/305))
* Disambiguated model API classes called 'None' ([#318](https://github.com/CiscoDevNet/ydk-gen/issues/318))
* Removed 'Bits' from classes representing bits leafs ([#318](https://github.com/CiscoDevNet/ydk-gen/issues/318), [#320](https://github.com/CiscoDevNet/ydk-gen/issues/320))

### C++

* Introduced support for two new service providers ([#365](https://github.com/CiscoDevNet/ydk-gen/pull/365))
* RestconfServiceProvider
* OpenDaylightServiceProvider
* Introduced support for netconf service ([#341](https://github.com/CiscoDevNet/ydk-gen/pull/341), [#352](https://github.com/CiscoDevNet/ydk-gen/pull/352))
* Released ydk-cpp for OSX platform (on [Homebrew](https://github.com/CiscoDevNet/homebrew-ydk)) and on Ubuntu platform (on [Lauchpad](https://launchpad.net/~ydk)) ([#362](https://github.com/CiscoDevNet/ydk-gen/pull/362), [#322](https://github.com/CiscoDevNet/ydk-gen/pull/322))
* Added support for generated CRUD model tests based on bundles ([#354](https://github.com/CiscoDevNet/ydk-gen/pull/354))
* Improved negative test cases and added support for netconf operations on leafs and leaf-lists ([#324](https://github.com/CiscoDevNet/ydk-gen/pull/324))

### Documentation

<!-- END doctoc generated TOC please keep comment here to allow auto update -->
* Added documentation with examples for C++ OpenDaylightServiceProvider and RestconfServiceProvider ([#365](https://github.com/CiscoDevNet/ydk-gen/pull/365))
* Included model revision in documentation ([#272](https://github.com/CiscoDevNet/ydk-gen/issues/272))
* Improved documentation for string leafs ([#346](https://github.com/CiscoDevNet/ydk-gen/issues/346)), decimal64 leafs ([#300](https://github.com/CiscoDevNet/ydk-gen/issues/300), [#294](https://github.com/CiscoDevNet/ydk-gen/issues/294))
* Added more detailed documentation for ydk-gen ([#335](https://github.com/CiscoDevNet/ydk-gen/pull/335), [#364](https://github.com/CiscoDevNet/ydk-gen/pull/364))
* Improved look and feel of documentation ([#361](https://github.com/CiscoDevNet/ydk-gen/pull/361), [#356](https://github.com/CiscoDevNet/ydk-gen/pull/356))
* Cleaned up unused bundle profiles and added READMEs ([#208](https://github.com/CiscoDevNet/ydk-gen/issues/208))

**2016-11-30 version 0.5.2:**

Expand Down
2 changes: 1 addition & 1 deletion sdk/cpp/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Introduced support for C++ YDK bindings ([issue#118](https://github.com/CiscoDevNet/ydk-gen/issues/118), related [commits](https://github.com/manradhaCisco/ydk-gen/commits/ydk_core) and [pull requests](https://github.com/manradhaCisco/ydk-gen/pulls?q=is%3Apr+is%3Aclosed))
* Added support for CRUD, Validation and Codec services, along with Netconf and Codec providers, YDK types and errors
* Added support for Path API
* Used libyang and libnetconf libraries as part of the service and provider abstraction layer
* Used libyang and libnetconf libraries as part of the service and provider abstraction layer
* Integrated with CMake build system
* Wrote unit tests using `boost::unit_test`
* Added support for logging using `boost::log`
Expand Down
20 changes: 12 additions & 8 deletions sdk/cpp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,27 +62,31 @@ Install Tips
------------
YDK uses ``cmake`` as the build system of choice. To install the ``core`` package
```
ydk-cpp$ cd core
ydk-cpp$ cd core/ydk
core$ mkdir build && cd build
build$ cmake .. && sudo make install
build$ cmake .. && make
build$ sudo make install
```
Once you have installed the ``core`` package, you can install one or more model bundles. Note that some bundles have dependencies on other bundles. Those dependencies are already captured in the bundle package. To install the IETF bundle, execute
```
core$ cd ../ietf
core$ cd ../../ietf
ietf$ mkdir build && cd build
build$ cmake .. && sudo make install
build$ cmake .. && make
build$ sudo make install
```
To install the openconfig bundle, execute
```
ietf$ cd ../openconfig
openconfig$ mkdir build && cd build
build$ cmake .. && sudo make install
build$ cmake .. && make
build$ sudo make install
```
To install the cisco-ios-xr bundle, execute
```
openconfig$ cd ../cisco-ios-xr
cisco-ios-xr$ mkdir build && cd build
build$ cmake .. && sudo make install
build$ cmake .. && make
build$ sudo make install
build$ cd ../..
```

Expand Down Expand Up @@ -160,7 +164,7 @@ Finally, we invoke the create method of the `CRUDService` class passing in the s
try
{
crud_service.create(provider, *bgp);
}
}
catch(YDKException & e)
{
cerr << "Error details: " << boost::diagnostic_information(e) << endl;
Expand Down Expand Up @@ -189,7 +193,7 @@ YDK uses the `boost::log` logging library. The logging verbosity can be set usin

Release Notes
===============
The current YDK release version is 0.1.0 (alpha). YDK-Cpp is licensed under the Apache 2.0 License.
The current YDK release version is 0.5.3 (alpha). YDK-Cpp is licensed under the Apache 2.0 License.

Documentation and Support
===============
Expand Down
12 changes: 1 addition & 11 deletions sdk/cpp/core/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents**

- [YDK](#ydk)
- [Installation](#installation)
- [Running samples](#running-samples)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

<a href="https://github.com/CiscoDevNet/ydk-gen"><img src="https://cloud.githubusercontent.com/assets/17089095/14834057/2e1fe270-0bb7-11e6-9e94-73dd7d71e87d.png" height="240" width="240" ></a>

# YDK
Expand All @@ -25,7 +15,7 @@ Create a build directory to build the core library and install it:

## Running samples

Create a build directory to build the samples:
Create a build directory to build the samples. Note that these samples require the ietf, openconfig and cisco-ios-xr bundles to be already installed, along with the core library:
```
$ cd samples
$ mkdir build && cd build
Expand Down
3 changes: 2 additions & 1 deletion sdk/cpp/samples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ set(samples bgp_create
bgp_xr_create
bgp_xr_delete
bgp_xr_read
bgp_xr_opendaylight)
bgp_xr_opendaylight
bgp_restconf)

# set default build type if not specified by user
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
Expand Down
113 changes: 113 additions & 0 deletions sdk/cpp/samples/bgp_restconf.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/* ----------------------------------------------------------------
Copyright 2016 Cisco Systems
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
------------------------------------------------------------------*/

#include <boost/log/trivial.hpp>
#include <boost/log/expressions.hpp>
#include <iostream>
#include <string>

#include <ydk/errors.hpp>
#include <ydk/path_api.hpp>
#include <ydk/crud_service.hpp>
#include <ydk/restconf_provider.hpp>
#include <ydk/types.hpp>

#include "ydk_openconfig/openconfig_bgp.hpp"
#include "ydk_openconfig/openconfig_bgp_types.hpp"

#include "args_parser.h"

using namespace ydk;
using namespace std;


void config_bgp(openconfig_bgp::Bgp* bgp)
{
// Set the Global AS
bgp->global->config->as = 65172;
bgp->global->config->router_id = "1.2.3.4";

//Commented because of XR 611 issue with OC identity
// auto afi_safi = make_unique<openconfig_bgp::Bgp::Global::AfiSafis::AfiSafi>();
// afi_safi->afi_safi_name = openconfig_bgp_types::L3Vpn_Ipv4_UnicastIdentity();
// afi_safi->config->afi_safi_name = openconfig_bgp_types::L3Vpn_Ipv4_UnicastIdentity();
// afi_safi->config->enabled = false;
// afi_safi->parent = bgp->global->afi_safis.get();
// bgp->global->afi_safis->afi_safi.push_back(move(afi_safi));

auto neighbor = make_unique<openconfig_bgp::Bgp::Neighbors::Neighbor>();
neighbor->neighbor_address = "6.7.8.9";
neighbor->config->neighbor_address = "6.7.8.9";
neighbor->config->peer_as = 65001;
neighbor->config->local_as = 65001;
neighbor->config->peer_group = "IBGP";
//neighbor->config->peer_type = "INTERNAL";
//neighbor->config->remove_private_as = openconfig_bgp_types::Private_As_Remove_AllIdentity();
neighbor->parent = bgp->neighbors.get();
bgp->neighbors->neighbor.push_back(move(neighbor));

auto peer_group = make_unique<openconfig_bgp::Bgp::PeerGroups::PeerGroup>();
peer_group->peer_group_name = "IBGP";
peer_group->config->peer_group_name = "IBGP";
//peer_group->config->auth_password = "password";
peer_group->config->description = "test description";
peer_group->config->peer_as = 65001;
peer_group->config->local_as = 65001;
//peer_group->config->peer_type = "INTERNAL";
//peer_group->config->remove_private_as = openconfig_bgp_types::Private_As_Remove_AllIdentity();
peer_group->parent = bgp->peer_groups.get();
bgp->peer_groups->peer_group.push_back(move(peer_group));
}

int main(int argc, char* argv[])
{
vector<string> args = parse_args(argc, argv);
if(args.empty()) return 1;
string host, username, password;
int port;
username = args[0]; password = args[1]; host = args[2]; port = stoi(args[3]);
bool verbose=(args[4]=="--verbose");
if(verbose)
{
boost::log::core::get()->set_filter(
boost::log::trivial::severity >= boost::log::trivial::debug
);
}
else
{
boost::log::core::get()->set_filter(
boost::log::trivial::severity >= boost::log::trivial::error
);
}

try
{
ydk::path::Repository repo{"/test-location"};
RestconfServiceProvider provider{repo, "localhost", "admin", "admin", 12306, EncodingFormat::JSON};
CrudService crud{};

auto bgp = make_unique<openconfig_bgp::Bgp>();
config_bgp(bgp.get());
bool reply = crud.create(provider, *bgp);

if(reply) cout << "Create operation success" << endl << endl; else cout << "Operation failed" << endl << endl;
}
catch(YCPPError & e)
{
cerr << "Error details: "<<boost::diagnostic_information(e)<<endl;
}

}
2 changes: 1 addition & 1 deletion sdk/cpp/samples/bgp_xr_opendaylight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
See the License for the specific language governing permissions and
limitations under the License.
------------------------------------------------------------------*/
#define BOOST_TEST_MODULE OdlTest

#include <boost/log/trivial.hpp>
#include <boost/log/expressions.hpp>
#include <iostream>
Expand Down
6 changes: 3 additions & 3 deletions sdk/python/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ Linux
Mac
It is recommended to install homebrew (http://brew.sh), homebrew python package and Xcode command line tools on your system before installing YDK-Py::

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew install python
$ 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

Windows
It is recommended to install a python distribution like `PythonXY <https://python-xy.github.io/>`_ on your system before installing YDK-Py
Expand Down Expand Up @@ -169,7 +169,7 @@ YDK uses common Python logging. All modules are based on the "ydk" log::

Release Notes
--------------
The current YDK release version is 0.5.2 (beta). YDK-Py is licensed under the Apache 2.0 License.
The current YDK release version is 0.5.3 (beta). YDK-Py is licensed under the Apache 2.0 License.

Documentation and Support
--------------------------
Expand Down
14 changes: 7 additions & 7 deletions ydkgen/api_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def qn(self):

def convert_prop_name(self, stmt):
name = snake_case(stmt.arg)
if self.iskeyword(name):
if self.iskeyword(name) or self.iskeyword(name.lower()):
name = '%s_' % name

if name.startswith('_'):
Expand All @@ -111,7 +111,7 @@ def convert_owner_name(self, stmt):
name = camel_case(name) + 'Rpc'
else:
name = camel_case(name)
if self.iskeyword(name):
if self.iskeyword(name) or self.iskeyword(name.lower()):
name = '%s_' % name

if name.startswith('_'):
Expand Down Expand Up @@ -314,7 +314,7 @@ def stmt(self):
@stmt.setter
def stmt(self, stmt):
name = stmt.arg.replace('-', '_')
if self.iskeyword(name):
if self.iskeyword(name) or self.iskeyword(name.lower()):
name = '%s_' % name
if name[0] == '_':
name = 'y%s' % name
Expand Down Expand Up @@ -523,7 +523,7 @@ def stmt(self, stmt):
name = camel_case(name) + 'Rpc'
else:
name = camel_case(name)
if self.iskeyword(name):
if self.iskeyword(name) or self.iskeyword(name.lower()):
name = '%s_' % name
self.name = name

Expand Down Expand Up @@ -643,7 +643,7 @@ def stmt(self, stmt):
leaf_or_typedef = leaf_or_typedef.parent

name = '%s' % camel_case(leaf_or_typedef.arg)
if self.iskeyword(name):
if self.iskeyword(name) or self.iskeyword(name.lower()):
name = '%s' % name
self.name = name

Expand Down Expand Up @@ -700,7 +700,7 @@ def stmt(self):
def stmt(self, stmt):
self._stmt = stmt
name = snake_case(stmt.arg)
if self.iskeyword(name):
if self.iskeyword(name) or self.iskeyword(name.lower()):
name = '%s_' % name
self.name = name

Expand Down Expand Up @@ -772,7 +772,7 @@ def stmt(self, stmt):
leaf_or_typedef = leaf_or_typedef.parent

name = '%sEnum' % camel_case(escape_name(leaf_or_typedef.arg))
if self.iskeyword(name):
if self.iskeyword(name) or self.iskeyword(name.lower()):
name = '%s_' % name

if name[0] == '_':
Expand Down

0 comments on commit c2e1358

Please sign in to comment.