Skip to content

Commit 9c444ab

Browse files
committed
adding the API AppendConfig
1 parent 87e4076 commit 9c444ab

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

otg/otg.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,3 +264,31 @@ func (o *OTG) GNMIOpts() *gnmi.Opts {
264264
return rawapis.FetchOTGGNMI(ctx, o.ate)
265265
})
266266
}
267+
268+
269+
func (o *OTG) AppendConfig(t testing.TB, cfg gosnappi.ConfigAppend) {
270+
t.Helper()
271+
t = events.ActionStarted(t, "Appending config to %s", o.ate)
272+
warns, err := appendConfig(context.Background(), o.ate, cfg)
273+
if err != nil {
274+
t.Fatalf("AppendConfig(t) on %s: %v", o.ate, err)
275+
}
276+
277+
if len(warns) > 0 {
278+
t.Logf("AppendConfig(t) on %s non-fatal warnings: %v", o.ate, warns)
279+
}
280+
}
281+
282+
func appendConfig(ctx context.Context, ate binding.ATE, cfg gosnappi.ConfigAppend) ([]string, error) {
283+
api, err := rawapis.FetchOTG(ctx, ate)
284+
if err != nil {
285+
return nil, err
286+
}
287+
288+
resp, err := api.AppendConfig(cfg)
289+
if err != nil {
290+
return nil, err
291+
}
292+
return resp.Warnings(), nil
293+
}
294+

0 commit comments

Comments
 (0)