cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1489
Views
10
Helpful
8
Replies

ncs netsim create network

 

Hello everyone!

I would like to ask about emulating Cisco cisco-ios routers in NSO, I have used the command ncs-netsim Create-network but it showed an error as you can see in the photo.

I sourced the NCSRC in the ex2 dir but still, could you please help me out?

1 Accepted Solution

Accepted Solutions

RichardD2
Level 1
Level 1

I notice no trailing / at the end of your NED path. The workflow I typically follow is: (your version number will be different)

source nso-5.4.1/ncsrc
cd ncs-run
 ncs-netsim create-network ~/nso_5.4.1/ncs-run/packages/cisco-iosxr-cli-7.30/ 3 router
 ncs-netsim start
 ncs-netsim is-alive
 ncs-setup --netsim-dir ./netsim --dest 

Then run ncs

You don't want to start ncs before the netsim's are created, started and running. 

View solution in original post

8 Replies 8

u.avsec
Spotlight
Spotlight

Hey,

Seems like you are missing some Linux prerequisite packages. 'make' is missing at least. While you are at it see if 'ant' is also installed.

thanks a lot for your reply, I have installed it but, unfortunately, when i did the command again it says: 

abduljwad@u20-netconf:~/ex2$ ncs-netsim create-network packages/neds/cisco-ios-cli-3.0 3 c
/bin/sh: 1: cannot open /home/abduljwad/ex2/netsim/confd/var/confd/cdb/aaa_init.xml: No such file
make: *** [Makefile:41: install] Error 2

*** Failed to install
Try ncs-netsim --help or man ncs-netsim to get usage text

It seems like you are missing install NSO dir or files in that dir.

If you ride that path /home/abduljwad/ex2/netsim/confd/var/confd/cdb/ what do you see? You should see aaa_init.xml with these contents:

<config xmlns="http://tail-f.com/ns/config/1.0">

  <aaa xmlns="http://tail-f.com/ns/aaa/1.1">
    <authentication>
      <users>
        <user>
          <name>admin</name>
          <uid>9001</uid>
          <gid>100</gid>
          <password>$0$admin</password>
          <ssh_keydir>/var/confd/homes/admin/.ssh</ssh_keydir>
          <homedir>/var/confd/homes/admin</homedir>
        </user>
        <user>
          <name>oper</name>
          <uid>9001</uid>
          <gid>100</gid>
          <password>$0$oper</password>
          <ssh_keydir>/var/confd/homes/oper/.ssh</ssh_keydir>
          <homedir>/var/confd/homes/oper</homedir>
        </user>
        <user>
          <name>public</name>
          <uid>9001</uid>
          <gid>100</gid>
          <password>$0$public</password>
          <ssh_keydir>/var/confd/homes/public/.ssh</ssh_keydir>
          <homedir>/var/confd/homes/public</homedir>
        </user>
        <user>
          <name>private</name>
          <uid>9001</uid>
          <gid>100</gid>
          <password>$0$private</password>
          <ssh_keydir>/var/confd/homes/private/.ssh</ssh_keydir>
          <homedir>/var/confd/homes/private</homedir>
        </user>
      </users>
    </authentication>
    <ios>
      <level>
        <nr>0</nr>
        <prompt>\h> </prompt>
      </level>
      <level>
        <nr>15</nr>
        <prompt>\h# </prompt>
      </level>
      <privilege>
        <mode>exec</mode>
        <level>
          <nr>0</nr>
          <command>
            <name>exit</name>
          </command>
          <command>
            <name>action</name>
          </command>
          <command>
            <name>help</name>
          </command>
          <command>
            <name>autowizard</name>
          </command>
          <command>
            <name>enable</name>
          </command>
          <command>
            <name>startup</name>
          </command>
        </level>
        <level>
          <nr>15</nr>
          <command>
            <name>configure</name>
          </command>
        </level>
      </privilege>
    </ios>
  </aaa>

  <nacm xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-acm">
    <write-default>permit</write-default>
    <groups>
      <group>
        <name>admin</name>
        <user-name>admin</user-name>
        <user-name>private</user-name>
      </group>
      <group>
        <name>oper</name>
        <user-name>oper</user-name>
        <user-name>public</user-name>
      </group>
    </groups>
    <rule-list>
      <name>admin</name>
      <group>admin</group>
      <rule>
        <name>any-access</name>
        <action>permit</action>
      </rule>
    </rule-list>
    <rule-list>
      <name>any-group</name>
      <group>*</group>
      <rule>
        <name>tailf-aaa-authentication</name>
        <module-name>tailf-aaa</module-name>
        <path>/aaa/authentication/users/user[name='$USER']</path>
        <access-operations>read update</access-operations>
        <action>permit</action>
      </rule>
      <rule>
        <name>tailf-aaa-user</name>
        <module-name>tailf-aaa</module-name>
        <path>/user[name='$USER']</path>
        <access-operations>create read update delete</access-operations>
        <action>permit</action>
      </rule>
      <rule>
        <name>tailf-webui-user</name>
        <module-name>tailf-webui</module-name>
        <path>/webui/data-stores/user-profile[username='$USER']</path>
        <access-operations>create read update delete</access-operations>
        <action>permit</action>
      </rule>
    </rule-list>
  </nacm>

</config>

It is default config for admin/admin access to netsim devices.

RichardD2
Level 1
Level 1

In addition to ANT as someone has mentioned, I would make sure you have:

- a JAVA JDK-8.0 or higher

- Python 3.5 or higher

- xsltproc

- make

You mentioned sourcing ncsrc, but have you also run

ncs-setup --dest ~/NSO-DIR/ncs-run 

Thanks a bunch, i already have them and i run the ncs

RichardD2
Level 1
Level 1

I notice no trailing / at the end of your NED path. The workflow I typically follow is: (your version number will be different)

source nso-5.4.1/ncsrc
cd ncs-run
 ncs-netsim create-network ~/nso_5.4.1/ncs-run/packages/cisco-iosxr-cli-7.30/ 3 router
 ncs-netsim start
 ncs-netsim is-alive
 ncs-setup --netsim-dir ./netsim --dest 

Then run ncs

You don't want to start ncs before the netsim's are created, started and running. 

Trailing / doesn't influence creation of devices

root@1601121d3788:~/cfs# ncs-netsim create-network /var/opt/ncs/packages/cisco-ios 3 router
DEVICE router0 CREATED
DEVICE router1 CREATED
DEVICE router2 CREATED

Also, netsim is separate to NSO, doesn't matter when it is spun up, it can be done while NSO is up and running or when NSO is not set up yet.

The only thing needed is NSO install dir (unless netsim is hacked into being standalone) and NEDs

RichardD2
Level 1
Level 1

You are correct that netsim and nso are two different processes. However, if you start ncs and don't start the netsims, you won't be able to connect to anything. 

ncs@nso-devel:~/ncs-run$ ncs
ncs@nso-devel:~/ncs-run$ ncs_cli -Cu admin

admin connected from 127.0.0.1 using console on nso
admin@ncs# show devices br
NAME ADDRESS DESCRIPTION NED ID
--------------------------------------------------------------------

iosxr-r0 127.0.0.1 - cisco-iosxr-cli-7.38
iosxr-r1 127.0.0.1 - cisco-iosxr-cli-7.38
iosxr-r2 127.0.0.1 - cisco-iosxr-cli-7.38
iosxr-r3 127.0.0.1 - cisco-iosxr-cli-7.38

ncs@nso-devel:~/ncs-run$ ncs-netsim is-alive
DEVICE iosxr-r0 FAIL
DEVICE iosxr-r1 FAIL
DEVICE iosxr-r2 FAIL
DEVICE iosxr-r3 FAIL