Hi

On 2014年08月04日 23:51, Sujit Pandey wrote:
> Hello,
> I am sujit Pandey intern at orange lab. I am doing MPLS implementation and I 
> am using ryu conroller. I have few question regarding the switch 
> configuration:
> I am using the simple_switch13_stp.py and switches.py from topology.
> I cannot load these two file in my another apps. Because they are using 
> _context. my question is how to inherit a class that has context. for example 
> when I inherit a class simple_switch13_stp to some app containing -context 
> switch I got an error.
> 
> from ryu.base import app_manager
> import os
> from ryu.simple_switch13_stp import SimpleSwitch13
> from ryu.controller import ofp_event
> from ryu.controller.handler import MAIN_DISPATCHER
> from ryu.controller.handler import CONFIG_DISPATCHER
> from ryu.controller.handler import set_ev_cls
> from ryu.topology.switches import Switches,PortDataState,LinkState
> #from ryu.topology.api import get_switch, get_link
> from ryu.lib import stplib
> from ryu.lib.packet import packet
> from ryu.lib.packet import ethernet
> from ryu.topology.api import get_switch, get_link
> 
> 
> 
> 
> class topotester(SimpleSwitch13):
>     _CONTEXT='switches': switches.Switches
>    

_CONTEXT is "dictionary" Object.
If you wants to add "switches.Switches" class to _CONTEXT,
how about this?

-----
class topotester(SimpleSwitch13):
    _CONTEXTS = {'stplib': stplib.Stp,
                 'switches': Switches}
-----

>    
>     def __init__(self, *args, **kwargs):
>          #super(topotester, self).__init__(*args, **kwargs)
>          super(topotester, self).__init__(*args, **kwargs)        
>  and got an error
>     self.stp = kwargs['stplib']
> KeyError: 'stplib'
> where simple_switch13_stp.py has another context like
> 
> class SimpleSwitch13(app_manager.RyuApp):
>     OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION]
>    
>     _CONTEXTS = {'stplib': stplib.Stp}
> 
> please give me some idea.
> -- 
> Best regards
> 
> Sujit Pandey
> 
> 
> ------------------------------------------------------------------------------
> Infragistics Professional
> Build stunning WinForms apps today!
> Reboot your WinForms applications with our WinForms controls. 
> Build a bridge from your legacy apps to the future.
> http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
> 
> 
> 
> _______________________________________________
> Ryu-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
> 

------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to