Skip to content
This repository has been archived by the owner on Feb 1, 2020. It is now read-only.

"List [ Int ]" (sometimes) yields ListItem #2343

Open
kheradmand opened this issue Sep 14, 2017 · 2 comments
Open

"List [ Int ]" (sometimes) yields ListItem #2343

kheradmand opened this issue Sep 14, 2017 · 2 comments

Comments

@kheradmand
Copy link
Contributor

Hi I have the following configuration

<T> <k> @val ( 0 , 14 , false ) ~> @deref ( sel_profile , 0 ) ~> @setCrntRule ( . ) ~> @setCrntTable ( . ) ~> .HitMissCases ~> .ControlStatements ~> @egress ~> @txenPacket ~> @nextPacket </k> <headers> <header> <name> %standard_metadata_t </name> <opts> .Map </opts> <fields> ingress_port : 32 ( .FieldMods ) ;  ( egress_spec : 32 ( .FieldMods ) ;  .FieldDecs ) </fields> </header> <header> <name> data_t </name> <opts> "$fixed_width" |-> 40 </opts> <fields> f1 : 32 ( .FieldMods ) ;  ( b1 : 8 ( .FieldMods ) ;  .FieldDecs ) </fields> </header> </headers> <fieldLists> <fieldList> <name> sel_fields </name> <fields> ( data . f1 ) ;  .FieldListEntryItems </fields> </fieldList> </fieldLists> <fieldListCalcs> <fieldListCalc> <name> sel_hash </name> <fLists> ListItem ( sel_fields ) </fLists> <algorithm> crc16 </algorithm> <outWidth> 14 </outWidth> <fListIndex> 0 </fListIndex> </fieldListCalc> </fieldListCalcs> <calcFields> .CalcFieldCellBag </calcFields> <instances> <instance> <valid> true </valid> <metadata> true </metadata> <typeName> %standard_metadata_t </typeName> <name> standard_metadata </name> <fieldVals> ingress_port |-> @val ( 1 , 32 , false ) egress_spec |-> @undef </fieldVals> </instance> <instance> <valid> true </valid> <metadata> false </metadata> <typeName> data_t </typeName> <name> data </name> <fieldVals> b1 |-> @val ( 0 , 8 , false ) f1 |-> @val ( 1 , 32 , false ) </fieldVals> </instance> </instances> <parserStates> <state> <name> start </name> <body> ( extract ( data ) ; .ExtractOrSetStatements ) return ingress ; </body> </state> </parserStates> <statefuls> .StatefulCellBag </statefuls> <tableDirects> .Map </tableDirects> <actions> <action> <name> setf1 </name> <params> val , .ParamList </params> <body> modify_field ( ( data . f1 ) , ( val , .Args ) ) ;  .ActionStatements </body> </action> <action> <name> noop </name> <params> .ParamList </params> <body> .ActionStatements </body> </action> </actions> <actionProfiles> <actionProfile> <name> sel_profile </name> <acts> actions { noop ;  ( setf1 ;  .ActionNameItems ) } </acts> <opts> "$size" |-> 16384 "$selector" |-> sel </opts> <entries> 0 |-> ( ListItem ( @call ( setf1 , $resolved ( ListItem ( @val ( 10 , 0 , false ) ) ) ) ) ListItem ( @call ( setf1 , $resolved ( ListItem ( @val ( 20 , 0 , false ) ) ) ) ) ) </entries> </actionProfile> </actionProfiles> <actionSelectors> <actionSelector> <name> sel </name> <key> sel_hash </key> </actionSelector> </actionSelectors> <tables> <table> <name> test1 </name> <reads> ( data . b1 ) : exact ;  .FieldMatchs </reads> <acts> action_profile : sel_profile ; </acts> <opts> size : 1024 ;  .TableOptionals </opts> <rules> ListItem ( $rule ( 0 , $ctr ( ListItem ( @val ( 0 , 0 , false ) ) ) , @apref ( 0 ) ) ) </rules> </table> </tables> <controlFlows> <control> <name> ingress </name> <body> apply ( test1 ) { .HitMissCases }  .ControlStatements </body> </control> </controlFlows> <cfset> SetItem ( ingress ) </cfset> <calcFieldSet> .Set </calcFieldSet> <ctx> <frameStack> .List </frameStack> <crntTable> test1 </crntTable> <crntRule> 0 </crntRule> </ctx> <packet> ListItem ( @val ( 1 , 32 , false ) ) ListItem ( @val ( 0 , 8 , false ) ) </packet> <packetout> .List </packetout> <parser> <graph> <marked> SetItem ( data ) </marked> <dporder> ListItem ( data ) </dporder> </graph> <index> 2 </index> <lastExt> data </lastExt> <varWidth> . </varWidth> <packetSize> @val ( 5 , 0 , false ) </packetSize> </parser> <buffer> <in> .List </in> <out> .List </out> </buffer> </T>

note the

<actionProfile> <name> sel_profile </name> <acts> actions { noop ;  ( setf1 ;  .ActionNameItems ) } </acts> <opts> "$size" |-> 16384 "$selector" |-> sel </opts> <entries> 0 |-> ( ListItem ( @call ( setf1 , $resolved ( ListItem ( @val ( 10 , 0 , false ) ) ) ) ) ListItem ( @call ( setf1 , $resolved ( ListItem ( @val ( 20 , 0 , false ) ) ) ) ) ) </entries> </actionProfile> </actionProfiles>

part and specially

<entries> 0 |-> ( ListItem ( @call ( setf1 , $resolved ( ListItem ( @val ( 10 , 0 , false ) ) ) ) ) ListItem ( @call ( setf1 , $resolved ( ListItem ( @val ( 20 , 0 , false ) ) ) ) ) ) </entries>

Now I have the following rule

rule <k> @val(I:Int,_,false) ~> @deref(P:ActionProfileName , Id:Int) => G[0] ... </k>
     <actionProfiles> <actionProfile> <name> P </name> <entries> (Id |-> G:List) _:Map </entries> <opts> "$selector" |-> S:SelectorName _:Map </opts> ... </actionProfile> ... </actionProfiles>
     <actionSelectors> <actionSelector> <name> S </name> <key> FLC:FieldListCalculationName </key> ... </actionSelector> ... </actionSelectors>

The result of that is:

<T> <k> ListItem ( @call ( setf1 , $resolved ( ListItem ( @val ( 20 , 0 , false ) ) ) ) ) ~> @setCrntRule ( . ) ~> @setCrntTable ( . ) ~> .HitMissCases ~> .ControlStatements ~> @egress ~> @txenPacket ~> @nextPacket </k> <headers> <header> <name> %standard_metadata_t </name> <opts> .Map </opts> <fields> ingress_port : 32 ( .FieldMods ) ;  ( egress_spec : 32 ( .FieldMods ) ;  .FieldDecs ) </fields> </header> <header> <name> data_t </name> <opts> "$fixed_width" |-> 40 </opts> <fields> f1 : 32 ( .FieldMods ) ;  ( b1 : 8 ( .FieldMods ) ;  .FieldDecs ) </fields> </header> </headers> <fieldLists> <fieldList> <name> sel_fields </name> <fields> ( data . f1 ) ;  .FieldListEntryItems </fields> </fieldList> </fieldLists> <fieldListCalcs> <fieldListCalc> <name> sel_hash </name> <fLists> ListItem ( sel_fields ) </fLists> <algorithm> crc16 </algorithm> <outWidth> 14 </outWidth> <fListIndex> 0 </fListIndex> </fieldListCalc> </fieldListCalcs> <calcFields> .CalcFieldCellBag </calcFields> <instances> <instance> <valid> true </valid> <metadata> true </metadata> <typeName> %standard_metadata_t </typeName> <name> standard_metadata </name> <fieldVals> ingress_port |-> @val ( 1 , 32 , false ) egress_spec |-> @undef </fieldVals> </instance> <instance> <valid> true </valid> <metadata> false </metadata> <typeName> data_t </typeName> <name> data </name> <fieldVals> b1 |-> @val ( 0 , 8 , false ) f1 |-> @val ( 1 , 32 , false ) </fieldVals> </instance> </instances> <parserStates> <state> <name> start </name> <body> ( extract ( data ) ; .ExtractOrSetStatements ) return ingress ; </body> </state> </parserStates> <statefuls> .StatefulCellBag </statefuls> <tableDirects> .Map </tableDirects> <actions> <action> <name> setf1 </name> <params> val , .ParamList </params> <body> modify_field ( ( data . f1 ) , ( val , .Args ) ) ;  .ActionStatements </body> </action> <action> <name> noop </name> <params> .ParamList </params> <body> .ActionStatements </body> </action> </actions> <actionProfiles> <actionProfile> <name> sel_profile </name> <acts> actions { noop ;  ( setf1 ;  .ActionNameItems ) } </acts> <opts> "$size" |-> 16384 "$selector" |-> sel </opts> <entries> 0 |-> ( ListItem ( @call ( setf1 , $resolved ( ListItem ( @val ( 10 , 0 , false ) ) ) ) ) ListItem ( @call ( setf1 , $resolved ( ListItem ( @val ( 20 , 0 , false ) ) ) ) ) ) </entries> </actionProfile> </actionProfiles> <actionSelectors> <actionSelector> <name> sel </name> <key> sel_hash </key> </actionSelector> </actionSelectors> <tables> <table> <name> test1 </name> <reads> ( data . b1 ) : exact ;  .FieldMatchs </reads> <acts> action_profile : sel_profile ; </acts> <opts> size : 1024 ;  .TableOptionals </opts> <rules> ListItem ( $rule ( 0 , $ctr ( ListItem ( @val ( 0 , 0 , false ) ) ) , @apref ( 0 ) ) ) </rules> </table> </tables> <controlFlows> <control> <name> ingress </name> <body> apply ( test1 ) { .HitMissCases }  .ControlStatements </body> </control> </controlFlows> <cfset> SetItem ( ingress ) </cfset> <calcFieldSet> .Set </calcFieldSet> <ctx> <frameStack> .List </frameStack> <crntTable> test1 </crntTable> <crntRule> 0 </crntRule> </ctx> <packet> ListItem ( @val ( 1 , 32 , false ) ) ListItem ( @val ( 0 , 8 , false ) ) </packet> <packetout> .List </packetout> <parser> <graph> <marked> SetItem ( data ) </marked> <dporder> ListItem ( data ) </dporder> </graph> <index> 2 </index> <lastExt> data </lastExt> <varWidth> . </varWidth> <packetSize> @val ( 5 , 0 , false ) </packetSize> </parser> <buffer> <in> .List </in> <out> .List </out> </buffer> </T>

Suggesting that G[0] has been evaluated into ListItem ( @call ( setf1 , $resolved ( ListItem ( @val ( 20 , 0 , false ) ) ) ) ) rather than @call ( setf1 , $resolved ( ListItem ( @val ( 20 , 0 , false ) ) ) )

@kheradmand kheradmand changed the title List [ Int ] (sometimes) yields ListItem "List [ Int ] (sometimes) yields ListItem Sep 14, 2017
@kheradmand kheradmand changed the title "List [ Int ] (sometimes) yields ListItem "List [ Int ]" (sometimes) yields ListItem Sep 14, 2017
@ehildenb
Copy link
Member

ehildenb commented Sep 15, 2017 via email

@kheradmand
Copy link
Contributor Author

kheradmand commented Sep 15, 2017

I will try to craft a minimal example. The problem is that the issue does not manifest in small examples that I tried so far.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants