caida.load

Load a CAIDA network topology from a JSON file that was created via caida.save and process its vertices.

Attribute Provides:
  • topology

  • caida_topology

Attribute Depends:
  • graph

Model Component Dependencies:

Plugin

class caida.load_plugin.Load(graph, log)[source]

Bases: AbstractPlugin

Load a CAIDA network topology from a JSON file and process its vertices.

__annotate_func__ = None
__annotations_cache__ = {}
__firstlineno__ = 11
__static_attributes__ = ('routers', 'switches')
add_interfaces(vertex, interfaces)[source]

Connects the vertex to switches in the graph based on the interface data.

Parameters:
  • vertex (Vertex) – The vertex to which interfaces will be added.

  • interfaces (list) – A list of interface dictionaries.

get_switch(switch_name)[source]

Adds the switch to the self.switches dictionary if it is newly created.

Parameters:

switch_name (str) – The name of the switch.

Returns:

The switch vertex.

Return type:

Vertex

handle_bgp(vtx)[source]

Sets up BGP networks and neighbors for a router vertex.

Parameters:

vtx (dict) – The vertex dictionary containing BGP configuration.

handle_host(vtx)[source]

Creates a host vertex in the graph and adds its interfaces.

Parameters:

vtx (dict) – The vertex dictionary containing host information.

handle_router(vtx)[source]

Creates a router vertex in the graph, adds its interfaces, and sets up BGP if specified. This method currently does not handle OSPF links, which will need to happen prior to BGP so that it can properly advertise the BGP links.

Parameters:

vtx (dict) – The vertex dictionary containing router information.

run(filename)[source]

Load a CAIDA network topology from a JSON file and process its vertices. The JSON file should be created via the caida.save. Populates the self.switches and self.routers dictionaries per the topology and configures BGP for routers in a second pass over the data.

Parameters:

filename (str) – The path to the JSON file containing the topology data.

Raises:

TypeError – If the filename is not provided.