What you describe is easy.

Once the switch is *connected* to the controller, the controller can send it 
messages (flow-mods, etc.).  It doesn't need to be in response to a packet-in 
or anything else in particular.  It just needs to be connected.  As I 
previously mentioned, forwarding.hub sends a flow-mod in response to a 
ConnectionUp event *which is the earliest you could possibly send a message to 
a switch* since you can't send messages before you're connected.

You can also send messages not in response to an OpenFlow event by simply 
keeping your own reference to the Connection object, getting a reference from 
the OpenFlow nexus's .connections attribute (core.openflow.connections), or a 
couple of other ways (most or all of which are described in the sections of the 
manual I mentioned).

As for finding the appropriate Connection object to use, I would advise not 
using its IP address (or its MAC address as mentioned in your other post).  The 
most logical way to tell switches apart is via their datapath ID (DPID).  You 
can use the DPID with core.openflow.getConnection() or 
core.openflow.sendToDPID(), for example.  You *could* find a connection via IP 
address by, for example, enumerating the connections, and checking the peer 
name on its .sock attribute (as mentioned in the manual).

Hope that helps.

-- Murphy

On Mar 20, 2014, at 2:05 AM, Windhya Rankothge <windys...@gmail.com> wrote:

> Hi Murphy,
> 
> Thanks alot for the reply.. I read the POX manual and as I understood, once 
> the controller receive a packet from a switch, controller can use the 
> connection object of that switch and send a flow-mod message to that switch..
> But my requirement is, I want to send a flow-mod message to a specific 
> switch, where I know only the IP address of the switch..
> 
> For an example
> 
> h1 ---- s1 ---- s2 ---- s3 ---- h2
> 
> For this topology,
> 
> I want to install following flow-rules in s1,s2 and s3.. I have the IP 
> addresses of the switches..
> 
> In s1 : If packet comes from h1, forward it through port1
> In s2 : If packet comes from h1, forward it through port2
> In s3 : If packet comes from h1, forward it through port3
> 
> Highly appreciate your comments on this..
> 
> 
> 
> On Thu, Mar 20, 2014 at 8:21 AM, Murphy McCauley <murphy.mccau...@gmail.com> 
> wrote:
> There's nowhere in OpenFlow's flow-mod structure to specify the datapath.  
> It's just which datapath you send it to.  In POX, this means which Connection 
> object you use to send the message.  There's information relevant to your 
> question in the "OpenFlow in POX" section of the manual.  In particular, 
> there's a "Connection Objects" subsection at the beginning and then a 
> "Communicating with a Datapath" subsection later (these should probably be 
> merged).
> 
> As far as installing rules early, the best you can do is to set them as soon 
> as the switch connects to the controller -- in a ConnectionUp handler.  
> There's an example of this I think in forwarding.hub.
> 
> -- Murphy
> 
> On Mar 19, 2014, at 11:58 PM, Windhya Rankothge <windys...@gmail.com> wrote:
> 
> > Hi all,
> >
> > I want to send OFPFlowMod message to a specific switch from the 
> > controller.. I have read about OFPFlowMod message structure and saw that we 
> > can specify the datapath.. But I am not sure how I can use this datapath to 
> > specify the switch I want  to send the message.. Also I want to install 
> > rules on this specific switch before data packet transmission happen in the 
> > network..
> >
> > Highly appreciate your comments on this..
> >
> > Best Regards,
> >
> > Windhya Rankothge,
> > Universitat Pompeu Fabra,
> > Barcelona.
> 
> 
> 
> 
> -- 
> Best Regards,
>  
> Windhya Rankothge,
> Universitat Pompeu Fabra,
> Barcelona.

Reply via email to