// NewPluginRoutingFromBytes ...
559826
func NewPluginRoutingFromBytes(bytes []byte) (PluginRouting, error) {
	var routing PluginRouting
	if err := yaml.Unmarshal(bytes, &routing); err != nil {
		return PluginRouting{}, err
	}
	if err := routing.Validate(); err != nil {
		return PluginRouting{}, err
	}
	return routing, nil
}
67005
func NewBGP(socket string, asn uint32) *BGP {
	if socket == "" {
		socket = BGPSocketPath
	}
	return &BGP{
		vty: NewVTY(socket),
		asn: asn,
	}
}
346025
func NewProvider(datafile string) (isp.Provider, error) {
	prov := &provider{
		yfast.New(uint32(0)), // 32 bit universe size for 32 bit IPv4
	}
	return prov, prov.init(datafile)
}
1081309
func (e *podEnv) netPluginAdd(n *activeNet, netns string) error {
	output, err := e.execNetPlugin("ADD", n, netns)
	if err != nil {
		return pluginErr(err, output)
	}

	pr := cnitypes.Result{}
	if err = json.Unmarshal(output, &pr); err != nil {
		err = errwrap.Wrap(fmt.Errorf("parsing %q", string(output)), err)
		return errwrap.Wrap(fmt.Errorf("error parsing %q result", n.conf.Name), err)
	}

	if pr.IP4 == nil {
		return nil // TODO(casey) should this be an error?
	}

	// All is well - mutate the runtime
	n.runtime.MergeCNIResult(pr)
	return nil
}
441557
func NewProxyPlugin(pluginName string, osClient *osclient.Client, kClient *kclient.Client) (api.FilteringEndpointsConfigHandler, error) {
	if !IsOpenShiftMultitenantNetworkPlugin(pluginName) {
		return nil, nil
	}

	return &ovsProxyPlugin{
		registry: newRegistry(osClient, kClient),
		podsByIP: make(map[string]*kapi.Pod),
	}, nil
}
1126077
func NewFromConfig(filename string) (Router, error) {
	file, err := os.Open(filename)
	if err != nil {
		return nil, err
	}
	defer file.Close()

	fileBytes, err := ioutil.ReadAll(file)
	if err != nil {
		return nil, err
	}

	router, err := NewFromConfigBytes(fileBytes)
	if err != nil {
		return nil, fmt.Errorf(
			"Error initializing kayvee log router from file '%s':\n%s",
			filename, err.Error(),
		)
	}
	return router, nil
}
447572
func NewRouteFromHops(amtToSend lnwire.MilliSatoshi, timeLock uint32,
	sourceVertex Vertex, hops []*Hop) (*Route, error) {

	if len(hops) == 0 {
		return nil, ErrNoRouteHopsProvided
	}

	// First, we'll create a route struct and populate it with the fields
	// for which the values are provided as arguments of this function.
	// TotalFees is determined based on the difference between the amount
	// that is send from the source and the final amount that is received
	// by the destination.
	route := &Route{
		SourcePubKey:  sourceVertex,
		Hops:          hops,
		TotalTimeLock: timeLock,
		TotalAmount:   amtToSend,
		TotalFees:     amtToSend - hops[len(hops)-1].AmtToForward,
	}

	return route, nil
}
196640
func NewNodePlugin(pluginName string, osClient *osclient.Client, kClient *kclient.Client, hostname string, selfIP string, iptablesSyncPeriod time.Duration, mtu uint) (api.OsdnNodePlugin, error) {
	if !IsOpenShiftNetworkPlugin(pluginName) {
		return nil, nil
	}

	log.Infof("Initializing SDN node of type %q with configured hostname %q (IP %q), iptables sync period %q", pluginName, hostname, selfIP, iptablesSyncPeriod.String())
	if hostname == "" {
		output, err := kexec.New().Command("uname", "-n").CombinedOutput()
		if err != nil {
			return nil, err
		}
		hostname = strings.TrimSpace(string(output))
		log.Infof("Resolved hostname to %q", hostname)
	}
	if selfIP == "" {
		var err error
		selfIP, err = netutils.GetNodeIP(hostname)
		if err != nil {
			log.V(5).Infof("Failed to determine node address from hostname %s; using default interface (%v)", hostname, err)
			defaultIP, err := kubeutilnet.ChooseHostInterface()
			if err != nil {
				return nil, err
			}
			selfIP = defaultIP.String()
			log.Infof("Resolved IP address to %q", selfIP)
		}
	}

	plugin := &OsdnNode{
		multitenant:        IsOpenShiftMultitenantNetworkPlugin(pluginName),
		registry:           newRegistry(osClient, kClient),
		localIP:            selfIP,
		hostName:           hostname,
		vnids:              newVnidMap(),
		podNetworkReady:    make(chan struct{}),
		iptablesSyncPeriod: iptablesSyncPeriod,
		mtu:                mtu,
	}
	return plugin, nil
}
633864
func DoByteBufStreamingRoundTrip(stream testpb.BenchmarkService_StreamingCallClient, reqSize, respSize int) error {
	out := make([]byte, reqSize)
	if err := stream.(grpc.ClientStream).SendMsg(&out); err != nil {
		return fmt.Errorf("/BenchmarkService/StreamingCall.(ClientStream).SendMsg(_) = %v, want <nil>", err)
	}
	var in []byte
	if err := stream.(grpc.ClientStream).RecvMsg(&in); err != nil {
		// EOF is a valid error here.
		if err == io.EOF {
			return nil
		}
		return fmt.Errorf("/BenchmarkService/StreamingCall.(ClientStream).RecvMsg(_) = %v, want <nil>", err)
	}
	return nil
}
895011
func (s *NATService) NewListIpForwardingRulesParams() *ListIpForwardingRulesParams {
	p := &ListIpForwardingRulesParams{}
	p.p = make(map[string]interface{})
	return p
}
724725
func newPlugin() *priorityPlugin {
	return &priorityPlugin{
		Handler: admission.NewHandler(admission.Create, admission.Update, admission.Delete),
	}
}
177325
func NewProvider(ctx context.Context, queue *Queue, contentRouting routing.ContentRouting) Provider {
	return &provider{
		ctx:            ctx,
		queue:          queue,
		contentRouting: contentRouting,
	}
}
1314897
func NewPluginRoute(name, source, executable, version, triggerEvent string) (PluginRoute, error) {
	route := PluginRoute{
		Name:         name,
		Source:       source,
		Executable:   executable,
		Version:      version,
		TriggerEvent: triggerEvent,
	}
	if err := route.Validate(); err != nil {
		return PluginRoute{}, err
	}
	return route, nil
}
1322508
func newGateway(ctx context.Context, conn *grpc.ClientConn, opts []gwruntime.ServeMuxOption) (http.Handler, error) {

	mux := gwruntime.NewServeMux(opts...)

	for _, f := range []func(context.Context, *gwruntime.ServeMux, *grpc.ClientConn) error{
		examplepb.RegisterEchoServiceHandler,
		examplepb.RegisterStreamServiceHandler,
		examplepb.RegisterABitOfEverythingServiceHandler,
		examplepb.RegisterFlowCombinationHandler,
		examplepb.RegisterResponseBodyServiceHandler,
	} {
		if err := f(ctx, mux, conn); err != nil {
			return nil, err
		}
	}
	return mux, nil
}
567751
func NewPlugin(opts ...Option) *Plugin {
	p := &Plugin{}

	p.PluginName = "probe"
	p.HTTP = &rest.DefaultPlugin
	p.ServiceLabel = &servicelabel.DefaultPlugin
	p.StatusCheck = &statuscheck.DefaultPlugin

	for _, o := range opts {
		o(p)
	}

	if p.Deps.Log == nil {
		p.Deps.Log = logging.ForPlugin(p.String())
	}

	return p
}
1120067
func NewRouter(f *Fibre) *Router {
	return &Router{
		fibre:  f,
		routes: make(map[string][]*Route),
	}
}
685506
func NewPlugin(opts ...Option) *Plugin {
	p := &Plugin{}

	p.PluginName = "etcd"
	p.StatusCheck = &statuscheck.DefaultPlugin
	p.Resync = &resync.DefaultPlugin

	for _, o := range opts {
		o(p)
	}

	p.PluginDeps.Setup()

	return p
}