Skip to content

Commit

Permalink
Merge branch 'netopeerguid'
Browse files Browse the repository at this point in the history
  • Loading branch information
alexadavid committed Aug 22, 2016
2 parents 608fdbe + 075416f commit 2c2ffc2
Show file tree
Hide file tree
Showing 122 changed files with 13,611 additions and 7,276 deletions.
3 changes: 2 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "install/mod_netconf"]
[submodule "mod_netconf"]
path = install/mod_netconf
url = https://github.com/CESNET/mod_netconf.git

56 changes: 40 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,58 @@ NetopeerGUI is web graphical user interface for configuring devices based on pro

NetopeerGUI is developed as [Symfony2 app](http://symfony.com).

## NetopeerGUI demo - virtual machine
## NetopeerGUI demo installation - using Vagrant on CentOS7

You can download VirtualBox image from https://www.liberouter.org/docs/2015-05-11-netopeer-demo.ova

To import this image into VirtualBox, just follow these steps:
If you do not have a vagrant box for CentOS7 box yet, use:

vagrant box add centos/7 --provider=virtualbox

Clone this repository and run following:

cd install
vagrant up
vagrant ssh
sudo su
sed -i 's/SELINUX=\(enforcing\|permissive\)/SELINUX=disabled/g' /etc/selinux/config
exit; exit
# due to SElinux settings
vagrant reload
vagrant ssh
sudo su
cd /var/www/netopeergui
php composer.phar install
service httpd restart
service netopeerguid restart

After that, you can run NetopeerGUI on local port :2280, so open http://localhost:2280/netopeergui
Username and password is admin:pass. Now, you can connect to any NETCONF device.

1. Import *.ova file into VirtualBox: File > Import appliance
2. Run new virtual system. After automatic login, you will see README with next instructions.
3. It's recommended to install VirtualBox Guest Additions (for better system support).
TODO: vagrant does not install service correctly yet, will be repaired. Removing problems with SElinux are in progress.

## Installation
**Install pyang** from https://code.google.com/p/pyang/

After tha, **run** the following commands:
Requirements:
* all dependencies will be checked during installation script
* https://github.com/CESNET/libnetconf2 (will be installed in make install)
* https://github.com/CESNET/mod_netconf/tree/netopeerguid (will be installed in make install)

To install, **run** the following commands:

# go to apache web directory
cd /var/www

git clone --recursive https://github.com/cesnet/netopeer-gui.git
# OR for already cloned repos or older GIT versions use
#
# git clone https://github.com/cesnet/netopeer-gui.git
# cd netopeergui
# git submodule update --init --recursive
git clone netopeerguid https://github.com/cesnet/netopeer-gui.git

cd netopeer-gui

# build from predefined scripts
cd install
./(centos6|centos7)/install.sh

# or build manually
git submodule update --init --recursive
cd install

./bootstrap.sh

# for change some variables, look at ./configure --help
Expand Down Expand Up @@ -133,4 +157,4 @@ and edit following lines:

Configuration notes are described in [SamlSPBundle configuration](https://github.com/aerialship/SamlSPBundle/blob/master/src/AerialShip/SamlSPBundle/Resources/doc/configuration.md) doc.

This example service uses [https://openidp.feide.no](https://openidp.feide.no) user provider. For register this your netopeerGUI, generate FederationMetadata.xml file (located in /saml/sp/FederationMetadata.xml) and upload it into OpenIDP.
This example service uses [https://openidp.feide.no](https://openidp.feide.no) user provider. For register this your netopeerGUI, generate FederationMetadata.xml file (located in /saml/sp/FederationMetadata.xml) and upload it into OpenIDP.
35 changes: 27 additions & 8 deletions app/SymfonyRequirements.php
Original file line number Diff line number Diff line change
Expand Up @@ -530,11 +530,22 @@ function_exists('simplexml_import_dom'),

/* optional recommendations follow */

$this->addRecommendation(
file_get_contents(__FILE__) === file_get_contents(__DIR__.'/../vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/skeleton/app/SymfonyRequirements.php'),
'Requirements file should be up-to-date',
'Your requirements file is outdated. Run composer install and re-check your configuration.'
);
if (file_exists(__DIR__.'/../vendor/composer')) {
require_once __DIR__.'/../vendor/autoload.php';

try {
$r = new \ReflectionClass('Sensio\Bundle\DistributionBundle\SensioDistributionBundle');

$contents = file_get_contents(dirname($r->getFileName()).'/Resources/skeleton/app/SymfonyRequirements.php');
} catch (\ReflectionException $e) {
$contents = '';
}
$this->addRecommendation(
file_get_contents(__FILE__) === $contents,
'Requirements file should be up-to-date',
'Your requirements file is outdated. Run composer install and re-check your configuration.'
);
}

$this->addRecommendation(
version_compare($installedPhpVersion, '5.3.4', '>='),
Expand Down Expand Up @@ -614,15 +625,15 @@ class_exists('Locale'),
'Install and enable the <strong>intl</strong> extension (used for validators).'
);

if (class_exists('Collator')) {
if (extension_loaded('intl')) {
// in some WAMP server installations, new Collator() returns null
$this->addRecommendation(
null !== new Collator('fr_FR'),
'intl extension should be correctly configured',
'The intl extension does not behave properly. This problem is typical on PHP 5.3.X x64 WIN builds.'
);
}

if (class_exists('Locale')) {
// check for compatible ICU versions (only done when you have the intl extension)
if (defined('INTL_ICU_VERSION')) {
$version = INTL_ICU_VERSION;
} else {
Expand All @@ -641,6 +652,14 @@ class_exists('Locale'),
'intl ICU version should be at least 4+',
'Upgrade your <strong>intl</strong> extension with a newer ICU version (4+).'
);

$this->addPhpIniRecommendation(
'intl.error_level',
create_function('$cfgValue', 'return (int) $cfgValue === 0;'),
true,
'intl.error_level should be 0 in php.ini',
'Set "<strong>intl.error_level</strong>" to "<strong>0</strong>" in php.ini<a href="#phpini">*</a> to inhibit the messages when an error occurs in ICU functions.'
);
}

$accelerator =
Expand Down
2 changes: 1 addition & 1 deletion app/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ parameters:
#fit_netopeer.single_instance.host: 'localhost'
#fit_netopeer.single_instance.port: '830'

netopeer.data.class: FIT\NetopeerBundle\Models\Data
netopeer.netconf.functionality: FIT\NetopeerBundle\Services\Functionality\NetconfFunctionality

# Twig Configuration
twig:
Expand Down
Binary file modified composer.phar
100644 → 100755
Binary file not shown.
15 changes: 15 additions & 0 deletions install-no-composer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

dir_base=$(pwd)
cmd_base='php app/console'

cp app/config/parameters.yml.dist app/config/parameters.yml
php vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php
${cmd_base} cache:clear --env=prod
${cmd_base} assets:install --symlink --relative
${cmd_base} doctrine:database:create
${cmd_base} doctrine:generate:entities FIT
${cmd_base} doctrine:schema:update --force
${cmd_base} app:user --action=add --user=admin --pass=pass
${cmd_base} assetic:dump --env=prod --no-debug
${cmd_base} app:install --post=install
5 changes: 0 additions & 5 deletions install/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ if MODNETCONF_OPT
else
MODNETCONF_OPT=
endif
if PYANG_OPT
PYANG_OPT=pyang
else
PYANG_OPT=
endif

SUBDIRS=$(MODNETCONF_OPT) $(PYANG_OPT)

Expand Down
12 changes: 12 additions & 0 deletions install/Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure(2) do |config|
config.vm.box = "centos/7"

config.vm.network "forwarded_port", guest: 80, host: 2280

config.vm.provision "shell" do |s|
s.path = "centos7/install.sh"
end
end
63 changes: 63 additions & 0 deletions install/centos6/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
sudo yum install -y wget git gcc gcc-c++

sudo yum install -y zlib1g-devel libssl-devel openssl-devel cmake pcre-devel
wget https://red.libssh.org/attachments/download/177/libssh-0.7.2.tar.xz
tar -xJf libssh-0.7.2.tar.xz
mkdir -p libssh-0.7.2/build && cd libssh-0.7.2/build
cmake .. && make -j2 && sudo make install
cd ../..

git clone https://github.com/CESNET/libyang.git
mkdir -p libyang/build
cd libyang/build
git checkout devel
cmake -DENABLE_BUILD_TESTS=OFF .. && sudo make install && sudo make install

cd ../..
wget https://cmocka.org/files/1.0/cmocka-1.0.1.tar.xz
tar -xJf cmocka-1.0.1.tar.xz
mkdir -p cmocka-1.0.1/build && cd cmocka-1.0.1/build
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr .. && make -j2 && sudo make install

cd ../..
git clone git://github.com/cejkato2/libwebsockets lws
mkdir lws/b
cd lws/b
cmake .. && sudo make install


# libnetconf2
#
cd ../..
git clone https://github.com/CESNET/libnetconf2.git
mkdir -p libnetconf2/build
cd libnetconf2/build
git checkout devel
cmake -DENABLE_TLS=ON -DENABLE_SSH=ON -DENABLE_BUILD_TESTS=OFF .. && sudo make install


# libnetconf
#
# cd ../..
# sudo yum install -y python-setuptools
# git clone https://github.com/mbj4668/pyang.git
# cd pyang
# python setup.py install

# cd ../..
# git clone --depth 1 https://github.com/CESNET/libnetconf.git
# sudo yum install -y libxml2-devel libxslt-devel curl-devel libtool
# cd libnetconf
# ./configure --prefix=/usr --libdir=/usr/lib -q


cd ../..
cd mod_netconf
# sudo yum install -y json-c-devel
./bootstrap.sh
./configure
make
make install

ldconfig

70 changes: 70 additions & 0 deletions install/centos7/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
sudo yum install -y wget git gcc gcc-c++ zlib1g-devel libssl-devel openssl-devel cmake pcre-devel autoconf automake json-c-devel

# PHP dependencies:
yum install -y php php-common php-json php-dom php-pdo php-intl php-sysvsem

(
wget https://red.libssh.org/attachments/download/177/libssh-0.7.2.tar.xz
tar -xJf libssh-0.7.2.tar.xz
mkdir -p libssh-0.7.2/build
cd libssh-0.7.2/build
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DLIB_INSTALL_DIR=/usr/lib64 .. && make -j2 && sudo make install
)

(
git clone -b devel --depth 1 https://github.com/CESNET/libyang.git
mkdir -p libyang/build
cd libyang/build
cmake -DCMAKE_INSTALL_PREFIX=/usr -DLIB_INSTALL_DIR=lib64 -DENABLE_BUILD_TESTS=OFF .. && sudo make install && sudo make install
)

(
wget https://cmocka.org/files/1.0/cmocka-1.0.1.tar.xz
tar -xJf cmocka-1.0.1.tar.xz
mkdir -p cmocka-1.0.1/build
cd cmocka-1.0.1/build
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr .. && make -j2 && sudo make install
)

(
git clone --depth 1 git://github.com/cejkato2/libwebsockets lws
mkdir lws/b
cd lws/b
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DLWS_INSTALL_LIB_DIR=/usr/lib -DLIB_SUFFIX=64 .. && sudo make install
)

# libnetconf2
(
git clone -b devel --depth 1 https://github.com/CESNET/libnetconf2.git
mkdir -p libnetconf2/build
cd libnetconf2/build
cmake -DENABLE_TLS=ON -DENABLE_SSH=ON -DENABLE_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=/usr -DLIB_INSTALL_DIR=lib64 .. && sudo make install
)
ldconfig

(
git clone -b netopeerguid --depth 1 https://github.com/CESNET/mod_netconf
cd mod_netconf
./bootstrap.sh
./configure
make
make install
)

(
cd /var/www/
git clone -b netopeerguid --depth 1 https://github.com/CESNET/Netopeer-GUI netopeergui
cd netopeergui
cp app/config/parameters.yml.dist app/config/parameters.yml
php app/check.php
php ./composer.phar self-update
php ./composer.phar install
cd install
./bootstrap.sh && ./configure --without-modnetconf -q && make install
service httpd restart
service netopeerguid restart
cd /var/www/netopeergui
php app/console app:install --post=install
chcon -R -t httpd_sys_rw_content_t /var/www/netopeergui/app/{cache,logs}
)

23 changes: 1 addition & 22 deletions install/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ fi
AC_ARG_VAR(webguiname, [Installation directory name for webgui [netconfwebgui]])
AC_SUBST(webguiname)

AC_ARG_VAR(httpdmoduledir, [Installation directory for Apache module, leave unset to use Apache default.])
AC_SUBST(httpdmoduledir)

if test "x$httpdconfddir" == x; then
httpdconfddir="/etc/httpd/conf.d"
fi
Expand All @@ -37,9 +34,6 @@ AC_SUBST(httpdconfddir)
AC_ARG_WITH(modnetconf, AC_HELP_STRING([--without-modnetconf],[Do not compile and install mod_netconf.]), [], [with_modnetconf="yes"])
AM_CONDITIONAL([MODNETCONF_OPT], [test "x$with_modnetconf" != "xno"])

AC_ARG_WITH(pyang, AC_HELP_STRING([--without-pyang],[Do not install pyang plugins.]), [], [with_pyang="yes"])
AM_CONDITIONAL([PYANG_OPT], [test "x$with_pyang" != "xno"])

# Check for rpmbuild
AC_CHECK_PROG(RPMBUILD, [rpmbuild], [rpmbuild], [""])
AC_CHECK_PROG(HTTPD, [httpd], [yes], [""])
Expand All @@ -56,18 +50,6 @@ AC_MSG_ERROR([php was not found])
fi
AC_SUBST(PHP)

AC_CHECK_PROG(PYANG, [pyang], [yes], [""])
AC_PATH_PROGS(PYTHON, [python], [no], [$PATH])
if test "x$PYTHON" == xno; then
AC_MSG_ERROR(["python was not found."])
fi

AC_ARG_VAR(pyplugindir, [Installation directory for pyang plugin])
if test "x$pyplugindir" == x; then
pyplugindir=[$(${PYTHON} -c 'from distutils.sysconfig import get_python_lib; print get_python_lib()+"/pyang/plugins"')]
fi
AC_SUBST(pyplugindir)

# Check for rpmbuild
AC_CHECK_PROG(RPMBUILD, rpmbuild, rpmbuild, [""])
RPM_RELEASE=1
Expand All @@ -84,8 +66,7 @@ AM_CONDITIONAL(MAKE_RPMS, test x$RPMBUILD != x)

AC_CONFIG_SUBDIRS(mod_netconf)
AC_CONFIG_FILES([Makefile
netopeergui.conf
pyang/Makefile])
netopeergui.conf])
AC_OUTPUT

echo
Expand All @@ -106,14 +87,12 @@ echo " CFLAGS...............: $CFLAGS"
echo
echo "Components"
echo " mod_netconf..........: $with_modnetconf"
echo " pyang plugins........: $with_pyang"
echo
echo "Installation...........: make install (as root if needed, with 'su' or 'sudo')"
echo " prefix...............: $prefix"
echo " python module dir....: $pyplugindir"
echo " webgui dir...........: $webguidir"
echo " webgui name..........: $webguiname"
echo " httpdmoduledir.......: $(test -z "$httpdmoduledir" && echo "Apache default path" || echo "$httpdmoduledir")"
echo " httpdconfddir........: $(test -z "$httpdconfddir" && echo "Apache default path" || echo "$httpdconfddir")"
echo

Loading

0 comments on commit 2c2ffc2

Please sign in to comment.