replay_event Module
Classes representing events to be replayed. These events can be serialized to
events.trace JSON files.
Note about the JSON events.trace format:
All events are serialized to JSON with the Event.to_json() method.
All events have a fingerprint field, which is used to compute functional
equivalence between events across different replays of the trace.
The default format of the fingerprint field is a tuple (event class name,).
The specific format of the fingerprint field is documented in each class’
fingerprint() method.
The format of other additional fields is documented in
each event’s __init__() method.
-
class sts.replay_event.CheckInvariants(label=None, round=-1, time=None, invariant_check_name='InvariantChecker.check_correspondence')[source]
Bases: sts.replay_event.InputEvent
Causes the simulation to pause itself and check the given invariant before
proceeding.
-
__init__(label=None, round=-1, time=None, invariant_check_name='InvariantChecker.check_correspondence')[source]
- Parameters:
- label: a unique label for this event. Internal event labels begin with ‘i’
and input event labels begin with ‘e’.
- time: the timestamp of when this event occured. Stored as a tuple:
[seconds since unix epoch, microseconds].
- round: optional integer. Indicates what simulation round this event occured
in.
- invariant_check_name: unique name of the invariant to be checked. See
config.invariant_checks for an exhaustive list of possible invariant
checks.
-
static from_json(json_hash)[source]
-
proceed(simulation)[source]
-
to_json()[source]
-
class sts.replay_event.ConnectToControllers(label=None, round=-1, time=None, timeout_disallowed=False, prunable=False)[source]
Bases: sts.replay_event.InternalEvent
Logged at the beginning of the execution. Causes all switches to open
TCP connections their their parent controller(s).
-
static from_json(json_hash)[source]
-
proceed(simulation)[source]
-
class sts.replay_event.ControlChannelBlock(dpid, controller_id, label=None, round=-1, time=None)[source]
Bases: sts.replay_event.InputEvent
Simulates delay between switches and controllers by temporarily
queuing all messages sent on the switch<->controller TCP connection. No
messages will be sent over the connection until a ControlChannelUnblock
occurs.
-
__init__(dpid, controller_id, label=None, round=-1, time=None)[source]
- Parameters:
- dpid: unique integer identifier of the switch.
- controller_id: unique string label for the controller.
- label: a unique label for this event. Internal event labels begin with ‘i’
and input event labels begin with ‘e’.
- time: the timestamp of when this event occured. Stored as a tuple:
[seconds since unix epoch, microseconds].
- round: optional integer. Indicates what simulation round this event occured
in.
-
fingerprint[source]
Fingerprint tuple format: (class name, dpid, controller id)
-
static from_json(json_hash)[source]
-
proceed(simulation)[source]
-
class sts.replay_event.ControlChannelUnblock(dpid, controller_id, label=None, round=-1, time=None)[source]
Bases: sts.replay_event.InputEvent
Unblocks the control channel delay triggered by a ControlChannelUnblock.
All queued messages will be sent.
-
__init__(dpid, controller_id, label=None, round=-1, time=None)[source]
- Parameters:
- dpid: unique integer identifier of the switch.
- controller_id: unique string label for the controller.
- label: a unique label for this event. Internal event labels begin with ‘i’
and input event labels begin with ‘e’.
- time: the timestamp of when this event occured. Stored as a tuple:
[seconds since unix epoch, microseconds].
- round: optional integer. Indicates what simulation round this event occured
in.
-
fingerprint[source]
Fingerprint tuple format: (class name, dpid, controller id)
-
static from_json(json_hash)[source]
-
proceed(simulation)[source]
-
class sts.replay_event.ControlMessageBase(dpid, controller_id, fingerprint, label=None, round=-1, time=None, timeout_disallowed=False)[source]
Bases: sts.replay_event.InternalEvent
Logged whenever the GodScheduler decides to allow a switch to receive or
send an openflow packet.
-
__init__(dpid, controller_id, fingerprint, label=None, round=-1, time=None, timeout_disallowed=False)[source]
- Parameters:
- dpid: unique integer identifier of the switch.
- controller_id: unique string label for the controller.
- label: a unique label for this event. Internal event labels begin with ‘i’
and input event labels begin with ‘e’.
- time: the timestamp of when this event occured. Stored as a tuple:
[seconds since unix epoch, microseconds].
- round: optional integer. Indicates what simulation round this event occured
in.
- timeout_disallowed: whether the replayer should wait indefinitely for
this event to occur. Defaults to False.
-
fingerprint[source]
Fingerprint tuple format:
(class name, OFFingerprint, dpid, controller id)
See fingerprints/messages.py for OFFingerprint format.
-
class sts.replay_event.ControlMessageReceive(dpid, controller_id, fingerprint, label=None, round=-1, time=None, timeout_disallowed=False)[source]
Bases: sts.replay_event.ControlMessageBase
Logged whenever the GodScheduler decides to allow a switch to receive an
openflow message.
-
static from_json(json_hash)[source]
-
pending_receive[source]
-
proceed(simulation)[source]
-
class sts.replay_event.ControlMessageSend(dpid, controller_id, fingerprint, label=None, round=-1, time=None, timeout_disallowed=False)[source]
Bases: sts.replay_event.ControlMessageBase
Logged whenever the GodScheduler decides to allow a switch to send an
openflow message.
-
static from_json(json_hash)[source]
-
pending_send[source]
-
proceed(simulation)[source]
-
class sts.replay_event.ControllerFailure(controller_id, label=None, round=-1, time=None)[source]
Bases: sts.replay_event.InputEvent
Kills a controller process with kill -9
-
__init__(controller_id, label=None, round=-1, time=None)[source]
- Parameters:
- controller_id: unique string label for the controller to be killed.
- label: a unique label for this event. Internal event labels begin with ‘i’
and input event labels begin with ‘e’.
- time: the timestamp of when this event occured. Stored as a tuple:
[seconds since unix epoch, microseconds].
- round: optional integer. Indicates what simulation round this event occured
in.
-
fingerprint[source]
Fingerprint tuple format: (class name, controller id)
-
static from_json(json_hash)[source]
-
proceed(simulation)[source]
-
class sts.replay_event.ControllerRecovery(controller_id, label=None, round=-1, time=None)[source]
Bases: sts.replay_event.InputEvent
Reboots a crashed controller by reinvoking its original command line
parameters
-
__init__(controller_id, label=None, round=-1, time=None)[source]
- Parameters:
- controller_id: unique string label for the controller.
- label: a unique label for this event. Internal event labels begin with ‘i’
and input event labels begin with ‘e’.
- time: the timestamp of when this event occured. Stored as a tuple:
[seconds since unix epoch, microseconds].
- round: optional integer. Indicates what simulation round this event occured
in.
-
fingerprint[source]
Fingerprint tuple format: (class name, controller id)
-
static from_json(json_hash)[source]
-
proceed(simulation)[source]
-
class sts.replay_event.ControllerStateChange(controller_id, fingerprint, name, value, label=None, round=-1, time=None, timeout_disallowed=False)[source]
Bases: sts.replay_event.InternalEvent
Logged for any (visible) state change in the controller (e.g.
mastership change). Visibility into controller state changes is obtained
via syncproto.
-
__init__(controller_id, fingerprint, name, value, label=None, round=-1, time=None, timeout_disallowed=False)[source]
- Parameters:
- controller_id: unique string label for the controller.
- name: The format string passed to the controller’s logging library.
- value: An array of values for the format string.
- label: a unique label for this event. Internal event labels begin with ‘i’
and input event labels begin with ‘e’.
- time: the timestamp of when this event occured. Stored as a tuple:
[seconds since unix epoch, microseconds].
- round: optional integer. Indicates what simulation round this event occured
in.
- timeout_disallowed: whether the replayer should wait indefinitely for
this event to occur. Defaults to False.
-
fingerprint[source]
Fingerprint tuple format:
(class name, PendingStateChange.fingerprint, controller id)
PendingStateChange.fingerprint is the format string passed to the
controller’s logging library (without interpolated values)
-
static from_json(json_hash)[source]
-
static from_pending_state_change(state_change)[source]
-
pending_state_change[source]
-
proceed(simulation)[source]
-
class sts.replay_event.DataplaneDrop(fingerprint, label=None, round=-1, time=None, passive=True)[source]
Bases: sts.replay_event.InputEvent
Removes an in-flight dataplane packet with the given fingerprint from
the network.
-
__init__(fingerprint, label=None, round=-1, time=None, passive=True)[source]
- Parameters:
- label: a unique label for this event. Internal event labels begin with ‘i’
and input event labels begin with ‘e’.
- time: the timestamp of when this event occured. Stored as a tuple:
[seconds since unix epoch, microseconds].
- round: optional integer. Indicates what simulation round this event occured
in.
- passive: whether we’re using Replayer.DataplaneChecker
-
fingerprint[source]
Fingerprint tuple format:
(class name, DPFingerprint, switch dpid, port no)
See fingerprints/messages.py for format of DPFingerprint.
-
static from_json(json_hash)[source]
-
proceed(simulation)[source]
-
to_json()[source]
-
class sts.replay_event.DataplanePermit(fingerprint, label=None, round=-1, time=None, passive=True)[source]
Bases: sts.replay_event.InternalEvent
DataplanePermit allows a packet to move from one port to another in the
dataplane. We basically just keep this around for bookkeeping purposes. During
replay, this let’s us know which packets to let through, and which to drop.
-
__init__(fingerprint, label=None, round=-1, time=None, passive=True)[source]
- Parameters:
- label: a unique label for this event. Internal event labels begin with ‘i’
and input event labels begin with ‘e’.
- time: the timestamp of when this event occured. Stored as a tuple:
[seconds since unix epoch, microseconds].
- round: optional integer. Indicates what simulation round this event occured
in.
- passive: whether we’re using Replayer.DataplaneChecker
-
fingerprint[source]
Fingerprint tuple format:
(class name, DPFingerprint, switch dpid, port no)
See fingerprints/messages.py for format of DPFingerprint.
-
static from_json(json_hash)[source]
-
proceed(simulation)[source]
-
to_json()[source]
-
class sts.replay_event.DeterministicValue(controller_id, name, value, label=None, round=-1, time=None, timeout_disallowed=False)[source]
Bases: sts.replay_event.InternalEvent
Logged whenever the controller asks for a deterministic value (e.g.
gettimeofday()
-
__init__(controller_id, name, value, label=None, round=-1, time=None, timeout_disallowed=False)[source]
- Parameters:
- controller_id: unique string label for the controller.
- name: name of the DeterministicValue request, e.g. “gettimeofday”
- value: the return value of the DeterministicValue request.
- label: a unique label for this event. Internal event labels begin with ‘i’
and input event labels begin with ‘e’.
- time: the timestamp of when this event occured. Stored as a tuple:
[seconds since unix epoch, microseconds].
- round: optional integer. Indicates what simulation round this event occured
in.
- timeout_disallowed: whether the replayer should wait indefinitely for
this event to occur. Defaults to False.
-
static from_json(json_hash)[source]
-
proceed(simulation)[source]
-
class sts.replay_event.Event(prefix='e', label=None, round=-1, time=None, dependent_labels=None, prunable=True)[source]
Bases: object
Superclass for all event types.
-
__init__(prefix='e', label=None, round=-1, time=None, dependent_labels=None, prunable=True)[source]
-
fingerprint[source]
All events must have a fingerprint. Fingerprints are used to compute
functional equivalence.
-
proceed(simulation)[source]
Executes a single `round’. Returns a boolean that is true if the
Replayer may continue to the next Event, otherwise proceed() again
later.
-
to_json()[source]
Convert the event to json format
-
class sts.replay_event.HostMigration(old_ingress_dpid, old_ingress_port_no, new_ingress_dpid, new_ingress_port_no, host_id, label=None, round=-1, time=None)[source]
Bases: sts.replay_event.InputEvent
Migrates a host from one location in network to another. Creates a new
virtual port on the new switch, and takes down the old port on the old switch.
-
__init__(old_ingress_dpid, old_ingress_port_no, new_ingress_dpid, new_ingress_port_no, host_id, label=None, round=-1, time=None)[source]
- Parameters:
- old_ingress_dpid: unique integer identifier of the ingress switch the host is
moving away from.
- old_ingress_port_no: integer identifier of the port the host is moving
away from.
- new_ingress_dpid: unique integer identifier of the ingress switch the host is
moving to.
- new_ingress_port_no: integer identifier of the port the host is moving
to.
- host_id: unique integer identifier of the host.
- label: a unique label for this event. Internal event labels begin with ‘i’
and input event labels begin with ‘e’.
- time: the timestamp of when this event occured. Stored as a tuple:
[seconds since unix epoch, microseconds].
- round: optional integer. Indicates what simulation round this event occured
in.
-
fingerprint[source]
Fingerprint tuple format:
(class name, old dpid, old port, new dpid, new port, host id)
-
static from_json(json_hash)[source]
-
new_location[source]
-
old_location[source]
-
proceed(simulation)[source]
-
class sts.replay_event.InputEvent(label=None, round=-1, time=None, dependent_labels=None, prunable=True)[source]
Bases: sts.replay_event.Event
An InputEvents is an event that the simulator injects into the simulation.
Each InputEvent has a list of dependent InternalEvents that it takes in its
constructor. This enables us to properly prune events.
`InputEvents’ may also be referred to as ‘external
events’, elsewhere in documentation or code.
-
__init__(label=None, round=-1, time=None, dependent_labels=None, prunable=True)[source]
-
class sts.replay_event.InternalEvent(label=None, round=-1, time=None, timeout_disallowed=False, prunable=False)[source]
Bases: sts.replay_event.Event
An InternalEvent is one that happens within the controller(s) under
simulation. Derivatives of this class verify that the internal event has
occured during replay in its proceed method before it returns.
-
__init__(label=None, round=-1, time=None, timeout_disallowed=False, prunable=False)[source]
-
disallow_timeouts()[source]
-
proceed(simulation)[source]
-
class sts.replay_event.InvariantViolation(violations, label=None, round=-1, time=None)[source]
Bases: sts.replay_event.SpecialEvent
Class for logging violations as json dicts
-
__init__(violations, label=None, round=-1, time=None)[source]
- Parameters:
- violations: an array of strings specifying the invariant violation
fingerprints. Format of the strings depends on the invariant check.
Empty array means there were no violations.
- label: a unique label for this event. Internal event labels begin with ‘i’
and input event labels begin with ‘e’.
- time: the timestamp of when this event occured. Stored as a tuple:
[seconds since unix epoch, microseconds].
- round: optional integer. Indicates what simulation round this event occured
in.
-
static from_json(json_hash)[source]
-
class sts.replay_event.LinkDiscovery(controller_id, link_attrs, label=None, round=-1, time=None)[source]
Bases: sts.replay_event.InputEvent
Deprecated
-
__init__(controller_id, link_attrs, label=None, round=-1, time=None)[source]
-
fingerprint[source]
-
static from_json(json_hash)[source]
-
proceed(simulation)[source]
-
class sts.replay_event.LinkFailure(start_dpid, start_port_no, end_dpid, end_port_no, label=None, round=-1, time=None)[source]
Bases: sts.replay_event.InputEvent
Cuts a link between switches. This causes the switch to send an
ofp_port_status message to its parent(s). All packets forwarded over
this link will be dropped until a LinkRecovery occurs.
-
__init__(start_dpid, start_port_no, end_dpid, end_port_no, label=None, round=-1, time=None)[source]
- Parameters:
- start_dpid: unique integer identifier of the first switch connected to the link.
- start_port_no: integer port number of the start switch’s port.
- end_dpid: unique integer identifier of the second switch connected to the link.
- end_port_no: integer port number of the end switch’s port to be created.
- label: a unique label for this event. Internal event labels begin with ‘i’
and input event labels begin with ‘e’.
- time: the timestamp of when this event occured. Stored as a tuple:
[seconds since unix epoch, microseconds].
- round: optional integer. Indicates what simulation round this event occured
in.
-
fingerprint[source]
Fingerprint tuple format:
(class name, start dpid, start port_no, end dpid, end port_no)
-
static from_json(json_hash)[source]
-
proceed(simulation)[source]
-
class sts.replay_event.LinkRecovery(start_dpid, start_port_no, end_dpid, end_port_no, label=None, round=-1, time=None)[source]
Bases: sts.replay_event.InputEvent
Recovers a failed link between switches. This causes the switch to send an
ofp_port_status message to its parent(s).
-
__init__(start_dpid, start_port_no, end_dpid, end_port_no, label=None, round=-1, time=None)[source]
- Parameters:
- start_dpid: unique integer identifier of the first switch connected to the link.
- start_port_no: integer port number of the start switch’s port.
- end_dpid: unique integer identifier of the second switch connected to the link.
- end_port_no: integer port number of the end switch’s port to be created.
- label: a unique label for this event. Internal event labels begin with ‘i’
and input event labels begin with ‘e’.
- time: the timestamp of when this event occured. Stored as a tuple:
[seconds since unix epoch, microseconds].
- round: optional integer. Indicates what simulation round this event occured
in.
-
fingerprint[source]
Fingerprint tuple format:
(class name, start dpid, start port, end dpid, end port)
-
static from_json(json_hash)[source]
-
proceed(simulation)[source]
-
class sts.replay_event.PendingStateChange[source]
Bases: sts.replay_event.PendingStateChange
-
class sts.replay_event.PolicyChange(request_type, label=None, round=-1, time=None)[source]
Bases: sts.replay_event.InputEvent
Not currently supported
-
__init__(request_type, label=None, round=-1, time=None)[source]
-
static from_json(json_hash)[source]
-
proceed(simulation)[source]
-
class sts.replay_event.SpecialEvent(prefix='e', label=None, round=-1, time=None, dependent_labels=None, prunable=True)[source]
Bases: sts.replay_event.Event
-
proceed(_)[source]
-
class sts.replay_event.SwitchFailure(dpid, label=None, round=-1, time=None)[source]
Bases: sts.replay_event.InputEvent
Crashes a switch, by disconnecting its TCP connection with the
controller(s).
-
__init__(dpid, label=None, round=-1, time=None)[source]
- Parameters:
- dpid: unique integer identifier of the switch.
- label: a unique label for this event. Internal event labels begin with ‘i’
and input event labels begin with ‘e’.
- time: the timestamp of when this event occured. Stored as a tuple:
[seconds since unix epoch, microseconds].
- round: optional integer. Indicates what simulation round this event occured
in.
-
fingerprint[source]
Fingerprint tuple format: (class name, dpid)
-
static from_json(json_hash)[source]
-
proceed(simulation)[source]
-
class sts.replay_event.SwitchRecovery(dpid, label=None, round=-1, time=None)[source]
Bases: sts.replay_event.InputEvent
Recovers a crashed switch, by reconnecting its TCP connection with the
controller(s).
-
__init__(dpid, label=None, round=-1, time=None)[source]
- Parameters:
- dpid: unique integer identifier of the switch.
- label: a unique label for this event. Internal event labels begin with ‘i’
and input event labels begin with ‘e’.
- time: the timestamp of when this event occured. Stored as a tuple:
[seconds since unix epoch, microseconds].
- round: optional integer. Indicates what simulation round this event occured
in.
-
fingerprint[source]
Fingerprint tuple format: (class name, dpid)
-
static from_json(json_hash)[source]
-
proceed(simulation)[source]
-
class sts.replay_event.TrafficInjection(label=None, dp_event=None, host_id=None, round=-1, time=None, prunable=True)[source]
Bases: sts.replay_event.InputEvent
Injects a dataplane packet into the network at the given host’s access link
-
__init__(label=None, dp_event=None, host_id=None, round=-1, time=None, prunable=True)[source]
- Parameters:
- dp_event: DataplaneEvent object encapsulating the packet contents and the
access link.
- host_id: unique integer label identifying the host that generated the
packet.
- label: a unique label for this event. Internal event labels begin with ‘i’
and input event labels begin with ‘e’.
- time: the timestamp of when this event occured. Stored as a tuple:
[seconds since unix epoch, microseconds].
- round: optional integer. Indicates what simulation round this event occured
in.
- prunable: whether this input event can be pruned during delta
debugging.
-
fingerprint[source]
Fingerprint tuple format: (class name, dp event, host_id)
The format of dp event is:
{“interface”: HostInterface.to_json(), “packet”: base 64 encoded packet contents}
See entities.py for the HostInterface json format.
-
static from_json(json_hash)[source]
-
proceed(simulation)[source]
-
to_json()[source]
-
class sts.replay_event.WaitTime(wait_time, label=None, round=-1, time=None)[source]
Bases: sts.replay_event.InputEvent
Causes the simulation to sleep for the specified number of seconds.
Controller processes continue running during this time.
-
__init__(wait_time, label=None, round=-1, time=None)[source]
- Parameters:
- wait_time: float representing how long to sleep in seconds.
- label: a unique label for this event. Internal event labels begin with ‘i’
and input event labels begin with ‘e’.
- time: the timestamp of when this event occured. Stored as a tuple:
[seconds since unix epoch, microseconds].
- round: optional integer. Indicates what simulation round this event occured
in.
-
static from_json(json_hash)[source]
-
proceed(simulation)[source]
-
sts.replay_event.assert_fields_exist(json_hash, *args)[source]
assert that the fields exist in json_hash
-
sts.replay_event.dictify_fingerprint(fingerprint)[source]
-
sts.replay_event.get_link(link_event, simulation)[source]
topology Module
If the user does not specify a topology to test on, use by default a full mesh
of switches, with one host connected to each switch. For example, with N = 3:
controller
- host1 host2
-
- switch1-(1)————(3)–switch2
/
(2) (4)
- /
- /
- /
- (6)-switch3-(5)
host3
-
class sts.topology.BufferedPatchPanel(switches, hosts, connected_port_mapping)[source]
Bases: sts.topology.PatchPanel, pox.lib.revent.revent.EventMixin
A Buffered Patch panel.Listens to SwitchDPPacketOut and HostDpPacketOut events,
and re-raises them to listeners of this object. Does not traffic until given
permission from a higher-level.
-
__init__(switches, hosts, connected_port_mapping)[source]
-
drop_dp_event(dp_event)[source]
Given a SwitchDpPacketOut event, remove it from our buffer, and do not forward.
Return the dropped event.
-
get_buffered_dp_event(fingerprint)[source]
-
permit_dp_event(dp_event)[source]
Given a SwitchDpPacketOut event, permit it to be forwarded
-
queued_dataplane_events[source]
-
sts.topology.BufferedPatchPanelForTopology(topology)[source]
Given a pox.lib.graph.graph object with hosts, switches, and other things,
produce an appropriate BufferedPatchPanel
-
class sts.topology.FatTree(num_pods=4, create_io_worker=None, gui=False)[source]
Bases: sts.topology.Topology
Construct a FatTree topology with a given number of pods
-
class FatTreeLinks(port2access_link, interface2access_link, port2internal_link, dpid2switch)[source]
Bases: sts.topology.LinkTracker
-
__init__(port2access_link, interface2access_link, port2internal_link, dpid2switch)[source]
-
FatTree.__init__(num_pods=4, create_io_worker=None, gui=False)[source]
-
FatTree.construct_tree(num_pods)[source]
According to “A Scalable, Commodity Data Center Network Architecture”,
k = number of ports per switch = number of pods
number core switches = (k/2)^2
number of edge switches per pod = k / 2
number of agg switches per pod = k / 2
number of hosts attached to each edge switch = k / 2
number of hosts per pod = (k/2)^2
total number of hosts = k^3 / 4
-
FatTree.install_default_routes()[source]
Install static routes as proposed in Section 3 of
“A Scalable, Commodity Data Center Network Architecture”.
This is really a strawman routing scheme. PORTLAND, et. al. are much better
-
FatTree.install_portland_routes()[source]
We use a modified version of PORTLAND. We make two changes: OpenFlow 1.0
doesn’t support prefix matching on MAC addresses, so we use IP addresses
instead. (same # of flow entries, and we don’t model flooding anyway)
Second, we ignore vmid and assume 8 bit pod ids. So, IPs are of the form:
123.pod.position.port
-
FatTree.wire_tree(access_links, network_links)[source]
-
class sts.topology.LinkTracker(dpid2switch, port2access_link, interface2access_link, port2internal_link)[source]
Bases: object
-
__init__(dpid2switch, port2access_link, interface2access_link, port2internal_link)[source]
-
access_links[source]
-
create_access_link(host, interface, switch, port)[source]
Create an access link between a host and a switch
If no interface is provided, an unused interface is used
If no port is provided, an unused port is used
-
create_network_link(from_switch, from_port, to_switch, to_port)[source]
Create a unidirectional network (internal) link between two switches
If a port is not provided, an unused port in the corresponding switch is used
-
find_unused_interface(host)[source]
Find a host’s unused interface; if no such interface exists, create a new one
-
find_unused_port(switch)[source]
Find a switch’s unused port; if no such port exists, create a new one
-
live_links[source]
-
migrate_host(old_ingress_dpid, old_ingress_portno, new_ingress_dpid, new_ingress_portno)[source]
Migrate the host from the old (ingress switch, port) to the new
(ingress switch, port). Note that the new port must not already be
present, otherwise an exception will be thrown (we treat all switches as
configurable software switches for convenience, rather than hardware switches
with a fixed number of ports)
-
network_links[source]
-
port_connected(port)[source]
Return whether the port is currently connected to anything
-
remove_access_link(host, switch)[source]
Remove an access link between a host and a switch
-
remove_network_link(from_switch, to_switch)[source]
Remove a unidirectional network (internal) link between two switches
-
repair_link(link)[source]
-
sever_link(link)[source]
-
class sts.topology.MeshTopology(num_switches=3, create_io_worker=None, netns_hosts=False, gui=False)[source]
Bases: sts.topology.Topology
-
class FullyMeshedLinks(dpid2switch, access_links=[])[source]
Bases: sts.topology.LinkTracker
A factory method (inner class) for creating a fully meshed network.
Connects every pair of switches. Ports are in ascending order of
the dpid of connected switch, while skipping the self-connections.
I.e., for (dpid, portno):
(0, 0) <-> (1,0)
(2, 1) <-> (1,1)
-
__init__(dpid2switch, access_links=[])[source]
-
MeshTopology.__init__(num_switches=3, create_io_worker=None, netns_hosts=False, gui=False)[source]
Populate the topology as a mesh of switches, connect the switches
to the controllers
- Optional argument(s):
- num_switches. The total number of switches to include in the mesh
- netns_switches. Whether to create network namespace hosts instead of
normal hosts.
-
class sts.topology.PatchPanel(switches, hosts, connected_port_mapping)[source]
Bases: object
A Patch panel. Contains a bunch of wires to forward packets between switches.
Listens to the SwitchDPPacketOut event on the switches.
-
__init__(switches, hosts, connected_port_mapping)[source]
- Constructor
-
-
deliver_packet(host, packet, host_interface)[source]
Deliver the packet to its final destination
-
forward_packet(next_switch, packet, next_port)[source]
Forward the packet to the given port
-
get_connected_port(node, port)[source]
-
handle_DpPacketOut(event)[source]
-
class sts.topology.Topology(create_io_worker=None, gui=False)[source]
Bases: object
Abstract base class of all topology types. Wraps the edges and vertices of
the network.
-
__init__(create_io_worker=None, gui=False)[source]
-
access_links[source]
-
block_connection(connection)[source]
-
blocked_controller_connections[source]
-
connect_to_controllers(controller_info_list, create_connection)[source]
Bind sockets from the software_switchs to the controllers. For now, assign each
switch to the next controller in the list in a round robin fashion.
- Controller info list is a list of ControllerConfig tuples
- create_io_worker is a factory method for creating IOWorker objects.
Takes a socket as a parameter
- create_connection is a factory method for creating Connection objects
which are connected to controllers. Takes a ControllerConfig object
as a parameter
-
crash_switch(software_switch)[source]
-
create_access_link(host, interface, switch, port)[source]
-
create_host(ingress_switch_or_switches, mac_or_macs=None, ip_or_ips=None, get_switch_port=<function get_switchs_host_port at 0x403f5f0>)[source]
Create a host, register it in the topology, and wire it to the given switch(es)
-
create_network_link(from_switch, from_port, to_switch, to_port)[source]
-
create_switch(switch_id, num_ports, can_connect_to_endhosts=True)[source]
Create a switch and register it in the topology
-
cut_links[source]
-
get_host(hid)[source]
-
get_link(dpid1, dpid2)[source]
-
get_switch(dpid)[source]
-
hosts[source]
-
live_edge_switches[source]
Return the software_switchs which are currently up and can connect to
hosts
-
live_links[source]
-
live_switches[source]
Return the software_switchs which are currently up
-
migrate_host(old_ingress_dpid, old_ingress_portno, new_ingress_dpid, new_ingress_portno)[source]
-
network_links[source]
-
ok_to_send(dp_event)[source]
Return True if it is ok to send the dp_event arg
-
static populate_from_topology(graph)[source]
Take a pox.lib.graph.graph.Graph and generate arguments needed for the
simulator
-
recover_switch(software_switch, down_controller_ids=None)[source]
-
remove_access_link(host, switch)[source]
-
remove_host(host)[source]
Remove a host and all associated access links
-
remove_network_link(from_switch, to_switch)[source]
-
remove_switch(switch)[source]
Remove a switch, along with all associated links and any dangling
hosts previously attached
-
repair_link(link)[source]
-
reset()[source]
Reset topology without new controllers
-
sever_link(link)[source]
-
switches[source]
-
unblock_connection(connection)[source]
-
unblocked_controller_connections[source]
-
sts.topology.create_host(ingress_switch_or_switches, mac_or_macs=None, ip_or_ips=None, get_switch_port=<function get_switchs_host_port at 0x403f5f0>)[source]
Create a Host, wired up to the given ingress switches
-
sts.topology.create_netns_host(create_io_worker, ingress_switch, ip_addr_str='', get_switch_port=<function get_switchs_host_port at 0x403f5f0>, cmd='xterm')[source]
Create a host with a process running in a separate network namespace.
The netns can only communicate with a single interface (for now) because it must
correspond to the physical interface in the network namespace guest.
Because there is only 1 logical interface possible, this means that there can only be
1 switch as well.
- ip_addr_str must be a string! not a IpAddr object
-
sts.topology.create_switch(switch_id, num_ports, can_connect_to_endhosts=True)[source]
-
sts.topology.get_switchs_host_port(switch)[source]
Return the switch’s ofp_phy_port connected to the host