@@ -181,6 +181,7 @@ func StripVLAN() Action {
181181// printf-style patterns for marshaling and unmarshaling actions.
182182const (
183183 patConnectionTracking = "ct(%s)"
184+ patMultipath = "multipath(%s,%d,%s,%d,%d,%s)"
184185 patConjunction = "conjunction(%d,%d/%d)"
185186 patModDataLinkDestination = "mod_dl_dst:%s"
186187 patModDataLinkSource = "mod_dl_src:%s"
@@ -439,6 +440,46 @@ func (a *outputFieldAction) GoString() string {
439440 return fmt .Sprintf ("ovs.OutputField(%q)" , a .field )
440441}
441442
443+ // Multipath returns a MultipathAction instance.
444+ //
445+ // Hashes fields using `basis` as a universal hash parameter, then
446+ // applies multipath link selection `algorithm` (with parameter `arg`)
447+ // to choose one of `n_links` output links numbered 0 through n_links
448+ // minus 1, and stores the link into `dst`, which must be a field or
449+ // subfield in the syntax described under ``Field Specifications’’
450+ // above.
451+ // https://www.openvswitch.org/support/dist-docs/ovs-actions.7.txt
452+ func Multipath (fields string , basis int , algorithm string , nlinks int , arg int , dst string ) Action {
453+ return & multipathAction {
454+ fields : fields ,
455+ basis : basis ,
456+ algorithm : algorithm ,
457+ nlinks : nlinks ,
458+ arg : arg ,
459+ dst : dst ,
460+ }
461+ }
462+
463+ // MarshalText converts the Bucket to its string representation
464+ func (me * multipathAction ) MarshalText () ([]byte , error ) {
465+ return bprintf (patMultipath , me .fields , me .basis , me .algorithm , me .nlinks , me .arg , me .dst ), nil
466+ }
467+
468+ // MultipathAction represents a multipath hashing rule
469+ type multipathAction struct {
470+ fields string
471+ basis int
472+ algorithm string
473+ nlinks int
474+ arg int
475+ dst string
476+ }
477+
478+ // GoString implements Action.
479+ func (me * multipathAction ) GoString () string {
480+ return fmt .Sprintf ("ovs.Multipath(%q, %q, %q, %q, %q, %q)" , me .fields , me .basis , me .algorithm , me .nlinks , me .arg , me .dst )
481+ }
482+
442483// Conjunction associates a flow with a certain conjunction ID to match on more than
443484// one dimension across multiple set matches.
444485func Conjunction (id int , dimensionNumber int , dimensionSize int ) Action {
0 commit comments