Netomox (Network Topology Modeling Toolbox) is a tool to make/validate network topology data that based on RFC8345.
Note
Development of netomox is going under OOL-MDDO (Okinawa Open Lab, Model-Driven Network DevOps) project as netomox-exp!
See also:
- RFC 8345 - A YANG Data Model for Network Topologies
- Netomox Examples
- Repository of example topology data instance (defined by netomox DSL)
- Network topology visualizer
- Install tools for development tools (in Ubuntu,
apt install build-essentials
) - Install
ruby
(>2.3),ruby-dev
,ruby-bundler
- Install packages used in this application
git clone
andbundle install --path=vendor/bundle
In vendor
dir, there are some data instances defined/handled with Netomox.
vendor/model
: topology data instance (json) of fictional network.vendor/model_defs
: topology data definition usingNetomox::DSL
to generate json data instance.- See. DSL Document
You can find latest yang files defined in RFC8345 and RFC8346 at Yang models repository on github. Draft L2 network topology yang file is also at experimental folder in the repository
- Install pyang (>1.7.4)
sudo pip install pyang
installspyang
,yang2dsdl
andjson2xml
.
- Install json_schema pyang plugin
sudo cp json_schema.py PYANG_PLUGIN_DIR
- install jsonlint-cli to validate json data.
sudo npm install -g jsonlint-cli
- or other JSON/XML utilities as you like.
Use topology model DSL (Domain Specific Language) to make target data. e.g.
bundle exec ruby model_defs/target.rb
It generate topology data and print it to standard-output as JSON.
bundle exec netomox check target.json
Install pyang JSON Schema plugin from EAGLE-Open-Model-Profile-and-Tools/YangJsonTools at ToolChain instead of cmoberg/pyang-json-schema-plugin. (because cmoberg's plugin can work only on single yang module at a time)
Generate json schema
pyang -f json_schema -o topo.jsonschema ietf-network@2018-02-26.yang ietf-network-topology@2018-02-26.yang
and validate (using jsonlint or other json tool).
jsonlint-cli -s topo.jsonschema target.json
Create jtox file at first.
[Notice] use base topology model (NOT augmented model such as L2/L3).
pyang -f jtox -o topo.jtox ietf-network-topology@2018-02-26.yang ietf-network@2018-02-26.yang
Convert json to xml
json2xml topo.jtox target.json | xmllint --format - > target.xml
Notice, topology YANG models are YANG/1.1, so you have to set -x
option to yang2dsdl
.
yang2dsdl -x -j -t config -v model/target.xml yang/ietf-network-topology@2018-02-26.yang yang/ietf-network@2018-02-26.yang
You can see diff of 2 topology data like that:
bundle exec netomox diff model/target.orig.json model/target.json
In default, checker diff output only changed object and its parent object.
-a
/--all
: checker diff output whole data include unchanged object.-c
/--color
: use color for diff.-o FILE
/--output FILE
: save diff data to FILE (json data includes diff info for diff viewer). If specified-o
and other options, ignored them.
Ready db_info.json
file to store information to connect your Neo4j database.
This application is using neography to post the data into neo4j graph database. Execute like below
bundle exec netomox graphdb target.json
-i FILE
/--info FILE
option: graph db connection info file (if not specified, usedb_info.json
)-c
/--clear
option: only deleting all data in graph (clear database and do not import graph data)
(Experimental)
Popoto.js is a graphical Neo4j query builder.
If you use Neo4j with netomox graphdb
command, you can also use popoto.js to query/visualize its data.
Install popoto and required packages at first.
cd popoto/
npm install
Next, Edit neo4j API entry point and its account in src/index.js
. (See Popoto.js Wiki in detail.)
popoto.rest.CYPHER_URL
popoto.rest.AUTHORIZATION
Run webpack dev-server and access localhost:8081
(See webpack.config.js
to config dev-server).
npm run start
Generate document using YARD.
bundle exec rake yard
Then, documents are generated at doc/
directory.
Read documents from doc/index.html
directly or yard http server. (default localhost:8808)
bundle exec yard server
rb2puml generates UML class diagram for PlantUML.
-s
/--simple
: Simple format (not include class method information)-d
/--dir
: Directory path to analyze source code (*.rb)
bundle exec rb2puml -d lib/netomox/dsl > netomox_dsl.puml
Or, install PlantUML and exec rake fig
.
bundle exec rake fig
Then, class diagrams will be created in figs/
directory.