Newer
Older
"code.fbi.h-da.de/cocsn/gosdn/forks/goarista/gnmi"
"code.fbi.h-da.de/cocsn/yang-models/generated/openconfig"
"github.com/google/uuid"
"github.com/openconfig/ygot/ygot"
)
func TestDevice_Id(t *testing.T) {
type fields struct {
GoStruct ygot.GoStruct
SBI SouthboundInterface
Transport Transport
}
tests := []struct {
name string
fields fields
want uuid.UUID
}{
{
name: "default",
fields: fields{
},
want: did,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
d := &Device{
GoStruct: tt.fields.GoStruct,
SBI: tt.fields.SBI,
Transport: tt.fields.Transport,
if got := d.ID(); !reflect.DeepEqual(got, tt.want) {
t.Errorf("ID() = %v, want %v", got, tt.want)
}
})
}
}
func TestNewDevice(t *testing.T) {
sbi := &OpenConfig{}
type args struct {
}
tests := []struct {
name string
args args
want *Device
wantErr bool
}{
{
name: "default",
args: args{
sbi: sbi,
opts: &GnmiTransportOptions{
Config: gnmi.Config{
Addr: "test:///",
Username: "test",
Password: "test",
},
},
want: &Device{
GoStruct: &openconfig.Device{},
SBI: sbi,
Options: &GnmiTransportOptions{
Config: gnmi.Config{
Addr: "test:///",
Username: "test",
Password: "test",
},
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := NewDevice(tt.args.sbi, tt.args.opts, tt.args.name)
tt.want.Transport.(*Gnmi).client = got.Transport.(*Gnmi).client