1
- // Copyright 2017 DigitalOcean.
1
+ // Copyright 2021 DigitalOcean.
2
2
//
3
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
4
// you may not use this file except in compliance with the License.
@@ -62,9 +62,9 @@ type DataPathReader interface {
62
62
// for the ovs DataPaths
63
63
type DataPathWriter interface {
64
64
// AddDataPath is the method used to add a datapath to the switch
65
- AddDataPath (string ) ([] byte , error )
65
+ AddDataPath (string ) error
66
66
// DelDataPath is the method used to remove a datapath from the switch
67
- DelDataPath (string ) ([] string , error )
67
+ DelDataPath (string ) error
68
68
}
69
69
70
70
// ConnTrackReader is the interface defining the read operations
@@ -112,8 +112,7 @@ func NewDataPathService() *DataPathService {
112
112
113
113
// Version retruns the ovs-dptcl --version currently installed
114
114
func (dp * DataPathService ) Version () (string , error ) {
115
- args := []string {"--version" }
116
- result , err := dp .CLI .Exec (args ... )
115
+ result , err := dp .CLI .Exec ("--version" )
117
116
if err != nil {
118
117
return "" , err
119
118
}
@@ -123,8 +122,7 @@ func (dp *DataPathService) Version() (string, error) {
123
122
124
123
// GetDataPaths returns the output of the command 'ovs-dpctl dump-dps'
125
124
func (dp * DataPathService ) GetDataPaths () ([]string , error ) {
126
- args := []string {"dump-dps" }
127
- result , err := dp .CLI .Exec (args ... )
125
+ result , err := dp .CLI .Exec ("dump-dps" )
128
126
if err != nil {
129
127
return nil , err
130
128
}
@@ -135,31 +133,29 @@ func (dp *DataPathService) GetDataPaths() ([]string, error) {
135
133
// AddDataPath create a Datapath with the command 'ovs-dpctl add-dp <DP>'
136
134
// It takes one argument, the required DataPath Name and returns an error
137
135
// if it failed
138
- func (dp * DataPathService ) AddDataPath (dpName string ) ([]byte , error ) {
139
- args := []string {"add-dp" , dpName }
140
-
141
- return dp .CLI .Exec (args ... )
136
+ func (dp * DataPathService ) AddDataPath (dpName string ) error {
137
+ _ , err := dp .CLI .Exec ("add-dp" , dpName )
138
+ return err
142
139
}
143
140
144
141
// DelDataPath create a Datapath with the command 'ovs-dpctl del-dp <DP>'
145
142
// It takes one argument, the required DataPath Name and returns an error
146
143
// if it failed
147
- func (dp * DataPathService ) DelDataPath (dpName string ) ([] byte , error ) {
148
- args := [] string { "del-dp" , dpName }
144
+ func (dp * DataPathService ) DelDataPath (dpName string ) error {
145
+ _ , err := dp . CLI . Exec ( "del-dp" , dpName )
149
146
150
- return dp . CLI . Exec ( args ... )
147
+ return err
151
148
}
152
149
153
150
// GetCTLimits returns the conntrack limits for a given datapath
154
151
// equivalent to running: 'sudo ovs-dpctl ct-get-limits <datapath_name> zone=<#1>,<#2>,...'
155
152
func (dp * DataPathService ) GetCTLimits (dpName string , zones []uint64 ) (* ConnTrackOutput , error ) {
156
153
// Start by building the args
157
- args := []string {"ct-get-limits" }
158
154
if dpName == "" {
159
155
return nil , errMissingDataPathName
160
156
}
161
157
162
- args = append ( args , dpName )
158
+ args := [] string { "ct-get-limits" , dpName }
163
159
164
160
zoneParam := getZoneString (zones )
165
161
if zoneParam != "" {
0 commit comments