func ExecAdd(plugin string, netconf []byte) (*types.Result, error) { if os.Getenv("CNI_COMMAND") != "ADD" { return nil, fmt.Errorf("CNI_COMMAND is not ADD") } return invoke.ExecPluginWithResult(invoke.Find(plugin), netconf, invoke.ArgsFromEnv()) }
func (c *CNIConfig) AddNetwork(net *NetworkConfig, rt *RuntimeConf) (*types.Result, error) { pluginPath := invoke.FindInPath(net.Network.Type, c.Path) return invoke.ExecPluginWithResult(pluginPath, net.Bytes, c.args("ADD", rt)) }