-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path__init__.py
More file actions
54 lines (43 loc) · 1.39 KB
/
__init__.py
File metadata and controls
54 lines (43 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Ryu RESTful API abstraction
# Designed for ECE361 (University of Toronto) labs on SDN
"""
Pythonic interface for basic ovs-ofctl commands
Example workflow:
The equivalent of 'ovs-ofctl add-flow s1 in_port=1,actions=output:2'
Assume switch 's1' has datapath ID of 0x1
>>> import ryu-ofctl
>>> flow = ryu-ofctl.FlowEntry()
>>> act = ryu-ofctl.OutputAction(2)
>>>
>>> flow.in_port = 1
>>> flow.addAction(act)
>>>
>>> dpid = 0x1
>>> ryu-ofctl.insertFlow(dpid, flow)
The equivalent of 'ovs-ofctl del-flows s1 in_port=1'
>>> import ryu-ofctl
>>> flow = ryu-ofctl.FlowEntry()
>>>
>>> flow.in_port = 1
>>>
>>> dpid = 0x1
>>> ryu-ofctl.deleteFlow(dpid, flow)
The equivalent of 'ovs-ofctl del-flows s1'
>>> import ryu-ofctl
>>>
>>> dpid = 0x1
>>> ryu-ofctl.deleteAllFlows(dpid)
"""
from ryu_client import insertFlow, deleteFlow, deleteAllFlows,\
listSwitches, listLinks, listSwitchLinks,\
getMacIngressPort, setRyuEndpoint
from flow_entry import FlowEntry, OutputAction
__version__ = '1.1.0'
__all__ = [
'insertFlow', 'deleteFlow', 'deleteAllFlows',
'listSwitches', 'listLinks', 'listSwitchLinks', 'getMacIngressPort',
'FlowEntry', 'OutputAction', 'setRyuEndpoint'
]
__author__ = 'Thomas Lin <t.lin@mail.utoronto.ca>'