File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -96,7 +96,12 @@ def decode_load_field(value):
9696 if len (parts ) != 2 :
9797 raise ValueError ("Malformed load action : %s" % value )
9898
99- return {"value" : int (parts [0 ], 0 ), "dst" : decode_field (parts [1 ])}
99+ # If the load action is performed within a learn() action,
100+ # The value can be specified as another field.
101+ try :
102+ return {"value" : int (parts [0 ], 0 ), "dst" : decode_field (parts [1 ])}
103+ except ValueError :
104+ return {"src" : decode_field (parts [0 ]), "dst" : decode_field (parts [1 ])}
100105
101106
102107def decode_set_field (field_decoders , value ):
Original file line number Diff line number Diff line change 127127 )
128128 ],
129129 ),
130+ (
131+ "actions=learn(load:NXM_NX_TUN_ID[]->NXM_NX_TUN_ID[])" ,
132+ [
133+ KeyValue (
134+ "learn" ,
135+ [
136+ {
137+ "load" : {
138+ "src" : {"field" : "NXM_NX_TUN_ID" },
139+ "dst" : {"field" : "NXM_NX_TUN_ID" },
140+ }
141+ }
142+ ],
143+ ),
144+ ],
145+ ),
130146 (
131147 "actions=set_field:00:11:22:33:44:55->eth_src" ,
132148 [
You can’t perform that action at this time.
0 commit comments