Example #1
0
File: ipam.go Project: dcbw/cni
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())
}
Example #2
0
File: api.go Project: dcbw/cni
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))
}