Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
re6stnet
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Milestones
Merge Requests
4
Merge Requests
4
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
re6stnet
Commits
8bf8de4e
Commit
8bf8de4e
authored
May 21, 2024
by
Tom Niget
Committed by
Tom Niget
Jun 14, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demo: fix graph generation for empty prefixes
parent
f484fc65
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
demo/demo
demo/demo
+7
-3
No files found.
demo/demo
View file @
8bf8de4e
...
...
@@ -94,6 +94,7 @@ class Re6stNode(nemu.Node):
def __init__(self, name, short):
super().__init__()
print("Re6stNode ctor %r %r" % (name, short))
self.name = name
self.short = short
self.Popen(('sysctl', '-q',
...
...
@@ -427,11 +428,12 @@ def route_svg(ipv4, z=4, default=type('', (), {'short': None})):
g = graph[n] = defaultdict(list)
g: dict[tuple[Re6stNode, bool], list[Re6stNode]]
for r in n.get_routes():
print("route_svg: %r" % r)
if (r.prefix and r.prefix.startswith('10.42.') if ipv4 else
r.prefix is None or r.prefix.startswith('2001:db8:')):
try:
g[node_by_ll(r.nexthop)].append(
node_by_ll(r.prefix)[0] if r.prefix else default
)
if r.prefix:
g[node_by_ll(r.nexthop)].append(node_by_ll(r.prefix)[0]
)
except KeyError:
pass
gv = ["digraph { splines = true; edge[color=grey, labelangle=0];"]
...
...
@@ -452,7 +454,9 @@ def route_svg(ipv4, z=4, default=type('', (), {'short': None})):
p2: Re6stNode
l2: list[str] = []
arrowhead = 'none'
for r2 in sorted(r2.short for r2 in r):
print("r=%r" % r)
print("processing: " + ", ".join("%r" % ((r2.name, r2.short),) for r2 in r))
for r2 in sorted(r2.short if r2.short else "NONE" for r2 in r):
if r2:
if r2 == p2.short:
r2 = '
<font
color=
"grey"
>
%s
</font>
' % r2
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment