diff options
Diffstat (limited to 'extras/hs-test/actions.go')
-rwxr-xr-x | extras/hs-test/actions.go | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/extras/hs-test/actions.go b/extras/hs-test/actions.go index 9885f87b87d..fe07b5fdb39 100755 --- a/extras/hs-test/actions.go +++ b/extras/hs-test/actions.go @@ -236,20 +236,26 @@ func (a *Actions) Configure2Veths(args []string) *ActionResult { ctx, cancel := newVppContext() defer cancel() + + vppConfig, err := DeserializeVppConfig(args[2]) + if err != nil { + return NewActionResult(err, ActionResultWithDesc("deserializing configuration failed")) + } + con, vppErrCh := vpphelper.StartAndDialContext(ctx, - vpphelper.WithVppConfig(configTemplate+startup.ToString()), + vpphelper.WithVppConfig(vppConfig.getTemplate()+startup.ToString()), vpphelper.WithRootDir(fmt.Sprintf("/tmp/%s", args[1]))) exitOnErrCh(ctx, cancel, vppErrCh) var fn func(context.Context, api.Connection) error - if args[2] == "srv" { + if vppConfig.Variant == "srv" { fn = configure2vethsTopo("vppsrv", "10.10.10.1/24", "1", 1) - } else if args[2] == "srv-with-preset-hw-addr" { + } else if vppConfig.Variant == "srv-with-preset-hw-addr" { fn = configure2vethsTopo("vppsrv", "10.10.10.1/24", "1", 1, "00:00:5e:00:53:01") } else { fn = configure2vethsTopo("vppcln", "10.10.10.2/24", "2", 2) } - err := fn(ctx, con) + err = fn(ctx, con) if err != nil { return NewActionResult(err, ActionResultWithDesc("configuration failed")) } |