# Struct snowcap::topology_zoo::ZooTopology[−][src]

pub struct ZooTopology { /* fields omitted */ }
Expand description

# ZooTopology

This struct can be used to generate a network from a ZooTopology graphml file. In addition, you can set (predictably) random link weights, and generate a (predictably) random iBGP topologies.

let mut t = ZooTopology::new(gml_filename, 42)?;
t.ibgp_spanning_forest(4);

let mut net = t.get_net();
net.set_config(&t.get_config()?)?;
t.advertise_prefixes(&mut net, 16, 0.5)?;

You can choose from the following iBGP topologies:

• Full-mesh
• Topology with a single route reflector, and all other routers being clients connected to that route reflector
• Spanning forest topology with num_roots different root nodes, chosen randomly, and a hierarchie of route reflectors, where each internal non-root node has exactly one parent route reflector.

## Implementations

Return a new ZooTopology instance by reading and parsing the privided GML file. Per default, it will generate a ZooTopology with 100 prefixes. The iBGP topology is not generated by default.

# Panics

Panics if somehow, petgraph does not play along and creates nodes in a wierd order.

This funciton applies a scenario to a topology (including some common configuration). This function may panic, if the topology does not support the scenario.

Applies the transient condition scenario, and returns (if possible) the tuple Network, Config and HardPolicy. If the arguemnt external_routers is given, their values represent the following:

1. Name of the router configured with local-pref 100
2. Name of the router configured with local-pref 50
3. Name of the router added (or removed) during reconfiguration.

This function is called when calling ZooTopology::apply_scenario with the scenario Scenario::VerifyTransientCondition or Scenario::VerifyTransientConditionReverse

Returns a reference to the iBGP roots

Randomize all link weights

Reset the seed to a known value

Forms an iBGP full mesh between all routers.

Forms an iBGP graph by choosing one route reflector in the network, where all other routers are connected to that router as client. Here, we choose the router having the most IGP connections to other internal routers.

# Panics

This function panics if there exists no internal router.

Forms an iBGP graph by choosing one route reflector in the network, where all other routers are connected to that router as client. Here, we choose the route reflector at random.

# Panics

This function panics if there exists no internal router.

Forms an iBGP graph by choosing one route reflector in the network, where all other routers are connected to that router as client. Here, the router with the given name is selected.

# Panics

This function panics if there exists no internal router with the given name.

Form an iBGP graph by choosing two route reflectors in the network. All non-root routers are connected to both route reflectors, and the two route reflectors form a peering session.

# Panics

This funciton panics if there are less than 2 internal routers

Form an iBGP graph by choosing two route reflectors in the network. All non-root routers are connected to both route reflectors, and the two route reflectors form a peering session. One route reflector is chosen based on its importance, and the other is selected by name.

# Panics

This funciton panics if there exists less than 2 internal routers, and if the named router does not exist

Form an iBGP graph by choosing two route reflectors in the network. All non-root routers are connected to both route reflectors, and the two route reflectors form a peering session. One route reflector is chosen randomly, and the other is selected by name.

# Panics

This funciton panics if there exists less than 2 internal routers, and if the named router does not exist

Form an iBGP graph by choosing two route reflectors in the network. All non-root routers are connected to both route reflectors, and the two route reflectors form a peering session.

# Panics

This funciton panics if the two routers don’t exist or are external routers

Prepares the ibgp graph such that it forms a spanning forest, originating from n root noes. This result will always be the same given the same seed

# Panics

This function panics if num_roots is larger than the number of internal routers in the network.

Prepares the network to be set up for a BGP acquisition. The following is done:

1. The netowrk is split into two connected parts. All links between the two components are disabled. The two connected parts will both have at least one node connected to external devices.
2. In one of the two components, the IGP weights will be scaled by the igp_scale_factor
3. Both components will select a route reflector, and all nodes in the component will have a session to this route reflector.

# Panics

This function panics if the network cannot be split into two connected components. This can be the case if there exists only one router, that is connected to external devices.

Prepares the network to be set up after BGP acquisition. The following is done:

1. The two split network parts are reconnected, and their
2. In one of the two components, the IGP weights will be scaled by the inverse of igp_scale_factor
3. Both route reflectors will be connected.

# Panics

This function panics if the network cannot be split into two connected components. This can be the case if there exists only one router, that is connected to external devices.

Generates a netsim::network::Network structure, and updates the internal datastructure to point to the correct indices of the network. This is required before you call the get_config method.

This function will make sure that external routers advertise some prefixes in the following way:

For each prefix and for each external router, determine (by using randomness), if the route should be advertised by by this external router, based on the probability given as argument.

Returns the current configuration based on the already prepared data.

# Panics

This function panics if the network was not already generated, and the node indexes are not yet present!

## Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

## Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)