Skip to content
Snippets Groups Projects
gnmi_transport_test.go 4.07 KiB
Newer Older
  • Learn to ignore specific revisions
  • Manuel Kieweg's avatar
    Manuel Kieweg committed
    package nucleus
    
    import (
    	"code.fbi.h-da.de/cocsn/gosdn/forks/goarista/gnmi"
    	"context"
    	gpb "github.com/openconfig/gnmi/proto/gnmi"
    	"github.com/openconfig/gnmi/proto/gnmi_ext"
    	"reflect"
    	"testing"
    )
    
    func TestGetWithRequest(t *testing.T) {
    	type args struct {
    		ctx context.Context
    		req *gpb.GetRequest
    	}
    	tests := []struct {
    		name    string
    		args    args
    		want    interface{}
    		wantErr bool
    	}{
    		// TODO: Add test cases.
    	}
    	for _, tt := range tests {
    		t.Run(tt.name, func(t *testing.T) {
    			got, err := GetWithRequest(tt.args.ctx, tt.args.req)
    			if (err != nil) != tt.wantErr {
    				t.Errorf("GetWithRequest() error = %v, wantErr %v", err, tt.wantErr)
    				return
    			}
    			if !reflect.DeepEqual(got, tt.want) {
    				t.Errorf("GetWithRequest() got = %v, want %v", got, tt.want)
    			}
    		})
    	}
    }
    
    func TestGnmi_Capabilities(t *testing.T) {
    	type args struct {
    		ctx context.Context
    	}
    	tests := []struct {
    		name    string
    		g       Gnmi
    		args    args
    		want    interface{}
    		wantErr bool
    	}{
    		// TODO: Add test cases.
    	}
    	for _, tt := range tests {
    		t.Run(tt.name, func(t *testing.T) {
    			got, err := tt.g.Capabilities(tt.args.ctx)
    			if (err != nil) != tt.wantErr {
    				t.Errorf("Capabilities() error = %v, wantErr %v", err, tt.wantErr)
    				return
    			}
    			if !reflect.DeepEqual(got, tt.want) {
    				t.Errorf("Capabilities() got = %v, want %v", got, tt.want)
    			}
    		})
    	}
    }
    
    func TestGnmi_Close(t *testing.T) {
    	tests := []struct {
    		name    string
    		g       Gnmi
    		wantErr bool
    	}{
    		// TODO: Add test cases.
    	}
    	for _, tt := range tests {
    		t.Run(tt.name, func(t *testing.T) {
    			if err := tt.g.Close(); (err != nil) != tt.wantErr {
    				t.Errorf("Close() error = %v, wantErr %v", err, tt.wantErr)
    			}
    		})
    	}
    }
    
    func TestGnmi_Get(t *testing.T) {
    	type args struct {
    		ctx    context.Context
    		paths  [][]string
    		origin string
    	}
    	tests := []struct {
    		name    string
    		g       Gnmi
    		args    args
    		want    interface{}
    		wantErr bool
    	}{
    		// TODO: Add test cases.
    	}
    	for _, tt := range tests {
    		t.Run(tt.name, func(t *testing.T) {
    			got, err := tt.g.Get(tt.args.ctx, tt.args.paths, tt.args.origin)
    			if (err != nil) != tt.wantErr {
    				t.Errorf("Get() error = %v, wantErr %v", err, tt.wantErr)
    				return
    			}
    			if !reflect.DeepEqual(got, tt.want) {
    				t.Errorf("Get() got = %v, want %v", got, tt.want)
    			}
    		})
    	}
    }
    
    func TestGnmi_GetConfig(t *testing.T) {
    	tests := []struct {
    		name string
    		g    Gnmi
    		want interface{}
    	}{
    		// TODO: Add test cases.
    	}
    	for _, tt := range tests {
    		t.Run(tt.name, func(t *testing.T) {
    			if got := tt.g.GetConfig(); !reflect.DeepEqual(got, tt.want) {
    				t.Errorf("GetConfig() = %v, want %v", got, tt.want)
    			}
    		})
    	}
    }
    
    func TestGnmi_Set(t *testing.T) {
    	type args struct {
    		ctx    context.Context
    		setOps []*gnmi.Operation
    		exts   []*gnmi_ext.Extension
    	}
    	tests := []struct {
    		name    string
    		g       Gnmi
    		args    args
    		wantErr bool
    	}{
    		// TODO: Add test cases.
    	}
    	for _, tt := range tests {
    		t.Run(tt.name, func(t *testing.T) {
    			if err := tt.g.Set(tt.args.ctx, tt.args.setOps, tt.args.exts...); (err != nil) != tt.wantErr {
    				t.Errorf("Set() error = %v, wantErr %v", err, tt.wantErr)
    			}
    		})
    	}
    }
    
    func TestGnmi_SetConfig(t *testing.T) {
    	type args struct {
    		in0 interface{}
    	}
    	tests := []struct {
    		name    string
    		g       Gnmi
    		args    args
    		wantErr bool
    	}{
    		// TODO: Add test cases.
    	}
    	for _, tt := range tests {
    		t.Run(tt.name, func(t *testing.T) {
    			if err := tt.g.SetConfig(tt.args.in0); (err != nil) != tt.wantErr {
    				t.Errorf("SetConfig() error = %v, wantErr %v", err, tt.wantErr)
    			}
    		})
    	}
    }
    
    func TestGnmi_Subscribe(t *testing.T) {
    	type args struct {
    		ctx              context.Context
    		subscribeOptions *gnmi.SubscribeOptions
    		respChan         chan<- *gpb.SubscribeResponse
    	}
    	tests := []struct {
    		name    string
    		g       Gnmi
    		args    args
    		wantErr bool
    	}{
    		// TODO: Add test cases.
    	}
    	for _, tt := range tests {
    		t.Run(tt.name, func(t *testing.T) {
    			if err := tt.g.Subscribe(tt.args.ctx, tt.args.subscribeOptions, tt.args.respChan); (err != nil) != tt.wantErr {
    				t.Errorf("Subscribe() error = %v, wantErr %v", err, tt.wantErr)
    			}
    		})
    	}
    }