Re: [ovs-discuss] [openvswitch 2.9.90] Unable to use literal in nested output of learn action

2018-04-11 Thread Ben Pfaff
On Wed, Apr 11, 2018 at 08:14:07PM -0400, Flavio Fernandes wrote:
> 
> 
> > On Apr 7, 2018, at 1:53 PM, Ben Pfaff  wrote:
> > 
> > On Fri, Apr 06, 2018 at 04:18:31PM -0400, Flavio Fernandes wrote:
> >> Dear OVS Gurus:
> >> 
> >> I came across something simple and silly, which is making me think it is 
> >> actually a bug.
> >> 
> >> In a nutshell, I'm trying to use a literal with the action output nested 
> >> in a learn().
> >> If I use a fancier (and more common) notation:
> >> 
> >>   output:NXM_OF_IN_PORT[]
> >> 
> >> that works fine. However, if I try to use a literal such as:
> >> 
> >>   output:2
> >> 
> >> I get:
> >> 
> >>   ovs-ofctl: 2: unknown field `2'
> > 
> > The learn action simply can't do that.  (I think that the ovs-ofctl
> > manpage does not suggest that it can.)
> 
> 
> Yes, I should have read it more carefully. It was an incorrect assumption on 
> my part
> that the nested output action was the same as action outside learn. I am a 
> better
> educated now. ;) Thanks for that clarification, Ben.

Well, it's a reasonable question.  Maybe the manpage should be clearer
that the actions supported within learn are very limited.
___
discuss mailing list
disc...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-discuss


Re: [ovs-discuss] [openvswitch 2.9.90] Unable to use literal in nested output of learn action

2018-04-11 Thread Flavio Fernandes


> On Apr 7, 2018, at 1:53 PM, Ben Pfaff  wrote:
> 
> On Fri, Apr 06, 2018 at 04:18:31PM -0400, Flavio Fernandes wrote:
>> Dear OVS Gurus:
>> 
>> I came across something simple and silly, which is making me think it is 
>> actually a bug.
>> 
>> In a nutshell, I'm trying to use a literal with the action output nested in 
>> a learn().
>> If I use a fancier (and more common) notation:
>> 
>>   output:NXM_OF_IN_PORT[]
>> 
>> that works fine. However, if I try to use a literal such as:
>> 
>>   output:2
>> 
>> I get:
>> 
>>   ovs-ofctl: 2: unknown field `2'
> 
> The learn action simply can't do that.  (I think that the ovs-ofctl
> manpage does not suggest that it can.)


Yes, I should have read it more carefully. It was an incorrect assumption on my 
part
that the nested output action was the same as action outside learn. I am a 
better
educated now. ;) Thanks for that clarification, Ben.

-- flaviof





signature.asc
Description: Message signed with OpenPGP
___
discuss mailing list
disc...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-discuss


Re: [ovs-discuss] [openvswitch 2.9.90] Unable to use literal in nested output of learn action

2018-04-07 Thread Ben Pfaff
On Fri, Apr 06, 2018 at 04:18:31PM -0400, Flavio Fernandes wrote:
> Dear OVS Gurus:
> 
> I came across something simple and silly, which is making me think it is 
> actually a bug.
> 
> In a nutshell, I'm trying to use a literal with the action output nested in a 
> learn().
> If I use a fancier (and more common) notation:
> 
>output:NXM_OF_IN_PORT[]
> 
> that works fine. However, if I try to use a literal such as:
> 
>output:2
> 
> I get:
> 
>ovs-ofctl: 2: unknown field `2'

The learn action simply can't do that.  (I think that the ovs-ofctl
manpage does not suggest that it can.)
___
discuss mailing list
disc...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-discuss


[ovs-discuss] [openvswitch 2.9.90] Unable to use literal in nested output of learn action

2018-04-07 Thread Flavio Fernandes
Dear OVS Gurus:

I came across something simple and silly, which is making me think it is 
actually a bug.

In a nutshell, I'm trying to use a literal with the action output nested in a 
learn().
If I use a fancier (and more common) notation:

   output:NXM_OF_IN_PORT[]

that works fine. However, if I try to use a literal such as:

   output:2

I get:

   ovs-ofctl: 2: unknown field `2'


Here is a set of steps I use from a sandbox session:

   $ ./boot.sh ; ./configure ; make -j4 ; \
 make sandbox

   $ ovs-vsctl add-br br0 \
 -- add-port br0 p1 -- set interface p1 ofport_request=1 \
 -- add-port br0 p2 -- set interface p2 ofport_request=2 \
 -- set Bridge br0 fail-mode=secure

   # this works just fine
   $ ovs-ofctl add-flow br0 "table=0 actions=learn(table=1, hard_timeout=600, \
 in_port=1, \
 NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[], \
 output:NXM_OF_IN_PORT[]), \
 resubmit(,1)"

   $ ovs-ofctl add-flow br0 "table=1 priority=0 actions=flood"

   $ ovs-ofctl -OOpenFlow13 --names --no-stat dump-flows br0
 reset_counts 
actions=learn(table=1,hard_timeout=600,in_port=p1,NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],output:NXM_OF_IN_PORT[]),resubmit(,1)
 table=1, reset_counts priority=0 actions=FLOOD

   # very similar to the learn action done above, except I'm attempting to hard 
code an output value
   $ ovs-ofctl add-flow br0 "table=0 actions=learn(table=1, hard_timeout=600, \
 in_port=2, \
 NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[], \
 output:2), \
 resubmit(,1)"
   ovs-ofctl: 2: unknown field `2'

   $ echo $?
   1

I also played a little bit with the parser test to reproduce this behavior. See 
below.

So... bug or FAD? If you think BUG, I can dig a little more to learn what is 
going on.
It has been a while, so chances are that most of you will have this fixed 
before I manage
to blink. :)

Best,

-- flaviof




$ make check TESTSUITEFLAGS=--list 2>/dev/null | grep -m1 -i learn
454: learn.at:3 learning action - parsing and formatting


$ git diff
diff --git a/tests/learn.at b/tests/learn.at
index 5f1d6df..eaf1147 100644
--- a/tests/learn.at
+++ b/tests/learn.at
@@ -7,6 +7,7 @@ actions=learn(send_flow_rem)
actions=learn(delete_learned)
actions=learn(send_flow_rem,delete_learned)
actions=learn(NXM_OF_VLAN_TCI[0..11], NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[], 
output:NXM_OF_IN_PORT[], load:10->NXM_NX_REG0[5..10])
+actions=learn(NXM_OF_VLAN_TCI[0..11], NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[], 
output:99)
actions=learn(table=1,idle_timeout=10, hard_timeout=20, fin_idle_timeout=5, 
fin_hard_timeout=10, priority=10, cookie=0xfedcba9876543210, 
in_port=99,eth_dst=eth_src,load:in_port->reg1[16..31])
actions=learn(limit=4096)
actions=learn(limit=4096,result_dst=reg0[0])


$ make check TESTSUITEFLAGS='454'
...
454: learning action - parsing and formattingFAILED (learn.at:15)


signature.asc
Description: Message signed with OpenPGP
___
discuss mailing list
disc...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-discuss


Re: [ovs-discuss] [openvswitch 2.9.90] Unable to use literal in nested output of learn action

2018-04-06 Thread Ben Pfaff
The binary encoding of the "learn" action just doesn't support an
"output to immediate" action, so some kind of different approach is
needed.

On Fri, Apr 06, 2018 at 05:57:14PM -0400, Flavio Fernandes wrote:
> 
> Heh, after sending that msg, I did a little digging in the code [1] and doc 
> and it seems clear that
> integer literals are just not supported as a value for the output action name.
> 
> I imagine that in order to handle that, that code section would need to be 
> extended to perform
> a "parse_int_string(value,...)" and etc.
> 
> All in all, I convinced myself that this is a FAD. One can easily load a 
> literal
> integer into a REG and use that as output [2] anyways. So, that is plenty 
> good.
> 
> Thanks and sorry for the noise,
> 
> -- flaviof
> 
> 
> [1]: 
> https://github.com/openvswitch/ovs/blob/a045e4b03d7603572ae0d503762c52dc40bf6f23/lib/learn.c#L371
> 
> [2]: load:0x1->NXM_NX_REG1[] ... output:NXM_NX_REG1[]
> 
> 
> 
> > On Apr 6, 2018, at 4:18 PM, Flavio Fernandes  wrote:
> > 
> > Dear OVS Gurus:
> > 
> > I came across something simple and silly, which is making me think it is 
> > actually a bug.
> > 
> > In a nutshell, I'm trying to use a literal with the action output nested in 
> > a learn().
> > If I use a fancier (and more common) notation:
> > 
> >   output:NXM_OF_IN_PORT[]
> > 
> > that works fine. However, if I try to use a literal such as:
> > 
> >   output:2
> > 
> > I get:
> > 
> >   ovs-ofctl: 2: unknown field `2'
> > 
> > 
> > Here is a set of steps I use from a sandbox session:
> > 
> >   $ ./boot.sh ; ./configure ; make -j4 ; \
> > make sandbox
> > 
> >   $ ovs-vsctl add-br br0 \
> > -- add-port br0 p1 -- set interface p1 ofport_request=1 \
> > -- add-port br0 p2 -- set interface p2 ofport_request=2 \
> > -- set Bridge br0 fail-mode=secure
> > 
> >   # this works just fine
> >   $ ovs-ofctl add-flow br0 "table=0 actions=learn(table=1, 
> > hard_timeout=600, \
> > in_port=1, \
> > NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[], \
> > output:NXM_OF_IN_PORT[]), \
> > resubmit(,1)"
> > 
> >   $ ovs-ofctl add-flow br0 "table=1 priority=0 actions=flood"
> > 
> >   $ ovs-ofctl -OOpenFlow13 --names --no-stat dump-flows br0
> > reset_counts 
> > actions=learn(table=1,hard_timeout=600,in_port=p1,NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],output:NXM_OF_IN_PORT[]),resubmit(,1)
> > table=1, reset_counts priority=0 actions=FLOOD
> > 
> >   # very similar to the learn action done above, except I'm attempting to 
> > hard code an output value
> >   $ ovs-ofctl add-flow br0 "table=0 actions=learn(table=1, 
> > hard_timeout=600, \
> > in_port=2, \
> > NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[], \
> > output:2), \
> > resubmit(,1)"
> >   ovs-ofctl: 2: unknown field `2'
> > 
> >   $ echo $?
> >   1
> > 
> > I also played a little bit with the parser test to reproduce this behavior. 
> > See below.
> > 
> > So... bug or FAD? If you think BUG, I can dig a little more to learn what 
> > is going on.
> > It has been a while, so chances are that most of you will have this fixed 
> > before I manage
> > to blink. :)
> > 
> > Best,
> > 
> > -- flaviof
> > 
> > 
> > 
> > 
> > $ make check TESTSUITEFLAGS=--list 2>/dev/null | grep -m1 -i learn
> > 454: learn.at:3 learning action - parsing and formatting
> > 
> > 
> > $ git diff
> > diff --git a/tests/learn.at b/tests/learn.at
> > index 5f1d6df..eaf1147 100644
> > --- a/tests/learn.at
> > +++ b/tests/learn.at
> > @@ -7,6 +7,7 @@ actions=learn(send_flow_rem)
> > actions=learn(delete_learned)
> > actions=learn(send_flow_rem,delete_learned)
> > actions=learn(NXM_OF_VLAN_TCI[0..11], NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[], 
> > output:NXM_OF_IN_PORT[], load:10->NXM_NX_REG0[5..10])
> > +actions=learn(NXM_OF_VLAN_TCI[0..11], NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[], 
> > output:99)
> > actions=learn(table=1,idle_timeout=10, hard_timeout=20, fin_idle_timeout=5, 
> > fin_hard_timeout=10, priority=10, cookie=0xfedcba9876543210, 
> > in_port=99,eth_dst=eth_src,load:in_port->reg1[16..31])
> > actions=learn(limit=4096)
> > actions=learn(limit=4096,result_dst=reg0[0])
> > 
> > 
> > $ make check TESTSUITEFLAGS='454'
> > ...
> > 454: learning action - parsing and formattingFAILED (learn.at:15)
> 



> ___
> discuss mailing list
> disc...@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-discuss

___
discuss mailing list
disc...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-discuss


Re: [ovs-discuss] [openvswitch 2.9.90] Unable to use literal in nested output of learn action

2018-04-06 Thread Flavio Fernandes

Heh, after sending that msg, I did a little digging in the code [1] and doc and 
it seems clear that
integer literals are just not supported as a value for the output action name.

I imagine that in order to handle that, that code section would need to be 
extended to perform
a "parse_int_string(value,...)" and etc.

All in all, I convinced myself that this is a FAD. One can easily load a literal
integer into a REG and use that as output [2] anyways. So, that is plenty good.

Thanks and sorry for the noise,

-- flaviof


[1]: 
https://github.com/openvswitch/ovs/blob/a045e4b03d7603572ae0d503762c52dc40bf6f23/lib/learn.c#L371

[2]: load:0x1->NXM_NX_REG1[] ... output:NXM_NX_REG1[]



> On Apr 6, 2018, at 4:18 PM, Flavio Fernandes  wrote:
> 
> Dear OVS Gurus:
> 
> I came across something simple and silly, which is making me think it is 
> actually a bug.
> 
> In a nutshell, I'm trying to use a literal with the action output nested in a 
> learn().
> If I use a fancier (and more common) notation:
> 
>   output:NXM_OF_IN_PORT[]
> 
> that works fine. However, if I try to use a literal such as:
> 
>   output:2
> 
> I get:
> 
>   ovs-ofctl: 2: unknown field `2'
> 
> 
> Here is a set of steps I use from a sandbox session:
> 
>   $ ./boot.sh ; ./configure ; make -j4 ; \
> make sandbox
> 
>   $ ovs-vsctl add-br br0 \
> -- add-port br0 p1 -- set interface p1 ofport_request=1 \
> -- add-port br0 p2 -- set interface p2 ofport_request=2 \
> -- set Bridge br0 fail-mode=secure
> 
>   # this works just fine
>   $ ovs-ofctl add-flow br0 "table=0 actions=learn(table=1, hard_timeout=600, \
> in_port=1, \
> NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[], \
> output:NXM_OF_IN_PORT[]), \
> resubmit(,1)"
> 
>   $ ovs-ofctl add-flow br0 "table=1 priority=0 actions=flood"
> 
>   $ ovs-ofctl -OOpenFlow13 --names --no-stat dump-flows br0
> reset_counts 
> actions=learn(table=1,hard_timeout=600,in_port=p1,NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],output:NXM_OF_IN_PORT[]),resubmit(,1)
> table=1, reset_counts priority=0 actions=FLOOD
> 
>   # very similar to the learn action done above, except I'm attempting to 
> hard code an output value
>   $ ovs-ofctl add-flow br0 "table=0 actions=learn(table=1, hard_timeout=600, \
> in_port=2, \
> NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[], \
> output:2), \
> resubmit(,1)"
>   ovs-ofctl: 2: unknown field `2'
> 
>   $ echo $?
>   1
> 
> I also played a little bit with the parser test to reproduce this behavior. 
> See below.
> 
> So... bug or FAD? If you think BUG, I can dig a little more to learn what is 
> going on.
> It has been a while, so chances are that most of you will have this fixed 
> before I manage
> to blink. :)
> 
> Best,
> 
> -- flaviof
> 
> 
> 
> 
> $ make check TESTSUITEFLAGS=--list 2>/dev/null | grep -m1 -i learn
> 454: learn.at:3 learning action - parsing and formatting
> 
> 
> $ git diff
> diff --git a/tests/learn.at b/tests/learn.at
> index 5f1d6df..eaf1147 100644
> --- a/tests/learn.at
> +++ b/tests/learn.at
> @@ -7,6 +7,7 @@ actions=learn(send_flow_rem)
> actions=learn(delete_learned)
> actions=learn(send_flow_rem,delete_learned)
> actions=learn(NXM_OF_VLAN_TCI[0..11], NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[], 
> output:NXM_OF_IN_PORT[], load:10->NXM_NX_REG0[5..10])
> +actions=learn(NXM_OF_VLAN_TCI[0..11], NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[], 
> output:99)
> actions=learn(table=1,idle_timeout=10, hard_timeout=20, fin_idle_timeout=5, 
> fin_hard_timeout=10, priority=10, cookie=0xfedcba9876543210, 
> in_port=99,eth_dst=eth_src,load:in_port->reg1[16..31])
> actions=learn(limit=4096)
> actions=learn(limit=4096,result_dst=reg0[0])
> 
> 
> $ make check TESTSUITEFLAGS='454'
> ...
> 454: learning action - parsing and formattingFAILED (learn.at:15)



signature.asc
Description: Message signed with OpenPGP
___
discuss mailing list
disc...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-discuss