Skip to content
Snippets Groups Projects
Commit 8a8516ed authored by Manuel Kieweg's avatar Manuel Kieweg
Browse files

nbi implementation done

parent 97044a5c
No related branches found
No related tags found
1 merge request!155Northbound Interface
This commit is part of merge request !155. Comments created here will be created in the context of that merge request.
......@@ -21,7 +21,7 @@ import (
func Subscribe(address, username, password, deviceName string, sample, heartbeat int64, args ...string) error {
sbi := &nucleus.OpenConfig{}
tOpts := &tpb.TransportOption{
Addr: address,
Address: address,
Username: username,
Password: password,
Tls: false,
......
package gosdn
import (
spb "code.fbi.h-da.de/cocsn/api/go/gosdn/southbound"
"context"
"net"
"net/http"
......
......@@ -288,7 +288,11 @@ func handleSetSbi(pnd nucleus.PrincipalNetworkDomain, req []*ppb.SetSbi) (*ppb.S
}
func handleSetChange(pnd nucleus.PrincipalNetworkDomain, req []*ppb.SetChange) (*ppb.SetResponse, error) {
<<<<<<< HEAD
for _, r := range req {
=======
for _,r := range req {
>>>>>>> 4a937a94 (nbi implementation done)
cuid, err := uuid.Parse(r.Cuid)
if err != nil {
return nil, err
......@@ -316,7 +320,11 @@ func handleSetChange(pnd nucleus.PrincipalNetworkDomain, req []*ppb.SetChange) (
}
func handleChangeRequest(pnd nucleus.PrincipalNetworkDomain, req []*ppb.ChangeRequest) (*ppb.SetResponse, error) {
<<<<<<< HEAD
for _, r := range req {
=======
for _,r := range req {
>>>>>>> 4a937a94 (nbi implementation done)
did, err := uuid.Parse(r.Id)
if err != nil {
return nil, err
......
package nucleus
import (
ppb "code.fbi.h-da.de/cocsn/api/go/gosdn/pnd"
"errors"
"os"
"sync"
......
package nucleus
import (
ppb "code.fbi.h-da.de/cocsn/api/go/gosdn/pnd"
"context"
"reflect"
......
package nucleus
import (
tpb "code.fbi.h-da.de/cocsn/api/go/gosdn/transport"
"context"
"errors"
"reflect"
......@@ -10,6 +9,9 @@ import (
spb "code.fbi.h-da.de/cocsn/api/go/gosdn/southbound"
tpb "code.fbi.h-da.de/cocsn/api/go/gosdn/transport"
spb "code.fbi.h-da.de/cocsn/api/go/gosdn/southbound"
tpb "code.fbi.h-da.de/cocsn/api/go/gosdn/transport"
"code.fbi.h-da.de/cocsn/gosdn/forks/goarista/gnmi"
"code.fbi.h-da.de/cocsn/gosdn/mocks"
"code.fbi.h-da.de/cocsn/yang-models/generated/openconfig"
......@@ -483,8 +485,6 @@ func TestNewGnmiTransport(t *testing.T) {
Compression: "brotli",
},
}}},
<<<<<<< HEAD
=======
want: nil,
wantErr: true,
},
......@@ -495,7 +495,7 @@ func TestNewGnmiTransport(t *testing.T) {
TransportOption: &tpb.TransportOption_GnmiTransportOption{
GnmiTransportOption: &tpb.GnmiTransportOption{
GrpcDialOptions: map[string]string{
"cert-file":"invalid",
"cert-file": "invalid",
},
},
}}},
......@@ -503,17 +503,16 @@ func TestNewGnmiTransport(t *testing.T) {
wantErr: true,
},
{
name: "certificate error no ca file",
args: args{
name: "certificate error no ca file",
args: args{
opts: &tpb.TransportOption{
TransportOption: &tpb.TransportOption_GnmiTransportOption{
GnmiTransportOption: &tpb.GnmiTransportOption{
GrpcDialOptions: map[string]string{
"ca-file":"invalid",
"ca-file": "invalid",
},
},
}}},
>>>>>>> 55fb68b4 (moved transport options to proto)
want: nil,
wantErr: true,
},
......@@ -523,11 +522,8 @@ func TestNewGnmiTransport(t *testing.T) {
if tt.name == "default" {
startGnmiTarget <- gnmiConfig.Addr
}
<<<<<<< HEAD
got, err := NewGnmiTransport(tt.args.opts, NewSBI(spb.Type_OPENCONFIG))
=======
got, err := NewGnmiTransport(tt.args.opts, &OpenConfig{})
>>>>>>> 55fb68b4 (moved transport options to proto)
if (err != nil) != tt.wantErr {
t.Errorf("NewGnmiTransport() error = %v, wantErr %v", err, tt.wantErr)
return
......
package nucleus
import (
<<<<<<< HEAD
"context"
tpb "code.fbi.h-da.de/cocsn/api/go/gosdn/transport"
"code.fbi.h-da.de/cocsn/gosdn/nucleus/errors"
=======
tpb "code.fbi.h-da.de/cocsn/api/go/gosdn/transport"
"code.fbi.h-da.de/cocsn/gosdn/nucleus/errors"
"context"
>>>>>>> 55fb68b4 (moved transport options to proto)
"github.com/openconfig/ygot/ytypes"
)
......@@ -28,15 +22,12 @@ type Transport interface {
// NewTransport receives TransportOptions and returns an appropriate Transport
// implementation
func NewTransport(opts *tpb.TransportOption, sbi SouthboundInterface) (Transport, error) {
<<<<<<< HEAD
if opts == nil {
return nil, &errors.ErrInvalidParameters{
Func: NewTransport,
Param: "'opt' cannot be 'nil'",
}
}
=======
>>>>>>> 55fb68b4 (moved transport options to proto)
switch o := opts.TransportOption.(type) {
case *tpb.TransportOption_GnmiTransportOption:
return NewGnmiTransport(opts, sbi)
......
package integration
import (
tpb "code.fbi.h-da.de/cocsn/api/go/gosdn/transport"
"os"
"testing"
......
package integration
import (
spb "code.fbi.h-da.de/cocsn/api/go/gosdn/southbound"
tpb "code.fbi.h-da.de/cocsn/api/go/gosdn/transport"
"context"
"reflect"
"sort"
......@@ -226,7 +228,11 @@ func TestGnmi_SubscribeIntegration(t *testing.T) {
name: "destination unreachable",
fields: fields{
opt: &tpb.TransportOption{
<<<<<<< HEAD
Address: "203.0.113.10:6030",
=======
Address: "203.0.113.10:6030",
>>>>>>> 4a937a94 (nbi implementation done)
},
},
args: args{
......@@ -303,7 +309,11 @@ func TestGnmi_CapabilitiesIntegration(t *testing.T) {
{
name: "destination unreachable",
fields: fields{opt: &tpb.TransportOption{
<<<<<<< HEAD
Address: "203.0.113.10:6030",
=======
Address: "203.0.113.10:6030",
>>>>>>> 4a937a94 (nbi implementation done)
},
},
args: args{ctx: context.Background()},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment