IETF 96 Hackcathon yuma123 project report

From Yuma123 Wiki
Jump to navigationJump to search

Overview

Q: What is yuma123?

  • BSD licensed evolved from the 2012 last release of Yuma as BSD licensed software.
  • Follows net-snmp in terms of standard packaging and build tools (autoconf/automake, debian buiianld)

Q: How stable is it?

  • It is used on commercial products (H1 switches from Transpacket AS)

Q: What are the project advantages?

  • Lighter easier to build and install on mainstream debian/Ubuntu.
  • Focus on netconfd and yangcli and ease of development debian packaged modules for the server.

Q: What are the project disadvantages?

  • No restconf planned yet.
  • No YANG 1.1 support yet.
  • Less focus on schema conversion tools and template generation.

Goals for IETF 96 Hackathon

  • [OK] Goal 0: Add mainstream distribution package repository support (ubuntu thrusty 14.04). Publish online both src and binary packages. apt-get install and apt-get source should work! Do it as simple as net-snmp!! Power to the people!!!
sudo add-apt-repository "deb http://yuma123.org/repos/apt/ubuntu trusty main"
wget -O - http://yuma123.org/repos/yuma123.gpg.key | sudo apt-key add -
sudo apt-get update
sudo apt-get install netconfd yangcli

Installation complete! ... Configure ssh for netconf:

sudo su
echo "Port 830" >> /etc/ssh/sshd_config
echo "Subsystem netconf /usr/sbin/netconf-subsystem" >> /etc/ssh/sshd_config
service ssh restart
exit

Start netconfd:

netconfd --module=ietf-system --module=ietf-interfaces --user=$USER

Connect with yangcli:

yangcli --server=127.0.0.1 --user=$USER

...

yangcli vladimir@127.0.0.1> create /system/location

Filling optional leaf /system/location:
Enter string value for leaf <location>
yangcli vladimir@127.0.0.1:create> Berlin

RPC OK Reply 1 for session 1:

yangcli vladimir@127.0.0.1> commit

RPC OK Reply 2 for session 1:

yangcli vladimir@127.0.0.1> xget /system

RPC Data Reply 3 for session 1:

rpc-reply {
  data {
    system {
      location Berlin
    }
  }
}
  • [OK] Goal 1: Design a simplified client application API for development of scripted configuration and monitoring tools: yangrpc

netconf/src/yangrpc/yangrpc.h:

int yangrpc_init(int argc, char* argv[]);
yangrpc_cb_t* yangrpc_connect(char* server, uint16_t port, char* user, char* password, char* publick_key, char* private_key);
status_t yangrpc_parse_cli(yangrpc_cb_t *server_cb, char* cli_cmd_str, val_value_t** request_val);
status_t yangrpc_exec(yangrpc_cb_t *server_cb, val_value_t* request_val, val_value_t** reply_val);
void yangrpc_close(yangrpc_cb_t *yangrpc_cb);
  • [OK] Goal 2: Add support for yangcli style scripting to perl and python:

netconf/python/example-yangcli/python-yangcli-example.py:

from yangcli import yangcli
from lxml import etree
import yangrpc
import sys

conn = yangrpc.connect("127.0.0.1", 830, "root", "mysecretpass","/root/.ssh/id_rsa","/root/.ssh/id_rsa.pub")
if(conn==None):
    print("Error: yangrpc failed to connect!")
    sys.exit(1)

names = yangcli(conn, "xget /interfaces-state").xpath('./data/interfaces-state/interface/name')

for name in names:
	print name.text

print("Done.")

netconf/perl/example-yangcli/perl-yangcli-example.pl:

use yuma;
use yangrpc;
use yangcli;
use XML::LibXML;

my $conn = yangrpc::connect("127.0.0.1", 830, "root", "mysecretpass","/root/.ssh/id_rsa","/root/.ssh/id_rsa.pub");
defined($conn) || die "Error: yangrpc failed to connect!";

my @names = yangcli::yangcli($conn, "xget /interfaces-state")->findnodes("./rpc-reply/data/interfaces-state/interface/name");

for my $name (@names) {
    print $name->textContent()."\n";
}
print("Done.\n");
  • [OK] Goal 3: Add python and perl modules exporting the yuma API and the yangrpc API with the yangcli wrapper.
yangcli --server=31.133.137.254 --user=phablet --password="mysecretpass" --run-command="xget /" --batch-mode 
yangcli-python --server=31.133.137.254 --user=phablet --password="mysecetpass" --run-command="xget /" --batch-mode
yangcli-perl --server=31.133.137.254 --user=phablet --password="mysecretpass" --run-command="xget /" --batch-mode
  • [NO] Goal 4: Add multi-client session support to yuma123.
  • [OK] Goal 5: Publish IETF 96 Hackathon report (this) on http://yuma123.org/wiki

Hello world netconf/YANG

Everyone who is interested can connect to a Ubuntu 14_04 phone running the yuma123 netconfd server and template module packages ietf-system and ietf-interfaces:

yangcli --server=31.133.163.179 --user=hackathon --password=hackathon