Packet in/out streaming from ofagent to core
Getting ready for packet streaming
Change-Id: I8d70d4d6ffbb23c0d7ab20582e9afac49f9f6461
Support flow_delete_strict
Change-Id: I5dab5f74a7daddcddfeb8691a3940347cb2fc11b
Packet out halfway plumbed
Change-Id: I799d3f59d42ac9de0563b5e6b9a0064fd895a6f6
refactored async_twisted
Change-Id: I68f8d12ce6fdbb70cee398f581669529b567d94d
Packet in pipeline and ofagent refactoring
Change-Id: I31ecbf7d52fdd18c3884b8d1870f673488f808df
diff --git a/ofagent/of_protocol_handler.py b/ofagent/of_protocol_handler.py
index a74f205..e109782 100644
--- a/ofagent/of_protocol_handler.py
+++ b/ofagent/of_protocol_handler.py
@@ -27,7 +27,7 @@
class OpenFlowProtocolHandler(object):
- def __init__(self, datapath_id, agent, cxn, rpc):
+ def __init__(self, datapath_id, device_id, agent, cxn, rpc):
"""
The upper half of the OpenFlow protocol, focusing on message
exchanges.
@@ -38,6 +38,7 @@
are made as result of processing incoming OpenFlow request messages.
"""
self.datapath_id = datapath_id
+ self.device_id = device_id
self.agent = agent
self.cxn = cxn
self.rpc = rpc
@@ -71,7 +72,7 @@
@inlineCallbacks
def handle_feature_request(self, req):
- device_info = yield self.rpc.get_device_info(self.datapath_id)
+ device_info = yield self.rpc.get_device_info(self.device_id)
kw = pb2dict(device_info.switch_features)
self.cxn.send(ofp.message.features_reply(
xid=req.xid,
@@ -95,7 +96,7 @@
@inlineCallbacks
def handle_flow_mod_request(self, req):
- yield self.rpc.update_flow_table(self.datapath_id, to_grpc(req))
+ yield self.rpc.update_flow_table(self.device_id, to_grpc(req))
def handle_get_async_request(self, req):
raise NotImplementedError()
@@ -108,7 +109,7 @@
@inlineCallbacks
def handle_group_mod_request(self, req):
- yield self.rpc.update_group_table(self.datapath_id, to_grpc(req))
+ yield self.rpc.update_group_table(self.device_id, to_grpc(req))
def handle_meter_mod_request(self, req):
raise NotImplementedError()
@@ -121,8 +122,7 @@
xid=req.xid, role=req.role, generation_id=req.generation_id))
def handle_packet_out_request(self, req):
- # TODO send packet out
- pass
+ self.rpc.send_packet_out(self.device_id, to_grpc(req))
def handle_set_config_request(self, req):
# TODO ignore for now
@@ -145,7 +145,7 @@
@inlineCallbacks
def handle_device_description_request(self, req):
- device_info = yield self.rpc.get_device_info(self.datapath_id)
+ device_info = yield self.rpc.get_device_info(self.device_id)
kw = pb2dict(device_info.desc)
self.cxn.send(ofp.message.desc_stats_reply(xid=req.xid, **kw))
@@ -154,13 +154,13 @@
@inlineCallbacks
def handle_flow_stats_request(self, req):
- flow_stats = yield self.rpc.list_flows(self.datapath_id)
+ flow_stats = yield self.rpc.list_flows(self.device_id)
self.cxn.send(ofp.message.flow_stats_reply(
xid=req.xid, entries=[to_loxi(f) for f in flow_stats]))
@inlineCallbacks
def handle_group_stats_request(self, req):
- group_stats = yield self.rpc.list_groups(self.datapath_id)
+ group_stats = yield self.rpc.list_groups(self.device_id)
self.cxn.send(ofp.message.group_stats_reply(
xid=req.xid, entries=[to_loxi(g) for g in group_stats]))
@@ -190,7 +190,7 @@
@inlineCallbacks
def handle_port_desc_request(self, req):
- port_list = yield self.rpc.get_port_list(self.datapath_id)
+ port_list = yield self.rpc.get_port_list(self.device_id)
self.cxn.send(ofp.message.port_desc_stats_reply(
xid=req.xid,
#flags=None,
@@ -246,3 +246,5 @@
ofp.OFPT_TABLE_MOD: handle_table_mod_request,
}
+ def forward_packet_in(self, ofp_packet_in):
+ self.cxn.send(to_loxi(ofp_packet_in))