Skip to content

Instantly share code, notes, and snippets.

@mattkaar
Forked from jexp/network_test.adoc
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattkaar/44af397d28da4c5e6580 to your computer and use it in GitHub Desktop.
Save mattkaar/44af397d28da4c5e6580 to your computer and use it in GitHub Desktop.

Network Setup

create (_132:`Subnet` {`cidr`:"1.0.0.240/30", `name`:"one-alpha"})
create (_133:`Subnet` {`cidr`:"1.0.0.32/29", `name`:"one-branchalpha"})
create (_134:`Subnet` {`cidr`:"1.0.0.40/29", `name`:"one-branchbravo"})
create (_135:`Subnet` {`cidr`:"1.0.0.48/29", `name`:"one-branchcharlie"})
create (_136:`Subnet` {`cidr`:"1.0.0.56/29", `name`:"one-branchdelta"})
create (_137:`Subnet` {`cidr`:"1.0.0.244/30", `name`:"one-bravo"})
create (_138:`Subnet` {`cidr`:"1.0.0.248/30", `name`:"one-charlie"})
create (_139:`Subnet` {`cidr`:"1.0.0.0/27", `name`:"one-core"})
create (_140:`Subnet` {`cidr`:"1.1.1.0/24", `name`:"one-coreservices"})
create (_141:`Subnet` {`cidr`:"1.0.0.252/30", `name`:"one-delta"})
create (_142:`Subnet` {`cidr`:"2.0.0.240/30", `name`:"two-alpha"})
create (_143:`Subnet` {`cidr`:"2.0.0.32/29", `name`:"two-branchalpha"})
create (_144:`Subnet` {`cidr`:"2.0.0.40/29", `name`:"two-branchbravo"})
create (_145:`Subnet` {`cidr`:"2.0.0.48/29", `name`:"two-branchcharlie"})
create (_146:`Subnet` {`cidr`:"2.0.0.56/29", `name`:"two-branchdelta"})
create (_147:`Subnet` {`cidr`:"2.0.0.244/30", `name`:"two-bravo"})
create (_148:`Subnet` {`cidr`:"2.0.0.248/30", `name`:"two-charlie"})
create (_149:`Subnet` {`cidr`:"2.0.0.0/27", `name`:"two-core"})
create (_150:`Subnet` {`cidr`:"2.2.2.0/24", `name`:"two-coreservices"})
create (_151:`Subnet` {`cidr`:"2.0.0.252/30", `name`:"two-delta"})
create (_152:`Router` {`hostname`:"one-alpha"})
create (_153:`AutonomousSystem` {`number`:"7018"})
create (_154:`Router` {`hostname`:"one-bravo"})
create (_155:`Router` {`hostname`:"one-charlie"})
create (_156:`Router` {`hostname`:"one-delta"})
create (_157:`Router` {`hostname`:"one-services"})
create (_158:`Router` {`hostname`:"two-alpha"})
create (_159:`AutonomousSystem` {`number`:"3356"})
create (_160:`Router` {`hostname`:"two-bravo"})
create (_161:`Router` {`hostname`:"two-charlie"})
create (_162:`Router` {`hostname`:"two-delta"})
create (_163:`Router` {`hostname`:"two-services"})
create _152-[:`INTERFACE` {`address`:"1.0.0.242"}]->_132
create _152-[:`INTERFACE` {`address`:"1.0.0.33"}]->_133
create _152-[:`INTERFACE` {`address`:"1.0.0.245"}]->_137
create _152-[:`INTERFACE` {`address`:"1.0.0.4"}]->_139
create _152-[:`BELONGS_TO`]->_153
create _154-[:`INTERFACE` {`address`:"1.0.0.41"}]->_134
create _154-[:`INTERFACE` {`address`:"1.0.0.246"}]->_137
create _154-[:`INTERFACE` {`address`:"1.0.0.249"}]->_138
create _154-[:`INTERFACE` {`address`:"1.0.0.6"}]->_139
create _154-[:`INTERFACE` {`address`:"2.0.0.58"}]->_146
create _154-[:`BELONGS_TO`]->_153
create _155-[:`INTERFACE` {`address`:"1.0.0.49"}]->_135
create _155-[:`INTERFACE` {`address`:"1.0.0.250"}]->_138
create _155-[:`INTERFACE` {`address`:"1.0.0.8"}]->_139
create _155-[:`INTERFACE` {`address`:"1.0.0.253"}]->_141
create _155-[:`BELONGS_TO`]->_153
create _156-[:`INTERFACE` {`address`:"1.0.0.241"}]->_132
create _156-[:`INTERFACE` {`address`:"1.0.0.57"}]->_136
create _156-[:`INTERFACE` {`address`:"1.0.0.2"}]->_139
create _156-[:`INTERFACE` {`address`:"1.0.0.254"}]->_141
create _156-[:`BELONGS_TO`]->_153
create _157-[:`INTERFACE` {`address`:"1.0.0.1"}]->_139
create _157-[:`INTERFACE` {`address`:"1.1.1.1"}]->_140
create _157-[:`BELONGS_TO`]->_153
create _158-[:`INTERFACE` {`address`:"2.0.0.242"}]->_142
create _158-[:`INTERFACE` {`address`:"2.0.0.33"}]->_143
create _158-[:`INTERFACE` {`address`:"2.0.0.245"}]->_147
create _158-[:`INTERFACE` {`address`:"2.0.0.4"}]->_149
create _158-[:`BELONGS_TO`]->_159
create _160-[:`INTERFACE` {`address`:"2.0.0.41"}]->_144
create _160-[:`INTERFACE` {`address`:"2.0.0.246"}]->_147
create _160-[:`INTERFACE` {`address`:"2.0.0.249"}]->_148
create _160-[:`INTERFACE` {`address`:"2.0.0.6"}]->_149
create _160-[:`BELONGS_TO`]->_159
create _161-[:`INTERFACE` {`address`:"1.0.0.34"}]->_133
create _161-[:`INTERFACE` {`address`:"2.0.0.49"}]->_145
create _161-[:`INTERFACE` {`address`:"2.0.0.250"}]->_148
create _161-[:`INTERFACE` {`address`:"2.0.0.8"}]->_149
create _161-[:`INTERFACE` {`address`:"2.0.0.253"}]->_151
create _161-[:`BELONGS_TO`]->_159
create _162-[:`INTERFACE` {`address`:"2.0.0.241"}]->_142
create _162-[:`INTERFACE` {`address`:"2.0.0.57"}]->_146
create _162-[:`INTERFACE` {`address`:"2.0.0.2"}]->_149
create _162-[:`INTERFACE` {`address`:"2.0.0.254"}]->_151
create _162-[:`BELONGS_TO`]->_159
create _163-[:`INTERFACE` {`address`:"2.0.0.1"}]->_149
create _163-[:`INTERFACE` {`address`:"2.2.2.1"}]->_150
create _163-[:`BELONGS_TO`]->_159

Shortest Path two-core---one-coreservices

MATCH (a:Subnet {name:'two-core'})
MATCH (b:Subnet {name:'one-coreservices'})
MATCH path=shortestPath((a)-[*]-(b))
RETURN path

Shortest Path two-core---two-coreservices

MATCH (a:Subnet {name:'two-core'})
MATCH (b:Subnet {name:'two-coreservices'})
MATCH path=shortestPath((a)-[*]-(b))
RETURN path

Shortest Path one-coreservices---two-coreservices

MATCH (a:Subnet {name:'one-coreservices'})
MATCH (b:Subnet {name:'two-coreservices'})
MATCH path=shortestPath((a)-[*]-(b))
RETURN path

Shortest Path one-coreservices---two-coreservices with length param

MATCH (a:Subnet {name:'one-coreservices'})
MATCH (b:Subnet {name:'two-coreservices'})
MATCH path=shortestPath((a)-[*..30]-(b))
RETURN path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment