This repository was archived by the owner on Jun 27, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 95
Accessing Topology
joshreich edited this page Dec 5, 2014
·
6 revisions
Changes to the network topology are one of the most fundamental sources of dynamism. Consequently, all dynamic policies have a set_network
method which is automatically called by the runtime every time the network changes. By overriding this method, dynamic policies can access the updated network and its associated topology. Below is a simple example that stores the most recent topology.
class topo_reader(DynamicPolicy):
"""
Policy that stores the topology
"""
def __init__(self):
self.network = None
super(topo_reader,self).__init__()
def set_network(self, network):
self.network = network
def read_topology(self):
return self.network.topology
def __repr__(self):
return "topo_reader"
The following videos provide additional examples and details as to how the Pyretic runtime implements this feature:
- An example that uses the topology to flood over a minimum spanning tree
- An example that introduces the topology/network object and shows how to print it
- An in-depth dive into runtime support for network/topology access