We know that in the Netty architecture, a serverbootstrap used to generate a channel on the server side requires a channelpipelinefactory type of reference to serve the channel that establishes the connection, The pipeline processes requests from a client. So the openflowpipelinefactory here is floodlight to create the channelpipeline for the OpenFlow switch that establishes the connection.
1. Idlestatehandler a idlestateevent event when the channel does not run the corresponding read-write operation for a certain time;2. Readtimeouthandler read timeout processing;3. Handshaketimeouthandler Set a timer to check the status of the connection, the handshake phase. 4. Ofchannelhandler Core, handle all the business.
the code is as follows: Public classopenflowpipelinefactoryImplementsChannelpipelinefactory {
protectedControllerController ; protectedThreadpoolexecutorPipelineexecutor ; protectedTimerTimer; protectedIdlestatehandlerIdlehandler ; protectedReadtimeouthandlerReadtimeouthandler ; PublicOpenflowpipelinefactory (Controller controller,threadpoolexecutor Pipelineexecutor) { Super (); This .Controller= Controller; This .Pipelineexecutor= Pipelineexecutor; This .Timer = NewHashedwheeltimer (); This .Idlehandler = NewIdlestatehandler ( Timer , 0); This .Readtimeouthandler= NewReadtimeouthandler (Timer, (+ ); } @Override Publicchannelpipeline getpipeline ()throws Exception { ofchannelstate state =New ofchannelstate (); Channelpipeline pipeline = Channels. Pipeline ();Pipeline.addlast ("Ofmessagedecoder" , New Ofmessagedecoder ());Pipeline.addlast ("Ofmessageencoder" , NewOfmessageencoder ());Pipeline.addlast ("Idle" , Idlehandler);Pipeline.addlast ( "Timeout" , Readtimeouthandler);Pipeline.addlast ("Handshaketimeout" , New Handshaketimeouthandler (state, Timer,)); if (Pipelineexecutor!= NULL)Pipeline.addlast ( "Pipelineexecutor" , New Executionhandler ( Pipelineexecutor )); //ofchannelhandler is the core pipeline.addlast ( "Handler" , controller . Getchannelhandler (state)); return pipeline; }}
Copyright notice: This article blog original articles, blogs, without consent, may not be reproduced.
Floodlight in Channelpipeline Map