From 8f44a69779c6fc9cf984b086d11af2b58c65ab71 Mon Sep 17 00:00:00 2001 From: Manuel Kieweg <mail@manuelkieweg.de> Date: Thu, 18 Feb 2021 16:06:36 +0000 Subject: [PATCH] sbi test skeleton --- nucleus/southbound_test.go | 248 +++++++++++++++++++++++++++++++++++++ 1 file changed, 248 insertions(+) diff --git a/nucleus/southbound_test.go b/nucleus/southbound_test.go index 0fa4ffa90..bc36b6ac2 100644 --- a/nucleus/southbound_test.go +++ b/nucleus/southbound_test.go @@ -1 +1,249 @@ package nucleus + +import ( + gpb "github.com/openconfig/gnmi/proto/gnmi" + "github.com/openconfig/goyang/pkg/yang" + "github.com/openconfig/ygot/ytypes" + "reflect" + "testing" +) + +func TestAristaOC_SbiIdentifier(t *testing.T) { + type fields struct { + transport Transport + schema *ytypes.Schema + } + tests := []struct { + name string + fields fields + want string + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + oc := &AristaOC{ + transport: tt.fields.transport, + schema: tt.fields.schema, + } + if got := oc.SbiIdentifier(); got != tt.want { + t.Errorf("SbiIdentifier() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestAristaOC_Schema(t *testing.T) { + type fields struct { + transport Transport + schema *ytypes.Schema + } + tests := []struct { + name string + fields fields + want *ytypes.Schema + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + oc := &AristaOC{ + transport: tt.fields.transport, + schema: tt.fields.schema, + } + if got := oc.Schema(); !reflect.DeepEqual(got, tt.want) { + t.Errorf("Schema() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestAristaOC_SetNode(t *testing.T) { + type fields struct { + transport Transport + schema *ytypes.Schema + } + tests := []struct { + name string + fields fields + want func(schema *yang.Entry, root interface{}, path *gpb.Path, val interface{}, opts ...ytypes.SetNodeOpt) error + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + oc := &AristaOC{ + transport: tt.fields.transport, + schema: tt.fields.schema, + } + if got := oc.SetNode(); !reflect.DeepEqual(got, tt.want) { + t.Errorf("SetNode() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestOpenConfig_SbiIdentifier(t *testing.T) { + type fields struct { + transport Transport + schema *ytypes.Schema + } + tests := []struct { + name string + fields fields + want string + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + oc := &OpenConfig{ + transport: tt.fields.transport, + schema: tt.fields.schema, + } + if got := oc.SbiIdentifier(); got != tt.want { + t.Errorf("SbiIdentifier() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestOpenConfig_Schema(t *testing.T) { + type fields struct { + transport Transport + schema *ytypes.Schema + } + tests := []struct { + name string + fields fields + want *ytypes.Schema + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + oc := &OpenConfig{ + transport: tt.fields.transport, + schema: tt.fields.schema, + } + if got := oc.Schema(); !reflect.DeepEqual(got, tt.want) { + t.Errorf("Schema() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestOpenConfig_SetNode(t *testing.T) { + type fields struct { + transport Transport + schema *ytypes.Schema + } + tests := []struct { + name string + fields fields + want func(schema *yang.Entry, root interface{}, path *gpb.Path, val interface{}, opts ...ytypes.SetNodeOpt) error + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + oc := &OpenConfig{ + transport: tt.fields.transport, + schema: tt.fields.schema, + } + if got := oc.SetNode(); !reflect.DeepEqual(got, tt.want) { + t.Errorf("SetNode() = %v, want %v", got, tt.want) + } + }) + } +} + +func Test_sbiStorage_Sbi(t *testing.T) { + type args struct { + name string + } + tests := []struct { + name string + s sbiStorage + args args + want SouthboundInterface + wantErr bool + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got, err := tt.s.Sbi(tt.args.name) + if (err != nil) != tt.wantErr { + t.Errorf("Sbi() error = %v, wantErr %v", err, tt.wantErr) + return + } + if !reflect.DeepEqual(got, tt.want) { + t.Errorf("Sbi() got = %v, want %v", got, tt.want) + } + }) + } +} + +func Test_sbiStorage_add(t *testing.T) { + type args struct { + sbi SouthboundInterface + } + tests := []struct { + name string + s sbiStorage + args args + wantErr bool + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if err := tt.s.add(tt.args.sbi); (err != nil) != tt.wantErr { + t.Errorf("add() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} + +func Test_sbiStorage_delete(t *testing.T) { + type args struct { + name string + } + tests := []struct { + name string + s sbiStorage + args args + wantErr bool + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if err := tt.s.delete(tt.args.name); (err != nil) != tt.wantErr { + t.Errorf("delete() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} + +func Test_sbiStorage_exists(t *testing.T) { + type args struct { + name string + } + tests := []struct { + name string + s sbiStorage + args args + want bool + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := tt.s.exists(tt.args.name); got != tt.want { + t.Errorf("exists() = %v, want %v", got, tt.want) + } + }) + } +} -- GitLab