Skip to content
This repository was archived by the owner on Nov 2, 2023. It is now read-only.

Commit 59b2169

Browse files
author
Abhi Keshav
authored
Add testing for libydk+ydk-py (#32)
1 parent 6f3f379 commit 59b2169

File tree

6 files changed

+99
-28
lines changed

6 files changed

+99
-28
lines changed

.travis.yml

Lines changed: 11 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,22 @@
11
sudo: required
22

3-
43
matrix:
54
include:
65
- os: osx
76
language: generic
8-
- os: linux
9-
python: 3
10-
dist: trusty
7+
# - os: linux
8+
# python: 3
9+
# dist: trusty
10+
- env: DOCKER=true OS_TYPE=centos OS_VERSION=centos7
11+
- env: DOCKER=true OS_TYPE=ubuntu OS_VERSION=xenial
1112

1213
before_install:
13-
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; brew install libssh xml2 curl; curl -O https://devhub.cisco.com/artifactory/osx-ydk/0.6.3/libydk-0.6.3-Darwin.pkg; sudo installer -pkg libydk*pkg -target / ; curl -O https://www.python.org/ftp/python/3.6.3/python-3.6.3-macosx10.6.pkg ; sudo installer -pkg python-3.6.3-macosx10.6.pkg -target / ; fi
14-
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get update; sudo apt-get install libssh-dev libtool gdebi-core python3-dev python-dev -y; sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y ; sudo apt-get update ; sudo apt-get install cmake gcc-5 g++-5 -y; sudo ln -f -s /usr/bin/g++-5 /usr/bin/g++; sudo ln -f -s /usr/bin/gcc-5 /usr/bin/gcc; sudo apt-get install clang-3.8 lldb-3.8 -y ; sudo ln -f -s /usr/bin/clang++-3.8 /usr/bin/clang++ ; sudo ln -f -s /usr/bin/clang-3.8 /usr/bin/clang; git clone https://github.com/ciscodevnet/ydk-gen.git ; cd ydk-gen;git checkout 56108154420b728f49cf89d4a24f4460c7cbfc9b ; cd - ; mkdir ydk-gen/sdk/cpp/core/build ; cd ydk-gen/sdk/cpp/core/build; cmake -DCMAKE_BUILD_TYPE=Release .. ; sudo make install;cd - ; fi
15-
16-
install:
17-
- virtualenv venv -p python3
18-
- source venv/bin/activate
19-
- cd core
20-
- python setup.py sdist
21-
- pip install dist/*.tar.gz
22-
- cd ../ietf
23-
- python setup.py sdist
24-
- pip install dist/*.tar.gz
25-
- cd ../openconfig
26-
- python setup.py sdist
27-
- pip install dist/*.tar.gz
28-
- cd ../cisco-ios-xr
29-
- python setup.py sdist
30-
- pip install dist/*.tar.gz
31-
- cd ../cisco-ios-xe
32-
- python setup.py sdist
33-
- pip install dist/*.tar.gz
34-
14+
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./dependencies_osx.sh ; fi
15+
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./dependencies_trusty.sh ; fi
16+
- if [[ "$DOCKER" == "true" ]]; then docker pull ${OS_TYPE}:${OS_VERSION} ; fi
3517

3618
script:
37-
- cd ../core/samples
38-
- ./bgp_codec.py
19+
- if [[ "$DOCKER" == "true" ]] && [[ "$OS_TYPE" == "centos" ]]; then docker run -v `pwd`:/ydk-py ${OS_TYPE}:${OS_VERSION} bash -c "cd /ydk-py && ./dependencies_centos.sh && ./tests.sh" ; fi
20+
- if [[ "$DOCKER" == "true" ]] && [[ "$OS_TYPE" == "ubuntu" ]]; then docker run -v `pwd`:/ydk-py ${OS_TYPE}:${OS_VERSION} bash -c "cd /ydk-py && ./dependencies_xenial.sh && ./tests.sh" ; fi
21+
- if [[ "$DOCKER" != "true" ]]; then ./tests.sh ; fi
3922

dependencies_centos.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
3+
yum install -y epel-release
4+
yum install -y libxslt-devel libssh-devel python-devel cmake3 python-pip which make sudo > /dev/null
5+
yum install -y https://devhub.cisco.com/artifactory/rpm-ydk/0.6.3/libydk-0.6.3-1.x86_64.rpm > /dev/null
6+
7+
yum install centos-release-scl -y > /dev/null
8+
yum install devtoolset-4-gcc* -y > /dev/null
9+
10+
ln -sf /opt/rh/devtoolset-4/root/usr/bin/gcc /usr/bin/cc
11+
ln -sf /opt/rh/devtoolset-4/root/usr/bin/g++ /usr/bin/c++
12+
13+
sudo easy_install pip

dependencies_osx.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
brew update > /dev/null
4+
brew install libssh xml2 curl pybind11 > /dev/null
5+
6+
brew rm -f --ignore-dependencies python python3
7+
8+
curl -O https://devhub.cisco.com/artifactory/osx-ydk/0.6.3/libydk-0.6.3-Darwin.pkg
9+
sudo installer -pkg libydk*pkg -target /
10+
11+
sudo easy_install pip

dependencies_trusty.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
sudo apt-get update > /dev/null
4+
sudo apt-get install libssh-dev libtool gdebi-core python3-dev python-dev -y > /dev/null
5+
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y > /dev/null
6+
sudo apt-get update > /dev/null
7+
sudo apt-get install cmake gcc-5 g++-5 -y > /dev/null
8+
sudo ln -f -s /usr/bin/g++-5 /usr/bin/c++
9+
sudo ln -f -s /usr/bin/gcc-5 /usr/bin/cc
10+
git clone https://github.com/ciscodevnet/ydk-cpp.git -b 0.6.3
11+
mkdir ydk-cpp/core/ydk/build
12+
cd ydk-cpp/core/ydk/build
13+
cmake -DCMAKE_BUILD_TYPE=Release ..
14+
sudo make install
15+
cd -
16+
sudo easy_install pip

dependencies_xenial.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/sh
2+
3+
apt-get update -y > /dev/null
4+
apt-get install gdebi-core python-dev python-pip libtool-bin wget sudo -y > /dev/null
5+
add-apt-repository ppa:ubuntu-toolchain-r/test -y
6+
apt-get update > /dev/null
7+
apt-get install gcc-5 g++-5 -y > /dev/null
8+
ln -f -s /usr/bin/g++-5 /usr/bin/c++
9+
ln -f -s /usr/bin/gcc-5 /usr/bin/cc
10+
wget https://devhub.cisco.com/artifactory/debian-ydk/0.6.3/libydk_0.6.3-1_amd64.deb
11+
gdebi -n libydk_0.6.3-1_amd64.deb
12+
sudo easy_install pip

tests.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
3+
function pip_check_install {
4+
if [[ $(uname) == "Linux" ]] ; then
5+
os_info=$(cat /etc/*-release)
6+
if [[ ${os_info} == *"fedora"* ]]; then
7+
echo "custom pip install of $@ for centos"
8+
pip install --install-option="--install-purelib=/usr/lib64/python2.7/site-packages" --no-deps $@
9+
return
10+
fi
11+
elif [[ $(uname) == "Darwin" ]] ; then
12+
sudo pip install $@
13+
return
14+
fi
15+
pip install $@
16+
}
17+
18+
cd core
19+
python setup.py sdist
20+
pip install dist/*.tar.gz
21+
cd ../ietf
22+
python setup.py sdist
23+
pip_check_install dist/*.tar.gz
24+
cd ../openconfig
25+
python setup.py sdist
26+
pip_check_install dist/*.tar.gz
27+
cd ../cisco-ios-xr
28+
python setup.py sdist
29+
pip_check_install dist/*.tar.gz
30+
cd ../cisco-ios-xe
31+
python setup.py sdist
32+
pip_check_install dist/*.tar.gz
33+
34+
echo "Running codec sample"
35+
cd ../core/samples
36+
./bgp_codec.py

0 commit comments

Comments
 (0)