gui Package
gui Package
entities Module
Host, switch and link GUI entities that belong to the QGraphicsScene in TopologyView
-
class sts.gui.entities.GuiHost(graphics_scene, _id)[source]
Bases: sts.gui.entities.GuiNode
Interactive Host
-
mouseReleaseEvent(event)[source]
-
paint(painter, option, widget)[source]
-
class sts.gui.entities.GuiLink(graphics_scene, source_node, dest_node)[source]
Bases: PyQt4.QtGui.QGraphicsItem
Interactive Link
-
__init__(graphics_scene, source_node, dest_node)[source]
-
adjust()[source]
-
boundingRect()[source]
-
paint(painter, option, widget)[source]
-
class sts.gui.entities.GuiNode(graphics_scene, _id)[source]
Bases: PyQt4.QtGui.QGraphicsItem
- Abstract Interactive Node
- If switch, id = switch.dpid
If host, id = host.hid
-
__init__(graphics_scene, _id)[source]
-
addLink(link)[source]
-
boundingRect()[source]
-
hoverLeaveEvent(event)[source]
-
itemChange(change, value)[source]
-
links()[source]
-
mouseDoubleClickEvent(event)[source]
-
mousePressEvent(event)[source]
-
shape()[source]
-
class sts.gui.entities.GuiSwitch(graphics_scene, _id)[source]
Bases: sts.gui.entities.GuiNode
Interactive Switch
-
mouseReleaseEvent(event)[source]
- Popup menu contains:
- Add Link To –
Remove Link To –
Attach Host
Remove Host –
Remove Switch
-
paint(painter, option, widget)[source]
launcher Module
This file creates the GUI application window in a separate thread
-
class sts.gui.launcher.GuiWindow(sts_topology, syncPeriod=2.0, debugging=False)[source]
Bases: PyQt4.QtGui.QMainWindow
QMainWindow container for TopologyWidget
-
__init__(sts_topology, syncPeriod=2.0, debugging=False)[source]
-
center()[source]
-
class sts.gui.launcher.TopologyGui(sts_topology, syncPeriod=2.0, debugging=False)[source]
Invoked directly by the STS Topology class to launch a new GUI instance
-
__init__(sts_topology, syncPeriod=2.0, debugging=False)[source]
-
launch()[source]
-
class sts.gui.launcher.TopologyWidget(sts_topology, parent=None, syncPeriod=2.0, debugging=False)[source]
Bases: PyQt4.QtGui.QWidget
QWidget container for TopologyView
-
__init__(sts_topology, parent=None, syncPeriod=2.0, debugging=False)[source]
view Module
Graphical representation of STS topology switch, host and link entities
-
class sts.gui.view.STSSyncer(sts_topology, topology_view, sync_period=2.0, debugging=True)[source]
Container of Node and Link objects in GUI that periodically syncs with STS Topology
-
__init__(sts_topology, topology_view, sync_period=2.0, debugging=True)[source]
-
add_access_link(hid, dpid)[source]
Add and register an access link in GUI
-
add_host(hid, position=None)[source]
Add and register a host in GUI with the given hid and position
-
add_network_link(from_dpid, to_dpid)[source]
Add and register a unidirectional network link in GUI
-
add_switch(dpid, position=None)[source]
Add and register a switch in GUI with the given dpid and position
-
attach_host_to_switch(dpid)[source]
Create a host and attach it to the switch with the given dpid in both STS and GUI
-
create_network_link(from_dpid, to_dpid)[source]
Create a unidirectional network link in both STS and GUI
-
create_switch(dpid=None)[source]
Create a switch with the given dpid in both STS and GUI
-
debug(msg)[source]
-
deserialize_host(s)[source]
- Format Example:
- {“ingress_switch_dpids”:[1,3],
- “position”:(-60.0,20.0)}
-
deserialize_network_link(s)[source]
- Format Example:
- {“from_switch_dpid”:5,
- “to_switch_dpid”:3}
-
deserialize_switch(s)[source]
- Format Example:
- {“dpid”:5,
- “numports”:3
“position”:(-10.0,80.0)}
-
dpids[source]
-
get_sts_host(gui_host)[source]
Given a host in GUI, return the corresponding host in STS by hid
-
get_sts_switch(gui_switch)[source]
Given a switch in GUI, return the corresponding switch in STS by dpid
-
hids[source]
-
hosts[source]
-
links[source]
-
load_state()[source]
Load all JSON serialized entities of both the STS and GUI topologies from a file
Each line is in the format (type, serialized_entity):
“s” = switch
“h” = host
“l” = network link
Switches must be loaded first
-
remove_host(hid)[source]
Remove a host and all associated access links in both STS and GUI
-
remove_network_link(from_dpid, to_dpid)[source]
Remove a unidirectional network link in both STS and GUI
-
remove_switch(dpid)[source]
Remove a switch in both STS and GUI, along with all associated links and any
dangling hosts previously attached
-
reset()[source]
Reset GUI topology
-
save_state()[source]
Save all JSON serialized entities of both the STS and GUI topologies to a file
Each line is in the format (<entity type>, <serialized form>):
“s” = switch
“h” = host
“l” = network link
Access links need not be saved, because there is a one to one correspondence
between hosts and access links
-
serialize_host(gui_host, sts_host)[source]
- Format Example:
- {“ingress_switch_dpids”:[1,3],
- “position”:(-60.0,20.0)}
-
serialize_network_link(sts_link)[source]
- Format Example:
- {“from_switch_dpid”:5,
- “to_switch_dpid”:3}
-
serialize_switch(gui_switch, sts_switch)[source]
- Format Example:
- {“dpid”:5,
- “numports”:3
“position”:(-10.0,80.0)}
-
switches[source]
-
sync_with_sts()[source]
Resync all network elements if STS and GUI are persistently desynchronized
-
synced_with_sts()[source]
Return True if GUI and STS share the same map of nodes and links
-
toggle_debug_messages()[source]
-
class sts.gui.view.TopologyView(sts_topology, parent=None, sync_period=2.0, debugging=False)[source]
Bases: PyQt4.QtGui.QGraphicsView
QGraphicsView that provides a graphical representation of STS topology
-
__init__(sts_topology, parent=None, sync_period=2.0, debugging=False)[source]
-
mouseReleaseEvent(event)[source]
Show context menu when right-clicking on empty space on the scene.