Skip to content

Latest commit

 

History

History
275 lines (199 loc) · 6.87 KB

install.rst

File metadata and controls

275 lines (199 loc) · 6.87 KB

Installation

2   Packages

Some packages are required. The following are example of debian-based packages:

sudo apt install flex bison git make gcc libnghttp2-dev libssl-dev

3   Source

Check out the following GIT repos:

4   Building

The source is built as follows.

4.1   Add the clicon user and group

sudo useradd clicon -N
sudo groupadd clicon
sudo usermod -a -G clicon `whoami`

4.2   Cligen

cd cligen
./configure
make
sudo make install

4.3   Clixon

cd clixon
./configure
make
sudo make install

4.4   Python API

Either use PIP or Debian packages.

PIP:

cd clixon-pyapi
sudo -u clicon pip3 install -r requirements.txt
sudo python3 setup.py install

Debian:

cd clixon-pyapi
sudo ./requirements-apt.sh
sudo python3 setup.py install

4.5   Controller

cd clixon-controller
./configure
make
sudo make install

To make the controller the default clixon application:

(cd /usr/local/etc/clixon; ln -s /usr/local/etc/clixon/controller.xml clixon.xml)

It is recommended to NOT run the controller as root.

4.6   SystemD

In the clixon-controller source folder there is a file named clixon-controller.service which can be used to run the Controller backend using SystemD.

To install the SystemD service either copy the file manually:

cp clixon-controller.service /usr/lib/systemd/system/

Or use the Makefile and run "sudo make systemd" to copy the file to /usr/lib/systemd/system/.

$ sudo make systemd
/usr/bin/install -c clixon-controller.service /usr/lib/systemd/system/
Systemd service installed, run systemctl enable clixon-controller.service to enable it

After copying the file, run the following commands to enable and start the service:

sudo systemctl daemon-reload
sudo systemctl enable clixon-controller.service
sudo systemctl start clixon-controller.service
sudo systemctl status clixon-controller.service

5   Configure options

The Controller configure script (generated by autoconf) includes several options apart from the standard ones.

These include (standard options are omitted)
--enable-debug Build with debug symbols, default: no
--with-cligen=dir
 Use CLIGEN here
--with-clixon=dir
 Use Clixon here
--with-clicon-user=user
 Run as this user in example and test
--with-clicon-group=group
 Run as this group in example and test

6   Python install

Install the python code by copy:

sudo cp clixon_server.py /usr/local/bin/

Add a new clicon user and install the needed Python packages, the backend will start the Python server and drop the privileges to this user:

sudo useradd -g clicon -m clicon

7   Devices

The controller needs to be able to connect to devices via a NETCONF SSH sub-system.

Note

Devices must be reachable from the controller via a NETCONF SSH subsystem

Setting up he SSH subsystem is different for different device vendors.

When done, you can verify reachability as follows. Example: You login and start the controller as user ctrl, the device user is admin and the IP address is 172.17.0.3.

Verify the SSH subsystem works as follows:

ctrl> ssh [email protected] -s netconf
<?xml version="1.0" encoding="UTF-8"?>
<hello>....</hello>]]>]]>

8   Install script

# Do a fresh installation of Clixon controller on a Debian based system.

# Install the required packages
sudo apt update
sudo apt install -y flex bison git make gcc libnghttp2-dev libssl-dev

# Clone the repositories
git clone https://github.com/clicon/cligen.git
git clone https://github.com/clicon/clixon.git
git clone https://github.com/clicon/clixon-controller.git
git clone https://github.com/clicon/clixon-pyapi.git

# Add the clicon user
sudo useradd clicon -N
sudo groupadd clicon
sudo usermod -a -G clicon `whoami`

# Build and install cligen
(cd cligen && ./configure && make && sudo make install; ldconfig)

# Build and install clixon
(cd clixon && ./configure && make && sudo make install; ldconfig)

# Build and install clixon-controller
(cd clixon-controller && ./configure && make && sudo make install; ldconfig)

9   Building Debian packages

For each of the components (Cligen, Clixon, Clixon-controller and Clixon-pyapi) you can build Debian packages with the script build_deb.sh in the scripts/ directory.

The script will create a Debian package in the source directory and should be invoked from the source directory:

$ cd clixon-controller
$ ./scripts/build_deb.sh
...
$ ls *.deb
clixon-controller_1.2.0-1_amd64.deb

The package can be installed with dpkg -i <package> and removed with dpkg -r <package>.

10   Directory structure

In a typical installation, the main configuration file is in $SYSCONFIG/clixon/controller.xml (typically: usr/local/share/clixon/controller.xml). All other directories are declared in this configure file.

Extra config files loaded after the main in alphabetical order are placed in the $SYSCONFIG/clixon/controller/ directory. This is useful for adding and overriding the default config.

The directory structure is as follows:

${SYSCONFIG} (/usr/local/etc)
└── clixon
    ├── controller.xml
    └── clixon

${DATADIR}  (/usr/local/share)
├── clixon
└── controller
    ├── common
    │   ├── control
    │   │   └── clixon-controller-config.yang
    │   └── extensions
    ├── main
    │   ├── clixon-controller.yang
    │   └── ssh-users.yang
    ├── modules
    │   ├── __pycache__
    │   └── ssh_users.py
    └── mounts
        ├── default
        └── openconfig

${BINDIR} (/usr/local/bin)
├── clixon_cli
├── clixon_netconf
└── clixon_server.py

${SBINDIR} (/usr/local/sbin)
├── clixon_backend
└── clixon_restconf

${LIBDIR} (/usr/local/lib)
└── controller
    ├── backend
    │   └── controller_backend.so
    ├── cli
    │   └── controller_cli.so
    └── clispec
        ├── controller_configure.cli
        ├── controller_operation.cli
        └── controller_pipe.cli

${LOCALSTATEDIR} (/usr/local/var)
└── controller
    ├── candidate.d
    ├── running.d
    └── startup.dp

${RUNSTATEDIR} (/usr/local/var/run)
└── controller
    ├── controller.pid
    └── controller.sock