cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1863
Views
5
Helpful
6
Replies

Could not change netsim configurations in NSO

haofan
Level 4
Level 4

Hi Experts,

I could not change netsim configurations in NSO.  Can sync-from this netsim devices. 

admin@ncs# show devices list
NAME ADDRESS DESCRIPTION NED ID ADMIN STATE
------------------------------------------------------------------
DEVICE-172.17.0.3 172.17.0.3 test cisco-ios unlocked

admin@ncs# devices device DEVICE-172.17.0.3 sync-from
result true

admin@ncs(config-device-DEVICE-172.17.0.3)# config ios:cable rpd test

admin@ncs(config-rpd)# description test

admin@ncs(config-rpd)# commit

Aborted: External error in the NED implementation for device DEVICE-172.17.0.3: command: "\r\nLoading.\r\nError: failed to open file: File/directory does not exist.\r\n": NETSIM load merge ERROR

 

ncs-java-vm.log show below errors:

 

<ERROR> 16-Aug-2018::22:54:58.103 NedWorker Ned-Worker-Thread-0: - NedWorker error for ned_prepare_cli
com.tailf.ned.NedCliBaseTemplate$ApplyException: command: "\r\nLoading.\r\nError: failed to open file: File/directory does not exist.\r\n": NETSIM load merge ERROR
at com.tailf.packages.ned.ios.IOSNedCli.doApplyConfig(IOSNedCli.java:3953)
at com.tailf.packages.ned.ios.IOSNedCli.applyConfig(IOSNedCli.java:3884)
at com.tailf.ned.NedCliBaseTemplate.prepare(NedCliBaseTemplate.java:478)
at com.tailf.ned.NedWorker.dorun(NedWorker.java:1511)
at com.tailf.ned.NedWorker.run(NedWorker.java:294)

 

 

NSO version:
NSO 4.5.5 for linux on x86_64.
Revision: e1c1779 (GIT)
Date: Wed Mar 14 16:24:20 CET 2018
Erlang/OTP version: 18.3.4.5
Java version: 1.6.0_06
DOCUMENTATION_PACKAGE=nso-4.5.5.doc.tar.gz
EXAMPLE_PACKAGE=ncs-4.5.5.examples.tar.gz
 

1 Accepted Solution

Accepted Solutions

Later code does not fallback to use normal transfer of config. Also, in next release (today) the optimization is disabled by default. It can be re-enabled via a ned-setting, CHANGES (extract):

 

cisco-ios v6.2 [2018-08-31]
===========================

- Disabled automatic use of temporary file and 'load merge' command with
local NETSIM to transfer config. Added 'cisco-ios write transfer-via-file'
ned-setting to be able to enable the optimization with NETSIM only.
(CISCOIOS-1135 / RT34446)

 

View solution in original post

6 Replies 6

haofan
Level 4
Level 4

Anyone who know how to fix it ? I struggle it for a long time. 

Thanks. 

Jan Lindblad
Cisco Employee
Cisco Employee

Are your NETSIM(s) running on the same host/same file system as NSO? The cisco-ios CLI NED uses files to transfer information between NSO and the device quickly. This only works if they are running on the same host (or share the /tmp file system to be exact). Apparently the device can't read the file that the NED wrote, which would be easy to understand if they are on different hosts.

 

You have chosen to use CLI style communication style between NSO and the device. Is there any particular reason for this? You could switch the device to NETCONF communication and avoid this problem entirely, even if you still use the same NED YANG model. If there isn't any particular point you want to make with using CLI commands between the two, I would recommend switching to NETCONF.

 

If you want to switch, the command would be:

config

devices device yourdevice device-type netconf

commit

 

Hi Jan,

I run NSO in one container and run netsim in another container. So different file systems. It is work for old NSO version. I have ever mock 20 devices use netsim. Does have new change for this NSO version for netsim ? For netconf, it doesn't support for cable feature.

One question : you mean share /tmp file, I try to let NSO container mount /tmp file to host, and netsim container mount /tmp file to host, but when I use rest api to config device by NSO, there are "401 authentication needed" errors.

 

I run NSO in one container and run netsim in another container. So different file systems. It is work for old NSO version. 

At least this explains the problem. This is not about the version of NSO, but the version of the NED. You probably have different NED versions on your NSO systems. Maybe the same old NED can be run on your new NSO system if you recompile it? Check the NED docs.

 

I have ever mock 20 devices use netsim. Does have new change for this NSO version for netsim ? For netconf, it doesn't support for cable feature.

Not sure what you mean, if you have to change what when what?

 

Even if you switch to NETCONF, you still have the same YANG models. This means you will have support for exactly the same device functionality. NSO would just use NETCONF over SSH instead of CLI over SSH and files in /tmp to communicate.

 

One question : you mean share /tmp file, I try to let NSO container mount /tmp file to host, and netsim container mount /tmp file to host, but when I use rest api to config device by NSO, there are "401 authentication needed" errors.

I think this approach can be made to work, but if you don't specifically need to have CLI communication, I would still recommend to switch to NETCONF. It may also be possible to configure the NED to not use files (and hence not /tmp). Have a look in the NED documentation/YANG.

 

With Jan help, find the root cause. To improve netsim performance,  for netsim, push configurations by tmp file. 

For 5.6 version, will try send config as old type if failed to send configurations for netsim. 

vi cisco-ios/src/java/src/com/tailf/packages/ned/ios/IOSNedCli.java

 

if (isNetsim()) {
            logInfo(worker, "BEGIN sending (NETSIM)");
            String tmpfile = "/tmp/"+device_id+"-apply-config.txt";
            traceInfo(worker, "Writing config to " + tmpfile);
            if (writeFile(data, tmpfile) == false) {
                traceInfo(worker, "Internal ERROR: failed to write config to "+tmpfile);
            } else {
                try {
                    traceInfo(worker, "Loading config from " + tmpfile);
                    String res = print_line_exec(worker, "load merge " + tmpfile);
                    if (res.contains("Error:") == false)
                        sentConfig = true;
                } catch (Exception ignore) { }
            }
        }

        //
        // Send all lines to the device, one at a time
        //
        if (!sentConfig) {

For 6.0.5 version, directly throw exception when failed to send configurations for netsim:

// Write config to /tmp temporary file
String tmpfile = "/tmp/"+device_id+"-apply-config.txt";
traceInfo(worker, "Writing config to " + tmpfile);
if (!writeFile(data, tmpfile)) {
throw new ApplyException(tmpfile, "NETSIM failed to write config to /tmp", true, true);
}

So when I use 6.0.5 version it doesn't work for me, but 5.6 version it works for me. 

 

It is a bug, Jan wil create a ticket. 

 

Later code does not fallback to use normal transfer of config. Also, in next release (today) the optimization is disabled by default. It can be re-enabled via a ned-setting, CHANGES (extract):

 

cisco-ios v6.2 [2018-08-31]
===========================

- Disabled automatic use of temporary file and 'load merge' command with
local NETSIM to transfer config. Added 'cisco-ios write transfer-via-file'
ned-setting to be able to enable the optimization with NETSIM only.
(CISCOIOS-1135 / RT34446)