Thanks Murphy.. It worked correctly..

On Wed, May 29, 2013 at 12:52 PM, Murphy McCauley <murphy.mccau...@gmail.com
> wrote:

> I'd say the right way to do it is to remove the event listeners set by one
> component, and then set them up using the other.  l2_multi wasn't really
> written with this in mind so it'd take a bit of tweaking to make it happen.
>  If you were really inclined to do so, I think the easiest way would be to
> add a boolean enable/disable flag to the l2_multi class and to your version
> of it.  Then have an if statement in l2_multi._handle_ConnectionUp (and
> your own class's version) that uses the flag to decide whether it should
> actually call sw.connect().  When you want to switch between components,
> toggle the enabled flags, then iterate through all active connections,
> calling disconnect() on the switches of the old component and connect() on
> the switches of the new component.
>
> I think there may be a far, far easier way to go about this, though.  It
> seems like the only thing you should need to change is _get_path() or
> _get_raw_path() or _calc_paths().  I'd just swap the function at runtime.
>  For example, if you put a modified _get_path() in ext/longestpath.py, you
> could do something like...
>
> ./pox.py forwarding.l2_multi openflow.discovery py
>
> This will load up l2_multi and then give a Python interpreter.  You can
> swap the functions from the interpreter...
> POX> import pox.forwarding.l2_multi as l2m
> POX> shortest = l2m._get_path
> POX> import ext.longestpath
> POX> l2m._get_path = ext.longestpath._get_path
>
> You can switch back to shortest again by doing:
> POX> l2m._get_path = shortest
>
> When you switch, you'll have to wait for existing flows to time out, or
> send a flow_mod to each connection to delete them (iterate over
> core.openflow.connections).  You might want to wrap that and the other
> commands above into a quick little toggle function, which you could then
> add to the interactive prompt.  The component would looks something like:
>
> import pox.forwarding.l2_multi as l2m
>
> _orig_get_path = l2m._get_path
>
> def _my_get_path (...):
>   ...
>   Your longest path code here
>   ...
>
> def toggle ():
>   if l2m._get_path is _orig_get_path:
>     l2m._get_path = _my_get_path
>   else:
>     l2m._get_path = _orig_get_path
>
> def launch ():
>   core.Interactive.variables['toggle'] = toggle
>
> Then you can just do toggle() from the POX prompt to switch.
>
> Hope that helps.
>
> (Excuse bugs in the above code; none of it is tested.)
>
> -- Murphy
>
> On May 29, 2013, at 3:13 AM, Windhya Rankothge wrote:
>
> >
> > Hi,
> >
> > I am soory if this is a stupid question, but I am new to POX and even
> though i searched in internet i could not find an answer..
> >
> > I am using two component files : l2_multi.py component which will send
> traffic using shortest path.. and l2_multi_edited.py which will send
> traffic using longest path..
> >
> > I create a topoligy in mininet and start the POX with l2_multi.py
> component which will send traffic using shortest path..
> >
> > after sometime I want to change the componet to l2_multi_edited.py
> without restarting POX, so that  traffic will be send with longest path..
> >
> > how can I do this ? Please be kind enough to help me
> >
> >
> > Best Regards,
> >
> > Windhya Rankothge....
>
>


-- 
Best Regards,

Windhya Rankothge..... (WINDY)

Reply via email to