Discussion:
[Ryu-devel] how can i distinguish controllers for packet in to them?
mehran shetabi
2017-07-09 22:52:59 UTC
Permalink
Hi,

In Mininet, I created a topology with one switch, two host, and two inband RYU controller.
In OFPActionOutput() function, instead of using ofproto.OFPP_CONTROLLER for output port may I use port number (e.g. 3) that connected to the controller?
If the answer is no, is there any way to distinguish controllers for packet in to them?

Thank you,
Mehran shetabi
Fujimoto Satoshi
2017-07-10 01:05:38 UTC
Permalink
Hi, Mehran

Unfortunately, you cannot use the port number which is connected to the
controller in OFPActionOutput().

However, if you can set roles(Master/Slave) to the controllers,
you can use OFPSetAsync to control whether the switch sends Packet-In to
Master or Slave controller:
http://ryu.readthedocs.io/en/latest/ofproto_v1_3_ref.html#ryu.ofproto.ofproto_v1_3_parser.OFPSetAsync


Or, this is not a beautiful method, you can connect controllers and the
switch by another connection, like:

c1 ──of───sw ──of───c2
│      ││      │
└──────┘└──────┘("of" means an OpenFlow channel)

Then, you can specify the port number which is connected to the controller.
But the controller should receive packets in your application,
and the packets are "raw" packets, so the informations in the Packet-in
header will be lost.


Thanks,
Fujimoto

On 2017幎07月10日 07:52, mehran shetabi wrote:
>
> Hi,
>
>
> In Mininet, I created a topology with one switch, two host, and two
> inband RYU controller.
>
> In OFPActionOutput() function, instead of using
> ofproto.OFPP_CONTROLLER for output port may I use port number (e.g. 3)
> that connected to the controller?
>
> If the answer is no, is there any way to distinguish controllers for
> packet in to them?
>
>
> Thank you,
>
> Mehran shetabi
>
>
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>
>
> _______________________________________________
> Ryu-devel mailing list
> Ryu-***@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
mehran shetabi
2017-07-10 07:53:55 UTC
Permalink
hi, Fujimoto


how can i use OpenFlow channel in Mininet?

what do you mean about "But the controller should receive packets in your application" ?

can i make a change in RYU code for including port number which is connected to the controller in OFPActionOutput()?

if the answer is yes, how can i do this?


thank you,

Mehran shetabi


________________________________
From: Fujimoto Satoshi <***@gmail.com>
Sent: Monday, July 10, 2017 5:35 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net; ***@gmail.com
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

Unfortunately, you cannot use the port number which is connected to the controller in OFPActionOutput().

However, if you can set roles(Master/Slave) to the controllers,
you can use OFPSetAsync to control whether the switch sends Packet-In to Master or Slave controller:
http://ryu.readthedocs.io/en/latest/ofproto_v1_3_ref.html#ryu.ofproto.ofproto_v1_3_parser.OFPSetAsync


Or, this is not a beautiful method, you can connect controllers and the switch by another connection, like:

c1 ??of???sw ??of???c2
????????????????
???????????????? ("of" means an OpenFlow channel)

Then, you can specify the port number which is connected to the controller.
But the controller should receive packets in your application,
and the packets are "raw" packets, so the informations in the Packet-in header will be lost.


Thanks,
Fujimoto

On 2017?07?10? 07:52, mehran shetabi wrote:
Hi,

In Mininet, I created a topology with one switch, two host, and two inband RYU controller.
In OFPActionOutput() function, instead of using ofproto.OFPP_CONTROLLER for output port may I use port number (e.g. 3) that connected to the controller?
If the answer is no, is there any way to distinguish controllers for packet in to them?

Thank you,
Mehran shetabi
mehran shetabi
2017-07-10 21:04:48 UTC
Permalink
hi, Fujimoto


in the second solution, how can i retrieve Packet-in header?

is there any solution for it?


thank you,

Mehran shetabi

________________________________
From: Fujimoto Satoshi <***@gmail.com>
Sent: Monday, July 10, 2017 5:35 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net; ***@gmail.com
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

Unfortunately, you cannot use the port number which is connected to the controller in OFPActionOutput().

However, if you can set roles(Master/Slave) to the controllers,
you can use OFPSetAsync to control whether the switch sends Packet-In to Master or Slave controller:
http://ryu.readthedocs.io/en/latest/ofproto_v1_3_ref.html#ryu.ofproto.ofproto_v1_3_parser.OFPSetAsync


Or, this is not a beautiful method, you can connect controllers and the switch by another connection, like:

c1 ??of???sw ??of???c2
????????????????
???????????????? ("of" means an OpenFlow channel)

Then, you can specify the port number which is connected to the controller.
But the controller should receive packets in your application,
and the packets are "raw" packets, so the informations in the Packet-in header will be lost.


Thanks,
Fujimoto

On 2017?07?10? 07:52, mehran shetabi wrote:
Hi,

In Mininet, I created a topology with one switch, two host, and two inband RYU controller.
In OFPActionOutput() function, instead of using ofproto.OFPP_CONTROLLER for output port may I use port number (e.g. 3) that connected to the controller?
If the answer is no, is there any way to distinguish controllers for packet in to them?

Thank you,
Mehran shetabi
Fujimoto Satoshi
2017-07-11 00:15:55 UTC
Permalink
Hi, Mehran

> how can i use OpenFlow channel in Mininet?
Sorry, OpenFlow channel is a connection which is used for OpenFlow
protocol and you already have.
What I meant was that you should have another connection between
controllers and the switch other than OpenFlow channel,
to exchange "raw" packets, not OpenFlow packets.

> in the second solution, how can i retrieve Packet-in header?
As I said, in the second solution, the packets will be sent without
Packet-in header.
So, in this solution, there is no way to retrieve Packet-in header.
If you want to get Packet-in header, I think this solution is not suitable,
then you should apply the first solution (setting roles and Async).

Do you need to get Packet-in header?
If not, I try implementing and tell you how to implement the second
solution.


Thanks,
Fujimoto


On 2017幎07月11日 06:04, mehran shetabi wrote:
>
> hi, Fujimoto
>
>
> in the second solution, how can i retrieve Packet-in header?
>
> is there any solution for it?
>
>
> thank you,
>
> Mehran shetabi
>
> ------------------------------------------------------------------------
> *From:* Fujimoto Satoshi <***@gmail.com>
> *Sent:* Monday, July 10, 2017 5:35 AM
> *To:* mehran shetabi; ryu-***@lists.sourceforge.net;
> ***@gmail.com
> *Subject:* Re: [Ryu-devel] how can i distinguish controllers for
> packet in to them?
> Hi, Mehran
>
> Unfortunately, you cannot use the port number which is connected to
> the controller in OFPActionOutput().
>
> However, if you can set roles(Master/Slave) to the controllers,
> you can use OFPSetAsync to control whether the switch sends Packet-In
> to Master or Slave controller:
> http://ryu.readthedocs.io/en/latest/ofproto_v1_3_ref.html#ryu.ofproto.ofproto_v1_3_parser.OFPSetAsync
>
>
> Or, this is not a beautiful method, you can connect controllers and
> the switch by another connection, like:
>
> c1 ──of───sw ──of───c2
> │      ││      │
> └──────┘└──────┘("of" means an OpenFlow channel)
>
> Then, you can specify the port number which is connected to the
> controller.
> But the controller should receive packets in your application,
> and the packets are "raw" packets, so the informations in the
> Packet-in header will be lost.
>
>
> Thanks,
> Fujimoto
>
> On 2017幎07月10日 07:52, mehran shetabi wrote:
>>
>> Hi,
>>
>>
>> In Mininet, I created a topology with one switch, two host, and two
>> inband RYU controller.
>>
>> In OFPActionOutput() function, instead of using
>> ofproto.OFPP_CONTROLLER for output port may I use port number (e.g.
>> 3) that connected to the controller?
>>
>> If the answer is no, is there any way to distinguish controllers for
>> packet in to them?
>>
>>
>> Thank you,
>>
>> Mehran shetabi
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org!http://sdm.link/slashdot
>>
>>
>> _______________________________________________
>> Ryu-devel mailing list
>> Ryu-***@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>
mehran shetabi
2017-07-11 05:20:13 UTC
Permalink
hi, Fujimoto


with setting roles and Async solution, if there are more than two controllers, how can i distinguish between them?

my problem is, how can i sent packet-in to the exact controller?


thank you,

Mehran shetabi


________________________________
From: Fujimoto Satoshi <***@gmail.com>
Sent: Tuesday, July 11, 2017 4:45 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

how can i use OpenFlow channel in Mininet?
Sorry, OpenFlow channel is a connection which is used for OpenFlow protocol and you already have.
What I meant was that you should have another connection between controllers and the switch other than OpenFlow channel,
to exchange "raw" packets, not OpenFlow packets.

in the second solution, how can i retrieve Packet-in header?
As I said, in the second solution, the packets will be sent without Packet-in header.
So, in this solution, there is no way to retrieve Packet-in header.
If you want to get Packet-in header, I think this solution is not suitable,
then you should apply the first solution (setting roles and Async).

Do you need to get Packet-in header?
If not, I try implementing and tell you how to implement the second solution.


Thanks,
Fujimoto


On 2017?07?11? 06:04, mehran shetabi wrote:

hi, Fujimoto


in the second solution, how can i retrieve Packet-in header?

is there any solution for it?


thank you,

Mehran shetabi

________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Monday, July 10, 2017 5:35 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>; ***@gmail.com<mailto:***@gmail.com>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

Unfortunately, you cannot use the port number which is connected to the controller in OFPActionOutput().

However, if you can set roles(Master/Slave) to the controllers,
you can use OFPSetAsync to control whether the switch sends Packet-In to Master or Slave controller:
http://ryu.readthedocs.io/en/latest/ofproto_v1_3_ref.html#ryu.ofproto.ofproto_v1_3_parser.OFPSetAsync


Or, this is not a beautiful method, you can connect controllers and the switch by another connection, like:

c1 ??of???sw ??of???c2
????????????????
???????????????? ("of" means an OpenFlow channel)

Then, you can specify the port number which is connected to the controller.
But the controller should receive packets in your application,
and the packets are "raw" packets, so the informations in the Packet-in header will be lost.


Thanks,
Fujimoto

On 2017?07?10? 07:52, mehran shetabi wrote:
Hi,

In Mininet, I created a topology with one switch, two host, and two inband RYU controller.
In OFPActionOutput() function, instead of using ofproto.OFPP_CONTROLLER for output port may I use port number (e.g. 3) that connected to the controller?
If the answer is no, is there any way to distinguish controllers for packet in to them?

Thank you,
Mehran shetabi
Fujimoto Satoshi
2017-07-12 01:13:38 UTC
Permalink
Hi, Mehran


Sorry, I've overlooked about the following action, it may be able to
solve your problem:

http://ryu.readthedocs.io/en/latest/nicira_ext_ref.html#ryu.ofproto.ofproto_v1_3_parser.NXActionController


This action belongs to 'Nicira extensions', not OpenFlow,

but with this, switches can send Packet-In to the specific controller.


To specify the controller, the "controller_id" should be configured.

Ryu can configure it by "NXTSetControllerId", but this can be used in
only OpenFlow 1.0.


Then, it is not a beautiful method, how about the following?

(customizing ryu/app/simple_switch_13.py)



@set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
def switch_features_handler(self, ev):
datapath = ev.msg.datapath
ofproto = datapath.ofproto
parser = datapath.ofproto_parser


# configuring controller_id of this controller

req = ofproto_v1_0_parser.NXTSetControllerId(datapath,
controller_id=5)
datapath.send_msg(req)


# add an action to send Packet-In to this controller

match = parser.OFPMatch()
actions = [
parser.NXActionController(0, 5, ofproto.OFPR_ACTION)]

self.add_flow(datapath, 0, match, actions)



This can be good for you?

Thanks,
Fujimoto


On 2017幎07月11日 14:20, mehran shetabi wrote:
>
> hi, Fujimoto
>
>
> with setting roles and Async solution, if there are more than two
> controllers, how can i distinguish between them?
>
> my problem is, how can i sent packet-in to the exact controller?
>
>
> thank you,
>
> Mehran shetabi
>
>
> ------------------------------------------------------------------------
> *From:* Fujimoto Satoshi <***@gmail.com>
> *Sent:* Tuesday, July 11, 2017 4:45 AM
> *To:* mehran shetabi; ryu-***@lists.sourceforge.net
> *Subject:* Re: [Ryu-devel] how can i distinguish controllers for
> packet in to them?
> Hi, Mehran
>
>> how can i use OpenFlow channel in Mininet?
> Sorry, OpenFlow channel is a connection which is used for OpenFlow
> protocol and you already have.
> What I meant was that you should have another connection between
> controllers and the switch other than OpenFlow channel,
> to exchange "raw" packets, not OpenFlow packets.
>
>> in the second solution, how can i retrieve Packet-in header?
> As I said, in the second solution, the packets will be sent without
> Packet-in header.
> So, in this solution, there is no way to retrieve Packet-in header.
> If you want to get Packet-in header, I think this solution is not
> suitable,
> then you should apply the first solution (setting roles and Async).
>
> Do you need to get Packet-in header?
> If not, I try implementing and tell you how to implement the second
> solution.
>
>
> Thanks,
> Fujimoto
>
>
> On 2017幎07月11日 06:04, mehran shetabi wrote:
>>
>> hi, Fujimoto
>>
>>
>> in the second solution, how can i retrieve Packet-in header?
>>
>> is there any solution for it?
>>
>>
>> thank you,
>>
>> Mehran shetabi
>>
>> ------------------------------------------------------------------------
>> *From:* Fujimoto Satoshi <***@gmail.com>
>> *Sent:* Monday, July 10, 2017 5:35 AM
>> *To:* mehran shetabi; ryu-***@lists.sourceforge.net;
>> ***@gmail.com
>> *Subject:* Re: [Ryu-devel] how can i distinguish controllers for
>> packet in to them?
>> Hi, Mehran
>>
>> Unfortunately, you cannot use the port number which is connected to
>> the controller in OFPActionOutput().
>>
>> However, if you can set roles(Master/Slave) to the controllers,
>> you can use OFPSetAsync to control whether the switch sends Packet-In
>> to Master or Slave controller:
>> http://ryu.readthedocs.io/en/latest/ofproto_v1_3_ref.html#ryu.ofproto.ofproto_v1_3_parser.OFPSetAsync
>>
>>
>> Or, this is not a beautiful method, you can connect controllers and
>> the switch by another connection, like:
>>
>> c1 ──of───sw ──of───c2
>> │      ││      │
>> └──────┘└──────┘("of" means an OpenFlow channel)
>>
>> Then, you can specify the port number which is connected to the
>> controller.
>> But the controller should receive packets in your application,
>> and the packets are "raw" packets, so the informations in the
>> Packet-in header will be lost.
>>
>>
>> Thanks,
>> Fujimoto
>>
>> On 2017幎07月10日 07:52, mehran shetabi wrote:
>>>
>>> Hi,
>>>
>>>
>>> In Mininet, I created a topology with one switch, two host, and two
>>> inband RYU controller.
>>>
>>> In OFPActionOutput() function, instead of using
>>> ofproto.OFPP_CONTROLLER for output port may I use port number (e.g.
>>> 3) that connected to the controller?
>>>
>>> If the answer is no, is there any way to distinguish controllers for
>>> packet in to them?
>>>
>>>
>>> Thank you,
>>>
>>> Mehran shetabi
>>>
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Check out the vibrant tech community on one of the world's most
>>> engaging tech sites, Slashdot.org!http://sdm.link/slashdot
>>>
>>>
>>> _______________________________________________
>>> Ryu-devel mailing list
>>> Ryu-***@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>>
>
mehran shetabi
2017-07-12 20:50:14 UTC
Permalink
hi, Fujimoto


is there any conflict between OpenFlow 1.0 and OpenFlow 1.3?

you know, as you said, i use the code in my controller:



from ryu.ofproto import ofproto_v1_0_parser

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

def __init__(self, *args, **kwargs):
super(SimpleSwitch13, self).__init__(*args, **kwargs)
self.mac_to_port = {}

@set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
def switch_features_handler(self, ev):
datapath = ev.msg.datapath
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
dpid = datapath.id

# configuring controller_id of this controller
req = ofproto_v1_0_parser.NXTSetControllerId(datapath, controller_id=2)
datapath.send_msg(req)


# install table-miss flow entry
match = parser.OFPMatch()
actions = [parser.OFPActionOutput(ofproto.OFPP_CONTROLLER, ofproto.OFPCML_NO_BUFFER)]

idle_timeout=0
self.add_flow(datapath, 0, match, actions, idle_timeout, dpid)



but after adding the code that you mentioned, my controller didn't work properly (e.g. pingall command don't work).


how can i fix it?


thank you,

Mehran shetabi




________________________________
From: Fujimoto Satoshi <***@gmail.com>
Sent: Wednesday, July 12, 2017 5:43 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?


Hi, Mehran


Sorry, I've overlooked about the following action, it may be able to solve your problem:

http://ryu.readthedocs.io/en/latest/nicira_ext_ref.html#ryu.ofproto.ofproto_v1_3_parser.NXActionController


This action belongs to 'Nicira extensions', not OpenFlow,

but with this, switches can send Packet-In to the specific controller.


To specify the controller, the "controller_id" should be configured.

Ryu can configure it by "NXTSetControllerId", but this can be used in only OpenFlow 1.0.


Then, it is not a beautiful method, how about the following?

(customizing ryu/app/simple_switch_13.py)



@set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
def switch_features_handler(self, ev):
datapath = ev.msg.datapath
ofproto = datapath.ofproto
parser = datapath.ofproto_parser


# configuring controller_id of this controller

req = ofproto_v1_0_parser.NXTSetControllerId(datapath, controller_id=5)
datapath.send_msg(req)


# add an action to send Packet-In to this controller

match = parser.OFPMatch()
actions = [
parser.NXActionController(0, 5, ofproto.OFPR_ACTION)]

self.add_flow(datapath, 0, match, actions)


This can be good for you?

Thanks,
Fujimoto


On 2017$BG/(B07$B7n(B11$BF|(B 14:20, mehran shetabi wrote:

hi, Fujimoto


with setting roles and Async solution, if there are more than two controllers, how can i distinguish between them?

my problem is, how can i sent packet-in to the exact controller?


thank you,

Mehran shetabi


________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Tuesday, July 11, 2017 4:45 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

how can i use OpenFlow channel in Mininet?
Sorry, OpenFlow channel is a connection which is used for OpenFlow protocol and you already have.
What I meant was that you should have another connection between controllers and the switch other than OpenFlow channel,
to exchange "raw" packets, not OpenFlow packets.

in the second solution, how can i retrieve Packet-in header?
As I said, in the second solution, the packets will be sent without Packet-in header.
So, in this solution, there is no way to retrieve Packet-in header.
If you want to get Packet-in header, I think this solution is not suitable,
then you should apply the first solution (setting roles and Async).

Do you need to get Packet-in header?
If not, I try implementing and tell you how to implement the second solution.


Thanks,
Fujimoto


On 2017$BG/(B07$B7n(B11$BF|(B 06:04, mehran shetabi wrote:

hi, Fujimoto


in the second solution, how can i retrieve Packet-in header?

is there any solution for it?


thank you,

Mehran shetabi

________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Monday, July 10, 2017 5:35 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>; ***@gmail.com<mailto:***@gmail.com>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

Unfortunately, you cannot use the port number which is connected to the controller in OFPActionOutput().

However, if you can set roles(Master/Slave) to the controllers,
you can use OFPSetAsync to control whether the switch sends Packet-In to Master or Slave controller:
http://ryu.readthedocs.io/en/latest/ofproto_v1_3_ref.html#ryu.ofproto.ofproto_v1_3_parser.OFPSetAsync


Or, this is not a beautiful method, you can connect controllers and the switch by another connection, like:

c1 $B(!(!(Bof$B(!(!(!(Bsw $B(!(!(Bof$B(!(!(!(Bc2
$B("!!!!!!!!!!!!("("!!!!!!!!!!!!("(B
$B(&(!(!(!(!(!(!(%(&(!(!(!(!(!(!(%(B ("of" means an OpenFlow channel)

Then, you can specify the port number which is connected to the controller.
But the controller should receive packets in your application,
and the packets are "raw" packets, so the informations in the Packet-in header will be lost.


Thanks,
Fujimoto

On 2017$BG/(B07$B7n(B10$BF|(B 07:52, mehran shetabi wrote:
Hi,

In Mininet, I created a topology with one switch, two host, and two inband RYU controller.
In OFPActionOutput() function, instead of using ofproto.OFPP_CONTROLLER for output port may I use port number (e.g. 3) that connected to the controller?
If the answer is no, is there any way to distinguish controllers for packet in to them?

Thank you,
Mehran shetabi
Fujimoto Satoshi
2017-07-13 01:10:32 UTC
Permalink
Hi, Mehran

> is there any conflict between OpenFlow 1.0 and OpenFlow 1.3?
Sorry, I didn't make it clear enough.
"NXTSetControllerId" is not a OpenFlow action, is a Nicira Extension action.
But in Ryu, this action is provided for only OpenFlow 1.0.
In this solution, we "hack" to use this action in OpenFlow 1.3.
I think there should be no conflict.

And in your code, you should use "NXActionController" to send Packet-In
to the specific controller,
instead of "OFPActionOutput", it cannot do such a thing.
For "NXActionController", you have to specify the "controller_id" which
you specified in "NXTSetControllerId".

I attached a code to this mail, it should be work well.
Please try it.


Thanks,
Fujimoto

On 2017幎07月13日 05:50, mehran shetabi wrote:
>
> hi, Fujimoto
>
>
> is there any conflict between OpenFlow 1.0 and OpenFlow 1.3?
>
> you know, as you said, i use the code in my controller:
>
>
>
> from ryu.ofproto import ofproto_v1_0_parser
>
> class SimpleSwitch13(app_manager.RyuApp):
> OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION]
>
> def __init__(self, *args, **kwargs):
> super(SimpleSwitch13, self).__init__(*args, **kwargs)
> self.mac_to_port = {}
>
> @set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
> def switch_features_handler(self, ev):
> datapath = ev.msg.datapath
> ofproto = datapath.ofproto
> parser = datapath.ofproto_parser
> dpid = datapath.id
>
> # configuring controller_id of this controller
> req = ofproto_v1_0_parser.NXTSetControllerId(datapath,
> controller_id=2)
> datapath.send_msg(req)
>
>
> # install table-miss flow entry
> match = parser.OFPMatch()
> actions = [parser.OFPActionOutput(ofproto.OFPP_CONTROLLER,
> ofproto.OFPCML_NO_BUFFER)]
>
> idle_timeout=0
> self.add_flow(datapath, 0, match, actions, idle_timeout, dpid)
>
>
> but after adding the code that you mentioned, my controller didn't
> work properly (e.g. pingall command don't work).
>
>
> how can i fix it?
>
>
> thank you,
>
> Mehran shetabi
>
>
> ------------------------------------------------------------------------
> *From:* Fujimoto Satoshi <***@gmail.com>
> *Sent:* Wednesday, July 12, 2017 5:43 AM
> *To:* mehran shetabi; ryu-***@lists.sourceforge.net
> *Subject:* Re: [Ryu-devel] how can i distinguish controllers for
> packet in to them?
>
> Hi, Mehran
>
>
> Sorry, I've overlooked about the following action, it may be able to
> solve your problem:
>
> http://ryu.readthedocs.io/en/latest/nicira_ext_ref.html#ryu.ofproto.ofproto_v1_3_parser.NXActionController
>
>
> This action belongs to 'Nicira extensions', not OpenFlow,
>
> but with this, switches can send Packet-In to the specific controller.
>
>
> To specify the controller, the "controller_id" should be configured.
>
> Ryu can configure it by "NXTSetControllerId", but this can be used in
> only OpenFlow 1.0.
>
>
> Then, it is not a beautiful method, how about the following?
>
> (customizing ryu/app/simple_switch_13.py)
>
>
>
> @set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
> def switch_features_handler(self, ev):
> datapath = ev.msg.datapath
> ofproto = datapath.ofproto
> parser = datapath.ofproto_parser
>
>
> # configuring controller_id of this controller
>
> req = ofproto_v1_0_parser.NXTSetControllerId(datapath,
> controller_id=5)
> datapath.send_msg(req)
>
>
> # add an action to send Packet-In to this controller
>
> match = parser.OFPMatch()
> actions = [
> parser.NXActionController(0, 5, ofproto.OFPR_ACTION)]
>
> self.add_flow(datapath, 0, match, actions)
>
>
>
> This can be good for you?
>
> Thanks,
> Fujimoto
>
>
> On 2017幎07月11日 14:20, mehran shetabi wrote:
>>
>> hi, Fujimoto
>>
>>
>> with setting roles and Async solution, if there are more than two
>> controllers, how can i distinguish between them?
>>
>> my problem is, how can i sent packet-in to the exact controller?
>>
>>
>> thank you,
>>
>> Mehran shetabi
>>
>>
>> ------------------------------------------------------------------------
>> *From:* Fujimoto Satoshi <***@gmail.com>
>> *Sent:* Tuesday, July 11, 2017 4:45 AM
>> *To:* mehran shetabi; ryu-***@lists.sourceforge.net
>> *Subject:* Re: [Ryu-devel] how can i distinguish controllers for
>> packet in to them?
>> Hi, Mehran
>>
>>> how can i use OpenFlow channel in Mininet?
>> Sorry, OpenFlow channel is a connection which is used for OpenFlow
>> protocol and you already have.
>> What I meant was that you should have another connection between
>> controllers and the switch other than OpenFlow channel,
>> to exchange "raw" packets, not OpenFlow packets.
>>
>>> in the second solution, how can i retrieve Packet-in header?
>> As I said, in the second solution, the packets will be sent without
>> Packet-in header.
>> So, in this solution, there is no way to retrieve Packet-in header.
>> If you want to get Packet-in header, I think this solution is not
>> suitable,
>> then you should apply the first solution (setting roles and Async).
>>
>> Do you need to get Packet-in header?
>> If not, I try implementing and tell you how to implement the second
>> solution.
>>
>>
>> Thanks,
>> Fujimoto
>>
>>
>> On 2017幎07月11日 06:04, mehran shetabi wrote:
>>>
>>> hi, Fujimoto
>>>
>>>
>>> in the second solution, how can i retrieve Packet-in header?
>>>
>>> is there any solution for it?
>>>
>>>
>>> thank you,
>>>
>>> Mehran shetabi
>>>
>>> ------------------------------------------------------------------------
>>> *From:* Fujimoto Satoshi <***@gmail.com>
>>> *Sent:* Monday, July 10, 2017 5:35 AM
>>> *To:* mehran shetabi; ryu-***@lists.sourceforge.net;
>>> ***@gmail.com
>>> *Subject:* Re: [Ryu-devel] how can i distinguish controllers for
>>> packet in to them?
>>> Hi, Mehran
>>>
>>> Unfortunately, you cannot use the port number which is connected to
>>> the controller in OFPActionOutput().
>>>
>>> However, if you can set roles(Master/Slave) to the controllers,
>>> you can use OFPSetAsync to control whether the switch sends
>>> Packet-In to Master or Slave controller:
>>> http://ryu.readthedocs.io/en/latest/ofproto_v1_3_ref.html#ryu.ofproto.ofproto_v1_3_parser.OFPSetAsync
>>>
>>>
>>> Or, this is not a beautiful method, you can connect controllers and
>>> the switch by another connection, like:
>>>
>>> c1 ──of───sw ──of───c2
>>> │      ││      │
>>> └──────┘└──────┘("of" means an OpenFlow channel)
>>>
>>> Then, you can specify the port number which is connected to the
>>> controller.
>>> But the controller should receive packets in your application,
>>> and the packets are "raw" packets, so the informations in the
>>> Packet-in header will be lost.
>>>
>>>
>>> Thanks,
>>> Fujimoto
>>>
>>> On 2017幎07月10日 07:52, mehran shetabi wrote:
>>>>
>>>> Hi,
>>>>
>>>>
>>>> In Mininet, I created a topology with one switch, two host, and two
>>>> inband RYU controller.
>>>>
>>>> In OFPActionOutput() function, instead of using
>>>> ofproto.OFPP_CONTROLLER for output port may I use port number (e.g.
>>>> 3) that connected to the controller?
>>>>
>>>> If the answer is no, is there any way to distinguish controllers
>>>> for packet in to them?
>>>>
>>>>
>>>> Thank you,
>>>>
>>>> Mehran shetabi
>>>>
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Check out the vibrant tech community on one of the world's most
>>>> engaging tech sites, Slashdot.org!http://sdm.link/slashdot
>>>>
>>>>
>>>> _______________________________________________
>>>> Ryu-devel mailing list
>>>> Ryu-***@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>>>
>>
>
mehran shetabi
2017-07-13 23:24:44 UTC
Permalink
hi, Fujimoto


it is working.

but now my problem is, how can i install table-miss flow entry with "NXActionController" that consists controller_id of all of my controller and OFPR_NO_MATCH reason?

i want to populate mac-to-port table of all of my controller with running pingall command and then send packet-in to specific controller.

how can i do this?


thank you,

Mehran shetabi

________________________________
From: Fujimoto Satoshi <***@gmail.com>
Sent: Thursday, July 13, 2017 5:40 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

is there any conflict between OpenFlow 1.0 and OpenFlow 1.3?
Sorry, I didn't make it clear enough.
"NXTSetControllerId" is not a OpenFlow action, is a Nicira Extension action.
But in Ryu, this action is provided for only OpenFlow 1.0.
In this solution, we "hack" to use this action in OpenFlow 1.3.
I think there should be no conflict.

And in your code, you should use "NXActionController" to send Packet-In to the specific controller,
instead of "OFPActionOutput", it cannot do such a thing.
For "NXActionController", you have to specify the "controller_id" which you specified in "NXTSetControllerId".

I attached a code to this mail, it should be work well.
Please try it.


Thanks,
Fujimoto

On 2017$BG/(B07$B7n(B13$BF|(B 05:50, mehran shetabi wrote:

hi, Fujimoto


is there any conflict between OpenFlow 1.0 and OpenFlow 1.3?

you know, as you said, i use the code in my controller:



from ryu.ofproto import ofproto_v1_0_parser

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

def __init__(self, *args, **kwargs):
super(SimpleSwitch13, self).__init__(*args, **kwargs)
self.mac_to_port = {}

@set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
def switch_features_handler(self, ev):
datapath = ev.msg.datapath
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
dpid = datapath.id

# configuring controller_id of this controller
req = ofproto_v1_0_parser.NXTSetControllerId(datapath, controller_id=2)
datapath.send_msg(req)


# install table-miss flow entry
match = parser.OFPMatch()
actions = [parser.OFPActionOutput(ofproto.OFPP_CONTROLLER, ofproto.OFPCML_NO_BUFFER)]

idle_timeout=0
self.add_flow(datapath, 0, match, actions, idle_timeout, dpid)



but after adding the code that you mentioned, my controller didn't work properly (e.g. pingall command don't work).


how can i fix it?


thank you,

Mehran shetabi




________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Wednesday, July 12, 2017 5:43 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?


Hi, Mehran


Sorry, I've overlooked about the following action, it may be able to solve your problem:

http://ryu.readthedocs.io/en/latest/nicira_ext_ref.html#ryu.ofproto.ofproto_v1_3_parser.NXActionController


This action belongs to 'Nicira extensions', not OpenFlow,

but with this, switches can send Packet-In to the specific controller.


To specify the controller, the "controller_id" should be configured.

Ryu can configure it by "NXTSetControllerId", but this can be used in only OpenFlow 1.0.


Then, it is not a beautiful method, how about the following?

(customizing ryu/app/simple_switch_13.py)



@set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
def switch_features_handler(self, ev):
datapath = ev.msg.datapath
ofproto = datapath.ofproto
parser = datapath.ofproto_parser


# configuring controller_id of this controller

req = ofproto_v1_0_parser.NXTSetControllerId(datapath, controller_id=5)
datapath.send_msg(req)


# add an action to send Packet-In to this controller

match = parser.OFPMatch()
actions = [
parser.NXActionController(0, 5, ofproto.OFPR_ACTION)]

self.add_flow(datapath, 0, match, actions)


This can be good for you?

Thanks,
Fujimoto


On 2017$BG/(B07$B7n(B11$BF|(B 14:20, mehran shetabi wrote:

hi, Fujimoto


with setting roles and Async solution, if there are more than two controllers, how can i distinguish between them?

my problem is, how can i sent packet-in to the exact controller?


thank you,

Mehran shetabi


________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Tuesday, July 11, 2017 4:45 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

how can i use OpenFlow channel in Mininet?
Sorry, OpenFlow channel is a connection which is used for OpenFlow protocol and you already have.
What I meant was that you should have another connection between controllers and the switch other than OpenFlow channel,
to exchange "raw" packets, not OpenFlow packets.

in the second solution, how can i retrieve Packet-in header?
As I said, in the second solution, the packets will be sent without Packet-in header.
So, in this solution, there is no way to retrieve Packet-in header.
If you want to get Packet-in header, I think this solution is not suitable,
then you should apply the first solution (setting roles and Async).

Do you need to get Packet-in header?
If not, I try implementing and tell you how to implement the second solution.


Thanks,
Fujimoto


On 2017$BG/(B07$B7n(B11$BF|(B 06:04, mehran shetabi wrote:

hi, Fujimoto


in the second solution, how can i retrieve Packet-in header?

is there any solution for it?


thank you,

Mehran shetabi

________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Monday, July 10, 2017 5:35 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>; ***@gmail.com<mailto:***@gmail.com>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

Unfortunately, you cannot use the port number which is connected to the controller in OFPActionOutput().

However, if you can set roles(Master/Slave) to the controllers,
you can use OFPSetAsync to control whether the switch sends Packet-In to Master or Slave controller:
http://ryu.readthedocs.io/en/latest/ofproto_v1_3_ref.html#ryu.ofproto.ofproto_v1_3_parser.OFPSetAsync


Or, this is not a beautiful method, you can connect controllers and the switch by another connection, like:

c1 $B(!(!(Bof$B(!(!(!(Bsw $B(!(!(Bof$B(!(!(!(Bc2
$B("!!!!!!!!!!!!("("!!!!!!!!!!!!("(B
$B(&(!(!(!(!(!(!(%(&(!(!(!(!(!(!(%(B ("of" means an OpenFlow channel)

Then, you can specify the port number which is connected to the controller.
But the controller should receive packets in your application,
and the packets are "raw" packets, so the informations in the Packet-in header will be lost.


Thanks,
Fujimoto

On 2017$BG/(B07$B7n(B10$BF|(B 07:52, mehran shetabi wrote:
Hi,

In Mininet, I created a topology with one switch, two host, and two inband RYU controller.
In OFPActionOutput() function, instead of using ofproto.OFPP_CONTROLLER for output port may I use port number (e.g. 3) that connected to the controller?
If the answer is no, is there any way to distinguish controllers for packet in to them?

Thank you,
Mehran shetabi
Fujimoto Satoshi
2017-07-14 00:41:38 UTC
Permalink
Hi, Mehran

> how can i install table-miss flow entry
> with "NXActionController" that consists controller_id of all of
> my controller and OFPR_NO_MATCH reason?
You can specify "OFPR_NO_MATCH" to "reason" field in "NXActionController":
parser.NXActionController(max_len=0, controller_id=2,
reason=ofproto.OFPR_NO_MATCH)

However, what is "consists controller_id of all of my controller" ?
I thought you want to send packet-in to the "specific" controller,
so I think there is no need to specify two or more controllers in
"NXActionController".

Anyway, I think it's up to you how to implement your application.


Thanks,
Fujimoto

On 2017幎07月14日 08:24, mehran shetabi wrote:
>
> hi, Fujimoto
>
>
> it is working.
>
> but now my problem is, how can i install table-miss flow entry
> with "NXActionController" that consists controller_id of all of
> my controller and OFPR_NO_MATCH reason?
>
> i want to populate mac-to-port
> table of all of my controller with running pingall
> command and then send packet-in to specific controller.
>
> how can i do this?
>
>
> thank you,
>
> Mehran shetabi
>
> ------------------------------------------------------------------------
> *From:* Fujimoto Satoshi <***@gmail.com>
> *Sent:* Thursday, July 13, 2017 5:40 AM
> *To:* mehran shetabi; ryu-***@lists.sourceforge.net
> *Subject:* Re: [Ryu-devel] how can i distinguish controllers for
> packet in to them?
> Hi, Mehran
>
>> is there any conflict between OpenFlow 1.0 and OpenFlow 1.3?
> Sorry, I didn't make it clear enough.
> "NXTSetControllerId" is not a OpenFlow action, is a Nicira Extension
> action.
> But in Ryu, this action is provided for only OpenFlow 1.0.
> In this solution, we "hack" to use this action in OpenFlow 1.3.
> I think there should be no conflict.
>
> And in your code, you should use "NXActionController" to send
> Packet-In to the specific controller,
> instead of "OFPActionOutput", it cannot do such a thing.
> For "NXActionController", you have to specify the "controller_id"
> which you specified in "NXTSetControllerId".
>
> I attached a code to this mail, it should be work well.
> Please try it.
>
>
> Thanks,
> Fujimoto
>
> On 2017幎07月13日 05:50, mehran shetabi wrote:
>>
>> hi, Fujimoto
>>
>>
>> is there any conflict between OpenFlow 1.0 and OpenFlow 1.3?
>>
>> you know, as you said, i use the code in my controller:
>>
>>
>>
>> from ryu.ofproto import ofproto_v1_0_parser
>>
>> class SimpleSwitch13(app_manager.RyuApp):
>> OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION]
>>
>> def __init__(self, *args, **kwargs):
>> super(SimpleSwitch13, self).__init__(*args, **kwargs)
>> self.mac_to_port = {}
>>
>> @set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
>> def switch_features_handler(self, ev):
>> datapath = ev.msg.datapath
>> ofproto = datapath.ofproto
>> parser = datapath.ofproto_parser
>> dpid = datapath.id
>>
>> # configuring controller_id of this controller
>> req = ofproto_v1_0_parser.NXTSetControllerId(datapath,
>> controller_id=2)
>> datapath.send_msg(req)
>>
>>
>> # install table-miss flow entry
>> match = parser.OFPMatch()
>> actions = [parser.OFPActionOutput(ofproto.OFPP_CONTROLLER,
>> ofproto.OFPCML_NO_BUFFER)]
>>
>> idle_timeout=0
>> self.add_flow(datapath, 0, match, actions, idle_timeout, dpid)
>>
>>
>> but after adding the code that you mentioned, my controller didn't
>> work properly (e.g. pingall command don't work).
>>
>>
>> how can i fix it?
>>
>>
>> thank you,
>>
>> Mehran shetabi
>>
>>
>> ------------------------------------------------------------------------
>> *From:* Fujimoto Satoshi <***@gmail.com>
>> *Sent:* Wednesday, July 12, 2017 5:43 AM
>> *To:* mehran shetabi; ryu-***@lists.sourceforge.net
>> *Subject:* Re: [Ryu-devel] how can i distinguish controllers for
>> packet in to them?
>>
>> Hi, Mehran
>>
>>
>> Sorry, I've overlooked about the following action, it may be able to
>> solve your problem:
>>
>> http://ryu.readthedocs.io/en/latest/nicira_ext_ref.html#ryu.ofproto.ofproto_v1_3_parser.NXActionController
>>
>>
>> This action belongs to 'Nicira extensions', not OpenFlow,
>>
>> but with this, switches can send Packet-In to the specific controller.
>>
>>
>> To specify the controller, the "controller_id" should be configured.
>>
>> Ryu can configure it by "NXTSetControllerId", but this can be used in
>> only OpenFlow 1.0.
>>
>>
>> Then, it is not a beautiful method, how about the following?
>>
>> (customizing ryu/app/simple_switch_13.py)
>>
>>
>>
>> @set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
>> def switch_features_handler(self, ev):
>> datapath = ev.msg.datapath
>> ofproto = datapath.ofproto
>> parser = datapath.ofproto_parser
>>
>>
>> # configuring controller_id of this controller
>>
>> req = ofproto_v1_0_parser.NXTSetControllerId(datapath,
>> controller_id=5)
>> datapath.send_msg(req)
>>
>>
>> # add an action to send Packet-In to this controller
>>
>> match = parser.OFPMatch()
>> actions = [
>> parser.NXActionController(0, 5, ofproto.OFPR_ACTION)]
>>
>> self.add_flow(datapath, 0, match, actions)
>>
>>
>>
>> This can be good for you?
>>
>> Thanks,
>> Fujimoto
>>
>>
>> On 2017幎07月11日 14:20, mehran shetabi wrote:
>>>
>>> hi, Fujimoto
>>>
>>>
>>> with setting roles and Async solution, if there are more than two
>>> controllers, how can i distinguish between them?
>>>
>>> my problem is, how can i sent packet-in to the exact controller?
>>>
>>>
>>> thank you,
>>>
>>> Mehran shetabi
>>>
>>>
>>> ------------------------------------------------------------------------
>>> *From:* Fujimoto Satoshi <***@gmail.com>
>>> *Sent:* Tuesday, July 11, 2017 4:45 AM
>>> *To:* mehran shetabi; ryu-***@lists.sourceforge.net
>>> *Subject:* Re: [Ryu-devel] how can i distinguish controllers for
>>> packet in to them?
>>> Hi, Mehran
>>>
>>>> how can i use OpenFlow channel in Mininet?
>>> Sorry, OpenFlow channel is a connection which is used for OpenFlow
>>> protocol and you already have.
>>> What I meant was that you should have another connection between
>>> controllers and the switch other than OpenFlow channel,
>>> to exchange "raw" packets, not OpenFlow packets.
>>>
>>>> in the second solution, how can i retrieve Packet-in header?
>>> As I said, in the second solution, the packets will be sent without
>>> Packet-in header.
>>> So, in this solution, there is no way to retrieve Packet-in header.
>>> If you want to get Packet-in header, I think this solution is not
>>> suitable,
>>> then you should apply the first solution (setting roles and Async).
>>>
>>> Do you need to get Packet-in header?
>>> If not, I try implementing and tell you how to implement the second
>>> solution.
>>>
>>>
>>> Thanks,
>>> Fujimoto
>>>
>>>
>>> On 2017幎07月11日 06:04, mehran shetabi wrote:
>>>>
>>>> hi, Fujimoto
>>>>
>>>>
>>>> in the second solution, how can i retrieve Packet-in header?
>>>>
>>>> is there any solution for it?
>>>>
>>>>
>>>> thank you,
>>>>
>>>> Mehran shetabi
>>>>
>>>> ------------------------------------------------------------------------
>>>> *From:* Fujimoto Satoshi <***@gmail.com>
>>>> *Sent:* Monday, July 10, 2017 5:35 AM
>>>> *To:* mehran shetabi; ryu-***@lists.sourceforge.net;
>>>> ***@gmail.com
>>>> *Subject:* Re: [Ryu-devel] how can i distinguish controllers for
>>>> packet in to them?
>>>> Hi, Mehran
>>>>
>>>> Unfortunately, you cannot use the port number which is connected to
>>>> the controller in OFPActionOutput().
>>>>
>>>> However, if you can set roles(Master/Slave) to the controllers,
>>>> you can use OFPSetAsync to control whether the switch sends
>>>> Packet-In to Master or Slave controller:
>>>> http://ryu.readthedocs.io/en/latest/ofproto_v1_3_ref.html#ryu.ofproto.ofproto_v1_3_parser.OFPSetAsync
>>>>
>>>>
>>>> Or, this is not a beautiful method, you can connect controllers and
>>>> the switch by another connection, like:
>>>>
>>>> c1 ──of───sw ──of───c2
>>>> │      ││      │
>>>> └──────┘└──────┘("of" means an OpenFlow channel)
>>>>
>>>> Then, you can specify the port number which is connected to the
>>>> controller.
>>>> But the controller should receive packets in your application,
>>>> and the packets are "raw" packets, so the informations in the
>>>> Packet-in header will be lost.
>>>>
>>>>
>>>> Thanks,
>>>> Fujimoto
>>>>
>>>> On 2017幎07月10日 07:52, mehran shetabi wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>>
>>>>> In Mininet, I created a topology with one switch, two host, and
>>>>> two inband RYU controller.
>>>>>
>>>>> In OFPActionOutput() function, instead of using
>>>>> ofproto.OFPP_CONTROLLER for output port may I use port number
>>>>> (e.g. 3) that connected to the controller?
>>>>>
>>>>> If the answer is no, is there any way to distinguish controllers
>>>>> for packet in to them?
>>>>>
>>>>>
>>>>> Thank you,
>>>>>
>>>>> Mehran shetabi
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Check out the vibrant tech community on one of the world's most
>>>>> engaging tech sites, Slashdot.org!http://sdm.link/slashdot
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Ryu-devel mailing list
>>>>> Ryu-***@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>>>>
>>>
>>
>
mehran shetabi
2017-07-14 08:41:40 UTC
Permalink
hi, Fujimoto


for initializing controllers, i want to populate mac-to-port tables of all of controllers by sending packet-in with OFPR_NO_MATCH reason to them.

as before, i want to use this code for installing table-miss flow entry:


# install table-miss flow entry
match = parser.OFPMatch()
actions = [parser.OFPActionOutput(ofproto.OFPP_CONTROLLER, ofproto.OFPCML_NO_BUFFER)]


and then, with Nicira extension action set controller_id for them:


# configuring controller_id of this controller
req = ofproto_v1_0_parser.NXTSetControllerId(datapath, controller_id=2)
datapath.send_msg(req)


but, when i do this, there is no packet-in to my controller.

why?

can i have OpenFlow action and Nicira Extension action together in my ryu code?


thank you,

Mehran shetabi

________________________________
From: Fujimoto Satoshi <***@gmail.com>
Sent: Friday, July 14, 2017 5:11 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

how can i install table-miss flow entry with "NXActionController" that consists controller_id of all of my controller and OFPR_NO_MATCH reason?
You can specify "OFPR_NO_MATCH" to "reason" field in "NXActionController":
parser.NXActionController(max_len=0, controller_id=2, reason=ofproto.OFPR_NO_MATCH)

However, what is "consists controller_id of all of my controller" ?
I thought you want to send packet-in to the "specific" controller,
so I think there is no need to specify two or more controllers in "NXActionController".

Anyway, I think it's up to you how to implement your application.


Thanks,
Fujimoto

On 2017$BG/(B07$B7n(B14$BF|(B 08:24, mehran shetabi wrote:

hi, Fujimoto


it is working.

but now my problem is, how can i install table-miss flow entry with "NXActionController" that consists controller_id of all of my controller and OFPR_NO_MATCH reason?

i want to populate mac-to-port table of all of my controller with running pingall command and then send packet-in to specific controller.

how can i do this?


thank you,

Mehran shetabi

________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Thursday, July 13, 2017 5:40 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

is there any conflict between OpenFlow 1.0 and OpenFlow 1.3?
Sorry, I didn't make it clear enough.
"NXTSetControllerId" is not a OpenFlow action, is a Nicira Extension action.
But in Ryu, this action is provided for only OpenFlow 1.0.
In this solution, we "hack" to use this action in OpenFlow 1.3.
I think there should be no conflict.

And in your code, you should use "NXActionController" to send Packet-In to the specific controller,
instead of "OFPActionOutput", it cannot do such a thing.
For "NXActionController", you have to specify the "controller_id" which you specified in "NXTSetControllerId".

I attached a code to this mail, it should be work well.
Please try it.


Thanks,
Fujimoto

On 2017$BG/(B07$B7n(B13$BF|(B 05:50, mehran shetabi wrote:

hi, Fujimoto


is there any conflict between OpenFlow 1.0 and OpenFlow 1.3?

you know, as you said, i use the code in my controller:



from ryu.ofproto import ofproto_v1_0_parser

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

def __init__(self, *args, **kwargs):
super(SimpleSwitch13, self).__init__(*args, **kwargs)
self.mac_to_port = {}

@set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
def switch_features_handler(self, ev):
datapath = ev.msg.datapath
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
dpid = datapath.id

# configuring controller_id of this controller
req = ofproto_v1_0_parser.NXTSetControllerId(datapath, controller_id=2)
datapath.send_msg(req)


# install table-miss flow entry
match = parser.OFPMatch()
actions = [parser.OFPActionOutput(ofproto.OFPP_CONTROLLER, ofproto.OFPCML_NO_BUFFER)]

idle_timeout=0
self.add_flow(datapath, 0, match, actions, idle_timeout, dpid)



but after adding the code that you mentioned, my controller didn't work properly (e.g. pingall command don't work).


how can i fix it?


thank you,

Mehran shetabi




________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Wednesday, July 12, 2017 5:43 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?


Hi, Mehran


Sorry, I've overlooked about the following action, it may be able to solve your problem:

http://ryu.readthedocs.io/en/latest/nicira_ext_ref.html#ryu.ofproto.ofproto_v1_3_parser.NXActionController


This action belongs to 'Nicira extensions', not OpenFlow,

but with this, switches can send Packet-In to the specific controller.


To specify the controller, the "controller_id" should be configured.

Ryu can configure it by "NXTSetControllerId", but this can be used in only OpenFlow 1.0.


Then, it is not a beautiful method, how about the following?

(customizing ryu/app/simple_switch_13.py)



@set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
def switch_features_handler(self, ev):
datapath = ev.msg.datapath
ofproto = datapath.ofproto
parser = datapath.ofproto_parser


# configuring controller_id of this controller

req = ofproto_v1_0_parser.NXTSetControllerId(datapath, controller_id=5)
datapath.send_msg(req)


# add an action to send Packet-In to this controller

match = parser.OFPMatch()
actions = [
parser.NXActionController(0, 5, ofproto.OFPR_ACTION)]

self.add_flow(datapath, 0, match, actions)


This can be good for you?

Thanks,
Fujimoto


On 2017$BG/(B07$B7n(B11$BF|(B 14:20, mehran shetabi wrote:

hi, Fujimoto


with setting roles and Async solution, if there are more than two controllers, how can i distinguish between them?

my problem is, how can i sent packet-in to the exact controller?


thank you,

Mehran shetabi


________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Tuesday, July 11, 2017 4:45 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

how can i use OpenFlow channel in Mininet?
Sorry, OpenFlow channel is a connection which is used for OpenFlow protocol and you already have.
What I meant was that you should have another connection between controllers and the switch other than OpenFlow channel,
to exchange "raw" packets, not OpenFlow packets.

in the second solution, how can i retrieve Packet-in header?
As I said, in the second solution, the packets will be sent without Packet-in header.
So, in this solution, there is no way to retrieve Packet-in header.
If you want to get Packet-in header, I think this solution is not suitable,
then you should apply the first solution (setting roles and Async).

Do you need to get Packet-in header?
If not, I try implementing and tell you how to implement the second solution.


Thanks,
Fujimoto


On 2017$BG/(B07$B7n(B11$BF|(B 06:04, mehran shetabi wrote:

hi, Fujimoto


in the second solution, how can i retrieve Packet-in header?

is there any solution for it?


thank you,

Mehran shetabi

________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Monday, July 10, 2017 5:35 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>; ***@gmail.com<mailto:***@gmail.com>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

Unfortunately, you cannot use the port number which is connected to the controller in OFPActionOutput().

However, if you can set roles(Master/Slave) to the controllers,
you can use OFPSetAsync to control whether the switch sends Packet-In to Master or Slave controller:
http://ryu.readthedocs.io/en/latest/ofproto_v1_3_ref.html#ryu.ofproto.ofproto_v1_3_parser.OFPSetAsync


Or, this is not a beautiful method, you can connect controllers and the switch by another connection, like:

c1 $B(!(!(Bof$B(!(!(!(Bsw $B(!(!(Bof$B(!(!(!(Bc2
$B("!!!!!!!!!!!!("("!!!!!!!!!!!!("(B
$B(&(!(!(!(!(!(!(%(&(!(!(!(!(!(!(%(B ("of" means an OpenFlow channel)

Then, you can specify the port number which is connected to the controller.
But the controller should receive packets in your application,
and the packets are "raw" packets, so the informations in the Packet-in header will be lost.


Thanks,
Fujimoto

On 2017$BG/(B07$B7n(B10$BF|(B 07:52, mehran shetabi wrote:
Hi,

In Mininet, I created a topology with one switch, two host, and two inband RYU controller.
In OFPActionOutput() function, instead of using ofproto.OFPP_CONTROLLER for output port may I use port number (e.g. 3) that connected to the controller?
If the answer is no, is there any way to distinguish controllers for packet in to them?

Thank you,
Mehran shetabi
mehran shetabi
2017-07-14 14:53:02 UTC
Permalink
hi, Fujimoto

for initializing controllers, i want to populate mac-to-port tables of all of controllers by sending packet-in with OFPR_NO_MATCH reason to them.
as before, i want to use this code for installing table-miss flow entry:

# install table-miss flow entry
match = parser.OFPMatch()
actions = [parser.OFPActionOutput(ofproto.OFPP_CONTROLLER, ofproto.OFPCML_NO_BUFFER)]
idle_timeout=0
self.add_flow(datapath, 0, match, actions, idle_timeout, dpid)

and then, with Nicira extension action set controller_id for them:

# configuring controller_id of this controller
req = ofproto_v1_0_parser.NXTSetControllerId(datapath, controller_id=2)
datapath.send_msg(req)

but, when i do this, there is no packet-in to my controller.
why?
can i have OpenFlow action and Nicira Extension action together in my ryu code?

thank you,
Mehran shetabi


________________________________
From: mehran shetabi
Sent: Friday, July 14, 2017 1:11 PM
To: ryu-***@lists.sourceforge.net
Cc: ***@gmail.com
Subject: RE: [Ryu-devel] how can i distinguish controllers for packet in to them?


hi, Fujimoto


for initializing controllers, i want to populate mac-to-port tables of all of controllers by sending packet-in with OFPR_NO_MATCH reason to them.

as before, i want to use this code for installing table-miss flow entry:


# install table-miss flow entry
match = parser.OFPMatch()
actions = [parser.OFPActionOutput(ofproto.OFPP_CONTROLLER, ofproto.OFPCML_NO_BUFFER)]


and then, with Nicira extension action set controller_id for them:


# configuring controller_id of this controller
req = ofproto_v1_0_parser.NXTSetControllerId(datapath, controller_id=2)
datapath.send_msg(req)


but, when i do this, there is no packet-in to my controller.

why?

can i have OpenFlow action and Nicira Extension action together in my ryu code?


thank you,

Mehran shetabi

________________________________
From: Fujimoto Satoshi <***@gmail.com>
Sent: Friday, July 14, 2017 5:11 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

how can i install table-miss flow entry with "NXActionController" that consists controller_id of all of my controller and OFPR_NO_MATCH reason?
You can specify "OFPR_NO_MATCH" to "reason" field in "NXActionController":
parser.NXActionController(max_len=0, controller_id=2, reason=ofproto.OFPR_NO_MATCH)

However, what is "consists controller_id of all of my controller" ?
I thought you want to send packet-in to the "specific" controller,
so I think there is no need to specify two or more controllers in "NXActionController".

Anyway, I think it's up to you how to implement your application.


Thanks,
Fujimoto

On 2017$BG/(B07$B7n(B14$BF|(B 08:24, mehran shetabi wrote:

hi, Fujimoto


it is working.

but now my problem is, how can i install table-miss flow entry with "NXActionController" that consists controller_id of all of my controller and OFPR_NO_MATCH reason?

i want to populate mac-to-port table of all of my controller with running pingall command and then send packet-in to specific controller.

how can i do this?


thank you,

Mehran shetabi

________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Thursday, July 13, 2017 5:40 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

is there any conflict between OpenFlow 1.0 and OpenFlow 1.3?
Sorry, I didn't make it clear enough.
"NXTSetControllerId" is not a OpenFlow action, is a Nicira Extension action.
But in Ryu, this action is provided for only OpenFlow 1.0.
In this solution, we "hack" to use this action in OpenFlow 1.3.
I think there should be no conflict.

And in your code, you should use "NXActionController" to send Packet-In to the specific controller,
instead of "OFPActionOutput", it cannot do such a thing.
For "NXActionController", you have to specify the "controller_id" which you specified in "NXTSetControllerId".

I attached a code to this mail, it should be work well.
Please try it.


Thanks,
Fujimoto

On 2017$BG/(B07$B7n(B13$BF|(B 05:50, mehran shetabi wrote:

hi, Fujimoto


is there any conflict between OpenFlow 1.0 and OpenFlow 1.3?

you know, as you said, i use the code in my controller:



from ryu.ofproto import ofproto_v1_0_parser

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

def __init__(self, *args, **kwargs):
super(SimpleSwitch13, self).__init__(*args, **kwargs)
self.mac_to_port = {}

@set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
def switch_features_handler(self, ev):
datapath = ev.msg.datapath
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
dpid = datapath.id

# configuring controller_id of this controller
req = ofproto_v1_0_parser.NXTSetControllerId(datapath, controller_id=2)
datapath.send_msg(req)


# install table-miss flow entry
match = parser.OFPMatch()
actions = [parser.OFPActionOutput(ofproto.OFPP_CONTROLLER, ofproto.OFPCML_NO_BUFFER)]

idle_timeout=0
self.add_flow(datapath, 0, match, actions, idle_timeout, dpid)



but after adding the code that you mentioned, my controller didn't work properly (e.g. pingall command don't work).


how can i fix it?


thank you,

Mehran shetabi




________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Wednesday, July 12, 2017 5:43 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?


Hi, Mehran


Sorry, I've overlooked about the following action, it may be able to solve your problem:

http://ryu.readthedocs.io/en/latest/nicira_ext_ref.html#ryu.ofproto.ofproto_v1_3_parser.NXActionController


This action belongs to 'Nicira extensions', not OpenFlow,

but with this, switches can send Packet-In to the specific controller.


To specify the controller, the "controller_id" should be configured.

Ryu can configure it by "NXTSetControllerId", but this can be used in only OpenFlow 1.0.


Then, it is not a beautiful method, how about the following?

(customizing ryu/app/simple_switch_13.py)



@set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
def switch_features_handler(self, ev):
datapath = ev.msg.datapath
ofproto = datapath.ofproto
parser = datapath.ofproto_parser


# configuring controller_id of this controller

req = ofproto_v1_0_parser.NXTSetControllerId(datapath, controller_id=5)
datapath.send_msg(req)


# add an action to send Packet-In to this controller

match = parser.OFPMatch()
actions = [
parser.NXActionController(0, 5, ofproto.OFPR_ACTION)]

self.add_flow(datapath, 0, match, actions)


This can be good for you?

Thanks,
Fujimoto


On 2017$BG/(B07$B7n(B11$BF|(B 14:20, mehran shetabi wrote:

hi, Fujimoto


with setting roles and Async solution, if there are more than two controllers, how can i distinguish between them?

my problem is, how can i sent packet-in to the exact controller?


thank you,

Mehran shetabi


________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Tuesday, July 11, 2017 4:45 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

how can i use OpenFlow channel in Mininet?
Sorry, OpenFlow channel is a connection which is used for OpenFlow protocol and you already have.
What I meant was that you should have another connection between controllers and the switch other than OpenFlow channel,
to exchange "raw" packets, not OpenFlow packets.

in the second solution, how can i retrieve Packet-in header?
As I said, in the second solution, the packets will be sent without Packet-in header.
So, in this solution, there is no way to retrieve Packet-in header.
If you want to get Packet-in header, I think this solution is not suitable,
then you should apply the first solution (setting roles and Async).

Do you need to get Packet-in header?
If not, I try implementing and tell you how to implement the second solution.


Thanks,
Fujimoto


On 2017$BG/(B07$B7n(B11$BF|(B 06:04, mehran shetabi wrote:

hi, Fujimoto


in the second solution, how can i retrieve Packet-in header?

is there any solution for it?


thank you,

Mehran shetabi

________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Monday, July 10, 2017 5:35 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>; ***@gmail.com<mailto:***@gmail.com>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

Unfortunately, you cannot use the port number which is connected to the controller in OFPActionOutput().

However, if you can set roles(Master/Slave) to the controllers,
you can use OFPSetAsync to control whether the switch sends Packet-In to Master or Slave controller:
http://ryu.readthedocs.io/en/latest/ofproto_v1_3_ref.html#ryu.ofproto.ofproto_v1_3_parser.OFPSetAsync


Or, this is not a beautiful method, you can connect controllers and the switch by another connection, like:

c1 $B(!(!(Bof$B(!(!(!(Bsw $B(!(!(Bof$B(!(!(!(Bc2
$B("!!!!!!!!!!!!("("!!!!!!!!!!!!("(B
$B(&(!(!(!(!(!(!(%(&(!(!(!(!(!(!(%(B ("of" means an OpenFlow channel)

Then, you can specify the port number which is connected to the controller.
But the controller should receive packets in your application,
and the packets are "raw" packets, so the informations in the Packet-in header will be lost.


Thanks,
Fujimoto

On 2017$BG/(B07$B7n(B10$BF|(B 07:52, mehran shetabi wrote:
Hi,

In Mininet, I created a topology with one switch, two host, and two inband RYU controller.
In OFPActionOutput() function, instead of using ofproto.OFPP_CONTROLLER for output port may I use port number (e.g. 3) that connected to the controller?
If the answer is no, is there any way to distinguish controllers for packet in to them?

Thank you,
Mehran shetabi
mehran shetabi
2017-07-17 04:32:34 UTC
Permalink
________________________________
From: mehran shetabi
Sent: Friday, July 14, 2017 7:23 PM
To: ryu-***@lists.sourceforge.net
Cc: ***@gmail.com
Subject: RE: [Ryu-devel] how can i distinguish controllers for packet in to them?

hi, Fujimoto

for initializing controllers, i want to populate mac-to-port tables of all of controllers by sending packet-in with OFPR_NO_MATCH reason to them.
as before, i want to use this code for installing table-miss flow entry:

# install table-miss flow entry
match = parser.OFPMatch()
actions = [parser.OFPActionOutput(ofproto.OFPP_CONTROLLER, ofproto.OFPCML_NO_BUFFER)]
idle_timeout=0
self.add_flow(datapath, 0, match, actions, idle_timeout, dpid)

and then, with Nicira extension action set controller_id for them:

# configuring controller_id of this controller
req = ofproto_v1_0_parser.NXTSetControllerId(datapath, controller_id=2)
datapath.send_msg(req)

but, when i do this, there is no packet-in to my controller.
why?
can i have OpenFlow action and Nicira Extension action together in my ryu code?

thank you,
Mehran shetabi


________________________________
From: mehran shetabi
Sent: Friday, July 14, 2017 1:11 PM
To: ryu-***@lists.sourceforge.net
Cc: ***@gmail.com
Subject: RE: [Ryu-devel] how can i distinguish controllers for packet in to them?


hi, Fujimoto


for initializing controllers, i want to populate mac-to-port tables of all of controllers by sending packet-in with OFPR_NO_MATCH reason to them.

as before, i want to use this code for installing table-miss flow entry:


# install table-miss flow entry
match = parser.OFPMatch()
actions = [parser.OFPActionOutput(ofproto.OFPP_CONTROLLER, ofproto.OFPCML_NO_BUFFER)]


and then, with Nicira extension action set controller_id for them:


# configuring controller_id of this controller
req = ofproto_v1_0_parser.NXTSetControllerId(datapath, controller_id=2)
datapath.send_msg(req)


but, when i do this, there is no packet-in to my controller.

why?

can i have OpenFlow action and Nicira Extension action together in my ryu code?


thank you,

Mehran shetabi

________________________________
From: Fujimoto Satoshi <***@gmail.com>
Sent: Friday, July 14, 2017 5:11 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

how can i install table-miss flow entry with "NXActionController" that consists controller_id of all of my controller and OFPR_NO_MATCH reason?
You can specify "OFPR_NO_MATCH" to "reason" field in "NXActionController":
parser.NXActionController(max_len=0, controller_id=2, reason=ofproto.OFPR_NO_MATCH)

However, what is "consists controller_id of all of my controller" ?
I thought you want to send packet-in to the "specific" controller,
so I think there is no need to specify two or more controllers in "NXActionController".

Anyway, I think it's up to you how to implement your application.


Thanks,
Fujimoto

On 2017$BG/(B07$B7n(B14$BF|(B 08:24, mehran shetabi wrote:

hi, Fujimoto


it is working.

but now my problem is, how can i install table-miss flow entry with "NXActionController" that consists controller_id of all of my controller and OFPR_NO_MATCH reason?

i want to populate mac-to-port table of all of my controller with running pingall command and then send packet-in to specific controller.

how can i do this?


thank you,

Mehran shetabi

________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Thursday, July 13, 2017 5:40 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

is there any conflict between OpenFlow 1.0 and OpenFlow 1.3?
Sorry, I didn't make it clear enough.
"NXTSetControllerId" is not a OpenFlow action, is a Nicira Extension action.
But in Ryu, this action is provided for only OpenFlow 1.0.
In this solution, we "hack" to use this action in OpenFlow 1.3.
I think there should be no conflict.

And in your code, you should use "NXActionController" to send Packet-In to the specific controller,
instead of "OFPActionOutput", it cannot do such a thing.
For "NXActionController", you have to specify the "controller_id" which you specified in "NXTSetControllerId".

I attached a code to this mail, it should be work well.
Please try it.


Thanks,
Fujimoto

On 2017$BG/(B07$B7n(B13$BF|(B 05:50, mehran shetabi wrote:

hi, Fujimoto


is there any conflict between OpenFlow 1.0 and OpenFlow 1.3?

you know, as you said, i use the code in my controller:



from ryu.ofproto import ofproto_v1_0_parser

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

def __init__(self, *args, **kwargs):
super(SimpleSwitch13, self).__init__(*args, **kwargs)
self.mac_to_port = {}

@set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
def switch_features_handler(self, ev):
datapath = ev.msg.datapath
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
dpid = datapath.id

# configuring controller_id of this controller
req = ofproto_v1_0_parser.NXTSetControllerId(datapath, controller_id=2)
datapath.send_msg(req)


# install table-miss flow entry
match = parser.OFPMatch()
actions = [parser.OFPActionOutput(ofproto.OFPP_CONTROLLER, ofproto.OFPCML_NO_BUFFER)]

idle_timeout=0
self.add_flow(datapath, 0, match, actions, idle_timeout, dpid)



but after adding the code that you mentioned, my controller didn't work properly (e.g. pingall command don't work).


how can i fix it?


thank you,

Mehran shetabi




________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Wednesday, July 12, 2017 5:43 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?


Hi, Mehran


Sorry, I've overlooked about the following action, it may be able to solve your problem:

http://ryu.readthedocs.io/en/latest/nicira_ext_ref.html#ryu.ofproto.ofproto_v1_3_parser.NXActionController


This action belongs to 'Nicira extensions', not OpenFlow,

but with this, switches can send Packet-In to the specific controller.


To specify the controller, the "controller_id" should be configured.

Ryu can configure it by "NXTSetControllerId", but this can be used in only OpenFlow 1.0.


Then, it is not a beautiful method, how about the following?

(customizing ryu/app/simple_switch_13.py)



@set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
def switch_features_handler(self, ev):
datapath = ev.msg.datapath
ofproto = datapath.ofproto
parser = datapath.ofproto_parser


# configuring controller_id of this controller

req = ofproto_v1_0_parser.NXTSetControllerId(datapath, controller_id=5)
datapath.send_msg(req)


# add an action to send Packet-In to this controller

match = parser.OFPMatch()
actions = [
parser.NXActionController(0, 5, ofproto.OFPR_ACTION)]

self.add_flow(datapath, 0, match, actions)


This can be good for you?

Thanks,
Fujimoto


On 2017$BG/(B07$B7n(B11$BF|(B 14:20, mehran shetabi wrote:

hi, Fujimoto


with setting roles and Async solution, if there are more than two controllers, how can i distinguish between them?

my problem is, how can i sent packet-in to the exact controller?


thank you,

Mehran shetabi


________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Tuesday, July 11, 2017 4:45 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

how can i use OpenFlow channel in Mininet?
Sorry, OpenFlow channel is a connection which is used for OpenFlow protocol and you already have.
What I meant was that you should have another connection between controllers and the switch other than OpenFlow channel,
to exchange "raw" packets, not OpenFlow packets.

in the second solution, how can i retrieve Packet-in header?
As I said, in the second solution, the packets will be sent without Packet-in header.
So, in this solution, there is no way to retrieve Packet-in header.
If you want to get Packet-in header, I think this solution is not suitable,
then you should apply the first solution (setting roles and Async).

Do you need to get Packet-in header?
If not, I try implementing and tell you how to implement the second solution.


Thanks,
Fujimoto


On 2017$BG/(B07$B7n(B11$BF|(B 06:04, mehran shetabi wrote:

hi, Fujimoto


in the second solution, how can i retrieve Packet-in header?

is there any solution for it?


thank you,

Mehran shetabi

________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Monday, July 10, 2017 5:35 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>; ***@gmail.com<mailto:***@gmail.com>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

Unfortunately, you cannot use the port number which is connected to the controller in OFPActionOutput().

However, if you can set roles(Master/Slave) to the controllers,
you can use OFPSetAsync to control whether the switch sends Packet-In to Master or Slave controller:
http://ryu.readthedocs.io/en/latest/ofproto_v1_3_ref.html#ryu.ofproto.ofproto_v1_3_parser.OFPSetAsync


Or, this is not a beautiful method, you can connect controllers and the switch by another connection, like:

c1 $B(!(!(Bof$B(!(!(!(Bsw $B(!(!(Bof$B(!(!(!(Bc2
$B("!!!!!!!!!!!!("("!!!!!!!!!!!!("(B
$B(&(!(!(!(!(!(!(%(&(!(!(!(!(!(!(%(B ("of" means an OpenFlow channel)

Then, you can specify the port number which is connected to the controller.
But the controller should receive packets in your application,
and the packets are "raw" packets, so the informations in the Packet-in header will be lost.


Thanks,
Fujimoto

On 2017$BG/(B07$B7n(B10$BF|(B 07:52, mehran shetabi wrote:
Hi,

In Mininet, I created a topology with one switch, two host, and two inband RYU controller.
In OFPActionOutput() function, instead of using ofproto.OFPP_CONTROLLER for output port may I use port number (e.g. 3) that connected to the controller?
If the answer is no, is there any way to distinguish controllers for packet in to them?

Thank you,
Mehran shetabi
Fujimoto Satoshi
2017-07-18 00:01:23 UTC
Permalink
Hi, Mehran
Sorry for delaying.

As I said, NXTSetControllerId does set "controller_id", not send Packet-In.
To send Packet-In to the specific controller, you should also use
NXActionController.

Did you check my code (simple_switch_13_nx.py) which I've sent to you?
Please refer to this code to implement your apps, I think this contains
enough for you.

Thanks,
Fujimoto

On 2017幎07月14日 17:41, mehran shetabi wrote:
>
> hi, Fujimoto
>
>
> for initializing controllers, i want to populate mac-to-port tables of
> all of controllers by sending packet-in with OFPR_NO_MATCH reason to them.
>
> as before, i want to use this code for installing table-miss flow entry:
>
>
> # install table-miss flow entry
> match = parser.OFPMatch()
> actions = [parser.OFPActionOutput(ofproto.OFPP_CONTROLLER,
> ofproto.OFPCML_NO_BUFFER)]
>
>
> and then, with Nicira extension action set controller_id for them:
>
>
> # configuring controller_id of this controller
> req = ofproto_v1_0_parser.NXTSetControllerId(datapath,
> controller_id=2)
> datapath.send_msg(req)
>
>
> but, when i do this, there is no packet-in to my controller.
>
> why?
>
> can i have OpenFlow action and Nicira Extension action together in my
> ryu code?
>
>
> thank you,
>
> Mehran shetabi
>
> ------------------------------------------------------------------------
> *From:* Fujimoto Satoshi <***@gmail.com>
> *Sent:* Friday, July 14, 2017 5:11 AM
> *To:* mehran shetabi; ryu-***@lists.sourceforge.net
> *Subject:* Re: [Ryu-devel] how can i distinguish controllers for
> packet in to them?
> Hi, Mehran
>
>> how can i install table-miss flow entry
>> with "NXActionController" that consists controller_id of all of
>> my controller and OFPR_NO_MATCH reason?
> You can specify "OFPR_NO_MATCH" to "reason" field in "NXActionController":
> parser.NXActionController(max_len=0, controller_id=2,
> reason=ofproto.OFPR_NO_MATCH)
>
> However, what is "consists controller_id of all of my controller" ?
> I thought you want to send packet-in to the "specific" controller,
> so I think there is no need to specify two or more controllers in
> "NXActionController".
>
> Anyway, I think it's up to you how to implement your application.
>
>
> Thanks,
> Fujimoto
>
> On 2017幎07月14日 08:24, mehran shetabi wrote:
>>
>> hi, Fujimoto
>>
>>
>> it is working.
>>
>> but now my problem is, how can i install table-miss flow entry
>> with "NXActionController" that consists controller_id of all of
>> my controller and OFPR_NO_MATCH reason?
>>
>> i want to populate mac-to-port
>> table of all of my controller with running pingall
>> command and then send packet-in to specific controller.
>>
>> how can i do this?
>>
>>
>> thank you,
>>
>> Mehran shetabi
>>
>> ------------------------------------------------------------------------
>> *From:* Fujimoto Satoshi <***@gmail.com>
>> *Sent:* Thursday, July 13, 2017 5:40 AM
>> *To:* mehran shetabi; ryu-***@lists.sourceforge.net
>> *Subject:* Re: [Ryu-devel] how can i distinguish controllers for
>> packet in to them?
>> Hi, Mehran
>>
>>> is there any conflict between OpenFlow 1.0 and OpenFlow 1.3?
>> Sorry, I didn't make it clear enough.
>> "NXTSetControllerId" is not a OpenFlow action, is a Nicira Extension
>> action.
>> But in Ryu, this action is provided for only OpenFlow 1.0.
>> In this solution, we "hack" to use this action in OpenFlow 1.3.
>> I think there should be no conflict.
>>
>> And in your code, you should use "NXActionController" to send
>> Packet-In to the specific controller,
>> instead of "OFPActionOutput", it cannot do such a thing.
>> For "NXActionController", you have to specify the "controller_id"
>> which you specified in "NXTSetControllerId".
>>
>> I attached a code to this mail, it should be work well.
>> Please try it.
>>
>>
>> Thanks,
>> Fujimoto
>>
>> On 2017幎07月13日 05:50, mehran shetabi wrote:
>>>
>>> hi, Fujimoto
>>>
>>>
>>> is there any conflict between OpenFlow 1.0 and OpenFlow 1.3?
>>>
>>> you know, as you said, i use the code in my controller:
>>>
>>>
>>>
>>> from ryu.ofproto import ofproto_v1_0_parser
>>>
>>> class SimpleSwitch13(app_manager.RyuApp):
>>> OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION]
>>>
>>> def __init__(self, *args, **kwargs):
>>> super(SimpleSwitch13, self).__init__(*args, **kwargs)
>>> self.mac_to_port = {}
>>>
>>> @set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
>>> def switch_features_handler(self, ev):
>>> datapath = ev.msg.datapath
>>> ofproto = datapath.ofproto
>>> parser = datapath.ofproto_parser
>>> dpid = datapath.id
>>>
>>> # configuring controller_id of this controller
>>> req = ofproto_v1_0_parser.NXTSetControllerId(datapath,
>>> controller_id=2)
>>> datapath.send_msg(req)
>>>
>>>
>>> # install table-miss flow entry
>>> match = parser.OFPMatch()
>>> actions = [parser.OFPActionOutput(ofproto.OFPP_CONTROLLER,
>>> ofproto.OFPCML_NO_BUFFER)]
>>>
>>> idle_timeout=0
>>> self.add_flow(datapath, 0, match, actions, idle_timeout, dpid)
>>>
>>>
>>> but after adding the code that you mentioned, my controller didn't
>>> work properly (e.g. pingall command don't work).
>>>
>>>
>>> how can i fix it?
>>>
>>>
>>> thank you,
>>>
>>> Mehran shetabi
>>>
>>>
>>> ------------------------------------------------------------------------
>>> *From:* Fujimoto Satoshi <***@gmail.com>
>>> *Sent:* Wednesday, July 12, 2017 5:43 AM
>>> *To:* mehran shetabi; ryu-***@lists.sourceforge.net
>>> *Subject:* Re: [Ryu-devel] how can i distinguish controllers for
>>> packet in to them?
>>>
>>> Hi, Mehran
>>>
>>>
>>> Sorry, I've overlooked about the following action, it may be able to
>>> solve your problem:
>>>
>>> http://ryu.readthedocs.io/en/latest/nicira_ext_ref.html#ryu.ofproto.ofproto_v1_3_parser.NXActionController
>>>
>>>
>>> This action belongs to 'Nicira extensions', not OpenFlow,
>>>
>>> but with this, switches can send Packet-In to the specific controller.
>>>
>>>
>>> To specify the controller, the "controller_id" should be configured.
>>>
>>> Ryu can configure it by "NXTSetControllerId", but this can be used
>>> in only OpenFlow 1.0.
>>>
>>>
>>> Then, it is not a beautiful method, how about the following?
>>>
>>> (customizing ryu/app/simple_switch_13.py)
>>>
>>>
>>>
>>> @set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
>>> def switch_features_handler(self, ev):
>>> datapath = ev.msg.datapath
>>> ofproto = datapath.ofproto
>>> parser = datapath.ofproto_parser
>>>
>>>
>>> # configuring controller_id of this controller
>>>
>>> req = ofproto_v1_0_parser.NXTSetControllerId(datapath,
>>> controller_id=5)
>>> datapath.send_msg(req)
>>>
>>>
>>> # add an action to send Packet-In to this controller
>>>
>>> match = parser.OFPMatch()
>>> actions = [
>>> parser.NXActionController(0, 5, ofproto.OFPR_ACTION)]
>>>
>>> self.add_flow(datapath, 0, match, actions)
>>>
>>>
>>>
>>> This can be good for you?
>>>
>>> Thanks,
>>> Fujimoto
>>>
>>>
>>> On 2017幎07月11日 14:20, mehran shetabi wrote:
>>>>
>>>> hi, Fujimoto
>>>>
>>>>
>>>> with setting roles and Async solution, if there are more than two
>>>> controllers, how can i distinguish between them?
>>>>
>>>> my problem is, how can i sent packet-in to the exact controller?
>>>>
>>>>
>>>> thank you,
>>>>
>>>> Mehran shetabi
>>>>
>>>>
>>>> ------------------------------------------------------------------------
>>>> *From:* Fujimoto Satoshi <***@gmail.com>
>>>> *Sent:* Tuesday, July 11, 2017 4:45 AM
>>>> *To:* mehran shetabi; ryu-***@lists.sourceforge.net
>>>> *Subject:* Re: [Ryu-devel] how can i distinguish controllers for
>>>> packet in to them?
>>>> Hi, Mehran
>>>>
>>>>> how can i use OpenFlow channel in Mininet?
>>>> Sorry, OpenFlow channel is a connection which is used for OpenFlow
>>>> protocol and you already have.
>>>> What I meant was that you should have another connection between
>>>> controllers and the switch other than OpenFlow channel,
>>>> to exchange "raw" packets, not OpenFlow packets.
>>>>
>>>>> in the second solution, how can i retrieve Packet-in header?
>>>> As I said, in the second solution, the packets will be sent without
>>>> Packet-in header.
>>>> So, in this solution, there is no way to retrieve Packet-in header.
>>>> If you want to get Packet-in header, I think this solution is not
>>>> suitable,
>>>> then you should apply the first solution (setting roles and Async).
>>>>
>>>> Do you need to get Packet-in header?
>>>> If not, I try implementing and tell you how to implement the second
>>>> solution.
>>>>
>>>>
>>>> Thanks,
>>>> Fujimoto
>>>>
>>>>
>>>> On 2017幎07月11日 06:04, mehran shetabi wrote:
>>>>>
>>>>> hi, Fujimoto
>>>>>
>>>>>
>>>>> in the second solution, how can i retrieve Packet-in header?
>>>>>
>>>>> is there any solution for it?
>>>>>
>>>>>
>>>>> thank you,
>>>>>
>>>>> Mehran shetabi
>>>>>
>>>>> ------------------------------------------------------------------------
>>>>> *From:* Fujimoto Satoshi <***@gmail.com>
>>>>> *Sent:* Monday, July 10, 2017 5:35 AM
>>>>> *To:* mehran shetabi; ryu-***@lists.sourceforge.net;
>>>>> ***@gmail.com
>>>>> *Subject:* Re: [Ryu-devel] how can i distinguish controllers for
>>>>> packet in to them?
>>>>> Hi, Mehran
>>>>>
>>>>> Unfortunately, you cannot use the port number which is connected
>>>>> to the controller in OFPActionOutput().
>>>>>
>>>>> However, if you can set roles(Master/Slave) to the controllers,
>>>>> you can use OFPSetAsync to control whether the switch sends
>>>>> Packet-In to Master or Slave controller:
>>>>> http://ryu.readthedocs.io/en/latest/ofproto_v1_3_ref.html#ryu.ofproto.ofproto_v1_3_parser.OFPSetAsync
>>>>>
>>>>>
>>>>> Or, this is not a beautiful method, you can connect controllers
>>>>> and the switch by another connection, like:
>>>>>
>>>>> c1 ──of───sw ──of───c2
>>>>> │      ││      │
>>>>> └──────┘└──────┘("of" means an OpenFlow channel)
>>>>>
>>>>> Then, you can specify the port number which is connected to the
>>>>> controller.
>>>>> But the controller should receive packets in your application,
>>>>> and the packets are "raw" packets, so the informations in the
>>>>> Packet-in header will be lost.
>>>>>
>>>>>
>>>>> Thanks,
>>>>> Fujimoto
>>>>>
>>>>> On 2017幎07月10日 07:52, mehran shetabi wrote:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>>
>>>>>> In Mininet, I created a topology with one switch, two host, and
>>>>>> two inband RYU controller.
>>>>>>
>>>>>> In OFPActionOutput() function, instead of using
>>>>>> ofproto.OFPP_CONTROLLER for output port may I use port number
>>>>>> (e.g. 3) that connected to the controller?
>>>>>>
>>>>>> If the answer is no, is there any way to distinguish controllers
>>>>>> for packet in to them?
>>>>>>
>>>>>>
>>>>>> Thank you,
>>>>>>
>>>>>> Mehran shetabi
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------------------------
>>>>>> Check out the vibrant tech community on one of the world's most
>>>>>> engaging tech sites, Slashdot.org!http://sdm.link/slashdot
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Ryu-devel mailing list
>>>>>> Ryu-***@lists.sourceforge.net
>>>>>> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>>>>>
>>>>
>>>
>>
>
mehran shetabi
2017-07-18 19:35:24 UTC
Permalink
hi, Fujimoto


sorry, there is a missunderstanding.

i want to know, after setting controller_id for a controller with NXTSetControllerId action, can i use OFPActionOutput again for sending packet_in to it as before withot specifying controller_id, or i must use NXActionController for sending packet_in to it and there is no way to use OFPActionOutput action?


another question:

after setting controller_id for a controller with NXTSetControllerId action, can i use OFPRoleRequest action for changing state of controller (e.g. form SLAVE to EQUAL or from EQUAL to SLAVE) ?


thank you,

Mehran shetabi


________________________________
From: Fujimoto Satoshi <***@gmail.com>
Sent: Tuesday, July 18, 2017 4:31 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran
Sorry for delaying.

As I said, NXTSetControllerId does set "controller_id", not send Packet-In.
To send Packet-In to the specific controller, you should also use NXActionController.

Did you check my code (simple_switch_13_nx.py) which I've sent to you?
Please refer to this code to implement your apps, I think this contains enough for you.

Thanks,
Fujimoto

On 2017$BG/(B07$B7n(B14$BF|(B 17:41, mehran shetabi wrote:

hi, Fujimoto


for initializing controllers, i want to populate mac-to-port tables of all of controllers by sending packet-in with OFPR_NO_MATCH reason to them.

as before, i want to use this code for installing table-miss flow entry:


# install table-miss flow entry
match = parser.OFPMatch()
actions = [parser.OFPActionOutput(ofproto.OFPP_CONTROLLER, ofproto.OFPCML_NO_BUFFER)]


and then, with Nicira extension action set controller_id for them:


# configuring controller_id of this controller
req = ofproto_v1_0_parser.NXTSetControllerId(datapath, controller_id=2)
datapath.send_msg(req)


but, when i do this, there is no packet-in to my controller.

why?

can i have OpenFlow action and Nicira Extension action together in my ryu code?


thank you,

Mehran shetabi

________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Friday, July 14, 2017 5:11 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

how can i install table-miss flow entry with "NXActionController" that consists controller_id of all of my controller and OFPR_NO_MATCH reason?
You can specify "OFPR_NO_MATCH" to "reason" field in "NXActionController":
parser.NXActionController(max_len=0, controller_id=2, reason=ofproto.OFPR_NO_MATCH)

However, what is "consists controller_id of all of my controller" ?
I thought you want to send packet-in to the "specific" controller,
so I think there is no need to specify two or more controllers in "NXActionController".

Anyway, I think it's up to you how to implement your application.


Thanks,
Fujimoto

On 2017$BG/(B07$B7n(B14$BF|(B 08:24, mehran shetabi wrote:

hi, Fujimoto


it is working.

but now my problem is, how can i install table-miss flow entry with "NXActionController" that consists controller_id of all of my controller and OFPR_NO_MATCH reason?

i want to populate mac-to-port table of all of my controller with running pingall command and then send packet-in to specific controller.

how can i do this?


thank you,

Mehran shetabi

________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Thursday, July 13, 2017 5:40 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

is there any conflict between OpenFlow 1.0 and OpenFlow 1.3?
Sorry, I didn't make it clear enough.
"NXTSetControllerId" is not a OpenFlow action, is a Nicira Extension action.
But in Ryu, this action is provided for only OpenFlow 1.0.
In this solution, we "hack" to use this action in OpenFlow 1.3.
I think there should be no conflict.

And in your code, you should use "NXActionController" to send Packet-In to the specific controller,
instead of "OFPActionOutput", it cannot do such a thing.
For "NXActionController", you have to specify the "controller_id" which you specified in "NXTSetControllerId".

I attached a code to this mail, it should be work well.
Please try it.


Thanks,
Fujimoto

On 2017$BG/(B07$B7n(B13$BF|(B 05:50, mehran shetabi wrote:

hi, Fujimoto


is there any conflict between OpenFlow 1.0 and OpenFlow 1.3?

you know, as you said, i use the code in my controller:



from ryu.ofproto import ofproto_v1_0_parser

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

def __init__(self, *args, **kwargs):
super(SimpleSwitch13, self).__init__(*args, **kwargs)
self.mac_to_port = {}

@set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
def switch_features_handler(self, ev):
datapath = ev.msg.datapath
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
dpid = datapath.id

# configuring controller_id of this controller
req = ofproto_v1_0_parser.NXTSetControllerId(datapath, controller_id=2)
datapath.send_msg(req)


# install table-miss flow entry
match = parser.OFPMatch()
actions = [parser.OFPActionOutput(ofproto.OFPP_CONTROLLER, ofproto.OFPCML_NO_BUFFER)]

idle_timeout=0
self.add_flow(datapath, 0, match, actions, idle_timeout, dpid)



but after adding the code that you mentioned, my controller didn't work properly (e.g. pingall command don't work).


how can i fix it?


thank you,

Mehran shetabi




________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Wednesday, July 12, 2017 5:43 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?


Hi, Mehran


Sorry, I've overlooked about the following action, it may be able to solve your problem:

http://ryu.readthedocs.io/en/latest/nicira_ext_ref.html#ryu.ofproto.ofproto_v1_3_parser.NXActionController


This action belongs to 'Nicira extensions', not OpenFlow,

but with this, switches can send Packet-In to the specific controller.


To specify the controller, the "controller_id" should be configured.

Ryu can configure it by "NXTSetControllerId", but this can be used in only OpenFlow 1.0.


Then, it is not a beautiful method, how about the following?

(customizing ryu/app/simple_switch_13.py)



@set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
def switch_features_handler(self, ev):
datapath = ev.msg.datapath
ofproto = datapath.ofproto
parser = datapath.ofproto_parser


# configuring controller_id of this controller

req = ofproto_v1_0_parser.NXTSetControllerId(datapath, controller_id=5)
datapath.send_msg(req)


# add an action to send Packet-In to this controller

match = parser.OFPMatch()
actions = [
parser.NXActionController(0, 5, ofproto.OFPR_ACTION)]

self.add_flow(datapath, 0, match, actions)


This can be good for you?

Thanks,
Fujimoto


On 2017$BG/(B07$B7n(B11$BF|(B 14:20, mehran shetabi wrote:

hi, Fujimoto


with setting roles and Async solution, if there are more than two controllers, how can i distinguish between them?

my problem is, how can i sent packet-in to the exact controller?


thank you,

Mehran shetabi


________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Tuesday, July 11, 2017 4:45 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

how can i use OpenFlow channel in Mininet?
Sorry, OpenFlow channel is a connection which is used for OpenFlow protocol and you already have.
What I meant was that you should have another connection between controllers and the switch other than OpenFlow channel,
to exchange "raw" packets, not OpenFlow packets.

in the second solution, how can i retrieve Packet-in header?
As I said, in the second solution, the packets will be sent without Packet-in header.
So, in this solution, there is no way to retrieve Packet-in header.
If you want to get Packet-in header, I think this solution is not suitable,
then you should apply the first solution (setting roles and Async).

Do you need to get Packet-in header?
If not, I try implementing and tell you how to implement the second solution.


Thanks,
Fujimoto


On 2017$BG/(B07$B7n(B11$BF|(B 06:04, mehran shetabi wrote:

hi, Fujimoto


in the second solution, how can i retrieve Packet-in header?

is there any solution for it?


thank you,

Mehran shetabi

________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Monday, July 10, 2017 5:35 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>; ***@gmail.com<mailto:***@gmail.com>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

Unfortunately, you cannot use the port number which is connected to the controller in OFPActionOutput().

However, if you can set roles(Master/Slave) to the controllers,
you can use OFPSetAsync to control whether the switch sends Packet-In to Master or Slave controller:
http://ryu.readthedocs.io/en/latest/ofproto_v1_3_ref.html#ryu.ofproto.ofproto_v1_3_parser.OFPSetAsync


Or, this is not a beautiful method, you can connect controllers and the switch by another connection, like:

c1 $B(!(!(Bof$B(!(!(!(Bsw $B(!(!(Bof$B(!(!(!(Bc2
$B("!!!!!!!!!!!!("("!!!!!!!!!!!!("(B
$B(&(!(!(!(!(!(!(%(&(!(!(!(!(!(!(%(B ("of" means an OpenFlow channel)

Then, you can specify the port number which is connected to the controller.
But the controller should receive packets in your application,
and the packets are "raw" packets, so the informations in the Packet-in header will be lost.


Thanks,
Fujimoto

On 2017$BG/(B07$B7n(B10$BF|(B 07:52, mehran shetabi wrote:
Hi,

In Mininet, I created a topology with one switch, two host, and two inband RYU controller.
In OFPActionOutput() function, instead of using ofproto.OFPP_CONTROLLER for output port may I use port number (e.g. 3) that connected to the controller?
If the answer is no, is there any way to distinguish controllers for packet in to them?

Thank you,
Mehran shetabi
Fujimoto Satoshi
2017-07-19 00:21:38 UTC
Permalink
Hi, Mehran


> after setting controller_id for a controller with NXTSetControllerId
> action, can i use OFPActionOutput again for sending packet_in to it as
> before withot specifying controller_id

> after setting controller_id for a controller with NXTSetControllerId
> action, can i use OFPRoleRequest action for changing state of
> controller (e.g. form SLAVE to EQUAL or from EQUAL to SLAVE) ?


Yes to both questions.

There is no limit to using both OpenFlow Actions and Nicira Extension
Actions together.


Please note that you cannot specify "controller_id" and "reason" for
this action:

http://ryu.readthedocs.io/en/latest/ofproto_v1_3_ref.html#ryu.ofproto.ofproto_v1_3_parser.OFPActionOutput


Thanks,
Fujimoto

On 2017幎07月19日 04:35, mehran shetabi wrote:
>
> hi, Fujimoto
>
>
> sorry, there is a missunderstanding.
>
> i want to know, after setting controller_id for a controller with
> NXTSetControllerId action, can i use OFPActionOutput again for sending
> packet_in to it as before withot specifying controller_id, or i must
> use NXActionController for sending packet_in to it and there is no way
> to use OFPActionOutput action?
>
>
> another question:
>
> after setting controller_id for a controller with NXTSetControllerId
> action, can i use OFPRoleRequest action for changing state of
> controller (e.g. form SLAVE to EQUAL or from EQUAL to SLAVE) ?
>
>
> thank you,
>
> Mehran shetabi
>
>
> ------------------------------------------------------------------------
> *From:* Fujimoto Satoshi <***@gmail.com>
> *Sent:* Tuesday, July 18, 2017 4:31 AM
> *To:* mehran shetabi; ryu-***@lists.sourceforge.net
> *Subject:* Re: [Ryu-devel] how can i distinguish controllers for
> packet in to them?
> Hi, Mehran
> Sorry for delaying.
>
> As I said, NXTSetControllerId does set "controller_id", not send
> Packet-In.
> To send Packet-In to the specific controller, you should also use
> NXActionController.
>
> Did you check my code (simple_switch_13_nx.py) which I've sent to you?
> Please refer to this code to implement your apps, I think this
> contains enough for you.
>
> Thanks,
> Fujimoto
>
> On 2017幎07月14日 17:41, mehran shetabi wrote:
>>
>> hi, Fujimoto
>>
>>
>> for initializing controllers, i want to populate mac-to-port tables
>> of all of controllers by sending packet-in with OFPR_NO_MATCH reason
>> to them.
>>
>> as before, i want to use this code for installing table-miss flow entry:
>>
>>
>> # install table-miss flow entry
>> match = parser.OFPMatch()
>> actions = [parser.OFPActionOutput(ofproto.OFPP_CONTROLLER,
>> ofproto.OFPCML_NO_BUFFER)]
>>
>>
>> and then, with Nicira extension action set controller_id for them:
>>
>>
>> # configuring controller_id of this controller
>> req = ofproto_v1_0_parser.NXTSetControllerId(datapath,
>> controller_id=2)
>> datapath.send_msg(req)
>>
>>
>> but, when i do this, there is no packet-in to my controller.
>>
>> why?
>>
>> can i have OpenFlow action and Nicira Extension action together in
>> my ryu code?
>>
>>
>> thank you,
>>
>> Mehran shetabi
>>
>> ------------------------------------------------------------------------
>> *From:* Fujimoto Satoshi <***@gmail.com>
>> *Sent:* Friday, July 14, 2017 5:11 AM
>> *To:* mehran shetabi; ryu-***@lists.sourceforge.net
>> *Subject:* Re: [Ryu-devel] how can i distinguish controllers for
>> packet in to them?
>> Hi, Mehran
>>
>>> how can i install table-miss flow entry
>>> with "NXActionController" that consists controller_id of all of
>>> my controller and OFPR_NO_MATCH reason?
>> You can specify "OFPR_NO_MATCH" to "reason" field in
>> "NXActionController":
>> parser.NXActionController(max_len=0, controller_id=2,
>> reason=ofproto.OFPR_NO_MATCH)
>>
>> However, what is "consists controller_id of all of my controller" ?
>> I thought you want to send packet-in to the "specific" controller,
>> so I think there is no need to specify two or more controllers in
>> "NXActionController".
>>
>> Anyway, I think it's up to you how to implement your application.
>>
>>
>> Thanks,
>> Fujimoto
>>
>> On 2017幎07月14日 08:24, mehran shetabi wrote:
>>>
>>> hi, Fujimoto
>>>
>>>
>>> it is working.
>>>
>>> but now my problem is, how can i install table-miss flow entry
>>> with "NXActionController" that consists controller_id of all of
>>> my controller and OFPR_NO_MATCH reason?
>>>
>>> i want to populate mac-to-port
>>> table of all of my controller with running pingall
>>> command and then send packet-in to specific controller.
>>>
>>> how can i do this?
>>>
>>>
>>> thank you,
>>>
>>> Mehran shetabi
>>>
>>> ------------------------------------------------------------------------
>>> *From:* Fujimoto Satoshi <***@gmail.com>
>>> *Sent:* Thursday, July 13, 2017 5:40 AM
>>> *To:* mehran shetabi; ryu-***@lists.sourceforge.net
>>> *Subject:* Re: [Ryu-devel] how can i distinguish controllers for
>>> packet in to them?
>>> Hi, Mehran
>>>
>>>> is there any conflict between OpenFlow 1.0 and OpenFlow 1.3?
>>> Sorry, I didn't make it clear enough.
>>> "NXTSetControllerId" is not a OpenFlow action, is a Nicira Extension
>>> action.
>>> But in Ryu, this action is provided for only OpenFlow 1.0.
>>> In this solution, we "hack" to use this action in OpenFlow 1.3.
>>> I think there should be no conflict.
>>>
>>> And in your code, you should use "NXActionController" to send
>>> Packet-In to the specific controller,
>>> instead of "OFPActionOutput", it cannot do such a thing.
>>> For "NXActionController", you have to specify the "controller_id"
>>> which you specified in "NXTSetControllerId".
>>>
>>> I attached a code to this mail, it should be work well.
>>> Please try it.
>>>
>>>
>>> Thanks,
>>> Fujimoto
>>>
>>> On 2017幎07月13日 05:50, mehran shetabi wrote:
>>>>
>>>> hi, Fujimoto
>>>>
>>>>
>>>> is there any conflict between OpenFlow 1.0 and OpenFlow 1.3?
>>>>
>>>> you know, as you said, i use the code in my controller:
>>>>
>>>>
>>>>
>>>> from ryu.ofproto import ofproto_v1_0_parser
>>>>
>>>> class SimpleSwitch13(app_manager.RyuApp):
>>>> OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION]
>>>>
>>>> def __init__(self, *args, **kwargs):
>>>> super(SimpleSwitch13, self).__init__(*args, **kwargs)
>>>> self.mac_to_port = {}
>>>>
>>>> @set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
>>>> def switch_features_handler(self, ev):
>>>> datapath = ev.msg.datapath
>>>> ofproto = datapath.ofproto
>>>> parser = datapath.ofproto_parser
>>>> dpid = datapath.id
>>>>
>>>> # configuring controller_id of this controller
>>>> req = ofproto_v1_0_parser.NXTSetControllerId(datapath,
>>>> controller_id=2)
>>>> datapath.send_msg(req)
>>>>
>>>>
>>>> # install table-miss flow entry
>>>> match = parser.OFPMatch()
>>>> actions = [parser.OFPActionOutput(ofproto.OFPP_CONTROLLER,
>>>> ofproto.OFPCML_NO_BUFFER)]
>>>>
>>>> idle_timeout=0
>>>> self.add_flow(datapath, 0, match, actions, idle_timeout, dpid)
>>>>
>>>>
>>>> but after adding the code that you mentioned, my controller didn't
>>>> work properly (e.g. pingall command don't work).
>>>>
>>>>
>>>> how can i fix it?
>>>>
>>>>
>>>> thank you,
>>>>
>>>> Mehran shetabi
>>>>
>>>>
>>>> ------------------------------------------------------------------------
>>>> *From:* Fujimoto Satoshi <***@gmail.com>
>>>> *Sent:* Wednesday, July 12, 2017 5:43 AM
>>>> *To:* mehran shetabi; ryu-***@lists.sourceforge.net
>>>> *Subject:* Re: [Ryu-devel] how can i distinguish controllers for
>>>> packet in to them?
>>>>
>>>> Hi, Mehran
>>>>
>>>>
>>>> Sorry, I've overlooked about the following action, it may be able
>>>> to solve your problem:
>>>>
>>>> http://ryu.readthedocs.io/en/latest/nicira_ext_ref.html#ryu.ofproto.ofproto_v1_3_parser.NXActionController
>>>>
>>>>
>>>> This action belongs to 'Nicira extensions', not OpenFlow,
>>>>
>>>> but with this, switches can send Packet-In to the specific controller.
>>>>
>>>>
>>>> To specify the controller, the "controller_id" should be configured.
>>>>
>>>> Ryu can configure it by "NXTSetControllerId", but this can be used
>>>> in only OpenFlow 1.0.
>>>>
>>>>
>>>> Then, it is not a beautiful method, how about the following?
>>>>
>>>> (customizing ryu/app/simple_switch_13.py)
>>>>
>>>>
>>>>
>>>> @set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
>>>> def switch_features_handler(self, ev):
>>>> datapath = ev.msg.datapath
>>>> ofproto = datapath.ofproto
>>>> parser = datapath.ofproto_parser
>>>>
>>>>
>>>> # configuring controller_id of this controller
>>>>
>>>> req = ofproto_v1_0_parser.NXTSetControllerId(datapath,
>>>> controller_id=5)
>>>> datapath.send_msg(req)
>>>>
>>>>
>>>> # add an action to send Packet-In to this controller
>>>>
>>>> match = parser.OFPMatch()
>>>> actions = [
>>>> parser.NXActionController(0, 5, ofproto.OFPR_ACTION)]
>>>>
>>>> self.add_flow(datapath, 0, match, actions)
>>>>
>>>>
>>>>
>>>> This can be good for you?
>>>>
>>>> Thanks,
>>>> Fujimoto
>>>>
>>>>
>>>> On 2017幎07月11日 14:20, mehran shetabi wrote:
>>>>>
>>>>> hi, Fujimoto
>>>>>
>>>>>
>>>>> with setting roles and Async solution, if there are more than two
>>>>> controllers, how can i distinguish between them?
>>>>>
>>>>> my problem is, how can i sent packet-in to the exact controller?
>>>>>
>>>>>
>>>>> thank you,
>>>>>
>>>>> Mehran shetabi
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------
>>>>> *From:* Fujimoto Satoshi <***@gmail.com>
>>>>> *Sent:* Tuesday, July 11, 2017 4:45 AM
>>>>> *To:* mehran shetabi; ryu-***@lists.sourceforge.net
>>>>> *Subject:* Re: [Ryu-devel] how can i distinguish controllers for
>>>>> packet in to them?
>>>>> Hi, Mehran
>>>>>
>>>>>> how can i use OpenFlow channel in Mininet?
>>>>> Sorry, OpenFlow channel is a connection which is used for OpenFlow
>>>>> protocol and you already have.
>>>>> What I meant was that you should have another connection between
>>>>> controllers and the switch other than OpenFlow channel,
>>>>> to exchange "raw" packets, not OpenFlow packets.
>>>>>
>>>>>> in the second solution, how can i retrieve Packet-in header?
>>>>> As I said, in the second solution, the packets will be sent
>>>>> without Packet-in header.
>>>>> So, in this solution, there is no way to retrieve Packet-in header.
>>>>> If you want to get Packet-in header, I think this solution is not
>>>>> suitable,
>>>>> then you should apply the first solution (setting roles and Async).
>>>>>
>>>>> Do you need to get Packet-in header?
>>>>> If not, I try implementing and tell you how to implement the
>>>>> second solution.
>>>>>
>>>>>
>>>>> Thanks,
>>>>> Fujimoto
>>>>>
>>>>>
>>>>> On 2017幎07月11日 06:04, mehran shetabi wrote:
>>>>>>
>>>>>> hi, Fujimoto
>>>>>>
>>>>>>
>>>>>> in the second solution, how can i retrieve Packet-in header?
>>>>>>
>>>>>> is there any solution for it?
>>>>>>
>>>>>>
>>>>>> thank you,
>>>>>>
>>>>>> Mehran shetabi
>>>>>>
>>>>>> ------------------------------------------------------------------------
>>>>>> *From:* Fujimoto Satoshi <***@gmail.com>
>>>>>> *Sent:* Monday, July 10, 2017 5:35 AM
>>>>>> *To:* mehran shetabi; ryu-***@lists.sourceforge.net;
>>>>>> ***@gmail.com
>>>>>> *Subject:* Re: [Ryu-devel] how can i distinguish controllers for
>>>>>> packet in to them?
>>>>>> Hi, Mehran
>>>>>>
>>>>>> Unfortunately, you cannot use the port number which is connected
>>>>>> to the controller in OFPActionOutput().
>>>>>>
>>>>>> However, if you can set roles(Master/Slave) to the controllers,
>>>>>> you can use OFPSetAsync to control whether the switch sends
>>>>>> Packet-In to Master or Slave controller:
>>>>>> http://ryu.readthedocs.io/en/latest/ofproto_v1_3_ref.html#ryu.ofproto.ofproto_v1_3_parser.OFPSetAsync
>>>>>>
>>>>>>
>>>>>> Or, this is not a beautiful method, you can connect controllers
>>>>>> and the switch by another connection, like:
>>>>>>
>>>>>> c1 ──of───sw ──of───c2
>>>>>> │      ││      │
>>>>>> └──────┘└──────┘("of" means an OpenFlow channel)
>>>>>>
>>>>>> Then, you can specify the port number which is connected to the
>>>>>> controller.
>>>>>> But the controller should receive packets in your application,
>>>>>> and the packets are "raw" packets, so the informations in the
>>>>>> Packet-in header will be lost.
>>>>>>
>>>>>>
>>>>>> Thanks,
>>>>>> Fujimoto
>>>>>>
>>>>>> On 2017幎07月10日 07:52, mehran shetabi wrote:
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>>
>>>>>>> In Mininet, I created a topology with one switch, two host, and
>>>>>>> two inband RYU controller.
>>>>>>>
>>>>>>> In OFPActionOutput() function, instead of using
>>>>>>> ofproto.OFPP_CONTROLLER for output port may I use port number
>>>>>>> (e.g. 3) that connected to the controller?
>>>>>>>
>>>>>>> If the answer is no, is there any way to distinguish controllers
>>>>>>> for packet in to them?
>>>>>>>
>>>>>>>
>>>>>>> Thank you,
>>>>>>>
>>>>>>> Mehran shetabi
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ------------------------------------------------------------------------------
>>>>>>> Check out the vibrant tech community on one of the world's most
>>>>>>> engaging tech sites, Slashdot.org!http://sdm.link/slashdot
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Ryu-devel mailing list
>>>>>>> Ryu-***@lists.sourceforge.net
>>>>>>> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>>>>>>
>>>>>
>>>>
>>>
>>
>
mehran shetabi
2017-07-19 14:11:30 UTC
Permalink
hi, Fujimoto

Would you please run the attached files?
As you see, there is a little change in your code (simple_switch_13_nx.py).
I run this code (simple_switch_13_nx_01.py) as my in band controller (h200), then run $B!H(Bpingall$B!I(B command in Mininet, but it doesn$B!G(Bt work (there is no Packet_in to controller).
Would you please tell me why?
How can I fix it?
Again, I want to set controller_id with NXTSetControllerId action, and then use OFPActionOutput action for sending packet_in to the controller as before (without specifying controller_id).

Thank you,
Mehran shetabi


________________________________
From: Fujimoto Satoshi <***@gmail.com>
Sent: Wednesday, July 19, 2017 4:51 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?


Hi, Mehran


after setting controller_id for a controller with NXTSetControllerId action, can i use OFPActionOutput again for sending packet_in to it as before withot specifying controller_id

after setting controller_id for a controller with NXTSetControllerId action, can i use OFPRoleRequest action for changing state of controller (e.g. form SLAVE to EQUAL or from EQUAL to SLAVE) ?


Yes to both questions.

There is no limit to using both OpenFlow Actions and Nicira Extension Actions together.


Please note that you cannot specify "controller_id" and "reason" for this action:

http://ryu.readthedocs.io/en/latest/ofproto_v1_3_ref.html#ryu.ofproto.ofproto_v1_3_parser.OFPActionOutput

Thanks,
Fujimoto

On 2017$BG/(B07$B7n(B19$BF|(B 04:35, mehran shetabi wrote:

hi, Fujimoto


sorry, there is a missunderstanding.

i want to know, after setting controller_id for a controller with NXTSetControllerId action, can i use OFPActionOutput again for sending packet_in to it as before withot specifying controller_id, or i must use NXActionController for sending packet_in to it and there is no way to use OFPActionOutput action?


another question:

after setting controller_id for a controller with NXTSetControllerId action, can i use OFPRoleRequest action for changing state of controller (e.g. form SLAVE to EQUAL or from EQUAL to SLAVE) ?


thank you,

Mehran shetabi


________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Tuesday, July 18, 2017 4:31 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran
Sorry for delaying.

As I said, NXTSetControllerId does set "controller_id", not send Packet-In.
To send Packet-In to the specific controller, you should also use NXActionController.

Did you check my code (simple_switch_13_nx.py) which I've sent to you?
Please refer to this code to implement your apps, I think this contains enough for you.

Thanks,
Fujimoto

On 2017$BG/(B07$B7n(B14$BF|(B 17:41, mehran shetabi wrote:

hi, Fujimoto


for initializing controllers, i want to populate mac-to-port tables of all of controllers by sending packet-in with OFPR_NO_MATCH reason to them.

as before, i want to use this code for installing table-miss flow entry:


# install table-miss flow entry
match = parser.OFPMatch()
actions = [parser.OFPActionOutput(ofproto.OFPP_CONTROLLER, ofproto.OFPCML_NO_BUFFER)]


and then, with Nicira extension action set controller_id for them:


# configuring controller_id of this controller
req = ofproto_v1_0_parser.NXTSetControllerId(datapath, controller_id=2)
datapath.send_msg(req)


but, when i do this, there is no packet-in to my controller.

why?

can i have OpenFlow action and Nicira Extension action together in my ryu code?


thank you,

Mehran shetabi

________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Friday, July 14, 2017 5:11 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

how can i install table-miss flow entry with "NXActionController" that consists controller_id of all of my controller and OFPR_NO_MATCH reason?
You can specify "OFPR_NO_MATCH" to "reason" field in "NXActionController":
parser.NXActionController(max_len=0, controller_id=2, reason=ofproto.OFPR_NO_MATCH)

However, what is "consists controller_id of all of my controller" ?
I thought you want to send packet-in to the "specific" controller,
so I think there is no need to specify two or more controllers in "NXActionController".

Anyway, I think it's up to you how to implement your application.


Thanks,
Fujimoto

On 2017$BG/(B07$B7n(B14$BF|(B 08:24, mehran shetabi wrote:

hi, Fujimoto


it is working.

but now my problem is, how can i install table-miss flow entry with "NXActionController" that consists controller_id of all of my controller and OFPR_NO_MATCH reason?

i want to populate mac-to-port table of all of my controller with running pingall command and then send packet-in to specific controller.

how can i do this?


thank you,

Mehran shetabi

________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Thursday, July 13, 2017 5:40 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

is there any conflict between OpenFlow 1.0 and OpenFlow 1.3?
Sorry, I didn't make it clear enough.
"NXTSetControllerId" is not a OpenFlow action, is a Nicira Extension action.
But in Ryu, this action is provided for only OpenFlow 1.0.
In this solution, we "hack" to use this action in OpenFlow 1.3.
I think there should be no conflict.

And in your code, you should use "NXActionController" to send Packet-In to the specific controller,
instead of "OFPActionOutput", it cannot do such a thing.
For "NXActionController", you have to specify the "controller_id" which you specified in "NXTSetControllerId".

I attached a code to this mail, it should be work well.
Please try it.


Thanks,
Fujimoto

On 2017$BG/(B07$B7n(B13$BF|(B 05:50, mehran shetabi wrote:

hi, Fujimoto


is there any conflict between OpenFlow 1.0 and OpenFlow 1.3?

you know, as you said, i use the code in my controller:



from ryu.ofproto import ofproto_v1_0_parser

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

def __init__(self, *args, **kwargs):
super(SimpleSwitch13, self).__init__(*args, **kwargs)
self.mac_to_port = {}

@set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
def switch_features_handler(self, ev):
datapath = ev.msg.datapath
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
dpid = datapath.id

# configuring controller_id of this controller
req = ofproto_v1_0_parser.NXTSetControllerId(datapath, controller_id=2)
datapath.send_msg(req)


# install table-miss flow entry
match = parser.OFPMatch()
actions = [parser.OFPActionOutput(ofproto.OFPP_CONTROLLER, ofproto.OFPCML_NO_BUFFER)]

idle_timeout=0
self.add_flow(datapath, 0, match, actions, idle_timeout, dpid)



but after adding the code that you mentioned, my controller didn't work properly (e.g. pingall command don't work).


how can i fix it?


thank you,

Mehran shetabi




________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Wednesday, July 12, 2017 5:43 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?


Hi, Mehran


Sorry, I've overlooked about the following action, it may be able to solve your problem:

http://ryu.readthedocs.io/en/latest/nicira_ext_ref.html#ryu.ofproto.ofproto_v1_3_parser.NXActionController


This action belongs to 'Nicira extensions', not OpenFlow,

but with this, switches can send Packet-In to the specific controller.


To specify the controller, the "controller_id" should be configured.

Ryu can configure it by "NXTSetControllerId", but this can be used in only OpenFlow 1.0.


Then, it is not a beautiful method, how about the following?

(customizing ryu/app/simple_switch_13.py)



@set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
def switch_features_handler(self, ev):
datapath = ev.msg.datapath
ofproto = datapath.ofproto
parser = datapath.ofproto_parser


# configuring controller_id of this controller

req = ofproto_v1_0_parser.NXTSetControllerId(datapath, controller_id=5)
datapath.send_msg(req)


# add an action to send Packet-In to this controller

match = parser.OFPMatch()
actions = [
parser.NXActionController(0, 5, ofproto.OFPR_ACTION)]

self.add_flow(datapath, 0, match, actions)


This can be good for you?

Thanks,
Fujimoto


On 2017$BG/(B07$B7n(B11$BF|(B 14:20, mehran shetabi wrote:

hi, Fujimoto


with setting roles and Async solution, if there are more than two controllers, how can i distinguish between them?

my problem is, how can i sent packet-in to the exact controller?


thank you,

Mehran shetabi


________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Tuesday, July 11, 2017 4:45 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

how can i use OpenFlow channel in Mininet?
Sorry, OpenFlow channel is a connection which is used for OpenFlow protocol and you already have.
What I meant was that you should have another connection between controllers and the switch other than OpenFlow channel,
to exchange "raw" packets, not OpenFlow packets.

in the second solution, how can i retrieve Packet-in header?
As I said, in the second solution, the packets will be sent without Packet-in header.
So, in this solution, there is no way to retrieve Packet-in header.
If you want to get Packet-in header, I think this solution is not suitable,
then you should apply the first solution (setting roles and Async).

Do you need to get Packet-in header?
If not, I try implementing and tell you how to implement the second solution.


Thanks,
Fujimoto


On 2017$BG/(B07$B7n(B11$BF|(B 06:04, mehran shetabi wrote:

hi, Fujimoto


in the second solution, how can i retrieve Packet-in header?

is there any solution for it?


thank you,

Mehran shetabi

________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Monday, July 10, 2017 5:35 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>; ***@gmail.com<mailto:***@gmail.com>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

Unfortunately, you cannot use the port number which is connected to the controller in OFPActionOutput().

However, if you can set roles(Master/Slave) to the controllers,
you can use OFPSetAsync to control whether the switch sends Packet-In to Master or Slave controller:
http://ryu.readthedocs.io/en/latest/ofproto_v1_3_ref.html#ryu.ofproto.ofproto_v1_3_parser.OFPSetAsync


Or, this is not a beautiful method, you can connect controllers and the switch by another connection, like:

c1 $B(!(!(Bof$B(!(!(!(Bsw $B(!(!(Bof$B(!(!(!(Bc2
$B("!!!!!!!!!!!!("("!!!!!!!!!!!!("(B
$B(&(!(!(!(!(!(!(%(&(!(!(!(!(!(!(%(B ("of" means an OpenFlow channel)

Then, you can specify the port number which is connected to the controller.
But the controller should receive packets in your application,
and the packets are "raw" packets, so the informations in the Packet-in header will be lost.


Thanks,
Fujimoto

On 2017$BG/(B07$B7n(B10$BF|(B 07:52, mehran shetabi wrote:
Hi,

In Mininet, I created a topology with one switch, two host, and two inband RYU controller.
In OFPActionOutput() function, instead of using ofproto.OFPP_CONTROLLER for output port may I use port number (e.g. 3) that connected to the controller?
If the answer is no, is there any way to distinguish controllers for packet in to them?

Thank you,
Mehran shetabi
Fujimoto Satoshi
2017-07-20 01:05:28 UTC
Permalink
Hi, Mehran

You ran your controller in h200, right?
Perhaps, you cannot run your controller on a mininet host,
because mininet hosts cannot have OpenFlow channel, which is used for
sending OpenFlow messages.

I attached a topology file, please try with it.

Please note, the topology has two controllers.
When you run your application, you need to specify a controller address
to "--ofp-listen-host" option like below:
$ ryu-manager --ofp-listen-host '127.0.0.2' ryu.app.simple_switch_13_nx_01


Thanks,
Fujimoto

On 2017幎07月19日 23:11, mehran shetabi wrote:
>
> hi, Fujimoto
>
>
> Would you please run the attached files?
>
> As you see, there is a little change in your code
> (simple_switch_13_nx.py).
>
> I run this code (simple_switch_13_nx_01.py) as my in band controller
> (h200), then run “pingall” command in Mininet, but it doesn’t work
> (there is no Packet_in to controller).
>
> Would you please tell me why?
>
> How can I fix it?
>
> Again, I want to set controller_id with NXTSetControllerId action, and
> then use OFPActionOutput action for sending packet_in to the
> controller as before (without specifying controller_id).
>
> Thank you,
>
> Mehran shetabi
>
>
> ------------------------------------------------------------------------
> *From:* Fujimoto Satoshi <***@gmail.com>
> *Sent:* Wednesday, July 19, 2017 4:51 AM
> *To:* mehran shetabi; ryu-***@lists.sourceforge.net
> *Subject:* Re: [Ryu-devel] how can i distinguish controllers for
> packet in to them?
>
> Hi, Mehran
>
>
>> after setting controller_id for a controller with NXTSetControllerId
>> action, can i use OFPActionOutput again for sending packet_in to it
>> as before withot specifying controller_id
>
>> after setting controller_id for a controller with NXTSetControllerId
>> action, can i use OFPRoleRequest action for changing state of
>> controller (e.g. form SLAVE to EQUAL or from EQUAL to SLAVE) ?
>
>
> Yes to both questions.
>
> There is no limit to using both OpenFlow Actions and Nicira Extension
> Actions together.
>
>
> Please note that you cannot specify "controller_id" and "reason" for
> this action:
>
> http://ryu.readthedocs.io/en/latest/ofproto_v1_3_ref.html#ryu.ofproto.ofproto_v1_3_parser.OFPActionOutput
>
>
> Thanks,
> Fujimoto
>
> On 2017幎07月19日 04:35, mehran shetabi wrote:
>>
>> hi, Fujimoto
>>
>>
>> sorry, there is a missunderstanding.
>>
>> i want to know, after setting controller_id for a controller with
>> NXTSetControllerId action, can i use OFPActionOutput again for
>> sending packet_in to it as before withot
>> specifying controller_id, or i must use
>> NXActionController for sending packet_in to it and there is no way to
>> use OFPActionOutput action?
>>
>>
>> another question:
>>
>> after setting controller_id for a controller with NXTSetControllerId
>> action, can i use OFPRoleRequest action for changing state of
>> controller (e.g. form SLAVE to EQUAL or from EQUAL to SLAVE) ?
>>
>>
>> thank you,
>>
>> Mehran shetabi
>>
>>
>> ------------------------------------------------------------------------
>> *From:* Fujimoto Satoshi <***@gmail.com>
>> *Sent:* Tuesday, July 18, 2017 4:31 AM
>> *To:* mehran shetabi; ryu-***@lists.sourceforge.net
>> *Subject:* Re: [Ryu-devel] how can i distinguish controllers for
>> packet in to them?
>> Hi, Mehran
>> Sorry for delaying.
>>
>> As I said, NXTSetControllerId does set "controller_id", not send
>> Packet-In.
>> To send Packet-In to the specific controller, you should also use
>> NXActionController.
>>
>> Did you check my code (simple_switch_13_nx.py) which I've sent to you?
>> Please refer to this code to implement your apps, I think this
>> contains enough for you.
>>
>> Thanks,
>> Fujimoto
>>
>> On 2017幎07月14日 17:41, mehran shetabi wrote:
>>>
>>> hi, Fujimoto
>>>
>>>
>>> for initializing controllers, i want to populate mac-to-port tables
>>> of all of controllers by sending packet-in with OFPR_NO_MATCH reason
>>> to them.
>>>
>>> as before, i want to use this code for installing table-miss flow entry:
>>>
>>>
>>> # install table-miss flow entry
>>> match = parser.OFPMatch()
>>> actions = [parser.OFPActionOutput(ofproto.OFPP_CONTROLLER,
>>> ofproto.OFPCML_NO_BUFFER)]
>>>
>>>
>>> and then, with Nicira extension action set controller_id for them:
>>>
>>>
>>> # configuring controller_id of this controller
>>> req = ofproto_v1_0_parser.NXTSetControllerId(datapath,
>>> controller_id=2)
>>> datapath.send_msg(req)
>>>
>>>
>>> but, when i do this, there is no packet-in to my controller.
>>>
>>> why?
>>>
>>> can i have OpenFlow action and Nicira Extension action together in
>>> my ryu code?
>>>
>>>
>>> thank you,
>>>
>>> Mehran shetabi
>>>
>>> ------------------------------------------------------------------------
>>> *From:* Fujimoto Satoshi <***@gmail.com>
>>> *Sent:* Friday, July 14, 2017 5:11 AM
>>> *To:* mehran shetabi; ryu-***@lists.sourceforge.net
>>> *Subject:* Re: [Ryu-devel] how can i distinguish controllers for
>>> packet in to them?
>>> Hi, Mehran
>>>
>>>> how can i install table-miss flow entry
>>>> with "NXActionController" that consists controller_id of all of
>>>> my controller and OFPR_NO_MATCH reason?
>>> You can specify "OFPR_NO_MATCH" to "reason" field in
>>> "NXActionController":
>>> parser.NXActionController(max_len=0, controller_id=2,
>>> reason=ofproto.OFPR_NO_MATCH)
>>>
>>> However, what is "consists controller_id of all of my controller" ?
>>> I thought you want to send packet-in to the "specific" controller,
>>> so I think there is no need to specify two or more controllers in
>>> "NXActionController".
>>>
>>> Anyway, I think it's up to you how to implement your application.
>>>
>>>
>>> Thanks,
>>> Fujimoto
>>>
>>> On 2017幎07月14日 08:24, mehran shetabi wrote:
>>>>
>>>> hi, Fujimoto
>>>>
>>>>
>>>> it is working.
>>>>
>>>> but now my problem is, how can i install table-miss flow entry
>>>> with "NXActionController" that consists controller_id of all of
>>>> my controller and OFPR_NO_MATCH reason?
>>>>
>>>> i want to populate mac-to-port
>>>> table of all of my controller with running pingall
>>>> command and then send packet-in to specific controller.
>>>>
>>>> how can i do this?
>>>>
>>>>
>>>> thank you,
>>>>
>>>> Mehran shetabi
>>>>
>>>> ------------------------------------------------------------------------
>>>> *From:* Fujimoto Satoshi <***@gmail.com>
>>>> *Sent:* Thursday, July 13, 2017 5:40 AM
>>>> *To:* mehran shetabi; ryu-***@lists.sourceforge.net
>>>> *Subject:* Re: [Ryu-devel] how can i distinguish controllers for
>>>> packet in to them?
>>>> Hi, Mehran
>>>>
>>>>> is there any conflict between OpenFlow 1.0 and OpenFlow 1.3?
>>>> Sorry, I didn't make it clear enough.
>>>> "NXTSetControllerId" is not a OpenFlow action, is a Nicira
>>>> Extension action.
>>>> But in Ryu, this action is provided for only OpenFlow 1.0.
>>>> In this solution, we "hack" to use this action in OpenFlow 1.3.
>>>> I think there should be no conflict.
>>>>
>>>> And in your code, you should use "NXActionController" to send
>>>> Packet-In to the specific controller,
>>>> instead of "OFPActionOutput", it cannot do such a thing.
>>>> For "NXActionController", you have to specify the "controller_id"
>>>> which you specified in "NXTSetControllerId".
>>>>
>>>> I attached a code to this mail, it should be work well.
>>>> Please try it.
>>>>
>>>>
>>>> Thanks,
>>>> Fujimoto
>>>>
>>>> On 2017幎07月13日 05:50, mehran shetabi wrote:
>>>>>
>>>>> hi, Fujimoto
>>>>>
>>>>>
>>>>> is there any conflict between OpenFlow 1.0 and OpenFlow 1.3?
>>>>>
>>>>> you know, as you said, i use the code in my controller:
>>>>>
>>>>>
>>>>>
>>>>> from ryu.ofproto import ofproto_v1_0_parser
>>>>>
>>>>> class SimpleSwitch13(app_manager.RyuApp):
>>>>> OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION]
>>>>>
>>>>> def __init__(self, *args, **kwargs):
>>>>> super(SimpleSwitch13, self).__init__(*args, **kwargs)
>>>>> self.mac_to_port = {}
>>>>>
>>>>> @set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
>>>>> def switch_features_handler(self, ev):
>>>>> datapath = ev.msg.datapath
>>>>> ofproto = datapath.ofproto
>>>>> parser = datapath.ofproto_parser
>>>>> dpid = datapath.id
>>>>>
>>>>> # configuring controller_id of this controller
>>>>> req = ofproto_v1_0_parser.NXTSetControllerId(datapath,
>>>>> controller_id=2)
>>>>> datapath.send_msg(req)
>>>>>
>>>>>
>>>>> # install table-miss flow entry
>>>>> match = parser.OFPMatch()
>>>>> actions = [parser.OFPActionOutput(ofproto.OFPP_CONTROLLER,
>>>>> ofproto.OFPCML_NO_BUFFER)]
>>>>>
>>>>> idle_timeout=0
>>>>> self.add_flow(datapath, 0, match, actions, idle_timeout, dpid)
>>>>>
>>>>>
>>>>> but after adding the code that you mentioned, my controller didn't
>>>>> work properly (e.g. pingall command don't work).
>>>>>
>>>>>
>>>>> how can i fix it?
>>>>>
>>>>>
>>>>> thank you,
>>>>>
>>>>> Mehran shetabi
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------
>>>>> *From:* Fujimoto Satoshi <***@gmail.com>
>>>>> *Sent:* Wednesday, July 12, 2017 5:43 AM
>>>>> *To:* mehran shetabi; ryu-***@lists.sourceforge.net
>>>>> *Subject:* Re: [Ryu-devel] how can i distinguish controllers for
>>>>> packet in to them?
>>>>>
>>>>> Hi, Mehran
>>>>>
>>>>>
>>>>> Sorry, I've overlooked about the following action, it may be able
>>>>> to solve your problem:
>>>>>
>>>>> http://ryu.readthedocs.io/en/latest/nicira_ext_ref.html#ryu.ofproto.ofproto_v1_3_parser.NXActionController
>>>>>
>>>>>
>>>>> This action belongs to 'Nicira extensions', not OpenFlow,
>>>>>
>>>>> but with this, switches can send Packet-In to the specific controller.
>>>>>
>>>>>
>>>>> To specify the controller, the "controller_id" should be configured.
>>>>>
>>>>> Ryu can configure it by "NXTSetControllerId", but this can be used
>>>>> in only OpenFlow 1.0.
>>>>>
>>>>>
>>>>> Then, it is not a beautiful method, how about the following?
>>>>>
>>>>> (customizing ryu/app/simple_switch_13.py)
>>>>>
>>>>>
>>>>>
>>>>> @set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
>>>>> def switch_features_handler(self, ev):
>>>>> datapath = ev.msg.datapath
>>>>> ofproto = datapath.ofproto
>>>>> parser = datapath.ofproto_parser
>>>>>
>>>>>
>>>>> # configuring controller_id of this controller
>>>>>
>>>>> req = ofproto_v1_0_parser.NXTSetControllerId(datapath,
>>>>> controller_id=5)
>>>>> datapath.send_msg(req)
>>>>>
>>>>>
>>>>> # add an action to send Packet-In to this controller
>>>>>
>>>>> match = parser.OFPMatch()
>>>>> actions = [
>>>>> parser.NXActionController(0, 5, ofproto.OFPR_ACTION)]
>>>>>
>>>>> self.add_flow(datapath, 0, match, actions)
>>>>>
>>>>>
>>>>>
>>>>> This can be good for you?
>>>>>
>>>>> Thanks,
>>>>> Fujimoto
>>>>>
>>>>>
>>>>> On 2017幎07月11日 14:20, mehran shetabi wrote:
>>>>>>
>>>>>> hi, Fujimoto
>>>>>>
>>>>>>
>>>>>> with setting roles and Async solution, if there are more than two
>>>>>> controllers, how can i distinguish between them?
>>>>>>
>>>>>> my problem is, how can i sent packet-in to the exact controller?
>>>>>>
>>>>>>
>>>>>> thank you,
>>>>>>
>>>>>> Mehran shetabi
>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------------------
>>>>>> *From:* Fujimoto Satoshi <***@gmail.com>
>>>>>> *Sent:* Tuesday, July 11, 2017 4:45 AM
>>>>>> *To:* mehran shetabi; ryu-***@lists.sourceforge.net
>>>>>> *Subject:* Re: [Ryu-devel] how can i distinguish controllers for
>>>>>> packet in to them?
>>>>>> Hi, Mehran
>>>>>>
>>>>>>> how can i use OpenFlow channel in Mininet?
>>>>>> Sorry, OpenFlow channel is a connection which is used for
>>>>>> OpenFlow protocol and you already have.
>>>>>> What I meant was that you should have another connection between
>>>>>> controllers and the switch other than OpenFlow channel,
>>>>>> to exchange "raw" packets, not OpenFlow packets.
>>>>>>
>>>>>>> in the second solution, how can i retrieve Packet-in header?
>>>>>> As I said, in the second solution, the packets will be sent
>>>>>> without Packet-in header.
>>>>>> So, in this solution, there is no way to retrieve Packet-in header.
>>>>>> If you want to get Packet-in header, I think this solution is not
>>>>>> suitable,
>>>>>> then you should apply the first solution (setting roles and Async).
>>>>>>
>>>>>> Do you need to get Packet-in header?
>>>>>> If not, I try implementing and tell you how to implement the
>>>>>> second solution.
>>>>>>
>>>>>>
>>>>>> Thanks,
>>>>>> Fujimoto
>>>>>>
>>>>>>
>>>>>> On 2017幎07月11日 06:04, mehran shetabi wrote:
>>>>>>>
>>>>>>> hi, Fujimoto
>>>>>>>
>>>>>>>
>>>>>>> in the second solution, how can i retrieve Packet-in header?
>>>>>>>
>>>>>>> is there any solution for it?
>>>>>>>
>>>>>>>
>>>>>>> thank you,
>>>>>>>
>>>>>>> Mehran shetabi
>>>>>>>
>>>>>>> ------------------------------------------------------------------------
>>>>>>> *From:* Fujimoto Satoshi <***@gmail.com>
>>>>>>> *Sent:* Monday, July 10, 2017 5:35 AM
>>>>>>> *To:* mehran shetabi; ryu-***@lists.sourceforge.net;
>>>>>>> ***@gmail.com
>>>>>>> *Subject:* Re: [Ryu-devel] how can i distinguish controllers for
>>>>>>> packet in to them?
>>>>>>> Hi, Mehran
>>>>>>>
>>>>>>> Unfortunately, you cannot use the port number which is connected
>>>>>>> to the controller in OFPActionOutput().
>>>>>>>
>>>>>>> However, if you can set roles(Master/Slave) to the controllers,
>>>>>>> you can use OFPSetAsync to control whether the switch sends
>>>>>>> Packet-In to Master or Slave controller:
>>>>>>> http://ryu.readthedocs.io/en/latest/ofproto_v1_3_ref.html#ryu.ofproto.ofproto_v1_3_parser.OFPSetAsync
>>>>>>>
>>>>>>>
>>>>>>> Or, this is not a beautiful method, you can connect controllers
>>>>>>> and the switch by another connection, like:
>>>>>>>
>>>>>>> c1 ──of───sw ──of───c2
>>>>>>> │      ││      │
>>>>>>> └──────┘└──────┘("of" means an OpenFlow channel)
>>>>>>>
>>>>>>> Then, you can specify the port number which is connected to the
>>>>>>> controller.
>>>>>>> But the controller should receive packets in your application,
>>>>>>> and the packets are "raw" packets, so the informations in the
>>>>>>> Packet-in header will be lost.
>>>>>>>
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Fujimoto
>>>>>>>
>>>>>>> On 2017幎07月10日 07:52, mehran shetabi wrote:
>>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>>
>>>>>>>> In Mininet, I created a topology with one switch, two host, and
>>>>>>>> two inband RYU controller.
>>>>>>>>
>>>>>>>> In OFPActionOutput() function, instead of using
>>>>>>>> ofproto.OFPP_CONTROLLER for output port may I use port number
>>>>>>>> (e.g. 3) that connected to the controller?
>>>>>>>>
>>>>>>>> If the answer is no, is there any way to distinguish
>>>>>>>> controllers for packet in to them?
>>>>>>>>
>>>>>>>>
>>>>>>>> Thank you,
>>>>>>>>
>>>>>>>> Mehran shetabi
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> ------------------------------------------------------------------------------
>>>>>>>> Check out the vibrant tech community on one of the world's most
>>>>>>>> engaging tech sites, Slashdot.org!http://sdm.link/slashdot
>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> Ryu-devel mailing list
>>>>>>>> Ryu-***@lists.sourceforge.net
>>>>>>>> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>
mehran shetabi
2017-07-20 08:02:17 UTC
Permalink
hi, Fujimoto

With the new topology that you gave me, I did as you said, but there is still a problem.
As before, pingall command doesn$B!G(Bt work.
Are you try it in your pc? Is it work?
Would you please help me to fix it?

Thank you,
Mehran shetabi


________________________________
From: Fujimoto Satoshi <***@gmail.com>
Sent: Thursday, July 20, 2017 5:35 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

You ran your controller in h200, right?
Perhaps, you cannot run your controller on a mininet host,
because mininet hosts cannot have OpenFlow channel, which is used for sending OpenFlow messages.

I attached a topology file, please try with it.

Please note, the topology has two controllers.
When you run your application, you need to specify a controller address to "--ofp-listen-host" option like below:
$ ryu-manager --ofp-listen-host '127.0.0.2' ryu.app.simple_switch_13_nx_01


Thanks,
Fujimoto

On 2017$BG/(B07$B7n(B19$BF|(B 23:11, mehran shetabi wrote:

hi, Fujimoto

Would you please run the attached files?
As you see, there is a little change in your code (simple_switch_13_nx.py).
I run this code (simple_switch_13_nx_01.py) as my in band controller (h200), then run $B!H(Bpingall$B!I(B command in Mininet, but it doesn$B!G(Bt work (there is no Packet_in to controller).
Would you please tell me why?
How can I fix it?
Again, I want to set controller_id with NXTSetControllerId action, and then use OFPActionOutput action for sending packet_in to the controller as before (without specifying controller_id).

Thank you,
Mehran shetabi


________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Wednesday, July 19, 2017 4:51 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?


Hi, Mehran


after setting controller_id for a controller with NXTSetControllerId action, can i use OFPActionOutput again for sending packet_in to it as before withot specifying controller_id

after setting controller_id for a controller with NXTSetControllerId action, can i use OFPRoleRequest action for changing state of controller (e.g. form SLAVE to EQUAL or from EQUAL to SLAVE) ?


Yes to both questions.

There is no limit to using both OpenFlow Actions and Nicira Extension Actions together.


Please note that you cannot specify "controller_id" and "reason" for this action:

http://ryu.readthedocs.io/en/latest/ofproto_v1_3_ref.html#ryu.ofproto.ofproto_v1_3_parser.OFPActionOutput

Thanks,
Fujimoto

On 2017$BG/(B07$B7n(B19$BF|(B 04:35, mehran shetabi wrote:

hi, Fujimoto


sorry, there is a missunderstanding.

i want to know, after setting controller_id for a controller with NXTSetControllerId action, can i use OFPActionOutput again for sending packet_in to it as before withot specifying controller_id, or i must use NXActionController for sending packet_in to it and there is no way to use OFPActionOutput action?


another question:

after setting controller_id for a controller with NXTSetControllerId action, can i use OFPRoleRequest action for changing state of controller (e.g. form SLAVE to EQUAL or from EQUAL to SLAVE) ?


thank you,

Mehran shetabi


________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Tuesday, July 18, 2017 4:31 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran
Sorry for delaying.

As I said, NXTSetControllerId does set "controller_id", not send Packet-In.
To send Packet-In to the specific controller, you should also use NXActionController.

Did you check my code (simple_switch_13_nx.py) which I've sent to you?
Please refer to this code to implement your apps, I think this contains enough for you.

Thanks,
Fujimoto

On 2017$BG/(B07$B7n(B14$BF|(B 17:41, mehran shetabi wrote:

hi, Fujimoto


for initializing controllers, i want to populate mac-to-port tables of all of controllers by sending packet-in with OFPR_NO_MATCH reason to them.

as before, i want to use this code for installing table-miss flow entry:


# install table-miss flow entry
match = parser.OFPMatch()
actions = [parser.OFPActionOutput(ofproto.OFPP_CONTROLLER, ofproto.OFPCML_NO_BUFFER)]


and then, with Nicira extension action set controller_id for them:


# configuring controller_id of this controller
req = ofproto_v1_0_parser.NXTSetControllerId(datapath, controller_id=2)
datapath.send_msg(req)


but, when i do this, there is no packet-in to my controller.

why?

can i have OpenFlow action and Nicira Extension action together in my ryu code?


thank you,

Mehran shetabi

________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Friday, July 14, 2017 5:11 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

how can i install table-miss flow entry with "NXActionController" that consists controller_id of all of my controller and OFPR_NO_MATCH reason?
You can specify "OFPR_NO_MATCH" to "reason" field in "NXActionController":
parser.NXActionController(max_len=0, controller_id=2, reason=ofproto.OFPR_NO_MATCH)

However, what is "consists controller_id of all of my controller" ?
I thought you want to send packet-in to the "specific" controller,
so I think there is no need to specify two or more controllers in "NXActionController".

Anyway, I think it's up to you how to implement your application.


Thanks,
Fujimoto

On 2017$BG/(B07$B7n(B14$BF|(B 08:24, mehran shetabi wrote:

hi, Fujimoto


it is working.

but now my problem is, how can i install table-miss flow entry with "NXActionController" that consists controller_id of all of my controller and OFPR_NO_MATCH reason?

i want to populate mac-to-port table of all of my controller with running pingall command and then send packet-in to specific controller.

how can i do this?


thank you,

Mehran shetabi

________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Thursday, July 13, 2017 5:40 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

is there any conflict between OpenFlow 1.0 and OpenFlow 1.3?
Sorry, I didn't make it clear enough.
"NXTSetControllerId" is not a OpenFlow action, is a Nicira Extension action.
But in Ryu, this action is provided for only OpenFlow 1.0.
In this solution, we "hack" to use this action in OpenFlow 1.3.
I think there should be no conflict.

And in your code, you should use "NXActionController" to send Packet-In to the specific controller,
instead of "OFPActionOutput", it cannot do such a thing.
For "NXActionController", you have to specify the "controller_id" which you specified in "NXTSetControllerId".

I attached a code to this mail, it should be work well.
Please try it.


Thanks,
Fujimoto

On 2017$BG/(B07$B7n(B13$BF|(B 05:50, mehran shetabi wrote:

hi, Fujimoto


is there any conflict between OpenFlow 1.0 and OpenFlow 1.3?

you know, as you said, i use the code in my controller:



from ryu.ofproto import ofproto_v1_0_parser

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

def __init__(self, *args, **kwargs):
super(SimpleSwitch13, self).__init__(*args, **kwargs)
self.mac_to_port = {}

@set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
def switch_features_handler(self, ev):
datapath = ev.msg.datapath
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
dpid = datapath.id

# configuring controller_id of this controller
req = ofproto_v1_0_parser.NXTSetControllerId(datapath, controller_id=2)
datapath.send_msg(req)


# install table-miss flow entry
match = parser.OFPMatch()
actions = [parser.OFPActionOutput(ofproto.OFPP_CONTROLLER, ofproto.OFPCML_NO_BUFFER)]

idle_timeout=0
self.add_flow(datapath, 0, match, actions, idle_timeout, dpid)



but after adding the code that you mentioned, my controller didn't work properly (e.g. pingall command don't work).


how can i fix it?


thank you,

Mehran shetabi




________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Wednesday, July 12, 2017 5:43 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?


Hi, Mehran


Sorry, I've overlooked about the following action, it may be able to solve your problem:

http://ryu.readthedocs.io/en/latest/nicira_ext_ref.html#ryu.ofproto.ofproto_v1_3_parser.NXActionController


This action belongs to 'Nicira extensions', not OpenFlow,

but with this, switches can send Packet-In to the specific controller.


To specify the controller, the "controller_id" should be configured.

Ryu can configure it by "NXTSetControllerId", but this can be used in only OpenFlow 1.0.


Then, it is not a beautiful method, how about the following?

(customizing ryu/app/simple_switch_13.py)



@set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
def switch_features_handler(self, ev):
datapath = ev.msg.datapath
ofproto = datapath.ofproto
parser = datapath.ofproto_parser


# configuring controller_id of this controller

req = ofproto_v1_0_parser.NXTSetControllerId(datapath, controller_id=5)
datapath.send_msg(req)


# add an action to send Packet-In to this controller

match = parser.OFPMatch()
actions = [
parser.NXActionController(0, 5, ofproto.OFPR_ACTION)]

self.add_flow(datapath, 0, match, actions)


This can be good for you?

Thanks,
Fujimoto


On 2017$BG/(B07$B7n(B11$BF|(B 14:20, mehran shetabi wrote:

hi, Fujimoto


with setting roles and Async solution, if there are more than two controllers, how can i distinguish between them?

my problem is, how can i sent packet-in to the exact controller?


thank you,

Mehran shetabi


________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Tuesday, July 11, 2017 4:45 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

how can i use OpenFlow channel in Mininet?
Sorry, OpenFlow channel is a connection which is used for OpenFlow protocol and you already have.
What I meant was that you should have another connection between controllers and the switch other than OpenFlow channel,
to exchange "raw" packets, not OpenFlow packets.

in the second solution, how can i retrieve Packet-in header?
As I said, in the second solution, the packets will be sent without Packet-in header.
So, in this solution, there is no way to retrieve Packet-in header.
If you want to get Packet-in header, I think this solution is not suitable,
then you should apply the first solution (setting roles and Async).

Do you need to get Packet-in header?
If not, I try implementing and tell you how to implement the second solution.


Thanks,
Fujimoto


On 2017$BG/(B07$B7n(B11$BF|(B 06:04, mehran shetabi wrote:

hi, Fujimoto


in the second solution, how can i retrieve Packet-in header?

is there any solution for it?


thank you,

Mehran shetabi

________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Monday, July 10, 2017 5:35 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>; ***@gmail.com<mailto:***@gmail.com>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

Unfortunately, you cannot use the port number which is connected to the controller in OFPActionOutput().

However, if you can set roles(Master/Slave) to the controllers,
you can use OFPSetAsync to control whether the switch sends Packet-In to Master or Slave controller:
http://ryu.readthedocs.io/en/latest/ofproto_v1_3_ref.html#ryu.ofproto.ofproto_v1_3_parser.OFPSetAsync


Or, this is not a beautiful method, you can connect controllers and the switch by another connection, like:

c1 $B(!(!(Bof$B(!(!(!(Bsw $B(!(!(Bof$B(!(!(!(Bc2
$B("!!!!!!!!!!!!("("!!!!!!!!!!!!("(B
$B(&(!(!(!(!(!(!(%(&(!(!(!(!(!(!(%(B ("of" means an OpenFlow channel)

Then, you can specify the port number which is connected to the controller.
But the controller should receive packets in your application,
and the packets are "raw" packets, so the informations in the Packet-in header will be lost.


Thanks,
Fujimoto

On 2017$BG/(B07$B7n(B10$BF|(B 07:52, mehran shetabi wrote:
Hi,

In Mininet, I created a topology with one switch, two host, and two inband RYU controller.
In OFPActionOutput() function, instead of using ofproto.OFPP_CONTROLLER for output port may I use port number (e.g. 3) that connected to the controller?
If the answer is no, is there any way to distinguish controllers for packet in to them?

Thank you,
Mehran shetabi
Fujimoto Satoshi
2017-07-21 01:37:14 UTC
Permalink
Hi, Mehran

Sorry, I tried it again, the pingall command doesn't work.

When starting your application, I confirmed "NXTSetControllerId" was
sent to "s1":
mininet> sh ovs-ofctl snoop s1
NXT_SET_CONTROLLER_ID (OF1.3) (xid=0xb2839c10): id=2
OFPT_FLOW_MOD (OF1.3) (xid=0xb2839c11): ADD priority=0 out_port:0
actions=CONTROLLER:65535

and the flow is successfully installed in "s1":
$ ovs-ofctl dump-flows s1 -O OpenFlow13
OFPST_FLOW reply (OF1.3) (xid=0x2):
cookie=0x0, duration=314.861s, table=0, n_packets=8, n_bytes=448,
priority=0 actions=CONTROLLER:65535

However, Packet-In was never sent, even though the flow matches.

I guess that, for all controllers, the "controller_id" is implicitly
configured to 0,
and in this case, OVS sends Packet-In only to the controllers which
"controller_id" is 0.
So, the switch whose "controller_id" is 2 will never receive Packet-In.
(It is due to the behavior of OVS.
For more details, please ask to the OVS developer team.)

I think you need to use "NXActionController" for all controllers,
instead of "OFPActionOutput".
For example, if you have two controllers whose "controller_id" are 1 and 2,
the actions should be like below:
actions = [
parser.NXActionController(max_len=0, controller_id=1,
reason=ofproto.OFPR_NO_MATCH),
parser.NXActionController(max_len=0, controller_id=2,
reason=ofproto.OFPR_NO_MATCH)
]

Thanks,
Fujimoto


On 2017幎07月20日 17:02, mehran shetabi wrote:
>
> hi, Fujimoto
>
>
> With the new topology that you gave me, I did as you said, but there
> is still a problem.
>
> As before, pingall command doesn’t work.
>
> Are you try it in your pc? Is it work?
>
> Would you please help me to fix it?
>
> Thank you,
>
> Mehran shetabi
>
>
> ------------------------------------------------------------------------
> *From:* Fujimoto Satoshi <***@gmail.com>
> *Sent:* Thursday, July 20, 2017 5:35 AM
> *To:* mehran shetabi; ryu-***@lists.sourceforge.net
> *Subject:* Re: [Ryu-devel] how can i distinguish controllers for
> packet in to them?
> Hi, Mehran
>
> You ran your controller in h200, right?
> Perhaps, you cannot run your controller on a mininet host,
> because mininet hosts cannot have OpenFlow channel, which is used for
> sending OpenFlow messages.
>
> I attached a topology file, please try with it.
>
> Please note, the topology has two controllers.
> When you run your application, you need to specify a controller
> address to "--ofp-listen-host" option like below:
> $ ryu-manager --ofp-listen-host '127.0.0.2' ryu.app.simple_switch_13_nx_01
>
>
> Thanks,
> Fujimoto
>
> On 2017幎07月19日 23:11, mehran shetabi wrote:
>>
>> hi, Fujimoto
>>
>>
>> Would you please run the attached files?
>>
>> As you see, there is a little change in your code
>> (simple_switch_13_nx.py).
>>
>> I run this code (simple_switch_13_nx_01.py) as my in band controller
>> (h200), then run “pingall” command in Mininet, but it doesn’t work
>> (there is no Packet_in to controller).
>>
>> Would you please tell me why?
>>
>> How can I fix it?
>>
>> Again, I want to set controller_id with NXTSetControllerId action,
>> and then use OFPActionOutput action for sending packet_in to the
>> controller as before (without specifying controller_id).
>>
>> Thank you,
>>
>> Mehran shetabi
>>
>>
>> ------------------------------------------------------------------------
>> *From:* Fujimoto Satoshi <***@gmail.com>
>> *Sent:* Wednesday, July 19, 2017 4:51 AM
>> *To:* mehran shetabi; ryu-***@lists.sourceforge.net
>> *Subject:* Re: [Ryu-devel] how can i distinguish controllers for
>> packet in to them?
>>
>> Hi, Mehran
>>
>>
>>> after setting controller_id for a controller with NXTSetControllerId
>>> action, can i use OFPActionOutput again for sending packet_in to it
>>> as before withot specifying controller_id
>>
>>> after setting controller_id for a controller with NXTSetControllerId
>>> action, can i use OFPRoleRequest action for changing state of
>>> controller (e.g. form SLAVE to EQUAL or from EQUAL to SLAVE) ?
>>
>>
>> Yes to both questions.
>>
>> There is no limit to using both OpenFlow Actions and Nicira Extension
>> Actions together.
>>
>>
>> Please note that you cannot specify "controller_id" and "reason" for
>> this action:
>>
>> http://ryu.readthedocs.io/en/latest/ofproto_v1_3_ref.html#ryu.ofproto.ofproto_v1_3_parser.OFPActionOutput
>>
>>
>> Thanks,
>> Fujimoto
>>
>> On 2017幎07月19日 04:35, mehran shetabi wrote:
>>>
>>> hi, Fujimoto
>>>
>>>
>>> sorry, there is a missunderstanding.
>>>
>>> i want to know, after setting controller_id for a controller with
>>> NXTSetControllerId action, can i use OFPActionOutput again for
>>> sending packet_in to it as before withot
>>> specifying controller_id, or i must use
>>> NXActionController for sending packet_in to it and there is no way
>>> to use OFPActionOutput action?
>>>
>>>
>>> another question:
>>>
>>> after setting controller_id for a controller with NXTSetControllerId
>>> action, can i use OFPRoleRequest action for changing state of
>>> controller (e.g. form SLAVE to EQUAL or from EQUAL to SLAVE) ?
>>>
>>>
>>> thank you,
>>>
>>> Mehran shetabi
>>>
>>>
>>> ------------------------------------------------------------------------
>>> *From:* Fujimoto Satoshi <***@gmail.com>
>>> *Sent:* Tuesday, July 18, 2017 4:31 AM
>>> *To:* mehran shetabi; ryu-***@lists.sourceforge.net
>>> *Subject:* Re: [Ryu-devel] how can i distinguish controllers for
>>> packet in to them?
>>> Hi, Mehran
>>> Sorry for delaying.
>>>
>>> As I said, NXTSetControllerId does set "controller_id", not send
>>> Packet-In.
>>> To send Packet-In to the specific controller, you should also use
>>> NXActionController.
>>>
>>> Did you check my code (simple_switch_13_nx.py) which I've sent to you?
>>> Please refer to this code to implement your apps, I think this
>>> contains enough for you.
>>>
>>> Thanks,
>>> Fujimoto
>>>
>>> On 2017幎07月14日 17:41, mehran shetabi wrote:
>>>>
>>>> hi, Fujimoto
>>>>
>>>>
>>>> for initializing controllers, i want to populate mac-to-port tables
>>>> of all of controllers by sending packet-in with OFPR_NO_MATCH
>>>> reason to them.
>>>>
>>>> as before, i want to use this code for installing table-miss flow
>>>> entry:
>>>>
>>>>
>>>> # install table-miss flow entry
>>>> match = parser.OFPMatch()
>>>> actions = [parser.OFPActionOutput(ofproto.OFPP_CONTROLLER,
>>>> ofproto.OFPCML_NO_BUFFER)]
>>>>
>>>>
>>>> and then, with Nicira extension action set controller_id for them:
>>>>
>>>>
>>>> # configuring controller_id of this controller
>>>> req = ofproto_v1_0_parser.NXTSetControllerId(datapath,
>>>> controller_id=2)
>>>> datapath.send_msg(req)
>>>>
>>>>
>>>> but, when i do this, there is no packet-in to my controller.
>>>>
>>>> why?
>>>>
>>>> can i have OpenFlow action and Nicira Extension action together in
>>>> my ryu code?
>>>>
>>>>
>>>> thank you,
>>>>
>>>> Mehran shetabi
>>>>
>>>> ------------------------------------------------------------------------
>>>> *From:* Fujimoto Satoshi <***@gmail.com>
>>>> *Sent:* Friday, July 14, 2017 5:11 AM
>>>> *To:* mehran shetabi; ryu-***@lists.sourceforge.net
>>>> *Subject:* Re: [Ryu-devel] how can i distinguish controllers for
>>>> packet in to them?
>>>> Hi, Mehran
>>>>
>>>>> how can i install table-miss flow entry
>>>>> with "NXActionController" that consists controller_id of all of
>>>>> my controller and OFPR_NO_MATCH reason?
>>>> You can specify "OFPR_NO_MATCH" to "reason" field in
>>>> "NXActionController":
>>>> parser.NXActionController(max_len=0, controller_id=2,
>>>> reason=ofproto.OFPR_NO_MATCH)
>>>>
>>>> However, what is "consists controller_id of all of my controller" ?
>>>> I thought you want to send packet-in to the "specific" controller,
>>>> so I think there is no need to specify two or more controllers in
>>>> "NXActionController".
>>>>
>>>> Anyway, I think it's up to you how to implement your application.
>>>>
>>>>
>>>> Thanks,
>>>> Fujimoto
>>>>
>>>> On 2017幎07月14日 08:24, mehran shetabi wrote:
>>>>>
>>>>> hi, Fujimoto
>>>>>
>>>>>
>>>>> it is working.
>>>>>
>>>>> but now my problem is, how can i install table-miss flow entry
>>>>> with "NXActionController" that consists controller_id of all of
>>>>> my controller and OFPR_NO_MATCH reason?
>>>>>
>>>>> i want to populate mac-to-port
>>>>> table of all of my controller with running pingall
>>>>> command and then send packet-in to specific controller.
>>>>>
>>>>> how can i do this?
>>>>>
>>>>>
>>>>> thank you,
>>>>>
>>>>> Mehran shetabi
>>>>>
>>>>> ------------------------------------------------------------------------
>>>>> *From:* Fujimoto Satoshi <***@gmail.com>
>>>>> *Sent:* Thursday, July 13, 2017 5:40 AM
>>>>> *To:* mehran shetabi; ryu-***@lists.sourceforge.net
>>>>> *Subject:* Re: [Ryu-devel] how can i distinguish controllers for
>>>>> packet in to them?
>>>>> Hi, Mehran
>>>>>
>>>>>> is there any conflict between OpenFlow 1.0 and OpenFlow 1.3?
>>>>> Sorry, I didn't make it clear enough.
>>>>> "NXTSetControllerId" is not a OpenFlow action, is a Nicira
>>>>> Extension action.
>>>>> But in Ryu, this action is provided for only OpenFlow 1.0.
>>>>> In this solution, we "hack" to use this action in OpenFlow 1.3.
>>>>> I think there should be no conflict.
>>>>>
>>>>> And in your code, you should use "NXActionController" to send
>>>>> Packet-In to the specific controller,
>>>>> instead of "OFPActionOutput", it cannot do such a thing.
>>>>> For "NXActionController", you have to specify the "controller_id"
>>>>> which you specified in "NXTSetControllerId".
>>>>>
>>>>> I attached a code to this mail, it should be work well.
>>>>> Please try it.
>>>>>
>>>>>
>>>>> Thanks,
>>>>> Fujimoto
>>>>>
>>>>> On 2017幎07月13日 05:50, mehran shetabi wrote:
>>>>>>
>>>>>> hi, Fujimoto
>>>>>>
>>>>>>
>>>>>> is there any conflict between OpenFlow 1.0 and OpenFlow 1.3?
>>>>>>
>>>>>> you know, as you said, i use the code in my controller:
>>>>>>
>>>>>>
>>>>>>
>>>>>> from ryu.ofproto import ofproto_v1_0_parser
>>>>>>
>>>>>> class SimpleSwitch13(app_manager.RyuApp):
>>>>>> OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION]
>>>>>>
>>>>>> def __init__(self, *args, **kwargs):
>>>>>> super(SimpleSwitch13, self).__init__(*args, **kwargs)
>>>>>> self.mac_to_port = {}
>>>>>>
>>>>>> @set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
>>>>>> def switch_features_handler(self, ev):
>>>>>> datapath = ev.msg.datapath
>>>>>> ofproto = datapath.ofproto
>>>>>> parser = datapath.ofproto_parser
>>>>>> dpid = datapath.id
>>>>>>
>>>>>> # configuring controller_id of this controller
>>>>>> req = ofproto_v1_0_parser.NXTSetControllerId(datapath,
>>>>>> controller_id=2)
>>>>>> datapath.send_msg(req)
>>>>>>
>>>>>>
>>>>>> # install table-miss flow entry
>>>>>> match = parser.OFPMatch()
>>>>>> actions =
>>>>>> [parser.OFPActionOutput(ofproto.OFPP_CONTROLLER,
>>>>>> ofproto.OFPCML_NO_BUFFER)]
>>>>>>
>>>>>> idle_timeout=0
>>>>>> self.add_flow(datapath, 0, match, actions, idle_timeout, dpid)
>>>>>>
>>>>>>
>>>>>> but after adding the code that you mentioned, my controller
>>>>>> didn't work properly (e.g. pingall command don't work).
>>>>>>
>>>>>>
>>>>>> how can i fix it?
>>>>>>
>>>>>>
>>>>>> thank you,
>>>>>>
>>>>>> Mehran shetabi
>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------------------
>>>>>> *From:* Fujimoto Satoshi <***@gmail.com>
>>>>>> *Sent:* Wednesday, July 12, 2017 5:43 AM
>>>>>> *To:* mehran shetabi; ryu-***@lists.sourceforge.net
>>>>>> *Subject:* Re: [Ryu-devel] how can i distinguish controllers for
>>>>>> packet in to them?
>>>>>>
>>>>>> Hi, Mehran
>>>>>>
>>>>>>
>>>>>> Sorry, I've overlooked about the following action, it may be able
>>>>>> to solve your problem:
>>>>>>
>>>>>> http://ryu.readthedocs.io/en/latest/nicira_ext_ref.html#ryu.ofproto.ofproto_v1_3_parser.NXActionController
>>>>>>
>>>>>>
>>>>>> This action belongs to 'Nicira extensions', not OpenFlow,
>>>>>>
>>>>>> but with this, switches can send Packet-In to the specific
>>>>>> controller.
>>>>>>
>>>>>>
>>>>>> To specify the controller, the "controller_id" should be configured.
>>>>>>
>>>>>> Ryu can configure it by "NXTSetControllerId", but this can be
>>>>>> used in only OpenFlow 1.0.
>>>>>>
>>>>>>
>>>>>> Then, it is not a beautiful method, how about the following?
>>>>>>
>>>>>> (customizing ryu/app/simple_switch_13.py)
>>>>>>
>>>>>>
>>>>>>
>>>>>> @set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
>>>>>> def switch_features_handler(self, ev):
>>>>>> datapath = ev.msg.datapath
>>>>>> ofproto = datapath.ofproto
>>>>>> parser = datapath.ofproto_parser
>>>>>>
>>>>>>
>>>>>> # configuring controller_id of this controller
>>>>>>
>>>>>> req = ofproto_v1_0_parser.NXTSetControllerId(datapath,
>>>>>> controller_id=5)
>>>>>> datapath.send_msg(req)
>>>>>>
>>>>>>
>>>>>> # add an action to send Packet-In to this controller
>>>>>>
>>>>>> match = parser.OFPMatch()
>>>>>> actions = [
>>>>>> parser.NXActionController(0, 5, ofproto.OFPR_ACTION)]
>>>>>>
>>>>>> self.add_flow(datapath, 0, match, actions)
>>>>>>
>>>>>>
>>>>>>
>>>>>> This can be good for you?
>>>>>>
>>>>>> Thanks,
>>>>>> Fujimoto
>>>>>>
>>>>>>
>>>>>> On 2017幎07月11日 14:20, mehran shetabi wrote:
>>>>>>>
>>>>>>> hi, Fujimoto
>>>>>>>
>>>>>>>
>>>>>>> with setting roles and Async solution, if there are more than
>>>>>>> two controllers, how can i distinguish between them?
>>>>>>>
>>>>>>> my problem is, how can i sent packet-in to the exact controller?
>>>>>>>
>>>>>>>
>>>>>>> thank you,
>>>>>>>
>>>>>>> Mehran shetabi
>>>>>>>
>>>>>>>
>>>>>>> ------------------------------------------------------------------------
>>>>>>> *From:* Fujimoto Satoshi <***@gmail.com>
>>>>>>> *Sent:* Tuesday, July 11, 2017 4:45 AM
>>>>>>> *To:* mehran shetabi; ryu-***@lists.sourceforge.net
>>>>>>> *Subject:* Re: [Ryu-devel] how can i distinguish controllers for
>>>>>>> packet in to them?
>>>>>>> Hi, Mehran
>>>>>>>
>>>>>>>> how can i use OpenFlow channel in Mininet?
>>>>>>> Sorry, OpenFlow channel is a connection which is used for
>>>>>>> OpenFlow protocol and you already have.
>>>>>>> What I meant was that you should have another connection between
>>>>>>> controllers and the switch other than OpenFlow channel,
>>>>>>> to exchange "raw" packets, not OpenFlow packets.
>>>>>>>
>>>>>>>> in the second solution, how can i retrieve Packet-in header?
>>>>>>> As I said, in the second solution, the packets will be sent
>>>>>>> without Packet-in header.
>>>>>>> So, in this solution, there is no way to retrieve Packet-in header.
>>>>>>> If you want to get Packet-in header, I think this solution is
>>>>>>> not suitable,
>>>>>>> then you should apply the first solution (setting roles and Async).
>>>>>>>
>>>>>>> Do you need to get Packet-in header?
>>>>>>> If not, I try implementing and tell you how to implement the
>>>>>>> second solution.
>>>>>>>
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Fujimoto
>>>>>>>
>>>>>>>
>>>>>>> On 2017幎07月11日 06:04, mehran shetabi wrote:
>>>>>>>>
>>>>>>>> hi, Fujimoto
>>>>>>>>
>>>>>>>>
>>>>>>>> in the second solution, how can i retrieve Packet-in header?
>>>>>>>>
>>>>>>>> is there any solution for it?
>>>>>>>>
>>>>>>>>
>>>>>>>> thank you,
>>>>>>>>
>>>>>>>> Mehran shetabi
>>>>>>>>
>>>>>>>> ------------------------------------------------------------------------
>>>>>>>> *From:* Fujimoto Satoshi <***@gmail.com>
>>>>>>>> *Sent:* Monday, July 10, 2017 5:35 AM
>>>>>>>> *To:* mehran shetabi; ryu-***@lists.sourceforge.net;
>>>>>>>> ***@gmail.com
>>>>>>>> *Subject:* Re: [Ryu-devel] how can i distinguish controllers
>>>>>>>> for packet in to them?
>>>>>>>> Hi, Mehran
>>>>>>>>
>>>>>>>> Unfortunately, you cannot use the port number which is
>>>>>>>> connected to the controller in OFPActionOutput().
>>>>>>>>
>>>>>>>> However, if you can set roles(Master/Slave) to the controllers,
>>>>>>>> you can use OFPSetAsync to control whether the switch sends
>>>>>>>> Packet-In to Master or Slave controller:
>>>>>>>> http://ryu.readthedocs.io/en/latest/ofproto_v1_3_ref.html#ryu.ofproto.ofproto_v1_3_parser.OFPSetAsync
>>>>>>>>
>>>>>>>>
>>>>>>>> Or, this is not a beautiful method, you can connect controllers
>>>>>>>> and the switch by another connection, like:
>>>>>>>>
>>>>>>>> c1 ──of───sw ──of───c2
>>>>>>>> │      ││      │
>>>>>>>> └──────┘└──────┘("of" means an OpenFlow channel)
>>>>>>>>
>>>>>>>> Then, you can specify the port number which is connected to the
>>>>>>>> controller.
>>>>>>>> But the controller should receive packets in your application,
>>>>>>>> and the packets are "raw" packets, so the informations in the
>>>>>>>> Packet-in header will be lost.
>>>>>>>>
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> Fujimoto
>>>>>>>>
>>>>>>>> On 2017幎07月10日 07:52, mehran shetabi wrote:
>>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> In Mininet, I created a topology with one switch, two host,
>>>>>>>>> and two inband RYU controller.
>>>>>>>>>
>>>>>>>>> In OFPActionOutput() function, instead of using
>>>>>>>>> ofproto.OFPP_CONTROLLER for output port may I use port number
>>>>>>>>> (e.g. 3) that connected to the controller?
>>>>>>>>>
>>>>>>>>> If the answer is no, is there any way to distinguish
>>>>>>>>> controllers for packet in to them?
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Thank you,
>>>>>>>>>
>>>>>>>>> Mehran shetabi
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> ------------------------------------------------------------------------------
>>>>>>>>> Check out the vibrant tech community on one of the world's most
>>>>>>>>> engaging tech sites, Slashdot.org!http://sdm.link/slashdot
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> Ryu-devel mailing list
>>>>>>>>> Ryu-***@lists.sourceforge.net
>>>>>>>>> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>
mehran shetabi
2017-07-21 05:29:01 UTC
Permalink
Hi, Fujimoto

Thank you for your help. You are the best.

Thank you,
Mehran shetabi


________________________________
From: Fujimoto Satoshi <***@gmail.com>
Sent: Friday, July 21, 2017 6:07 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

Sorry, I tried it again, the pingall command doesn't work.

When starting your application, I confirmed "NXTSetControllerId" was sent to "s1":
mininet> sh ovs-ofctl snoop s1
NXT_SET_CONTROLLER_ID (OF1.3) (xid=0xb2839c10): id=2
OFPT_FLOW_MOD (OF1.3) (xid=0xb2839c11): ADD priority=0 out_port:0 actions=CONTROLLER:65535

and the flow is successfully installed in "s1":
$ ovs-ofctl dump-flows s1 -O OpenFlow13
OFPST_FLOW reply (OF1.3) (xid=0x2):
cookie=0x0, duration=314.861s, table=0, n_packets=8, n_bytes=448, priority=0 actions=CONTROLLER:65535

However, Packet-In was never sent, even though the flow matches.

I guess that, for all controllers, the "controller_id" is implicitly configured to 0,
and in this case, OVS sends Packet-In only to the controllers which "controller_id" is 0.
So, the switch whose "controller_id" is 2 will never receive Packet-In.
(It is due to the behavior of OVS.
For more details, please ask to the OVS developer team.)

I think you need to use "NXActionController" for all controllers, instead of "OFPActionOutput".
For example, if you have two controllers whose "controller_id" are 1 and 2,
the actions should be like below:
actions = [
parser.NXActionController(max_len=0, controller_id=1, reason=ofproto.OFPR_NO_MATCH),
parser.NXActionController(max_len=0, controller_id=2, reason=ofproto.OFPR_NO_MATCH)
]

Thanks,
Fujimoto


On 2017$BG/(B07$B7n(B20$BF|(B 17:02, mehran shetabi wrote:

hi, Fujimoto

With the new topology that you gave me, I did as you said, but there is still a problem.
As before, pingall command doesn$B!G(Bt work.
Are you try it in your pc? Is it work?
Would you please help me to fix it?

Thank you,
Mehran shetabi


________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Thursday, July 20, 2017 5:35 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

You ran your controller in h200, right?
Perhaps, you cannot run your controller on a mininet host,
because mininet hosts cannot have OpenFlow channel, which is used for sending OpenFlow messages.

I attached a topology file, please try with it.

Please note, the topology has two controllers.
When you run your application, you need to specify a controller address to "--ofp-listen-host" option like below:
$ ryu-manager --ofp-listen-host '127.0.0.2' ryu.app.simple_switch_13_nx_01


Thanks,
Fujimoto

On 2017$BG/(B07$B7n(B19$BF|(B 23:11, mehran shetabi wrote:

hi, Fujimoto

Would you please run the attached files?
As you see, there is a little change in your code (simple_switch_13_nx.py).
I run this code (simple_switch_13_nx_01.py) as my in band controller (h200), then run $B!H(Bpingall$B!I(B command in Mininet, but it doesn$B!G(Bt work (there is no Packet_in to controller).
Would you please tell me why?
How can I fix it?
Again, I want to set controller_id with NXTSetControllerId action, and then use OFPActionOutput action for sending packet_in to the controller as before (without specifying controller_id).

Thank you,
Mehran shetabi


________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Wednesday, July 19, 2017 4:51 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?


Hi, Mehran


after setting controller_id for a controller with NXTSetControllerId action, can i use OFPActionOutput again for sending packet_in to it as before withot specifying controller_id

after setting controller_id for a controller with NXTSetControllerId action, can i use OFPRoleRequest action for changing state of controller (e.g. form SLAVE to EQUAL or from EQUAL to SLAVE) ?


Yes to both questions.

There is no limit to using both OpenFlow Actions and Nicira Extension Actions together.


Please note that you cannot specify "controller_id" and "reason" for this action:

http://ryu.readthedocs.io/en/latest/ofproto_v1_3_ref.html#ryu.ofproto.ofproto_v1_3_parser.OFPActionOutput

Thanks,
Fujimoto

On 2017$BG/(B07$B7n(B19$BF|(B 04:35, mehran shetabi wrote:

hi, Fujimoto


sorry, there is a missunderstanding.

i want to know, after setting controller_id for a controller with NXTSetControllerId action, can i use OFPActionOutput again for sending packet_in to it as before withot specifying controller_id, or i must use NXActionController for sending packet_in to it and there is no way to use OFPActionOutput action?


another question:

after setting controller_id for a controller with NXTSetControllerId action, can i use OFPRoleRequest action for changing state of controller (e.g. form SLAVE to EQUAL or from EQUAL to SLAVE) ?


thank you,

Mehran shetabi


________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Tuesday, July 18, 2017 4:31 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran
Sorry for delaying.

As I said, NXTSetControllerId does set "controller_id", not send Packet-In.
To send Packet-In to the specific controller, you should also use NXActionController.

Did you check my code (simple_switch_13_nx.py) which I've sent to you?
Please refer to this code to implement your apps, I think this contains enough for you.

Thanks,
Fujimoto

On 2017$BG/(B07$B7n(B14$BF|(B 17:41, mehran shetabi wrote:

hi, Fujimoto


for initializing controllers, i want to populate mac-to-port tables of all of controllers by sending packet-in with OFPR_NO_MATCH reason to them.

as before, i want to use this code for installing table-miss flow entry:


# install table-miss flow entry
match = parser.OFPMatch()
actions = [parser.OFPActionOutput(ofproto.OFPP_CONTROLLER, ofproto.OFPCML_NO_BUFFER)]


and then, with Nicira extension action set controller_id for them:


# configuring controller_id of this controller
req = ofproto_v1_0_parser.NXTSetControllerId(datapath, controller_id=2)
datapath.send_msg(req)


but, when i do this, there is no packet-in to my controller.

why?

can i have OpenFlow action and Nicira Extension action together in my ryu code?


thank you,

Mehran shetabi

________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Friday, July 14, 2017 5:11 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

how can i install table-miss flow entry with "NXActionController" that consists controller_id of all of my controller and OFPR_NO_MATCH reason?
You can specify "OFPR_NO_MATCH" to "reason" field in "NXActionController":
parser.NXActionController(max_len=0, controller_id=2, reason=ofproto.OFPR_NO_MATCH)

However, what is "consists controller_id of all of my controller" ?
I thought you want to send packet-in to the "specific" controller,
so I think there is no need to specify two or more controllers in "NXActionController".

Anyway, I think it's up to you how to implement your application.


Thanks,
Fujimoto

On 2017$BG/(B07$B7n(B14$BF|(B 08:24, mehran shetabi wrote:

hi, Fujimoto


it is working.

but now my problem is, how can i install table-miss flow entry with "NXActionController" that consists controller_id of all of my controller and OFPR_NO_MATCH reason?

i want to populate mac-to-port table of all of my controller with running pingall command and then send packet-in to specific controller.

how can i do this?


thank you,

Mehran shetabi

________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Thursday, July 13, 2017 5:40 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

is there any conflict between OpenFlow 1.0 and OpenFlow 1.3?
Sorry, I didn't make it clear enough.
"NXTSetControllerId" is not a OpenFlow action, is a Nicira Extension action.
But in Ryu, this action is provided for only OpenFlow 1.0.
In this solution, we "hack" to use this action in OpenFlow 1.3.
I think there should be no conflict.

And in your code, you should use "NXActionController" to send Packet-In to the specific controller,
instead of "OFPActionOutput", it cannot do such a thing.
For "NXActionController", you have to specify the "controller_id" which you specified in "NXTSetControllerId".

I attached a code to this mail, it should be work well.
Please try it.


Thanks,
Fujimoto

On 2017$BG/(B07$B7n(B13$BF|(B 05:50, mehran shetabi wrote:

hi, Fujimoto


is there any conflict between OpenFlow 1.0 and OpenFlow 1.3?

you know, as you said, i use the code in my controller:



from ryu.ofproto import ofproto_v1_0_parser

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

def __init__(self, *args, **kwargs):
super(SimpleSwitch13, self).__init__(*args, **kwargs)
self.mac_to_port = {}

@set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
def switch_features_handler(self, ev):
datapath = ev.msg.datapath
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
dpid = datapath.id

# configuring controller_id of this controller
req = ofproto_v1_0_parser.NXTSetControllerId(datapath, controller_id=2)
datapath.send_msg(req)


# install table-miss flow entry
match = parser.OFPMatch()
actions = [parser.OFPActionOutput(ofproto.OFPP_CONTROLLER, ofproto.OFPCML_NO_BUFFER)]

idle_timeout=0
self.add_flow(datapath, 0, match, actions, idle_timeout, dpid)



but after adding the code that you mentioned, my controller didn't work properly (e.g. pingall command don't work).


how can i fix it?


thank you,

Mehran shetabi




________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Wednesday, July 12, 2017 5:43 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?


Hi, Mehran


Sorry, I've overlooked about the following action, it may be able to solve your problem:

http://ryu.readthedocs.io/en/latest/nicira_ext_ref.html#ryu.ofproto.ofproto_v1_3_parser.NXActionController


This action belongs to 'Nicira extensions', not OpenFlow,

but with this, switches can send Packet-In to the specific controller.


To specify the controller, the "controller_id" should be configured.

Ryu can configure it by "NXTSetControllerId", but this can be used in only OpenFlow 1.0.


Then, it is not a beautiful method, how about the following?

(customizing ryu/app/simple_switch_13.py)



@set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
def switch_features_handler(self, ev):
datapath = ev.msg.datapath
ofproto = datapath.ofproto
parser = datapath.ofproto_parser


# configuring controller_id of this controller

req = ofproto_v1_0_parser.NXTSetControllerId(datapath, controller_id=5)
datapath.send_msg(req)


# add an action to send Packet-In to this controller

match = parser.OFPMatch()
actions = [
parser.NXActionController(0, 5, ofproto.OFPR_ACTION)]

self.add_flow(datapath, 0, match, actions)


This can be good for you?

Thanks,
Fujimoto


On 2017$BG/(B07$B7n(B11$BF|(B 14:20, mehran shetabi wrote:

hi, Fujimoto


with setting roles and Async solution, if there are more than two controllers, how can i distinguish between them?

my problem is, how can i sent packet-in to the exact controller?


thank you,

Mehran shetabi


________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Tuesday, July 11, 2017 4:45 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

how can i use OpenFlow channel in Mininet?
Sorry, OpenFlow channel is a connection which is used for OpenFlow protocol and you already have.
What I meant was that you should have another connection between controllers and the switch other than OpenFlow channel,
to exchange "raw" packets, not OpenFlow packets.

in the second solution, how can i retrieve Packet-in header?
As I said, in the second solution, the packets will be sent without Packet-in header.
So, in this solution, there is no way to retrieve Packet-in header.
If you want to get Packet-in header, I think this solution is not suitable,
then you should apply the first solution (setting roles and Async).

Do you need to get Packet-in header?
If not, I try implementing and tell you how to implement the second solution.


Thanks,
Fujimoto


On 2017$BG/(B07$B7n(B11$BF|(B 06:04, mehran shetabi wrote:

hi, Fujimoto


in the second solution, how can i retrieve Packet-in header?

is there any solution for it?


thank you,

Mehran shetabi

________________________________
From: Fujimoto Satoshi <***@gmail.com><mailto:***@gmail.com>
Sent: Monday, July 10, 2017 5:35 AM
To: mehran shetabi; ryu-***@lists.sourceforge.net<mailto:ryu-***@lists.sourceforge.net>; ***@gmail.com<mailto:***@gmail.com>
Subject: Re: [Ryu-devel] how can i distinguish controllers for packet in to them?

Hi, Mehran

Unfortunately, you cannot use the port number which is connected to the controller in OFPActionOutput().

However, if you can set roles(Master/Slave) to the controllers,
you can use OFPSetAsync to control whether the switch sends Packet-In to Master or Slave controller:
http://ryu.readthedocs.io/en/latest/ofproto_v1_3_ref.html#ryu.ofproto.ofproto_v1_3_parser.OFPSetAsync


Or, this is not a beautiful method, you can connect controllers and the switch by another connection, like:

c1 $B(!(!(Bof$B(!(!(!(Bsw $B(!(!(Bof$B(!(!(!(Bc2
$B("!!!!!!!!!!!!("("!!!!!!!!!!!!("(B
$B(&(!(!(!(!(!(!(%(&(!(!(!(!(!(!(%(B ("of" means an OpenFlow channel)

Then, you can specify the port number which is connected to the controller.
But the controller should receive packets in your application,
and the packets are "raw" packets, so the informations in the Packet-in header will be lost.


Thanks,
Fujimoto

On 2017$BG/(B07$B7n(B10$BF|(B 07:52, mehran shetabi wrote:
Hi,

In Mininet, I created a topology with one switch, two host, and two inband RYU controller.
In OFPActionOutput() function, instead of using ofproto.OFPP_CONTROLLER for output port may I use port number (e.g. 3) that connected to the controller?
If the answer is no, is there any way to distinguish controllers for packet in to them?

Thank you,
Mehran shetabi
Loading...