Skip to content
Snippets Groups Projects
set.go 524 B
Newer Older
  • Learn to ignore specific revisions
  • package cli
    
    import (
    
    Andre Sterba's avatar
    Andre Sterba committed
    	"context"
    
    
    	"code.fbi.h-da.de/cocsn/gosdn/forks/goarista/gnmi"
    	"code.fbi.h-da.de/cocsn/gosdn/nucleus"
    )
    
    
    Manuel Kieweg's avatar
    Manuel Kieweg committed
    // Set sends a gNMI Set request to the specified target. Only one
    // request per invocation supported.
    func Set(a, u, p, typ string, args ...string) error {
    
    	opts := &nucleus.GnmiTransportOptions{
    		Config: gnmi.Config{
    			Addr:     a,
    
    Manuel Kieweg's avatar
    Manuel Kieweg committed
    			Username: u,
    			Password: p,
    
    		},
    	}
    	t, err := nucleus.NewGnmiTransport(opts)
    	if err != nil {
    		return err
    	}
    
    Manuel Kieweg's avatar
    Manuel Kieweg committed
    	return t.Set(context.Background(), args)