Network graph processing in Rust#1573
Conversation
03f6be2 to
464edcf
Compare
Codecov Report
@@ Coverage Diff @@
## main #1573 +/- ##
==========================================
+ Coverage 52.51% 54.33% +1.82%
==========================================
Files 141 141
Lines 21286 18548 -2738
Branches 5380 4452 -928
==========================================
- Hits 11178 10078 -1100
+ Misses 7148 5810 -1338
+ Partials 2960 2660 -300
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Would it make more sense to decouple the compression type from the graph type? e.g. add a 'compression' attribute? |
I think it would make more sense generally, but also brings up weird situations like if someone specifies |
@sporksmith What do you think about changing the config format from: network:
graph:
type: gml_xz
path: graph-compressed.gml.xzto: network:
graph:
type: gml
file:
path: graph-compressed.gml.xz
compression: xz |
sporksmith
left a comment
There was a problem hiding this comment.
Still reviewing a commit at a time - stopped at "f784149fe3329c3266e9520537d8ef9887eb1762 Add support for compressed network graphs"
LGTM. I just got to that commit in the review - maybe it makes sense for me to skip that commit for now, and you can push a fixup? |
I pushed it as a new commit rather than a fixup since it changes the old uncompressed behaviour as well. |
sporksmith
left a comment
There was a problem hiding this comment.
Finished - no further comments :)
The parser is currently unused.
|
The tornettools PR is shadow/tornettools/pull/31. |
This replaces shadow's topology parsing and processing with a Rust version. The GML is parsed using nom, and the graph processing is done using petgraph. The GML parser is in
src/lib/gml-parserand the graph processing code is insrc/main/routing. This also removes the igraph dependency. This PR will be easiest to review as individual commits.Network graph changes:
country_code,city_code, andip_addressnode fields (these will be used by tornettools instead)bandwidth_downandbandwidth_uptohost_bandwidth_downandhost_bandwidth_upShadow config changes:
city_code_hint,country_code_hint, andip_address_hinthost fieldsip_addrandnetwork_node_id(required) host fieldsgml_lzmagml_xzgraph typeFor the GML parser, I'm not super happy with it as a general GML parser and with its memory usage. But it has all of the required functionality required for shadow, so I think it's good enough for now. I might re-visit this in the future. Shadow can also now read
lzma-compressedxz-compressed network graph files.In Shadow's routing code, the IP address assignment was moved out of the
DNStype and into a newIpAssignmenttype. The hosts with theip_addrfield set are assigned their IP addresses first, and then the remaining hosts are assigned IP addresses starting at 11.0.0.1 (skipping any that end in.0or.255). Shadow computes a lookup table (aRoutingInfoobject) that contains computed latencies and packet loss fractions for all pairs of nodes that have hosts assigned to them. Rather than computing these values as-needed during the simulation, we now compute these all before the simulation starts. This lets us free the graph object before starting the simulation.If the
use_shortest_pathsconfig option is true (the default), shadow will compute the shortest paths between all graph nodes that have hosts assigned to them (but using the full graph during the shortest path calculation). For the path from a node to the same node (the path from node X to node X), rather than using a latency of 0, shadow will find the shortest path that contains at least one edge. This is consistent with shadow's current behaviour (shadow's current behaviour technically has a bug when the graph is directed, but that's fixed in this rust version).If the
use_shortest_pathsconfig option is false, the graph must be complete with self-loops (and have at most one edge between any two nodes), and shadow will simply use the direct edge between the two nodes.The configuration conversion script will no longer generate a valid shadow 2.0 config (for example it doesn't compute the
network_node_idfields). But the generated config file should still be useful if someone does need to convert a shadow 1.0 config, and will require a small amount of manual editing to get working. We think this is an okay compromise since the shadow config format has changed a lot, and we don't think the conversion scripts will be used very often.This PR won't be merged until we have a tornettools PR that's also ready to merge.