Running NetSim via CLI#
Advanced users can model their simulation via a configuration file (which can be created without the NetSim GUI) and run the simulation from command line. This is typically done in cases where very large networks are to be simulated (it takes too long to create it in the GUI), or to run a series of simulations automatically. The configuration file contains all required information to run the simulation including the network topology, devices, links, traffic, statistics, traces etc. To run Simulation in NetSim through command line interface (CLI), the following steps have to be followed.
Step 1: Note the Application Path
Application path is the current workspace location of the NetSim that you want to run. The default application path will be something like
"C:\Users\PC\Documents\NetSim\Workspaces\\<Your default workspace>\bin_x64" for 64-bit for 64-bit. For more information on NetSim workspace, Refer Section 4 "Workspaces and Experiments".
Step 2: Note the IO Path
IO path (Input/output Path) is the directory where the NetSim input files are placed, and output files are written by NetSim during (or after) simulation. In this directory, the input file i.e., the NetSim configuration file (Configuration.netsim), of the simulation scenario should be present. App path and IO path can also be same, i.e., Configuration.netsim can be placed inside the app path (the app path should have write permission). Otherwise, users can create a folder for IO path and Configuration.netsim can be placed inside that folder.
Note: Sample configuration.netsim files are available in the \<NetSim installation Directory>/Docs/ Sample_Configurations folder of the NetSim install directory inside the respective protocol folder names.
Step 3: Running NetSim through command line for Simulation.
To run NetSim through command line, copy the app path where NetSimCore.exe is present and paste it in the command prompt.
>cd \<app path>
Note: File path should be always added in the command prompt within double quotes. For example,
>cd "C:\Users\PC\Documents\\<Your default workspace>\bin_x64"
Running in CLI Mode when using floating licenses#
For floating licenses, type the following in the command prompt.
\<io path>\<space>-license\<space>5053@\<Server IP Address>
\<app path> contains all files of NetSim including NetSimCore.exe. Specifying the app path is optional. NetSim will take the current path as app path if not specified.
\<iopath> contains Configuration.netsim. (Configuration.xsd is available in the bin folder of NetSim's current workspace path C:\Users\PC\Documents\NetSim\Workspaces\\<Your default workspace>\bin_x64 for 64-bit
Refer section 7.2.4 to know about configuration.xsd file.
5053 is the port number through which the system communicates with the license server i.e. the system in which the dongle is running (for floating license users)
\<Server IP Address> is the ip address of the system where NetSim license server is running.
Note: Please contact your network administrator / lab in-charge to know the IP address of the PC where the NetSim license server is running.
The following screenshot is the example of running NetSim through CLI where the ip address of the NetSim license server is 192.168.0.9.
Figure 7‑1: Running NetSim through CLI mode for floating license
Running in CLI Mode when using node-locked or cloud licenses#
For cloud licenses and node-locked licenses, type the following in the command prompt
>NetSimCore.exe\<space>-apppath\<space>\<apppath>\<space>-iopath\<space>\<io path>\<space>-license\<space>\<license file path>
** contains all files of NetSim including > NetSimCore.exe
\<iopath> contains Configuration.netsim and Configuration.xsd
** path where the license file is present. > This is generally the \ /bin > folder.
For E.g. C:\Program Files\NetSim\Standard_v13_1\bin
The following screenshot is the example of running NetSim through CLI for the node locked or cloud license.
Figure 7‑2: Running NetSim through CLI mode for Cloud and Node lock licenses
Once simulation is complete the text files that are requested by the end user in Configuration.netsim will be written in the \<iopath>.
To know more about the options that are available to run NetSim via CLI, type the following in the command prompt.
>cd \<app path>
Figure 7‑3: More Options available to run NetSim via CLI
Quick edit for copy pastes in CLI mode#
With Quick Edit mode, you can copy text between a command window and Windows-based programs, and you can also paste text into a command window by using a right-click operation. To use Quick edit mode in command prompt users can run the command prompt à Right Click the icon in the upper-left corner of the Command Prompt window, and then Click Properties àIn the options, enable Quick Edit mode à and click on OK.
Figure 7‑4: Quick edit mode via CLI Running
Understanding the Configuration.netsim file#
When a scenario is created in the GUI, NetSim's UI code write all the details about the devices used and its properties, the links used and their properties, the properties of the environment being used, etc. in the file Configuration.netsim
The simulation engine that contains DLLs and NetSimCore.exe reads this Configuration.netsim, executes the simulation and writes output metrics files. The GUI then displays the metrics based on the text files written by the backend.
In order to run NetSim through command line (CLI), the user must create the Configuration.netsim file furnishing all the details about the devices, links and the environment of the desired scenario.
How to use Visual Studio to edit the Configuration file?#
In Visual Studio, XML view provides an editor for editing raw XML and provides IntelliSense and color coding. After you type the element name and press the CTRL+ SPACE, you will be presented with a list of attributes that the element supports. This is known as "IntelliSense". Using this feature, you can select the options that are required to create the desired scenario.
Color coding is followed to indicate the elements and the attributes in a unique fashion.
The following screenshot displays the Configuration.netsim which is opened through the Visual Studio as shown below Figure 7‑5.
Figure 7‑5: Open Configuration.netsim file via Visual Studio
To reformat click on editàAdvancedàFormat Document.
Figure 7‑6: Reformat the Configuration.netsim file
Sections of Configuration file#
These are the different sections in Configuration.netsim:
This section contains the details about the user credentials, such as the user mode (Admin or Exam or Practice), experiment name, date on which the experiment is created and the comments about the experiment. This section plays a significant role while running NetSim through GUI.
This section contains the GUI information like the environment length, view type etc. and the network name which is desired to be run.
This section is used to configure the devices and the links of the desired network at each layer of the TCP/IP stack. It consists of DEVICE_CONFIGURATION, CONNECTION and APPLICATION_CONFIGURATION. DEVICE_CONFIGURATION configures the devices in the desired network while the CONNECTION configures the links in the desired network and APPLICATION configures the Applications.
Simulation time and seed values are described in this section.
IPV4 and static ARP are enabled or disabled in this section. The text files illustrating the static routing and static ARP can be obtained by enabling the corresponding tags in the Configuration.netsim.
The packet trace and the event trace can be observed in the text files which are created by enabling the tags in this section. The required fields of the packet trace can be enabled in the PACKET_TRACE while the event trace can be enabled in the EVENT_TRACE of this section.
Sample Configuration file#
Sample "Configuration.netsim" file will be installed in user system along with the software at \<NetSim installed Path>\Docs\ Sample_Configuration\ \<Network Technology>.User can open and edit these files using Visual Studio 2015/2017/2019 or any XML editor. The purpose of providing the sample "Configuration.netsim" file is to assist the user in writing a network scenario manually by analyzing the format for that specific network technology.
Configuration.xsd is an XML schema Definition file which is present in the bin folder of NetSim's current workspace path
\<C:\Users\PC\Documents\NetSim\Workspaces\\<Your default workspace>\bin_x64> for 64-bit.
Configuration.xsd file can be placed inside the \<iopath> along with the configuration.netsim file to verify the contents in the configuration.netsim file. This file checks and validates the structure and vocabulary of a configuration.netsim document against the grammatical rules of the appropriate XML language.
It is not mandatory to place the configuration.xsd file along with the Configuration.netsim file in the iopath. But if it is done, then it will be easier to check & validate changes that are done to the Configuration.netsim file.