On Fri, Jul 20, 2012 at 11:39:21PM +1200, Joe Stringer wrote:
> On 20 July 2012 15:53, Ben Pfaff <b...@nicira.com> wrote:
> ...
> > For the string representations, as I told Joe Stringer, I'm leaning
> > toward requiring them to be in the correct order for instructions listed
> > above.  Otherwise it seems risky that one could confuse the user.
> > Similarly for the OF1.0 extension representation of OF1.1 instructions.
> 
> To this end, I've just been considering the way that instructions are
> parsed. My understanding is that internally, we work towards having no
> distinction between actions and instructions. The internal format
> should be correct (instructions follow actions), if we are parsing
> inputs correctly. As I understand, this means there is no motivation
> to have a delimiter as in patch #2.

That's more or less what I have in mind, except for vocabulary.  You
seem to have a notion that instructions and actions are non-overlapping
concepts.  That is not the case: in OF1.1 and later, actions are almost
always[*] encapsulated inside instructions, either inside an
Apply-Actions or Write-Actions instruction.

[*] Packet-Out is the exception that comes to mind.

> So when we parse, we enforce the ordering -- I would expect in
> str_to_ofpacts(), the logic would go more or less as follows:-
> 
> 
> 
> while (ofputil_parse_key_value(...)) {
>     /* if current key is an instruction, break; */
>     /* parse as an action/same logic as currently. */
> }
> 
> foreach (instruction_type t) {
>     /* if current key is not an instruction, error() */
>     if (current_key == t) {
>         /* parse */
>     } else if (key < type) { /* i.e., if the user specifies an
> instruction in the wrong order. */
>         /* bad ordering or duplicate instruction: error() */
>     }
>     ofputil_parse_key_value(...)
> }
> 
> if (left) error();
> 
> 
> 
> The above logic would force the user to put instructions/actions in
> the correct ordering, rather than the solution of patch #6 which
> allows any ordering, but may be executed differently than the user
> expects. Is this more in line with the direction you're expecting,
> Ben?

That's right except that actions and instructions overlap, so there's
not the clear-cut difference that you're envisioning.
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to