Network management as a Neo4j graph model

A graph data model of a data center, from its racks and routers down to the software running on each machine.

Open this model in toro4n The data center model in toro4n, with the Layers tab open in the side panel

What the model shows

On the hardware side, the data center contains routers and racks, racks hold switches and machines, and each machine has a type. On the network side, routers, switches, machines, and network zones all route to interfaces. Interfaces connect to zones and to each other, and they expose ports. Each Connection joins two ports. On the software side, machines run operating system, application, and service processes, and the application and service processes listen on ports. Operating systems, services, and other software each have a chain of versions. Applications depend on services, other software, and specific versions.

Network management is the most complex of Neo4j's official examples, which makes it a good one to learn from. Several nodes have two labels, such as Router:Egress, and some relationships connect two nodes with the same label, such as PREVIOUS from one Version to another. Three relationship types run from Interface to Port: EXPOSES, OPENS, and LISTENS.

Nodes and properties

Application:Process

Connection

DataCenter

Interface

Machine

Network:Zone

Os:Process

Port

Rack

Router

Router:Egress

Service:Process

Software

Software:Application

Software:Os

Software:Service

Switch

Type

Version

Relationships

Layers

Modeling notes

Cypher

Here's the Cypher script toro4n generates for this model. It creates every node and relationship, with each property's type name as a placeholder value.

CREATE (DataCenter:DataCenter {name: "STRING", location: "STRING"})
CREATE (Type:Type {id: "INTEGER", name: "STRING", type: "STRING", cpu: "INTEGER", ram: "INTEGER", disk: "INTEGER"})
CREATE (Machine:Machine {id: "INTEGER", name: "STRING"})
CREATE (Rack:Rack {name: "STRING", rack: "INTEGER", zone: "INTEGER"})
CREATE (Switch:Switch {ip: "STRING", rack: "INTEGER"})
CREATE (Router:Router {name: "STRING", zone: "INTEGER"})
CREATE (RouterEgress:Router:Egress {name: "STRING"})
CREATE (Interface:Interface {ip: "STRING"})
CREATE (NetworkZone:Network:Zone {ip: "STRING", size: "INTEGER", zone: "INTEGER"})
CREATE (Port:Port {port: "INTEGER"})
CREATE (Connection:Connection {id: "STRING", source: "STRING", target: "STRING", user: "STRING", time: "INTEGER"})
CREATE (OsProcess:Os:Process {name: "STRING", startTime: "INTEGER"})
CREATE (ApplicationProcess:Application:Process {name: "STRING", pid: "INTEGER", startTime: "INTEGER"})
CREATE (ServiceProcess:Service:Process {name: "STRING", pid: "INTEGER", startTime: "INTEGER"})
CREATE (Version:Version {name: "STRING"})
CREATE (SoftwareOs:Software:Os {name: "STRING", versions: "LIST<STRING>"})
CREATE (SoftwareApplication:Software:Application {name: "STRING", ports: "LIST<INTEGER>", dependencies: "LIST<STRING>"})
CREATE (SoftwareService:Software:Service {name: "STRING", versions: "LIST<STRING>", ports: "LIST<INTEGER>", dependencies: "LIST<STRING>"})
CREATE (Software:Software {name: "STRING"})
CREATE (DataCenter)-[:CONTAINS]->(Router)
CREATE (DataCenter)-[:CONTAINS]->(RouterEgress)
CREATE (DataCenter)-[:CONTAINS]->(Rack)
CREATE (Rack)-[:HOLDS]->(Switch)
CREATE (Rack)-[:HOLDS]->(Machine)
CREATE (Machine)-[:TYPE]->(Type)
CREATE (Router)-[:ROUTES]->(Interface)
CREATE (RouterEgress)-[:ROUTES]->(Interface)
CREATE (Switch)-[:ROUTES]->(Interface)
CREATE (Machine)-[:ROUTES]->(Interface)
CREATE (NetworkZone)-[:ROUTES]->(Interface)
CREATE (Interface)-[:CONNECTS]->(NetworkZone)
CREATE (Interface)-[:CONNECTS]->(Interface)
CREATE (Interface)-[:CONNECTIONS]->(Interface)
CREATE (Interface)-[:EXPOSES]->(Port)
CREATE (Interface)-[:OPENS]->(Port)
CREATE (Interface)-[:LISTENS]->(Port)
CREATE (Connection)-[:FROM]->(Port)
CREATE (Connection)-[:TO]->(Port)
CREATE (Machine)-[:RUNS]->(OsProcess)
CREATE (Machine)-[:RUNS]->(ApplicationProcess)
CREATE (Machine)-[:RUNS]->(ServiceProcess)
CREATE (Machine)-[:UPDATE_TO {ts: "INTEGER"}]->(Version)
CREATE (ApplicationProcess)-[:LISTENS]->(Port)
CREATE (ServiceProcess)-[:LISTENS]->(Port)
CREATE (ApplicationProcess)-[:DEPENDS_ON]->(ServiceProcess)
CREATE (OsProcess)-[:INSTANCE]->(Version)
CREATE (ApplicationProcess)-[:INSTANCE]->(SoftwareApplication)
CREATE (ServiceProcess)-[:INSTANCE]->(SoftwareService)
CREATE (ServiceProcess)-[:INSTANCE]->(Version)
CREATE (SoftwareOs)-[:VERSION]->(Version)
CREATE (SoftwareService)-[:VERSION]->(Version)
CREATE (Software)-[:VERSION]->(Version)
CREATE (Version)-[:PREVIOUS]->(Version)
CREATE (SoftwareService)-[:DEPENDS_ON]->(Version)
CREATE (SoftwareApplication)-[:DEPENDS_ON]->(Version)
CREATE (SoftwareApplication)-[:DEPENDS_ON]->(SoftwareService)
CREATE (SoftwareApplication)-[:DEPENDS_ON]->(Software)

Source

The model is based on neo4j-graph-examples/network-management on GitHub. Download the model as network-management.json.