Skip to content

Commit 325d901

Browse files
authored
Merge pull request #42 from digitalocean/nshrader/conjunction-array
ovs: find a failing case for conjuction action
2 parents ebeeb80 + 4e7e54d commit 325d901

File tree

4 files changed

+22
-7
lines changed

4 files changed

+22
-7
lines changed

ovs/action.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ func StripVLAN() Action {
149149
// printf-style patterns for marshaling and unmarshaling actions.
150150
const (
151151
patConnectionTracking = "ct(%s)"
152-
patConjunction = "conjunction(%d, %d/%d)"
152+
patConjunction = "conjunction(%d,%d/%d)"
153153
patModDataLinkDestination = "mod_dl_dst:%s"
154154
patModDataLinkSource = "mod_dl_src:%s"
155155
patModNetworkDestination = "mod_nw_dst:%s"

ovs/action_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,12 +541,12 @@ func TestConjunction(t *testing.T) {
541541
{
542542
desc: "set conjunction 1/2",
543543
a: Conjunction(123, 1, 2),
544-
action: "conjunction(123, 1/2)",
544+
action: "conjunction(123,1/2)",
545545
},
546546
{
547547
desc: "set conjunction 2/2",
548548
a: Conjunction(123, 2, 2),
549-
action: "conjunction(123, 2/2)",
549+
action: "conjunction(123,2/2)",
550550
},
551551
{
552552
desc: "set conjunction 3/2",

ovs/actionparser_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,19 +282,19 @@ func Test_parseAction(t *testing.T) {
282282
a: SetField("192.168.1.1", "arp_spa"),
283283
},
284284
{
285-
s: "conjunction(123, 1/2)",
285+
s: "conjunction(123,1/2)",
286286
a: Conjunction(123, 1, 2),
287287
},
288288
{
289-
s: "conjunction(123, 2/2)",
289+
s: "conjunction(123,2/2)",
290290
a: Conjunction(123, 2, 2),
291291
},
292292
{
293-
s: "conjunction(123, 3/2)",
293+
s: "conjunction(123,3/2)",
294294
invalid: true,
295295
},
296296
{
297-
s: "conjunxxxxx(123, 3/2)",
297+
s: "conjunxxxxx(123,3/2)",
298298
invalid: true,
299299
},
300300
}

ovs/flow_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,21 @@ func TestFlowMarshalText(t *testing.T) {
263263
},
264264
s: "priority=4020,tcp,tcp_flags=+syn+ack,nw_dst=192.0.2.1,tp_dst=22,table=45,idle_timeout=0,actions=resubmit(,1)",
265265
},
266+
{
267+
desc: "Conjunction flow",
268+
f: &Flow{
269+
Priority: 400,
270+
Protocol: ProtocolIPv4,
271+
Matches: []Match{
272+
NetworkDestination("192.0.2.1"),
273+
},
274+
Table: 45,
275+
Actions: []Action{
276+
Conjunction(123, 1, 2),
277+
},
278+
},
279+
s: "priority=400,ip,nw_dst=192.0.2.1,table=45,idle_timeout=0,actions=conjunction(123,1/2)",
280+
},
266281
}
267282

268283
for _, tt := range tests {

0 commit comments

Comments
 (0)