@@ -115,6 +115,45 @@ func (ovsif *Interface) DeletePort(port string) error {
115
115
return err
116
116
}
117
117
118
+ // Create creates a record in the OVS database, as with "ovs-vsctl create" and
119
+ // returns the UUID of the newly-created item.
120
+ // NOTE: This only works for QoS; for all other tables the created object will
121
+ // immediately be garbage-collected; we'd need an API that calls "create" and "set"
122
+ // in the same "ovs-vsctl" call.
123
+ func (ovsif * Interface ) Create (table string , values ... string ) (string , error ) {
124
+ args := append ([]string {"create" , table }, values ... )
125
+ return ovsif .exec (OVS_VSCTL , args ... )
126
+ }
127
+
128
+ // Destroy deletes the indicated record in the OVS database. It is not an error if
129
+ // the record does not exist
130
+ func (ovsif * Interface ) Destroy (table , record string ) error {
131
+ _ , err := ovsif .exec (OVS_VSCTL , "--if-exists" , "destroy" , table , record )
132
+ return err
133
+ }
134
+
135
+ // Get gets the indicated value from the OVS database. For multi-valued or
136
+ // map-valued columns, the data is returned in the same format as "ovs-vsctl get".
137
+ func (ovsif * Interface ) Get (table , record , column string ) (string , error ) {
138
+ return ovsif .exec (OVS_VSCTL , "get" , table , record , column )
139
+ }
140
+
141
+ // Set sets one or more columns on a record in the OVS database, as with
142
+ // "ovs-vsctl set"
143
+ func (ovsif * Interface ) Set (table , record string , values ... string ) error {
144
+ args := append ([]string {"set" , table , record }, values ... )
145
+ _ , err := ovsif .exec (OVS_VSCTL , args ... )
146
+ return err
147
+ }
148
+
149
+ // Clear unsets the indicated columns in the OVS database. It is not an error if
150
+ // the value is already unset
151
+ func (ovsif * Interface ) Clear (table , record string , columns ... string ) error {
152
+ args := append ([]string {"--if-exists" , "clear" , table , record }, columns ... )
153
+ _ , err := ovsif .exec (OVS_VSCTL , args ... )
154
+ return err
155
+ }
156
+
118
157
type Transaction struct {
119
158
ovsif * Interface
120
159
err error
0 commit comments