Netsim Wrapper
ncs-netsim is a great tool, but it lack of following features which are developed as part of netsim-wrapper
- netsim-wrapper features
- delete-devices <device-names>
- create-network-from [ yaml | json ] <filename>
- create-device-from [ yaml | json ] <filename>
- create-network-template [ yaml | json ]
- create-device-template [ yaml | json ]
netsim-wrapper is a wrapper on top of ncs-netsim with added features. It's written in python and we opened the space to add more features to it.
- Introduction
- Pre-requisites
- Installation
- Features
- Help
- FAQ
- Bug Tracking and Support
- License and Copyright
- Author and Thanks
- Contact
Introduction
ncs-netsim, It's a powerful tool to build a simulated network environment for Network Service Orchestrator (NSO) it's also called as NCS - NSO. In these network topologies we can test the network configurations based on the need as per the use case.
netsim-wrapper, An open space to automate the ncs-netsim.
Pre-requisites
- ncs-netsim command must be reconginsed by the terminal.
- netsim-wrapper supports both trains of python
2.7+ and 3.1+, the OS should not matter.
Installation and Downloads
The best way to get netsim-wrapper is with setuptools or pip. If you already have setuptools, you can install as usual:
python -m pip install netsim-wrapper
pip install netsim-wrapper
Otherwise download it from PyPi, extract it and run the setup.py script
python setup.py install
If you're Interested in the source, you can always pull from the github repo:
- From github
git clone https://github.com/kirankotari/netsim-wrapper.git
Features
Delete a device(s) from topology
existing device list
⋊> ~/k/i/netsim-wrapper on master ◦ netsim-wrapper list
ncs-netsim list for /Users/kkotari/idea/netsim-wrapper/netsim
name=xr0 netconf=12022 snmp=11022 ipc=5010 cli=10022 dir=/Users/kkotari/idea/netsim-wrapper/netsim/xr/xr0
name=xr1 netconf=12023 snmp=11023 ipc=5011 cli=10023 dir=/Users/kkotari/idea/netsim-wrapper/netsim/xr/xr1
name=xr2 netconf=12024 snmp=11024 ipc=5012 cli=10024 dir=/Users/kkotari/idea/netsim-wrapper/netsim/xr/xr2
name=xr3 netconf=12025 snmp=11025 ipc=5013 cli=10025 dir=/Users/kkotari/idea/netsim-wrapper/netsim/xr/xr3
⋊> ~/k/i/netsim-wrapper on master ◦
deleting devices
⋊> ~/k/i/netsim-wrapper on master ◦ netsim-wrapper delete-devices xr1 xr3
[ INFO ] :: [ ncs-netsim ] :: deleting device: xr1
[ INFO ] :: [ ncs-netsim ] :: deleting device: xr3
⋊> ~/k/i/netsim-wrapper on master ◦
latest device list
⋊> ~/k/i/netsim-wrapper on master ◦ netsim-wrapper list
ncs-netsim list for /Users/kkotari/idea/netsim-wrapper/netsim
name=xr0 netconf=12022 snmp=11022 ipc=5010 cli=10022 dir=/Users/kkotari/idea/netsim-wrapper/netsim/xr/xr0
name=xr2 netconf=12024 snmp=11024 ipc=5012 cli=10024 dir=/Users/kkotari/idea/netsim-wrapper/netsim/xr/xr2
⋊> ~/k/i/netsim-wrapper on master ◦
Create Network/Device Template
Template to automate the Network/Device creation process.
⋊> ~/k/i/netsim-wrapper on master ◦ netsim-wrapper create-network-template [yaml | json]
⋊> ~/k/i/netsim-wrapper on master ◦ netsim-wrapper create-device-template [yaml | json]
which gives template.json/yaml file where you can update the files based on your need/requirement.
Create Network/Device From Template
We are using the templates which are updated based on your requirement
⋊> ~/k/i/netsim-wrapper on master ◦ netsim-wrapper create-network-from [yaml | json] <filename>
⋊> ~/k/i/netsim-wrapper on master ◦ netsim-wrapper create-device-from [yaml | json] <filename>
How to choose the Templates and How they look (Template options)
These templates follows the same process of ncs-netsim, format is your choice
- prefix based creation -
netsim-wrapper create-network-template yaml or json <file> - name based creation -
netsim-wrapper create-device-template yaml or json <file>
Note:- If you need combinations of network/device template, we suggest to create 2 template files and run the command for each type.
You can find the example all supported templates under it's folder.
prefix-based template example
nso-packages-path: <path-to>/nso-local-lab/nso-run-5.2.1.2/packages
compile-neds: true
start-devices: true
add-to-nso: true
add-authgroup-to-nso: true
authgroup:
type: system
device-mode:
prefix-based:
cisco-ios-cli-6.56:
count: 2
prefix: ios-56-
cisco-ios-cli-6.55:
count: 2
prefix: ios-55-
load-day0-config: true
config-path: <path-to>/nso-local-lab/nso-run-5.2.1.2/preconfig
config-files:
- devices_ios_56.xml
- devices_ios_55.xml
name-based template example
nso-packages-path: <path-to>/nso-local-lab/nso-run-5.2.1.2/packages
compile-neds: true
start-devices: true
add-to-nso: true
add-authgroup-to-nso: true
authgroup:
type: system
device-mode:
name-based:
cisco-ios-cli-6.56:
- ios-56-name-100
- ios-56-name-150
cisco-ios-cli-6.55:
- ios-55-name-200
- ios-55-name-250
load-day0-config: true
config-path: <path-to>/nso-local-lab/nso-run-5.2.1.2/preconfig
config-files:
- devices_ios_56.xml
- devices_ios_55.xml
Template options in detail
nso-packages-path:
info: nso package path
compile-neds:
options: true or false
info: which run _make clean all_ for each ned
start-devices:
options: true or false
info: starts devices using _ncs-netsim start_, it's intellegent enought to start only stopped devices
add-to-nso:
options: true or false
info: adds day0 devices config to nso
add-authgroup-to-nso:
options:
type: local or system or custom
path: authgroup config file path this option is only for custom
info: configuring authgroup
device-mode:
- prefix-based: ncs-netsim create-network/add-to-network
ned-name: ned name
options:
count: number of devices
prefix: prefix text for device names
- name-based: ncs-netsim create-device/add-device
ned-name: ned name
options: device names
load-day0-config:
options: true or false
info: to add day0 config if the value is true
config-path:
info: configuratin folder path
config-files:
info: loads each configuration file from given config-path
Help
⋊> ~/k/i/netsim-wrapper on master ◦ netsim-wrapper --help
Usage netsim-wrapper [--dir <NetsimDir>]
create-network-template [yaml | json] |
create-network-from [yaml | json] <fileName> |
create-network <NcsPackage> <NumDevices> <Prefix> |
create-device-template [yaml | json] |
create-device-from [yaml | json] <fileName> |
create-device <NcsPackage> <DeviceName> |
add-to-network <NcsPackage> <NumDevices> <Prefix> |
add-device <NcsPackage> <DeviceName> |
delete-devices <DeviceNames> |
delete-network |
[-a | --async] start [devname] |
[-a | --async ] stop [devname] |
[-a | --async ] reset [devname] |
[-a | --async ] restart [devname] |
list |
is-alive [devname] |
status [devname] |
whichdir |
ncs-xml-init [devname] |
ncs-xml-init-remote <RemoteNodeName> [devname] |
[--force-generic] |
packages |
netconf-console devname [XpathFilter] |
[-w | --window] [cli | cli-c | cli-i] devname |
get-port devname [ipc | netconf | cli | snmp] |
-v | --version |
-h | --help
See manpage for ncs-netsim for more info. NetsimDir is optional
and defaults to ./netsim, any netsim directory above in the path,
or $NETSIM_DIR if set.
FAQ
-
Question: Do I need to install ncs-netsim too?
Answer: Not really, ncs-netsim tool comes along with NSO. If you are working with NSO it's won't be a problem. -
Question: Is python mandatory for netsim-wrapper?
Answer: Yes, the library is written in python and we wanted not to be dependend on NSO versions. -
Question: Is netsim-wrapper backword compatable?
Answer: We recommend to use netsim-wrapper commands instead of ncs-netsim. However couple of commands are still backward compatable ie.ncs-netsim list, etc. -
Question: I am seeing following error ./env.sh: line 12: export: `Fusion.app/Contents/Public:/Applications/Wireshark.app/Contents/MacOS': not a valid identifier
Answer: We recommend to check your env path as recommended in following link
Bug Tracker and Support
- Please report any suggestions, bug reports, or annoyances with netsim-wrapper through the Github bug tracker.
License and Copyright
-
netsim-wrapper is licensed Apache 2.0 2019-2020
Authors and Thanks
netsim-wrapper was developed by Kiran Kumar Kotari, For any suggestions or comments contact kkotari@cisco.com or kirankotari@live.com. If you find any bugs please fix them and send me a pull request.
Metadata
Release files for netsim-wrapper 3.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| netsim-wrapper-3.1.2.tar.gz | 20.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| netsim_wrapper-3.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 36.9 kB
Release files / netsim-wrapper-3.1.2.tar.gz
| Download URL | netsim-wrapper-3.1.2.tar.gz |
|---|---|
| Size | 20.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
da29225248d2f1e355daec3ba04b94b4b392431f4f873dbedf6fb57309fa1885
|
|
BLAKE2b-256 checksum How to use checksums |
1eec72b25362039dcbfd878de9d38130804116234e8a8a0a15bc2ab75ff7eb06
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.9
|
Release files / netsim_wrapper-3.1.2-py3-none-any.whl
| Download URL | netsim_wrapper-3.1.2-py3-none-any.whl |
|---|---|
| Size | 16.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4846cddd2176244748bd592fcafe01ad292a984cdc92d7ae6cf03352c3d9bc78
|
|
BLAKE2b-256 checksum How to use checksums |
7bc887a3f230b27047fd162c23c69a947bac479ed98f5906aa7b20884c5f78ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.9
|