node's name is mandatory. Should be in IP-address format. To change it to any other value - use label.
visualization' options: full option list
nodes:
10.10.10.2: # Name of node. Mandatory
# Tags of node. Any key (type string): value (str, int, float, dictionary, list) pairs. Optional
vendor: Juniper
role: router
ha_role: primary
location: dc1
# visualization' options
label: 10.10.10.2-R2
size: 15
color: red
10.10.10.3:
ha_role: secondary
location: dc1
10.10.10.6:
src, dst is mandatory
cost is optional. Default is 1. Equal to OSPF/IS-IS cost.
admin_group is optional. TE admin group, ie '0x00000010'
temetric is optional. TE metric
max_link_bw is optional. Max link bandwidth, bps
max_rsrv_link_bw is optional. Max reservable link bandwidth, bps
unreserved_bw_0 .. unreserved_bw_7 are optional. Unreserved bandwidth per priority, bps
color is optional, ie '#007bff'
dashes is optional. Input value: true/false. Default is false.
directed is optional. Default is false.
edges:
# use directed: true, otherwise all edges will be treated as undirected
- dst: 10.10.10.2
src: 10.10.10.3
cost: 1 # default value
- dst: 10.10.10.3
src: 10.10.10.6
# Tags of edge. Any key (type string): value (str, int, float, dictionary, list) pairs. Optional
bw: 1000
isp: verizon
media: fiber
src, dst are mandatory. Both must be present in nodes.
bandwidth is optional. Default is 0 (no reservation). Accepts bps or a G/M/K suffix, ie '2G'.
metric_type is optional. igp (default) uses cost, te uses temetric.
setup_priority, hold_priority are optional, 0..7 where 0 is the strongest. Default is 7. An omitted hold_priority follows setup_priority, and it may not be stronger than it.
admin_groups is optional: exclude-any, include-any, include-all, matched against the edge affinity names.
autoroute is optional. Default is false. When true the tunnel is used as a shortcut in path computation, like autoroute announce.
color is optional, ie '#7c3aed'
paths is optional. Default is a single primary path. Each path inherits bandwidth, priorities and admin_groups from the tunnel unless it sets its own.
role is optional: primary (default), secondary or standby.
ero is optional. Explicit route: a strict hop must have a direct link from the previous hop, a loose hop is reached by the shortest path.
srlg_exclude is optional. List of SRLG ids the path must avoid.
lsps:
TUN-A: # Name of tunnel. Mandatory
src: 10.10.10.2
dst: 10.10.10.6
bandwidth: 2G
metric_type: te
setup_priority: 7
hold_priority: 7
autoroute: false
color: '#7c3aed'
admin_groups:
exclude-any: [red]
paths:
primary:
ero:
- node: 10.10.10.3
hop: strict
- node: 10.10.10.6
hop: loose
backup:
role: standby
bandwidth: 1G
srlg_exclude: [100]
Subnets terminated on a node, the same as stub networks parsed from a real LSDB. No graph node is created for them, so they are counted as termination points only.
The key is the subnet in CIDR format. Its value is the list of nodes advertising it.
node is mandatory and must be present in nodes.
cost is optional. Cost from that node to the subnet.
area is optional. Area the subnet is advertised in.
metric_type is optional. IS-IS metric style.
isnarrow, isextended are optional. Input value: true/false.
stub_networks:
192.168.1.0/24: # Subnet in CIDR format. Mandatory
- node: 10.10.10.2
cost: 10
area: 0
# the same subnet advertised by a second node makes it backuped
- node: 10.10.10.3
cost: 20
area: 0
10.10.10.2/32:
- node: 10.10.10.2
cost: 1
Copy/paste this test topology to the input window above
nodes:
10.10.10.1:
10.10.10.2:
10.10.10.3:
10.10.10.4:
10.10.10.5:
10.10.10.6:
edges:
- src: 10.10.10.1
dst: 10.10.10.2
- src: 10.10.10.1
dst: 10.10.10.3
- src: 10.10.10.2
dst: 10.10.10.4
- src: 10.10.10.2
dst: 10.10.10.4
- src: 10.10.10.2
dst: 10.10.10.3
- src: 10.10.10.3
dst: 10.10.10.5
- src: 10.10.10.5
dst: 10.10.10.4
- src: 10.10.10.4
dst: 10.10.10.6
- src: 10.10.10.5
dst: 10.10.10.6
Copy/paste this test topology to the input window above
nodes:
10.10.10.1:
label: 10.10.10.1
location: dc1
10.10.10.2:
ha_role: primary
label: 10.10.10.2
location: dc1
size: 15
10.10.10.3:
ha_role: secondary
label: 10.10.10.3
location: dc1
10.10.10.4:
ha_role: primary
label: 10.10.10.4
location: dc2
size: 15
10.10.10.5:
ha_role: secondary
label: 10.10.10.5label
location: dc2
10.10.10.6:
label: 10.10.10.6
location: dc2
edges:
- src: 10.10.10.1
dst: 10.10.10.2
bw: 1000
directed: true
media: copper
- src: 10.10.10.2
dst: 10.10.10.1
bw: 1000
directed: true
media: copper
- src: 10.10.10.1
dst: 10.10.10.3
bw: 1000
directed: true
media: copper
- src: 10.10.10.3
dst: 10.10.10.1
bw: 1000
directed: true
media: copper
- src: 10.10.10.2
dst: 10.10.10.4
bw: 100
cost: 100
directed: true
isp: att
media: copper
- src: 10.10.10.4
dst: 10.10.10.2
bw: 100
directed: true
isp: att
media: copper
- src: 10.10.10.4
dst: 10.10.10.2
bw: 1000
directed: true
isp: verizon
media: fiber
- src: 10.10.10.2
dst: 10.10.10.4
bw: 1000
directed: true
isp: verizon
media: fiber
- src: 10.10.10.3
dst: 10.10.10.2
bw: 1000
directed: true
media: copper
- src: 10.10.10.2
dst: 10.10.10.3
bw: 1000
directed: true
media: copper
- src: 10.10.10.3
dst: 10.10.10.5
bw: 100
directed: true
isp: virgin
media: fiber
- src: 10.10.10.5
dst: 10.10.10.3
bw: 100
directed: true
isp: virgin
media: fiber
- src: 10.10.10.5
dst: 10.10.10.4
bw: 1000
directed: true
media: copper
- src: 10.10.10.4
dst: 10.10.10.5
bw: 1000
directed: true
media: copper
- src: 10.10.10.4
dst: 10.10.10.6
bw: 1000
directed: true
media: fiber
- src: 10.10.10.6
dst: 10.10.10.4
bw: 1000
directed: true
media: fiber
- src: 10.10.10.5
dst: 10.10.10.6
bw: 1000
directed: true
media: fiber
- src: 10.10.10.6
dst: 10.10.10.5
bw: 1000
directed: true
media: fiber
Query node by name (REST API)
query_params = {'name': '10.10.10.2'}
r_get = requests.get(f'http://{TOPOLOGRAPH_HOST}:{TOPOLOGRAPH_PORT}/api/diagram/{graph_time}/nodes', auth=(_USERNAME, _PASSWORD), params=query_params)
r_get.json()
[{'ha_role': 'primary', 'id': 1, 'label': '10.10.10.2', 'location': 'dc1', 'name': '10.10.10.2', 'size': 15}]
Query node by name (Topolograph Python SDK)
from topolograph import Topolograph
# Initialize client
topo = Topolograph(url=f'http://{TOPOLOGRAPH_HOST}:{TOPOLOGRAPH_PORT}', token='your-token')
# Or use: topo = Topolograph(url=f'http://{TOPOLOGRAPH_HOST}:{TOPOLOGRAPH_PORT}', username=_USERNAME, password=_PASSWORD)
# Get graph
graph = topo.graphs.get_by_time(graph_time)
# Query node by name
nodes = graph.nodes.get(name='10.10.10.2')
for node in nodes:
print(f"Node: {node.name}, ID: {node.id}, Attributes: {node.attributes}")
# Output: Node: 10.10.10.2, ID: 1, Attributes: {'ha_role': 'primary', 'label': '10.10.10.2', 'location': 'dc1', 'size': 15}
Query node by arbitrary tags. Get all nodes in location dc1 (REST API)
query_params = {'location': 'dc1'}
r_get = requests.get(f'http://{TOPOLOGRAPH_HOST}:{TOPOLOGRAPH_PORT}/api/diagram/{graph_time}/nodes', auth=(_USERNAME, _PASSWORD), params=query_params)
r_get.json()
[{'id': 0, 'label': '10.10.10.1', 'location': 'dc1', 'name': '10.10.10.1'},
{'ha_role': 'primary', 'id': 1, 'label': '10.10.10.2', 'location': 'dc1', 'name': '10.10.10.2', 'size': 15},
{'ha_role': 'secondary', 'id': 2, 'label': '10.10.10.3', 'location': 'dc1', 'name': '10.10.10.3'}]
Query node by arbitrary tags. Get all nodes in location dc1 (Topolograph Python SDK)
from topolograph import Topolograph
# Initialize client
topo = Topolograph(url=f'http://{TOPOLOGRAPH_HOST}:{TOPOLOGRAPH_PORT}', token='your-token')
# Get graph
graph = topo.graphs.get_by_time(graph_time)
# Query nodes by location tag
nodes = graph.nodes.get(location='dc1')
for node in nodes:
print(f"Node: {node.name}, Location: {node.attributes.get('location')}")
# Output:
# Node: 10.10.10.1, Location: dc1
# Node: 10.10.10.2, Location: dc1
# Node: 10.10.10.3, Location: dc1
Query node by arbitrary tags. Get all primary nodes in location dc1 (REST API)
query_params = {'location': 'dc1', 'ha_role': 'primary'}
r_get = requests.get(f'http://{TOPOLOGRAPH_HOST}:{TOPOLOGRAPH_PORT}/api/diagram/{graph_time}/nodes', auth=(_USERNAME, _PASSWORD), params=query_params)
r_get.json()
[{'ha_role': 'primary', 'id': 1, 'label': '10.10.10.2', 'location': 'dc1', 'name': '10.10.10.2', 'size': 15}]
Query node by arbitrary tags. Get all primary nodes in location dc1 (Topolograph Python SDK)
from topolograph import Topolograph
# Initialize client
topo = Topolograph(url=f'http://{TOPOLOGRAPH_HOST}:{TOPOLOGRAPH_PORT}', token='your-token')
# Get graph
graph = topo.graphs.get_by_time(graph_time)
# Query nodes by multiple tags
nodes = graph.nodes.get(location='dc1', ha_role='primary')
for node in nodes:
print(f"Node: {node.name}, Role: {node.attributes.get('ha_role')}, Location: {node.attributes.get('location')}")
# Output: Node: 10.10.10.2, Role: primary, Location: dc1
Query all edges between two nodes (REST API)
query_params = {'src_node': '10.10.10.2', 'dst_node': '10.10.10.4'}
r_get = requests.get(f'http://{TOPOLOGRAPH_HOST}:{TOPOLOGRAPH_PORT}/api/diagram/{graph_time}/edges', auth=(_USERNAME, _PASSWORD), params=query_params)
r_get.json()
[{'bw': 100, 'dst': '10.10.10.4', 'id': 4, 'isp': 'att', 'media': 'copper', 'src': '10.10.10.2', 'cost': 100},
{'bw': 1000, 'dst': '10.10.10.4', 'id': 7, 'isp': 'verizon', 'media': 'fiber', 'src': '10.10.10.2', 'cost': 1}]
Query all edges between two nodes (Topolograph Python SDK)
from topolograph import Topolograph
# Initialize client
topo = Topolograph(url=f'http://{TOPOLOGRAPH_HOST}:{TOPOLOGRAPH_PORT}', token='your-token')
# Get graph
graph = topo.graphs.get_by_time(graph_time)
# Query edges using client directly (edges API not yet in SDK)
edges = topo.get(f'/diagram/{graph_time}/edges', params={'src_node': '10.10.10.2', 'dst_node': '10.10.10.4'})
edges_data = edges.json()
print(edges_data)
# Output:
# [{'bw': 100, 'dst': '10.10.10.4', 'id': 4, 'isp': 'att', 'media': 'copper', 'src': '10.10.10.2', 'cost': 100},
# {'bw': 1000, 'dst': '10.10.10.4', 'id': 7, 'isp': 'verizon', 'media': 'fiber', 'src': '10.10.10.2', 'cost': 1}]
Query edge by arbitrary tags. Get all links between '10.10.10.2' and '10.10.10.4' from Verizon ISP (REST API)
query_params = {'src_node': '10.10.10.2', 'dst_node': '10.10.10.4', 'isp': 'verizon'}
r_get = requests.get(f'http://{TOPOLOGRAPH_HOST}:{TOPOLOGRAPH_PORT}/api/diagram/{graph_time}/edges', auth=(_USERNAME, _PASSWORD), params=query_params)
r_get.json()
[{'bw': 1000, 'dst': '10.10.10.4', 'id': 7, 'isp': 'verizon', 'media': 'fiber', 'src': '10.10.10.2', 'cost': 1}]
Query edge by arbitrary tags. Get all links between '10.10.10.2' and '10.10.10.4' from Verizon ISP (Topolograph Python SDK)
from topolograph import Topolograph
# Initialize client
topo = Topolograph(url=f'http://{TOPOLOGRAPH_HOST}:{TOPOLOGRAPH_PORT}', token='your-token')
# Get graph
graph = topo.graphs.get_by_time(graph_time)
# Query edges with additional filters using client directly
edges = topo.get(f'/diagram/{graph_time}/edges', params={
'src_node': '10.10.10.2',
'dst_node': '10.10.10.4',
'isp': 'verizon'
})
edges_data = edges.json()
print(edges_data)
# Output: [{'bw': 1000, 'dst': '10.10.10.4', 'id': 7, 'isp': 'verizon', 'media': 'fiber', 'src': '10.10.10.2', 'cost': 1}]