Skip to content

Commit 1141932

Browse files
authored
Merge pull request #75 from digitalocean/nbouliane/action_all
add support for action all
2 parents 93af8d3 + 16d948a commit 1141932

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

ovs/action.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ var (
6666
// Action strings in lower case, as those are compared to the lower case letters
6767
// in parseAction().
6868
const (
69+
actionAll = "all"
6970
actionDrop = "drop"
7071
actionFlood = "flood"
7172
actionInPort = "in_port"
@@ -96,6 +97,8 @@ func (a *textAction) MarshalText() ([]byte, error) {
9697
// GoString implements Action.
9798
func (a *textAction) GoString() string {
9899
switch a.action {
100+
case actionAll:
101+
return "ovs.All()"
99102
case actionDrop:
100103
return "ovs.Drop()"
101104
case actionFlood:
@@ -113,6 +116,14 @@ func (a *textAction) GoString() string {
113116
}
114117
}
115118

119+
// All outputs the packet on all switch ports except
120+
// the port on which it was received.
121+
func All() Action {
122+
return &textAction{
123+
action: actionAll,
124+
}
125+
}
126+
116127
// Drop immediately discards the packet. It must be the only Action
117128
// specified when used.
118129
func Drop() Action {

ovs/action_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ func TestActionConstants(t *testing.T) {
2424
a Action
2525
out string
2626
}{
27+
{
28+
a: All(),
29+
out: "all",
30+
},
2731
{
2832
a: Drop(),
2933
out: "drop",

0 commit comments

Comments
 (0)