Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Rebased core tests #286

Merged
110 commits merged into from
Nov 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
68ab203
First commit core api
manradhaCisco Aug 11, 2016
799e381
Changes in this commit
manradhaCisco Aug 13, 2016
c0ac35f
Fix ydkgen code for c++ to work with models under test (#4)
Aug 16, 2016
2599e3b
Add test case to use encode function to write to netconf (#3)
Aug 16, 2016
0740a09
Added get_ydk_path method for Cpp APIs, moved Entity class to a separ…
psykokwak4 Aug 16, 2016
1777234
Print virtual destructor
Aug 16, 2016
c6ff775
Update generated Cpp code to be able to commit bgp_sample.cpp
Aug 16, 2016
fb471f7
Fixed path for identity (#5)
psykokwak4 Aug 16, 2016
a7794bd
Fix xml serializer encoding of leafref and rpc input data node creation
manradhaCisco Aug 17, 2016
e6a8b42
Fix for bad access problem, test xr601 model loading
manradhaCisco Aug 18, 2016
aae66ac
1. Move updated fixes to libyang under manradhaCisco/libyang
manradhaCisco Aug 19, 2016
b095e50
Integrate bindings with core (#6)
Aug 20, 2016
06a4169
Use models path from config file (#7)
Aug 20, 2016
4b07d52
Add CRUD Read implementation plus test case (#9)
Aug 22, 2016
39b0d22
Coding style (#13)
Aug 25, 2016
8fe9896
Update CODINGSTYLE
Aug 25, 2016
187b4a6
Update and rename CODINGSTYLE to CODINGSTYLE.md
Aug 25, 2016
4122bc3
Added top entity lookup files (#14)
psykokwak4 Aug 25, 2016
91975d6
Updated to run tests with hand-written files without generating
Aug 25, 2016
0c77823
Fixed const, removed get_ydk_path as it is no longer used (#8)
Aug 22, 2016
8f68685
Netconf service provider implementation and test cases
manradhaCisco Aug 25, 2016
c620a2f
cmake sample
manradhaCisco Aug 26, 2016
38de6c3
update commit
manradhaCisco Aug 26, 2016
744ee11
fix bug with wrong statement being returned for list schemas
manradhaCisco Aug 26, 2016
7a9f353
sanity tests
manradhaCisco Aug 28, 2016
c51e7fa
Ydk core cmake (#15)
Aug 29, 2016
6cc415f
Clean up sample; Fix missig imports
Aug 30, 2016
bd66102
Clean up samples, provider
Aug 30, 2016
fdc14de
Clean up provider. Still needs more cleaning
Aug 30, 2016
f4b2d2f
Introduce netconf exceptions. Moved out YDKException to ydk namespace
Aug 31, 2016
97a2c5c
Gen changes
Aug 31, 2016
a0ab261
Fix cmake file for bundle
Sep 7, 2016
3ad5e03
Add support for enum type
Sep 8, 2016
1a0624d
validation service
manradhaCisco Sep 3, 2016
cb1a339
Clean up c++ ydkgen printers
Sep 9, 2016
7fb4801
code review change
manradhaCisco Sep 10, 2016
02fad27
Fix large model files issue by using compiler optimization -Os
Sep 12, 2016
8c7f3e6
Fix duplicate symbols issue with enum
Sep 12, 2016
2a3db9d
Fixed samples header paths
Sep 13, 2016
d43b4de
move libnetconf and libyang object files into libydk archive
Sep 8, 2016
bed39af
Remove unnecessary check for options.core
Sep 8, 2016
7e749a1
cloning from libyang ydk_core branch, use os func to navigate file sy…
Sep 9, 2016
4944abd
added readme
Sep 9, 2016
385468d
migrate libydk archive installation code to sdk dir
Sep 12, 2016
20602e6
added missing dependencies in cpp/samples/CMakeLists.txt
Sep 13, 2016
554d2f1
removing leftover functions in ydkgen/__init__.py
Sep 13, 2016
87c5776
renamed ydk object lib from "temp" to "ydk_core"
Sep 13, 2016
7796e4a
Merge pull request #16 from manradhaCisco/ydk_core_archives
ylil93 Sep 13, 2016
145ef4a
Core doc (#17)
Sep 14, 2016
8964ddd
Fixed core generation/test path/redirect debug msgs
Sep 15, 2016
b80e6b7
Fixed link for Enum/Identity, cpp primitive type. (#18)
Sep 15, 2016
bbcae04
Fix crud test (Still failing)
Sep 16, 2016
90189de
Add support for bits/decimal64 datatype (#19)
Sep 16, 2016
77a4784
Added support for Bits documentation (#20)
Sep 19, 2016
eba5062
remaining validation , plus repository model discovery
manradhaCisco Sep 13, 2016
736b796
make boost log link dynamically
manradhaCisco Sep 21, 2016
a98aa57
Fix core/generated code to fix some issues (#21)
Sep 27, 2016
66ce1c5
Delete hand-written api files and move valdiation test to outside cor…
Sep 27, 2016
57853f5
Fix ydk cmake
Sep 27, 2016
7eb420e
enable test case for remove-private-as
manradhaCisco Sep 27, 2016
606f326
Added failing test case for order of bits
Sep 30, 2016
2a2012a
Added failing testcase for submodule
Oct 2, 2016
168fdad
Add support for map of module name and entities for input/output of c…
Oct 3, 2016
b75292a
Added better suppport for enums to work with unions and leaf-list (#23)
Oct 4, 2016
fdc6dd7
Add support for leaf-list of bits + test case + clean up bits
Oct 4, 2016
2d38fd8
Fix boolean read
Oct 5, 2016
ea7105b
Codec entity (#24)
Oct 6, 2016
a23627f
modify cmakelists.txt to download libnetconf and libyang
Oct 11, 2016
0986450
Clean up core and test ydk cpp against XR (#25)
Oct 14, 2016
551af73
Revert "modify cmakelists.txt to download libnetconf and libyang" as …
Oct 14, 2016
ce717e7
Renamed core netconf test and added tests for XR
Oct 14, 2016
7b10a26
Update CMakeLists.txt
Oct 17, 2016
e4aa55e
Add 0.5.1 bundle profile
Oct 17, 2016
34ad80d
Apply Xiaoqin's fix for inter-bundle header include
Oct 17, 2016
c446ee6
Make bundle package non-debug
Oct 17, 2016
dfdab98
Same name fix (#26)
Oct 18, 2016
ed49a62
cmake header install issue resolved
Oct 18, 2016
4b58a1a
Added global variables, code review improvements (#27)
Oct 20, 2016
8f35d85
Temporarily comment out failing tests
Oct 28, 2016
7c29b7a
removing dependency on builtins str
Sep 2, 2016
f99157a
remove dependency on six
Sep 2, 2016
8c7ab8f
Remove cisco-ios-xr bundle dependency on openconfig (#237)
psykokwak4 Sep 7, 2016
df87da4
Add bundle install details to README
111pontes Sep 7, 2016
6897583
Add edits to README for readability
111pontes Sep 8, 2016
4073910
Fix README typo
111pontes Sep 8, 2016
2c3526f
updating install.sh to create python 3 env and readme (#242)
ylil93 Sep 12, 2016
1071653
Fix minor typos in README file
111pontes Sep 13, 2016
f011ef8
Fix oc-if sample app (#246)
111pontes Sep 14, 2016
c358edd
Update travis (#260)
Oct 7, 2016
6b0c0f4
Add final bundle adjustments for next major release (#258)
111pontes Oct 7, 2016
95d2926
Issue 216 (#261)
Oct 10, 2016
dbea055
Update version to 0.5.1 (#262)
Oct 10, 2016
1007050
Update ydk.services.rst (#263)
Oct 10, 2016
adefbf0
Removed auto cap (#265)
Oct 10, 2016
88126f1
Added datastore option check (#252) (#268)
Oct 12, 2016
b511a89
CRUD delete on list with id ref as key bug fix (#270)
ylil93 Oct 12, 2016
9b499d6
Update samples/readme for 0.5.1 (#271)
Oct 14, 2016
3836657
Loggin fix (#269)
Oct 15, 2016
399e284
NetconfService Issues (#248), (#247), (#235) (#274)
Oct 17, 2016
ce5e465
Update README.rst (#275)
Oct 17, 2016
cadb2ec
Fix cmake file for bundle
Sep 7, 2016
1c4a785
Fix large model files issue by using compiler optimization -Os
Sep 12, 2016
d724b77
Core doc (#17)
Sep 14, 2016
ff16080
update iskeyword bug
Oct 19, 2016
2a2edbf
fixed generate module path bug
Oct 20, 2016
5de9bc2
Test case fix, change afi_safi_name to Identity
psykokwak4 Oct 20, 2016
b8642be
Fix deviation table key
psykokwak4 Oct 20, 2016
8ba3e26
Apply Abhi's C++ patch
psykokwak4 Nov 2, 2016
9507d69
Added C++ tests to CI
psykokwak4 Nov 2, 2016
c107a5f
Merge remote-tracking branch ‘CiscoDevNet/master' into rebased_core_t…
psykokwak4 Nov 3, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.pydevproject
.project
.externalToolBuilders/
.temp
*.pyc
*~
*.swp
Expand Down Expand Up @@ -40,3 +41,5 @@ sdk/cpp/netconf_client.o
sdk/cpp/tests/ydk_test
sdk/cpp/ydk_client.so

*.sublime-project
*.sublime-workspace
39 changes: 13 additions & 26 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,19 @@
sudo: required

services:
- docker

os:
- linux
- osx
matrix:
include:
- os: linux
dist: trusty
language: python
python: 2.7
- os: osx
language: generic

before_install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get update && sudo apt-get install -y python-pip zlib1g-dev python-lxml libxml2-dev libxslt1-dev python-dev libboost-dev libboost-python-dev libssh-dev libcurl4-openssl-dev libtool python3-lxml; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install jq ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export PATH=$PATH:~/Library/Python; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker pull ydkdev/confd-beta; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install python3 ; fi

script:
- export PR=https://api.github.com/repos/$TRAVIS_REPO_SLUG/pulls/$TRAVIS_PULL_REQUEST
- export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo `curl -s $PR | jq -r .head.ref`; fi)
- export REPO=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_REPO_SLUG; else echo `curl -s $PR | jq -r .head.repo.full_name`; fi)
- echo "TRAVIS_BRANCH=$TRAVIS_BRANCH, PR=$PR, BRANCH=$BRANCH, REPO=$REPO"
- ./test/osx_linux_tests.sh --gen_py_version python2.7 --test_py_version python2.7
- ./test/osx_linux_tests.sh --gen_py_version python2.7 --test_py_version python3.4
- ./test/osx_linux_tests.sh --gen_py_version python3.4 --test_py_version python2.7
- ./test/osx_linux_tests.sh --gen_py_version python3.4 --test_py_version python3.4

- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker run -v $PWD/test/:/root/test/ ydkdev/confd-beta /root/test/travis_ci.sh --repo https://github.com/$REPO.git --branch $BRANCH --gen_py_version python2.7 --test_py_version python2.7; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker run -v $PWD/test/:/root/test/ ydkdev/confd-beta /root/test/travis_ci.sh --repo https://github.com/$REPO.git --branch $BRANCH --gen_py_version python2.7 --test_py_version python3.4; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker run -v $PWD/test/:/root/test/ ydkdev/confd-beta /root/test/travis_ci.sh --repo https://github.com/$REPO.git --branch $BRANCH --gen_py_version python3.4 --test_py_version python2.7; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker run -v $PWD/test/:/root/test/ ydkdev/confd-beta /root/test/travis_ci.sh --repo https://github.com/$REPO.git --branch $BRANCH --gen_py_version python3.4 --test_py_version python3.4; fi


- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./test/dependencies_osx.sh ; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./test/dependencies_linux.sh ; fi
- sudo ./test/tests.sh
137 changes: 89 additions & 48 deletions generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@
import fileinput
import logging
import os
import shutil
import subprocess
import sys
import time
import re

from git import Repo
from ydkgen import YdkGenerator
Expand Down Expand Up @@ -52,18 +54,23 @@ def print_about_page(ydk_root, py_api_doc_gen, release, is_bundle):
# modify about_ydk.rst page
for line in fileinput.input(os.path.join(py_api_doc_gen, 'about_ydk.rst'), 'r+w'):
if 'git clone repo-url' in line:
print(line.replace('repo-url', 'https://{0}.git'.format(url)), end=' ')
print(line.replace('repo-url', 'https://{0}.git'.format(url)), end='')
elif 'git checkout commit-id' in line:
print(line.replace('commit-id', '{}'.format(commit_id)))
print(line.replace('commit-id', '{}'.format(commit_id)), end='')
elif 'version-id' in line:
print(line.replace('version-id', '{}'.format(release.replace('release=', ''))))
print(line.replace('version-id', '{}'.format(release.replace('release=', ''))), end='')
else:
print(line, end=' ')
print(line, end='')


def get_release_version(output_directory):
version = ''
release = ''
def get_release_version(output_directory, language):
if language == 'python':
return get_py_release_version(output_directory)
elif language == 'cpp':
return get_cpp_release_version(output_directory)


def get_py_release_version(output_directory):
setup_file = os.path.join(output_directory, 'setup.py')
with open(setup_file, 'r') as f:
for line in f:
Expand All @@ -74,7 +81,30 @@ def get_release_version(output_directory):
release = "release=" + rv
version = "version=" + rv
break
return release, version
return (release, version)


def get_cpp_release_version(output_directory):
MAJOR_VERSION = re.compile(r"set\(YDK_[A-Z]*[_]*MAJOR_VERSION (?P<num>\d+)\)")
MINOR_VERSION = re.compile(r"set\(YDK_[A-Z]*[_]*MINOR_VERSION (?P<num>\d+)\)")
SERVICE_VERSION = re.compile(r"set\(YDK_[A-Z]*[_]*SERVICE_VERSION (?P<num>\d+)\)")
major_version, minor_version, service_version = 0, 0, 0
cmake_file = os.path.join(output_directory, 'CMakeLists.txt')
with open(cmake_file) as f:
for line in f:
major_match = MAJOR_VERSION.match(line)
minor_match = MINOR_VERSION.match(line)
service_match = SERVICE_VERSION.match(line)
if major_match:
major_version = major_match.group('num')
if minor_match:
minor_version = minor_match.group('num')
if service_match:
service_version = service_match.group('num')
version = "%s.%s.%s" % (major_version, minor_version, service_version)
release = "release=%s" % version
version = "version=%s" % version
return (release, version)


def copy_docs_from_bundles(ydk_root, language, destination_dir):
Expand Down Expand Up @@ -106,7 +136,7 @@ def generate_documentations(output_directory, ydk_root, language, is_bundle, is_
py_api_doc_gen = os.path.join(output_directory, 'docsgen')
py_api_doc = os.path.join(output_directory, 'docs_expanded')
# if it is package type
release, version = get_release_version(output_directory)
release, version = get_release_version(output_directory, language)
os.mkdir(py_api_doc)
# print about YDK page
print_about_page(ydk_root, py_api_doc_gen, release, is_bundle)
Expand Down Expand Up @@ -137,7 +167,7 @@ def create_pip_packages(output_directory):

if exit_code == 0:
print('\nSuccessfully created source distribution at %s/dist' %
(py_sdk_root,))
py_sdk_root)
else:
print('\nFailed to create source distribution')
sys.exit(exit_code)
Expand All @@ -147,22 +177,25 @@ def create_pip_packages(output_directory):
py_sdk_root,))


def create_shared_libraries(output_directory):
cpp_sdk_root = output_directory
os.chdir(cpp_sdk_root)
args = ['make']
exit_code = subprocess.call(args, env=os.environ.copy())

if exit_code == 0 and os.path.isfile(
os.path.join(cpp_sdk_root, 'ydk_cpp.so')):
print('\nSuccessfully created shared library %s as ydk_cpp.so' %
(cpp_sdk_root))
else:
def create_shared_libraries(output_directory, sudo):
cpp_sdk_root = os.path.join(output_directory)
cmake_build_dir = os.path.join(output_directory, 'build')
if os.path.exists(cmake_build_dir):
shutil.rmtree(cmake_build_dir)
os.makedirs(cmake_build_dir)
os.chdir(cmake_build_dir)
sudo_cmd = 'sudo' if sudo else ''
try:
subprocess.check_call(['%s' % sudo_cmd, 'cmake', '..'])
subprocess.check_call(['%s' % sudo_cmd, 'make', '-j5'])
subprocess.check_call(['%s' % sudo_cmd, 'make', 'install'])
except subprocess.CalledProcessError as e:
print('\nERROR: Failed to create shared library!\n')
sys.exit(exit_code)
sys.exit(e.returncode)
print('\nSuccessfully created and installed shared libraries')
print('\n=================================================')
print('Successfully generated C++ YDK at %s' % (cpp_sdk_root,))
print('Please read %sREADME.rst for information on how to install the package in your environment\n' % (
print('Please read %s/README.rst for information on how to install the package in your environment\n' % (
cpp_sdk_root,))


Expand Down Expand Up @@ -238,6 +271,12 @@ def _get_time_taken(start_time):
default=False,
help="Consider yang groupings as classes.")

parser.add_option("--sudo",
action="store_true",
dest="sudo",
default=False,
help="Use sudo for C++ core library installation.")

try:
arg = sys.argv[1]
except IndexError:
Expand Down Expand Up @@ -267,43 +306,45 @@ def _get_time_taken(start_time):
elif options.python:
language = 'python'


if options.profile:
output_directory = (YdkGenerator(
output_directory,
ydk_root,
options.groupings_as_class,
options.gentests,
language,
'profile').generate(options.profile))
output_directory,
ydk_root,
options.groupings_as_class,
options.gentests,
language,
'profile').generate(options.profile))

elif options.bundle:
output_directory = (YdkGenerator(
output_directory,
ydk_root,
options.groupings_as_class,
options.gentests,
language,
'bundle').generate(options.bundle))

elif options.core:
output_directory,
ydk_root,
options.groupings_as_class,
options.gentests,
language,
'bundle').generate(options.bundle))

if options.core:
output_directory = (YdkGenerator(
output_directory,
ydk_root,
options.groupings_as_class,
options.gentests,
language,
'core').generate())

output_directory,
ydk_root,
options.groupings_as_class,
options.gentests,
language,
'core').generate())

if options.gendoc:
generate_documentations(output_directory, ydk_root, language, options.bundle, options.core)

minutes_str, seconds_str = _get_time_taken(start_time)
print('\nTime taken for code/doc generation: {0} {1}\n'.format(minutes_str, seconds_str))
print('\nPerforming compilation and/or installation...\n')

if options.cpp:
create_shared_libraries(output_directory)
create_shared_libraries(output_directory, options.sudo)
else:
create_pip_packages(output_directory)

minutes_str, seconds_str = _get_time_taken(start_time)
print('Code generation completed successfully!')
print('Time taken: {0} {1}\n'.format(minutes_str, seconds_str))
print('Code generation and installation completed successfully!')
print('Total time taken: {0} {1}\n'.format(minutes_str, seconds_str))
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"Description": "YDK Test Profile",
"models": {
"dir": [
"/profiles/test/deviation/yang",
"/yang/deviation",
"/yang/ietf"
]
}
Expand Down
34 changes: 0 additions & 34 deletions profiles/test/deviation/yang/README.md

This file was deleted.

41 changes: 41 additions & 0 deletions profiles/test/ydktest-cpp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "ydktest",
"version":"0.1.0",
"ydk_version":"0.5.0",
"Author": "Cisco",
"Copyright": "Cisco",
"Description": "YDK Test Profile",
"models": {
"file": [
"sdk/cpp/ydk/tests/models/[email protected]",
"sdk/cpp/ydk/tests/models/[email protected]",
"sdk/cpp/ydk/tests/models/[email protected]",
"sdk/cpp/ydk/tests/models/[email protected]",
"sdk/cpp/ydk/tests/models/[email protected]",
"sdk/cpp/ydk/tests/models/openconfig-bgp-common-multiprotocol.yang",
"sdk/cpp/ydk/tests/models/openconfig-bgp-common-structure.yang",
"sdk/cpp/ydk/tests/models/openconfig-bgp-common.yang",
"sdk/cpp/ydk/tests/models/openconfig-bgp-global.yang",
"sdk/cpp/ydk/tests/models/openconfig-bgp-neighbor.yang",
"sdk/cpp/ydk/tests/models/openconfig-bgp-peer-group.yang",
"sdk/cpp/ydk/tests/models/openconfig-bgp-policy.yang",
"sdk/cpp/ydk/tests/models/openconfig-bgp-types.yang",
"sdk/cpp/ydk/tests/models/openconfig-bgp.yang",
"sdk/cpp/ydk/tests/models/openconfig-extensions.yang",
"sdk/cpp/ydk/tests/models/openconfig-interfaces.yang",
"sdk/cpp/ydk/tests/models/openconfig-policy-types.yang",
"sdk/cpp/ydk/tests/models/openconfig-routing-policy.yang",
"sdk/cpp/ydk/tests/models/openconfig-types.yang",
"sdk/cpp/ydk/tests/models/[email protected]",
"sdk/cpp/ydk/tests/models/[email protected]",
"sdk/cpp/ydk/tests/models/[email protected]",
"sdk/cpp/ydk/tests/models/[email protected]",
"sdk/cpp/ydk/tests/models/[email protected]",
"sdk/cpp/ydk/tests/models/[email protected]",
"yang/ietf/[email protected]",
"yang/ietf/[email protected]",
"yang/ydktest/[email protected]"
]
}
}

2 changes: 1 addition & 1 deletion sdk/cpp/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

builds

Loading