Re: [Ryu-devel] Application specific settings

2016-09-16 Thread Nick Sedelnikov
Hi,

Thank you for reply, but both methods lead to sources rewriting and app
will break on ryu updates, so for now I wrote config loader and hard-coded
locations, where it can be placed.

Nick

чт, 15 сент. 2016 г. в 11:00, Shinpei Muraoka :

> Hi,
>
> Ryu config must be set when ryu-manager to start.
> Please try following either method.
>
>   - Add config to ryu/ryu/flags.py
>   - Include your app to ryu/ryu/cmd/manager.py
>
> Thanks,
>
> On 2016年09月14日 23:38, Nick Sedelnikov wrote:
> > Hello all,
> >
> > I'm trying to add configuration flags for my ryu application.
> > I've copied some code from topology.switches to my app:
> >
> > from ryu import cfg
> >
> > CONF = cfg.CONF
> > CONF.register_cli_opts([
> > cfg.StrOpt('l7-config', default='', help='Forwarder config file.'),
> > ])
> >
> > but when I try to run `ryu-manager myapp`  Exception appears:
> >>> oslo_config.cfg.ArgsAlreadyParsedError: arguments already parsed:
> > cannot register CLI option
> >
> > Can anyone help me?
> >
> > Nick
> >
> >
> >
> --
> >
> >
> >
> > ___
> > Ryu-devel mailing list
> > Ryu-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/ryu-devel
> >
>
--
___
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel


Re: [Ryu-devel] Not able to install the RYU controller

2016-09-16 Thread Ajay Chopra
HI ,

Thank you Iwase .I have contacted the SDN Hub team for my issue I am in initial 
phase  of learning and understanding .
They have suggested few steps will try and see if it works .
 
-Aj

-Original Message-
From: Iwase Yusuke [mailto:iwase.yusu...@gmail.com] 
Sent: 16 September 2016 07:05
To: Ajay Chopra 
Cc: ryu-devel@lists.sourceforge.net; ntqua...@gmail.com; Jayavel Arumugam (IT 
Services), Noida 
Subject: Re: [Ryu-devel] Not able to install the RYU controller

Hi,

Sorry, I don't know about "all-in-one package from SDN Hub".
I can't guess what is the problem in this case.

It does not seem to be an official package of Ryu-devel and does not be 
maintained by Ryu-devel.

How about trying to contact to SDN Hub team?

Thanks,
Iwase


On 2016年09月15日 20:54, Ajay Chopra wrote:
> Hello Iwase ,
>
> I have got a all-in-one package from SDN Hub .
> I am trying to run the command  .
>
> cd /home/ubuntu/ryu && ./bin/ryu-manager --verbose 
> ryu/app/simple_switch_13.py
>
> Now in between running of this command it gets hanged ,can you let us know 
> what the issue with it .
>
> -Ajay
> -Original Message-
> From: Iwase Yusuke [mailto:iwase.yusu...@gmail.com]
> Sent: 30 August 2016 13:14
> To: Ajay Chopra 
> Cc: ryu-devel@lists.sourceforge.net; Jayavel Arumugam (IT Services), 
> Noida ; ntqua...@gmail.com
> Subject: Re: [Ryu-devel] Not able to install the RYU controller
>
> Hi,
>
> I don't know much about the packages on RHEL and CentOS, though...
>
> You can install pip manually as follow.
> $ wget https://bootstrap.pypa.io/get-pip.py
> $ sudo python3.5 get-pip.py
>
> Thanks,
> Iwase
>
>
> On 2016年08月30日 16:30, Ajay Chopra wrote:
>> Hi,
>>
>> Iwase -ys ,usr/local/bin/python3.5: No module named pip .
>> But when I do -"sudo yum install git python-dev python-setuptools 
>> python-pip" , it shows
>>  -Package python-setuptools-0.6.10-3.el6.noarch already installed and 
>> latest version
>>  -No package python-pip available.
>>  -Nothing to do
>>
>> So , I need to install which version of setup-tools and where I need 
>> to copy it so that it can be picked by the python script.
>>
>> -Ajay
>> -Original Message-
>> From: Iwase Yusuke [mailto:iwase.yusu...@gmail.com]
>> Sent: 30 August 2016 12:42
>> To: Ajay Chopra 
>> Cc: ryu-devel@lists.sourceforge.net; Jayavel Arumugam (IT Services), 
>> Noida ; ntqua...@gmail.com
>> Subject: Re: [Ryu-devel] Not able to install the RYU controller
>>
>> Hi,
>>
>> If you have install Python3.5 and want to install Ryu to Python3.5, how 
>> about the following?
>>$ python3.5 -m pip setuptools
>>
>> If the output is:
>>/usr/bin/python3.5: No module named pip you need to install setuptools 
>> and pip into Python3.5 environment, first.
>>
>> Thanks,
>> Iwase
>>
>>
>> On 2016年08月30日 16:05, Ajay Chopra wrote:
>>> The python2.7 -m pip setuptools  command  shows  .
>>>
>>> /usr/local/bin/python2.7: No module named pip
>>>
>>> -Ajay
>>> -Original Message-
>>> From: Ajay Chopra
>>> Sent: 30 August 2016 12:33
>>> To: ryu-devel@lists.sourceforge.net
>>> Cc: ntqua...@gmail.com; Jayavel Arumugam (IT Services), Noida 
>>> 
>>> Subject: RE: [Ryu-devel] Not able to install the RYU controller
>>>
>>> I have installed the Python Version 3.5 When I do the python --version it 
>>> gives Python 3.5.0 .
>>>
>>> -Ajay
>>>
>>> -Original Message-
>>> From: Iwase Yusuke [mailto:iwase.yusu...@gmail.com]
>>> Sent: 30 August 2016 12:30
>>> To: Ajay Chopra 
>>> Cc: ryu-devel@lists.sourceforge.net; ntqua...@gmail.com; Jayavel 
>>> Arumugam (IT Services), Noida 
>>> Subject: Re: [Ryu-devel] Not able to install the RYU controller
>>>
>>> Hi,
>>>
 Location: /usr/lib/python2.6/site-packages
>>>
>>> This shows pip command still on python2.6.
>>> Ryu cannot be installed correctly on python2.6.
>>>
>>> Could you install python2.7 or python3.4+?
>>> How about the output of the following command?
>>>e.g.) with python2.7
>>>  $ python2.7 -m pip setuptools
>>>
>>> If not, I recommend to upgrade python version or use virtualenv to create 
>>> python2.7 or python3.4 environment.
>>>
>>> Thanks,
>>> Iwase
>>>
>>>
>>> On 2016年08月30日 15:43, Ajay Chopra wrote:
 Hello Iwase ,

 Getting the below message with command .

 I think its installed .

 Metadata-Version: 1.0
 Name: setuptools
 Version: 0.6rc11
 Summary: 
 Home-page: xxx
 Author: xxx
 Author-email: xxx
 License: xxx
 Location: /usr/lib/python2.6/site-packages
 Requires:
 Classifiers:

 -Ajay
 -Original Message-
 From: Iwase Yusuke [mailto:iwase.yusu...@gmail.com]
 Sent: 30 August 2016 12:10
 To: Ajay Chopra 
 Cc: ntqua...@gmail.com; ryu-devel@lists.sourceforge.net; Jayavel 
 Arumugam (IT Services), Noida 

Re: [Ryu-devel] [PATCH] Add Nicira extension vlan_tci field

2016-09-16 Thread FUJITA Tomonori
On Tue, 13 Sep 2016 16:04:37 +0900
IWAMOTO Toshihiro  wrote:

> This Nicira extension field is VLAN VID+CFI+PCP.
> OXM_OF_VLAN_VID and OXM_OF_VLAN_PCP should work fine in theory, but
> in OvS it seems vlan_tci must be used to access the CFI bit from
> NX_LEARN actions.
> 
> Signed-off-by: IWAMOTO Toshihiro 
> ---
>  ryu/ofproto/nicira_ext.py | 3 +++
>  1 file changed, 3 insertions(+)

Applied, thanks.

--
___
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel


Re: [Ryu-devel] Ryu app

2016-09-16 Thread Iwase Yusuke
Hi,

I think it depends on your application design.
I can not mention further about which is the better way...

FYI: If you want to just avoid the looped topology (by
blocking redundant port by STP), how about using STP
support of OVS as following?
e.g.) please enable STP support on your OVS
   sudo ovs-vsctl set Bridge s1 stp_enable=true

Certainly, Ryu can not control the port status (just
receiving the port status messages) in this case, but you
can avoid the looped topology at the switch side.

Thanks,
Iwase

On 2016年09月16日 03:42, Francesco Murador wrote:
> Sorry for this other question you're very polite to help me in all the 
> things. But i need to use dal_plugin with rest call or i can just do an 
> import to my application and simply use it?
>
> Inviato da iPhone
>
>> Il giorno 15/set/2016, alle ore 10:10, Iwase Yusuke 
>>  ha scritto:
>>
>> Hi,
>>
>> Sorry, I could not exactly understand what you want to do with your app...
>>
>> Your questions is
>> "How to instantiate another Ryu application in your Ryu application?",
>> right?
>>
>> If so, it might be difficult, I guess...
>> "Dynamic application loading" is discussed before, but seems to be not 
>> merged.
>> https://www.mail-archive.com/ryu-devel@lists.sourceforge.net/msg09857.html
>>
>> Thanks,
>> Iwase
>>
>>
>>> On 2016年09月14日 20:43, Francesco Murador wrote:
>>> i attach you my code and the assertion error that i have, so you can 
>>> understand
>>> what i'm doing port it's an istance of a port of a switch and where i sent 
>>> the
>>> signal of BLOCK of port or LEARN, FORWARD or something other. I hope you can
>>> help me i'm going crazy with that...and another question i have to send port
>>> request every 5 seconds or more how can i do that?
>>>
>>> Il giorno 13 set 2016 alle 03:20, Iwase Yusuke  ha 
>>> scritto:
>>>
 Hi,

 How about skipping the ofp event processing for the specific dpid
 at the top of each event handler?

 e.g.) If dpid is registered, do switch_features_handler, otherwise skip.
 $ git diff
 diff --git a/ryu/app/simple_switch_13.py b/ryu/app/simple_switch_13.py
 index 3e7c598..c8a9291 100644
 --- a/ryu/app/simple_switch_13.py
 +++ b/ryu/app/simple_switch_13.py
 @@ -30,8 +30,12 @@ class SimpleSwitch13(app_manager.RyuApp):
 super(SimpleSwitch13, self).__init__(*args, **kwargs)
 self.mac_to_port = {}

 + self.registered_dpids = [1, 2, 3] # specify the range of dpid
 +
 @set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
 def switch_features_handler(self, ev):
 + if ev.msg.datapath.id not in self.registered_dpids:
 + return
 datapath = ev.msg.datapath
 ofproto = datapath.ofproto
 parser = datapath.ofproto_parser


> On 2016年09月06日 18:47, Francesco Murador wrote:
> Hi i have a question...i need to start stplib when i check a thing how 
> can i
> start it? Not at the begin of my program with _CONTEXTS...i have to check 
> if
> some values in a switch are out of range if they aren't i need to start 
> the
> spanning tree because all i want is to block a dpid but if i don't block a
> dpid i have a topology with loops so normal simple_switch will not work 
> so i
> had to run the stplib
> --
> ___
> Ryu-devel mailing list
> Ryu-devel@lists.sourceforge.net 
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>>>
>>>
>>>
>>> --
>>>
>>>
>>>
>>> ___
>>> Ryu-devel mailing list
>>> Ryu-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>>>
>
> --
> ___
> Ryu-devel mailing list
> Ryu-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>

--
___
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel


[Ryu-devel] Request to help on python

2016-09-16 Thread Darvid William
Hi All

I am new to SDN and python. I want to start my learning on SDN with RYU
controller
May I request you guys to suggest the required topics in python I have to
be perfect so that I can understand the code clearly.

Any helpful links would be appreciated.

Thanks
William
--
___
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel


Re: [Ryu-devel] Get the mac address of all switches

2016-09-16 Thread Nick Sedelnikov
Alan,

I've checked this on simple application:
"""
from ryu.base import app_manager
from ryu.controller import ofp_event
from ryu.controller.dpset import DPSet
from ryu.controller.handler import MAIN_DISPATCHER, set_ev_cls
from ryu.ofproto import ofproto_v1_3


class MyApp(app_manager.RyuApp):
OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION]

_CONTEXTS = {'dpset': DPSet}

def __init__(self, *args, **kwargs):
super(MyApp, self).__init__(*args, **kwargs)
self.dpset = kwargs['dpset']

@set_ev_cls(ofp_event.EventOFPPacketIn, MAIN_DISPATCHER)
def on_packetin(self, ev):
switches = self.dpset.get_all()
mac_addresses = [(s[0],
s[1].ports[ofproto_v1_3.OFPP_LOCAL].hw_addr)
 for s in switches]
print("mac_addresses {}".format(mac_addresses))
"""

First I've started mn like this: `mn --topo=linear,2 --controller=remote`
Then I started `ryu-manager myapp --verbose`, and called `pingall` in mn.
On packetin i received:
>> EVENT ofp_event->MyApp EventOFPPacketIn
>> mac_addresses [(1, '3e:a1:63:df:fa:4e'), (2, '8e:8e:51:8f:df:47')]

Hope it helps.

If it still doesn't work check for correct switch registration by dpset -
there must be following lines in output (with --verbose flag set):
>> EVENT ofp_event->dpset EventOFPStateChange
>> DPSET: register datapath 


Nick

пт, 16 сент. 2016 г. в 18:07, Alan Wang :

> Hi,
>
> Thanks for your reply.
>
> I tried your code and simulate it with mininet.
>
> But it returns empty list.
>
> How to solve the problem?
>
> Thanks,
>
> Alan
>
> 2016-09-16 21:46 GMT+08:00 Nick Sedelnikov :
>
>> Hi,
>>
>> To know all registered switches try:
>> """
>> from ryu.controller.dpset import DPSet
>>
>> class MyApp(app_manager.RyuApp):
>> # ...
>>
>> _CONTEXTS = {'dpset': DPSet}
>>
>> def __init__(self, *args, **kwargs):
>> super(MyApp, self).__init__(*args, **kwargs)
>> # ...
>> self.dpset = kwargs['dpset']
>> # ...
>> """
>> Then fetch switches:
>> >> switches = self.dpset.get_all()
>> >> mac_addresses = [(s[0], s[1].ports[OFPP_LOCAL].hw_addr) for s in
>> switches]
>> It will return tuple(dpid, mac_address), like this:
>> [(1, '0a:74:ba:ce:11:47'), (2, '32:5b:11:d9:72:4f')]
>>
>>
>>
>> пт, 16 сент. 2016 г. в 15:25, Alan Wang :
>>
>>> Hi All,
>>>
>>> I want to know the mac address of all switches from controller. How to
>>> get the mac
>>>
>>> address of switch?
>>>
>>> Thanks,
>>>
>>> Alan
>>>
>>> --
>>> ___
>>> Ryu-devel mailing list
>>> Ryu-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>>>
>>
>
--
___
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel


Re: [Ryu-devel] Get the mac address of all switches

2016-09-16 Thread Nick Sedelnikov
Hi,

To know all registered switches try:
"""
from ryu.controller.dpset import DPSet

class MyApp(app_manager.RyuApp):
# ...

_CONTEXTS = {'dpset': DPSet}

def __init__(self, *args, **kwargs):
super(MyApp, self).__init__(*args, **kwargs)
# ...
self.dpset = kwargs['dpset']
# ...
"""
Then fetch switches:
>> switches = self.dpset.get_all()
>> mac_addresses = [(s[0], s[1].ports[OFPP_LOCAL].hw_addr) for s in
switches]
It will return tuple(dpid, mac_address), like this:
[(1, '0a:74:ba:ce:11:47'), (2, '32:5b:11:d9:72:4f')]



пт, 16 сент. 2016 г. в 15:25, Alan Wang :

> Hi All,
>
> I want to know the mac address of all switches from controller. How to get
> the mac
>
> address of switch?
>
> Thanks,
>
> Alan
>
> --
> ___
> Ryu-devel mailing list
> Ryu-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>
--
___
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel


[Ryu-devel] Get the mac address of all switches

2016-09-16 Thread Alan Wang
Hi All,

I want to know the mac address of all switches from controller. How to get
the mac

address of switch?

Thanks,

Alan
--
___
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel


Re: [Ryu-devel] Ryu app

2016-09-16 Thread Francesco Murador
Can i activate stp sending a message directly from ryu? I want to include the 
code of the dal_plugin directly with an import and then do something similar to 
that i sent to you in my application code..could you help me in that? If i do 
that will it load dynamically the simple_switch_13 by registering the app? 
And i have another solution for that if i send to the switch that i have to 
block ports the NO_stp or no_receive_stp message? 
Inviato da iPhone

> Il giorno 16/set/2016, alle ore 10:14, Iwase Yusuke  
> ha scritto:
> 
> Hi,
> 
> I think it depends on your application design.
> I can not mention further about which is the better way...
> 
> FYI: If you want to just avoid the looped topology (by
> blocking redundant port by STP), how about using STP
> support of OVS as following?
> e.g.) please enable STP support on your OVS
>  sudo ovs-vsctl set Bridge s1 stp_enable=true
> 
> Certainly, Ryu can not control the port status (just
> receiving the port status messages) in this case, but you
> can avoid the looped topology at the switch side.
> 
> Thanks,
> Iwase
> 
>> On 2016年09月16日 03:42, Francesco Murador wrote:
>> Sorry for this other question you're very polite to help me in all the 
>> things. But i need to use dal_plugin with rest call or i can just do an 
>> import to my application and simply use it?
>> 
>> Inviato da iPhone
>> 
>>> Il giorno 15/set/2016, alle ore 10:10, Iwase Yusuke 
>>>  ha scritto:
>>> 
>>> Hi,
>>> 
>>> Sorry, I could not exactly understand what you want to do with your app...
>>> 
>>> Your questions is
>>> "How to instantiate another Ryu application in your Ryu application?",
>>> right?
>>> 
>>> If so, it might be difficult, I guess...
>>> "Dynamic application loading" is discussed before, but seems to be not 
>>> merged.
>>> https://www.mail-archive.com/ryu-devel@lists.sourceforge.net/msg09857.html
>>> 
>>> Thanks,
>>> Iwase
>>> 
>>> 
 On 2016年09月14日 20:43, Francesco Murador wrote:
 i attach you my code and the assertion error that i have, so you can 
 understand
 what i'm doing port it's an istance of a port of a switch and where i sent 
 the
 signal of BLOCK of port or LEARN, FORWARD or something other. I hope you 
 can
 help me i'm going crazy with that...and another question i have to send 
 port
 request every 5 seconds or more how can i do that?
 
 Il giorno 13 set 2016 alle 03:20, Iwase Yusuke  
 ha scritto:
 
> Hi,
> 
> How about skipping the ofp event processing for the specific dpid
> at the top of each event handler?
> 
> e.g.) If dpid is registered, do switch_features_handler, otherwise skip.
> $ git diff
> diff --git a/ryu/app/simple_switch_13.py b/ryu/app/simple_switch_13.py
> index 3e7c598..c8a9291 100644
> --- a/ryu/app/simple_switch_13.py
> +++ b/ryu/app/simple_switch_13.py
> @@ -30,8 +30,12 @@ class SimpleSwitch13(app_manager.RyuApp):
> super(SimpleSwitch13, self).__init__(*args, **kwargs)
> self.mac_to_port = {}
> 
> + self.registered_dpids = [1, 2, 3] # specify the range of dpid
> +
> @set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
> def switch_features_handler(self, ev):
> + if ev.msg.datapath.id not in self.registered_dpids:
> + return
> datapath = ev.msg.datapath
> ofproto = datapath.ofproto
> parser = datapath.ofproto_parser
> 
> 
>> On 2016年09月06日 18:47, Francesco Murador wrote:
>> Hi i have a question...i need to start stplib when i check a thing how 
>> can i
>> start it? Not at the begin of my program with _CONTEXTS...i have to 
>> check if
>> some values in a switch are out of range if they aren't i need to start 
>> the
>> spanning tree because all i want is to block a dpid but if i don't block 
>> a
>> dpid i have a topology with loops so normal simple_switch will not work 
>> so i
>> had to run the stplib
>> --
>> ___
>> Ryu-devel mailing list
>> Ryu-devel@lists.sourceforge.net 
>> https://lists.sourceforge.net/lists/listinfo/ryu-devel
 
 
 
 --
 
 
 
 ___
 Ryu-devel mailing list
 Ryu-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/ryu-devel
>> 
>> --
>> ___
>> Ryu-devel mailing list
>> Ryu-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>> 

--

Re: [Ryu-devel] Get the mac address of all switches

2016-09-16 Thread Alan Wang
Hi,

Thanks for your reply.

I tried your code and simulate it with mininet.

But it returns empty list.

How to solve the problem?

Thanks,

Alan

2016-09-16 21:46 GMT+08:00 Nick Sedelnikov :

> Hi,
>
> To know all registered switches try:
> """
> from ryu.controller.dpset import DPSet
>
> class MyApp(app_manager.RyuApp):
> # ...
>
> _CONTEXTS = {'dpset': DPSet}
>
> def __init__(self, *args, **kwargs):
> super(MyApp, self).__init__(*args, **kwargs)
> # ...
> self.dpset = kwargs['dpset']
> # ...
> """
> Then fetch switches:
> >> switches = self.dpset.get_all()
> >> mac_addresses = [(s[0], s[1].ports[OFPP_LOCAL].hw_addr) for s in
> switches]
> It will return tuple(dpid, mac_address), like this:
> [(1, '0a:74:ba:ce:11:47'), (2, '32:5b:11:d9:72:4f')]
>
>
>
> пт, 16 сент. 2016 г. в 15:25, Alan Wang :
>
>> Hi All,
>>
>> I want to know the mac address of all switches from controller. How to
>> get the mac
>>
>> address of switch?
>>
>> Thanks,
>>
>> Alan
>> 
>> --
>> ___
>> Ryu-devel mailing list
>> Ryu-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>>
>
--
___
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel