vpphelper provides helper functions (using govpp) that helps to connect to VPP and configure VPP using a configuration (.conf) file.
StartAndDialContext function starts VPP using a VPP configuration file and returns a Connection to VPP.
conn, vppErrCh := vpphelper.StartAndDialContext(connectCtx)The following two functional options can also be passed as parameters to the StartAndDialContext function:
WithRootDir: sets the root directory for all.conffilesWithVppConfig: setsvpp.conffile template. All the%[1]sin the template will be replaced by therootDir.
conn, vppErrCh := vpphelper.StartAndDialContext(connectCtx, vpphelper.WithRootDir("/tmp/vpp2"), vpphelper.WithVppConfig(newVppConfContents))Note: newVppConfContents variable in above code snippet is a multiline string having vpp.conf template. An example of such template is available in vpp.conf.go.