Propagate port change to SDN controller via OF13
This change adds plumbing to propagate new logical port
additions up to the SDN contoller via OpenFlow.
Change-Id: Ic02586b096144c3697a0974ebbc8a7be8760bef8
diff --git a/ofagent/agent.py b/ofagent/agent.py
index cabcc6c..a60b7f7 100644
--- a/ofagent/agent.py
+++ b/ofagent/agent.py
@@ -25,7 +25,7 @@
from common.utils.asleep import asleep
from of_connection import OpenFlowConnection
from of_protocol_handler import OpenFlowProtocolHandler
-
+from ofagent.protos.openflow_13_pb2 import ChangeEvent
log = structlog.get_logger()
@@ -121,6 +121,14 @@
def forward_packet_in(self, ofp_packet_in):
self.proto_handler.forward_packet_in(ofp_packet_in)
+ def forward_change_event(self, event):
+ # assert isinstance(event, ChangeEvent)
+ log.info('got-change-event', change_event=event)
+ if event.HasField("port_status"):
+ self.proto_handler.forward_port_status(event.port_status)
+ else:
+ log.error('unknown-change-event', change_event=event)
+
if __name__ == '__main__':
"""Run this to test the agent for N concurrent sessions: