Skip to main content

Creating an NSO Service

·249 words·2 mins
Nso Nso
Step by step the ladder is ascended

记录一下如何创建一个NSO service,只是用来测试使用,无参考意义。

Step 1: Generate a service packet in runtime package directory.

#cd ncs-run/packages
#ncs-make-package --service-skeleton template <l3vpn>

Step 2: Modify the template file:

使用NSO dry-run 一个配置,并format xml格式.修改template 文件如下:

[root@localhost templates]# pwd
[root@localhost templates]# ls
[root@localhost templates]# cat l3vpn-template.xml 
<config-template xmlns=""
  <devices xmlns="">
                   <bgp xmlns="">
[root@localhost templates]# 

Step 3: Edit YANG service model in PACKAGE-NAME/src/yang


[root@localhost yang]# cat l3vpn.yang 
module l3vpn {
  namespace "http://com/example/l3vpn";
  prefix l3vpn;

  import ietf-inet-types {
    prefix inet;
  import tailf-ncs {
    prefix ncs;
  import tailf-common {
    prefix tailf;

  list l3vpn {
    key name;

    uses ncs:service-data;
    ncs:servicepoint "l3vpn";

    leaf name {
      type string;

    // may replace this with other ways of refering to the devices.

    // replace with your own stuff here
    leaf device {
      mandatory true;
      type leafref {
        path "/ncs:devices/ncs:device/ncs:name";
    leaf bgpas {
      type string;
    leaf vpnname {
      type string;
    leaf load {
      type string;
    leaf peerip {
      type string;
    leaf asnum {
      type string;
    leaf keeptime {
      type string;
    leaf holdtime {
      type string;
    leaf limit {
      type string;
    leaf percent {
      type string;
    leaf idletime {
      type string;
[root@localhost yang]# 

Step 4:Build the service mode/Reload

$ make


admin@ncs# packages reload