Re: [nox-dev] how to manage multiple switches with the help of NOX controller

2011-07-25 Thread ali ahmad

Thanks for the answers

Subject: Re: [nox-dev] how to manage multiple switches with the help of NOX 
controller
From: jam...@nau.edu
Date: Mon, 25 Jul 2011 00:10:28 -0700
CC: nox-dev@noxrepo.org
To: aliahmad...@hotmail.com



Responses in-line.
On Jul 24, 2011, at 9:29 PM, ali ahmad wrote:
This is what i got, u want to say that its an event whenever the switches get 
connected to controller , their dpids are recorded at that time. So, now 
whenever this event occurs it will be handled by the function you hv defined as
def handle_datapath_join (self, dpid):self.dpids.add(dpid)
it will save all the dpids in the list u hv defined as   self.dpids = set()
I have two queries (sorry basic coding questions)1) datapath-join is a .hh file 
instead of writing its actual name in the argument u hv written 
handle_datapath_join, does this matter? 
handle_datapath_join is a method on the mycomponent class which I defined.  I 
can name it whatever I want.  I set this method as a callback to handle the 
datapath_join event by using the register_for_datapath_join method inherited 
from the component superclass (defined in core.py, if I recall correctly).  
This method takes care of using the correct name.  You can read the 
documentation or code in core.py for some more info.  But that's all there is 
to it.  The .hh files don't directly matter when you're working in Python.  
Reading core.py and the Python examples (and maybe the .i files) is probably 
going to be way more useful to you than reading the C++ files.  In more 
practical terms: The code I gave works the way it is (mod the bug I mentioned 
-- it should actually be "def handle_datapath_join (self, dpid, attrs):").
2)dpids scope is just inside the function def handle_datapath_join (self, 
dpid):?   actually i want to use it inside other function as well
The scope of the dpid argument to the method may only exist inside that 
handler, but I am putting it into the self.dpids set.  dpids is a field on 
mycomponent -- its scope is the entire object.  From any method in mycomponent, 
you can access self.dpids.  If you save a reference to the mycomponent object 
(for example, pyswitch does this by saving self to a global variable called 
"inst" inside the __init__ method), you can access it from outside the object 
as well.   
-- Murphy

At last, thanks a lot ,ur help was a great support in the progress of my work.
Subject: Re: [nox-dev] how to manage multiple switches with the help of NOX 
controller
From: jam...@nau.edu
Date: Sun, 24 Jul 2011 12:34:06 -0700
CC: nox-dev@noxrepo.org
To: aliahmad...@hotmail.com

The arguments the register functions are callbacks to be called when the 
corresponding events occur.  In the case of my example program, these are two 
methods implemented on mycomponent (handle_datapath_join).  The docstring for 
register_for_datapath_join (in core.py) has more info:
def register_for_datapath_join(self, handler):
Register a handler for a datapath join event.
The handler will be called with: handler(dpid, attrs).'dpid' is the datapath id 
of the switch'attrs' is a dictionary with the following keys:
N_BUFFERS, N_TABLES, CAPABILITIES, ACTIONS, PORTS
The PORTS value is a list of port dictionaries where eachdictionary has the 
keys listed in the register_for_port_statusdocumentation.

Note that this makes apparent a bug in my example program.  
handle_datapath_join() should have a second parameter ("attrs").
-- Murphy
On Jul 24, 2011, at 5:04 AM, ali ahmad wrote:thnks a lot but I am really sorry 
for bothering u again and again but it would be kind of u if u just tell me 
that what are these arguments inside the functions u hv inialized 
self.register_for_datapath_join(self.handle_datapath_join)
self.register_for_datapath_leave(self.handle_datapath_leave)Subject: Re: 
[nox-dev] how to manage multiple switches with the help of NOX controller
From: jam...@nau.edu
Date: Sun, 24 Jul 2011 04:39:40 -0700
CC: nox-dev@noxrepo.org
To: aliahmad...@hotmail.com

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

Re: [nox-dev] how to manage multiple switches with the help of NOX controller

2011-07-25 Thread Murphy McCauley
Responses in-line.

On Jul 24, 2011, at 9:29 PM, ali ahmad wrote:

> 
> This is what i got, u want to say that its an event whenever the switches get 
> connected to controller , their dpids are recorded at that time. So, now 
> whenever this event occurs it will be handled by the function you hv defined 
> as
> 
> def handle_datapath_join (self, dpid):
> self.dpids.add(dpid)
> 
> it will save all the dpids in the list u hv defined as
>self.dpids = set()
> 
> I have two queries (sorry basic coding questions)
> 1) datapath-join is a .hh file instead of writing its actual name in the 
> argument u hv written handle_datapath_join, does this matter? 

handle_datapath_join is a method on the mycomponent class which I defined.  I 
can name it whatever I want.  I set this method as a callback to handle the 
datapath_join event by using the register_for_datapath_join method inherited 
from the component superclass (defined in core.py, if I recall correctly).  
This method takes care of using the correct name.  You can read the 
documentation or code in core.py for some more info.  But that's all there is 
to it.  The .hh files don't directly matter when you're working in Python.  
Reading core.py and the Python examples (and maybe the .i files) is probably 
going to be way more useful to you than reading the C++ files.  In more 
practical terms: The code I gave works the way it is (mod the bug I mentioned 
-- it should actually be "def handle_datapath_join (self, dpid, attrs):").

> 2)dpids scope is just inside the function def handle_datapath_join (self, 
> dpid):?
>actually i want to use it inside other function as well

The scope of the dpid argument to the method may only exist inside that 
handler, but I am putting it into the self.dpids set.  dpids is a field on 
mycomponent -- its scope is the entire object.  From any method in mycomponent, 
you can access self.dpids.  If you save a reference to the mycomponent object 
(for example, pyswitch does this by saving self to a global variable called 
"inst" inside the __init__ method), you can access it from outside the object 
as well.   

-- Murphy

> 
> At last, thanks a lot ,ur help was a great support in the progress of my work.
> 
> Subject: Re: [nox-dev] how to manage multiple switches with the help of NOX 
> controller
> From: jam...@nau.edu
> Date: Sun, 24 Jul 2011 12:34:06 -0700
> CC: nox-dev@noxrepo.org
> To: aliahmad...@hotmail.com
> 
> The arguments the register functions are callbacks to be called when the 
> corresponding events occur.  In the case of my example program, these are two 
> methods implemented on mycomponent (handle_datapath_join).  The docstring for 
> register_for_datapath_join (in core.py) has more info:
> 
> def register_for_datapath_join(self, handler):
> 
> Register a handler for a datapath join event.
> 
> The handler will be called with: handler(dpid, attrs).
> 'dpid' is the datapath id of the switch
> 'attrs' is a dictionary with the following keys:
> 
> N_BUFFERS, N_TABLES, CAPABILITIES, ACTIONS, PORTS
> 
> The PORTS value is a list of port dictionaries where each
> dictionary has the keys listed in the register_for_port_status
> documentation.
> 
> 
> Note that this makes apparent a bug in my example program.  
> handle_datapath_join() should have a second parameter ("attrs").
> 
> -- Murphy
> 
> On Jul 24, 2011, at 5:04 AM, ali ahmad wrote:
> 
> thnks a lot but I am really sorry for bothering u again and again but it 
> would be kind of u if u just tell me that what are these arguments inside the 
> functions u hv inialized
>  self.register_for_datapath_join(self.handle_datapath_join)
> self.register_for_datapath_leave(self.handle_datapath_leave)
> Subject: Re: [nox-dev] how to manage multiple switches with the help of NOX 
> controller
> From: jam...@nau.edu
> Date: Sun, 24 Jul 2011 04:39:40 -0700
> CC: nox-dev@noxrepo.org
> To: aliahmad...@hotmail.com
> 
> 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.__c

Re: [nox-dev] how to manage multiple switches with the help of NOX controller

2011-07-24 Thread ali ahmad


This is what i got, u want to say that its an event whenever the switches get 
connected to controller , their dpids are recorded at that time. So, now 
whenever this event occurs it will be handled by the function you hv defined as
def handle_datapath_join (self, dpid):self.dpids.add(dpid)
it will save all the dpids in the list u hv defined as   self.dpids = set()
I have two queries (sorry basic coding questions)1) datapath-join is a .hh file 
instead of writing its actual name in the argument u hv written 
handle_datapath_join, does this matter? 2)dpids scope is just inside the 
function def handle_datapath_join (self, dpid):?   actually i want to use it 
inside other function as well
At last, thanks a lot ,ur help was a great support in the progress of my work.
Subject: Re: [nox-dev] how to manage multiple switches with the help of NOX 
controller
From: jam...@nau.edu
Date: Sun, 24 Jul 2011 12:34:06 -0700
CC: nox-dev@noxrepo.org
To: aliahmad...@hotmail.com



The arguments the register functions are callbacks to be called when the 
corresponding events occur.  In the case of my example program, these are two 
methods implemented on mycomponent (handle_datapath_join).  The docstring for 
register_for_datapath_join (in core.py) has more info:
def register_for_datapath_join(self, handler):
Register a handler for a datapath join event.
The handler will be called with: handler(dpid, attrs).'dpid' is the datapath id 
of the switch'attrs' is a dictionary with the following keys:
N_BUFFERS, N_TABLES, CAPABILITIES, ACTIONS, PORTS
The PORTS value is a list of port dictionaries where eachdictionary has the 
keys listed in the register_for_port_statusdocumentation.

Note that this makes apparent a bug in my example program.  
handle_datapath_join() should have a second parameter ("attrs").
-- Murphy
On Jul 24, 2011, at 5:04 AM, ali ahmad wrote:thnks a lot but I am really sorry 
for bothering u again and again but it would be kind of u if u just tell me 
that what are these arguments inside the functions u hv inialized 
self.register_for_datapath_join(self.handle_datapath_join)
self.register_for_datapath_leave(self.handle_datapath_leave)Subject: Re: 
[nox-dev] how to manage multiple switches with the help of NOX controller
From: jam...@nau.edu
Date: Sun, 24 Jul 2011 04:39:40 -0700
CC: nox-dev@noxrepo.org
To: aliahmad...@hotmail.com

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: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: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, 201

Re: [nox-dev] how to manage multiple switches with the help of NOX controller

2011-07-24 Thread Murphy McCauley
The arguments the register functions are callbacks to be called when the 
corresponding events occur.  In the case of my example program, these are two 
methods implemented on mycomponent (handle_datapath_join).  The docstring for 
register_for_datapath_join (in core.py) has more info:

def register_for_datapath_join(self, handler):

Register a handler for a datapath join event.

The handler will be called with: handler(dpid, attrs).
'dpid' is the datapath id of the switch
'attrs' is a dictionary with the following keys:

N_BUFFERS, N_TABLES, CAPABILITIES, ACTIONS, PORTS

The PORTS value is a list of port dictionaries where each
dictionary has the keys listed in the register_for_port_status
documentation.


Note that this makes apparent a bug in my example program.  
handle_datapath_join() should have a second parameter ("attrs").

-- Murphy

On Jul 24, 2011, at 5:04 AM, ali ahmad wrote:

> thnks a lot but I am really sorry for bothering u again and again but it 
> would be kind of u if u just tell me that what are these arguments inside the 
> functions u hv inialized
>  self.register_for_datapath_join(self.handle_datapath_join)
> self.register_for_datapath_leave(self.handle_datapath_leave)
> Subject: Re: [nox-dev] how to manage multiple switches with the help of NOX 
> controller
> From: jam...@nau.edu
> Date: Sun, 24 Jul 2011 04:39:40 -0700
> CC: nox-dev@noxrepo.org
> To: aliahmad...@hotmail.com
> 
> 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:
> 
> 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:
> 
> 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=ope

Re: [nox-dev] how to manage multiple switches with the help of NOX controller

2011-07-24 Thread ali ahmad

thnks a lot but I am really sorry for bothering u again and again but it would 
be kind of u if u just tell me that what are these arguments inside the 
functions u hv inialized 
self.register_for_datapath_join(self.handle_datapath_join)
self.register_for_datapath_leave(self.handle_datapath_leave)Subject: Re: 
[nox-dev] how to manage multiple switches with the help of NOX controller
From: jam...@nau.edu
Date: Sun, 24 Jul 2011 04:39:40 -0700
CC: nox-dev@noxrepo.org
To: aliahmad...@hotmail.com



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: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: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 wantto flood the message at all the ports 
of all the switches than how would i knowthat what are the dpids of the 
switches. like i have to call this fuction to flood the messageon 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 inadvance 
whether the packet to be sent is buffered.  If'buffer_id' is -1, it 
sends 'packet'; otherwise, it sends thebuffer represented by 
'buffer_id'.
dp_id - datapath to send packet tobuffer_id - id of buffer to 
send outpacket - data to put in openflow packetactions - list 
of actions or dp port to send out ofinport - 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


Re: [nox-dev] how to manage multiple switches with the help of NOX controller

2011-07-24 Thread Murphy McCauley
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:

> 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:
> 
> 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


Re: [nox-dev] how to manage multiple switches with the help of NOX controller

2011-07-24 Thread Murphy McCauley
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:

> 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


Re: [nox-dev] how to manage multiple switches with the help of NOX controller

2011-07-24 Thread Murphy McCauley
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