No and no.

You should really ready pyswitch.py -- as I said, it does most of what you need 
already.  However, here's the start of an untested component that doesn't do 
anything except keep track of dpids:

from nox.lib.core import *

class mycomponent (Component):
  def __init__ (self, ctxt):
    Component.__init__(self, ctxt)
    self.dpids = set()
    self.register_for_datapath_join(self.handle_datapath_join)
    self.register_for_datapath_leave(self.handle_datapath_leave)

  def handle_datapath_join (self, dpid):
    self.dpids.add(dpid)

  def handle_datapath_leave (self, dpid):
    self.dpids.remove(dpid)

  def getInterface (self):
    return self.__class__.__name__

def getFactory ():
  class Factory:
    def instance (self, ctxt):
      return mycomponent(ctxt)

  return Factory()

Good luck.

-- Murphy

P.S., I am assuming you're dropping the CC to the mailing list by accident.  
Please be sure to "reply all".

On Jul 24, 2011, at 3:33 AM, ali ahmad wrote:
<Off list>
> Subject: Re: [nox-dev] how to manage multiple switches with the help of NOX 
> controller
> From: jam...@nau.edu
> Date: Sun, 24 Jul 2011 03:25:54 -0700
> CC: nox-dev@noxrepo.org
> To: aliahmad...@hotmail.com
> 
> NOX comes with a number of components which implement different pieces of 
> functionality, and topology is one example of such.  For some more 
> information, see the wiki: 
> http://noxrepo.org/noxwiki/index.php/NOX_Components .  For an example of 
> using the topology component from Python, see the flowtracer component.
> 
> But skipping the topology component for now and keeping your own list of of 
> dpids might be more approachable for the moment.  pyswitch actually 
> demonstrates setting up callbacks for the datapath_join and datapath_leave 
> events.  All you need to do is write handlers that actually keep track of 
> dpids (by adding and removing them from a Python set would be my suggestion). 
>  This is only a handful of lines of code.
> 
> -- Murphy
> 
> On Jul 24, 2011, at 3:09 AM, ali ahmad wrote:
> <Off list>
> Subject: Re: [nox-dev] how to manage multiple switches with the help of NOX 
> controller
> From: jam...@nau.edu
> Date: Sun, 24 Jul 2011 02:53:44 -0700
> CC: nox-dev@noxrepo.org
> To: aliahmad...@hotmail.com
> 
> If you want to do it yourself, just monitor datapath_join events.  These are 
> fired whenever a switch connects, and the event object holds the dpid of the 
> switch.  Store these in a list.
> 
> Or you can just make use of the topology component, which does pretty much 
> exactly this (along with some other stuff), and then has a method to get a 
> list of all connected switches.
> 
> Hope that helps.
> -- Murphy
> 
> On Jul 23, 2011, at 11:04 PM, ali ahmad wrote:
> 
> hi!
>  i am using multiple switches with a single controller than  if i want
> to flood the message at all the ports of all the switches than how would i 
> know
> that what are the dpids of the switches. like i have to call this fuction to 
> flood the message
> on all the switches.
> 
>  def send_openflow(self, dp_id, buffer_id, packet, actions,
>                       inport=openflow.OFPP_CONTROLLER):
>         """
>         Sends an openflow packet to a datapath.
> 
>         This function is a convenient wrapper for send_openflow_packet
>         and send_openflow_buffer for situations where it is unknown in
>         advance whether the packet to be sent is buffered.  If
>         'buffer_id' is -1, it sends 'packet'; otherwise, it sends the
>         buffer represented by 'buffer_id'.
> 
>         dp_id - datapath to send packet to
>         buffer_id - id of buffer to send out
>         packet - data to put in openflow packet
>         actions - list of actions or dp port to send out of
>         inport - dp port to mark as source (defaults to Controller
>                  port)
> _______________________________________________
> nox-dev mailing list
> nox-dev@noxrepo.org
> http://noxrepo.org/mailman/listinfo/nox-dev
> 
> 
> 
> 

_______________________________________________
nox-dev mailing list
nox-dev@noxrepo.org
http://noxrepo.org/mailman/listinfo/nox-dev

Reply via email to