The ncs-netsim tool takes any number of NED
packages as input. The user can specify the number of device
instances per package (device type) and a string that is used as
prefix for the name of the devices. The command takes the
following parameters:
Assume you have prepared a NSO package for a device called
router
. (See the
examples.ncs/getting-started/developing-with-ncs/0-router-network
example). Also assume the package is in
./packages/router
. At this point you can
create the simulated network by:
This creates three devices; device0
,
device1
, and device2
. The simulated
network is stored in the ./netsim
directory.
The output structure is:
There is one separate directory for every ConfD simulating
the devices.
The network can be started with
You can add more devices to the network in a similiar way
as it was created. E.g. if you created a network with some
Juniper devices and want to add some Cisco IOS devices. Point to
the NED you want to use (See
{NCS_DIR}/packages/neds/
) and run the
command. Remember to start the new devices after they have been
added to the network.
To extract the device data from the simulated network to a
file in XML format.
This data is usually used to load the simulated network into
NSO. Putting the xml file in the ./ncs-cdb
folder will load it when NSO starts. If NSO is already
started it can be reloaded while running.
The generated device data creates devices of the same type
as the device being simulated. This is true for netconf, cli and
snmp devices. When simulating generic devices the simulated device
will run as a netconf device.
Under very special circumstances one can choose to force
running the simulation as a generic device with the option
--force-generic
The simulated network device info can be shown with:
Here you can see the device name, the working directory and
port number for different services to be accessed on the simulated
device (NETCONF SSH, SNMP, IPC and direct access to the
CLI).
You can reach the CLI of individual devices with:
The simulated devices actually provides three different
styles of CLI:
-
cli : J-Style
-
cli-c : Cisco XR Style
-
cli-i : Cisco IOS Style
Individual devices can be started and stopped with:
You can check the status of the simulated network. Either a
short version just to see if the device is running or a more
verbose with all information.
View which packages are used in the simulated network.
It is also possible to reset the network back to state of
initialization.
When you are done, remove the network.
The netsim tool includes a standard ConfD distribution and the ConfD C
API library (libconfd) that the ConfD tools use. The library is built
with default settings where the values for MAXDEPTH and MAXKEYLEN are
20 and 9, respectively. These values define the size of confd_hkeypath_t
struct and this size is related to the size of data models in terms of
depth and key lengths. Default values should be big enough even for very
large and complex data models. But in some rare cases, one or both of
these values might not be large enough for a given data model.
One might observe a limitation when the data models that are used by
simulated devices exceed these limits. Then it would not be possible to
use the ConfD tools that are provided with the netsim. To overcome
this limitation, it is advised to use the corresponding NSO tools to
perform desired tasks on devices.
NSO and ConfD tools and Python APIs are basically the same except for
naming, the default IPC port and the MAXDEPTH and MAXKEYLEN values, where
for NSO tools, the values are set to 60 and 18, respectively. Thus, the
advised solution is to use the NSO tools and NSO Python API with netsim.
e.g. Instead of using below cmd
One may use: