Skip to content
Snippets Groups Projects
Commit 67db13a2 authored by S.H.'s avatar S.H.
Browse files

add test case for getting network elements to test-config

parent 7eb3664a
Branches
No related tags found
No related merge requests found
Pipeline #263809 failed
...@@ -7,10 +7,12 @@ import ( ...@@ -7,10 +7,12 @@ import (
"os" "os"
"time" "time"
"code.fbi.h-da.de/danet/gosdn/api/go/gosdn/networkelement"
"code.fbi.h-da.de/danet/gosdn/api/go/gosdn/pnd" "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/pnd"
"code.fbi.h-da.de/danet/gosdn/applications/rtdt-manager/gosdnutil" "code.fbi.h-da.de/danet/gosdn/applications/rtdt-manager/gosdnutil"
rtdt_auth "code.fbi.h-da.de/danet/gosdn/applications/rtdt-manager/rtdt-auth" rtdt_auth "code.fbi.h-da.de/danet/gosdn/applications/rtdt-manager/rtdt-auth"
"code.fbi.h-da.de/danet/gosdn/applications/rtdt-manager/sdnconfig" "code.fbi.h-da.de/danet/gosdn/applications/rtdt-manager/sdnconfig"
"code.fbi.h-da.de/danet/gosdn/applications/rtdt-manager/util"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/credentials/insecure"
) )
...@@ -39,6 +41,26 @@ func SetupGosdnConn() (*pnd.PrincipalNetworkDomain, *rtdt_auth.RtdtAuth) { ...@@ -39,6 +41,26 @@ func SetupGosdnConn() (*pnd.PrincipalNetworkDomain, *rtdt_auth.RtdtAuth) {
} }
func GetMne(name string) {
gosdn_pnd, testauth := SetupGosdnConn()
if gosdn_pnd == nil || testauth == nil {
fmt.Println("ERROR: couldn't establish connection to gosdn")
}
getAllReq := &networkelement.GetAllRequest{
Timestamp: util.Now(),
Pid: gosdn_pnd.GetId(),
}
mneServiceClient := networkelement.NewNetworkElementServiceClient(testauth.GetConn())
response, err := mneServiceClient.GetAll(testauth.CreateContextWithAuthorization(), getAllReq)
if err != nil {
fmt.Printf("Bad thing happened. Bad thing: %v\n", err)
return
}
for i, mne := range response.GetMne() {
fmt.Printf("Mne model %d: %s\n", i, mne.String())
}
}
func Download() { func Download() {
gosdn_pnd, testauth := SetupGosdnConn() gosdn_pnd, testauth := SetupGosdnConn()
if gosdn_pnd == nil || testauth == nil { if gosdn_pnd == nil || testauth == nil {
...@@ -93,6 +115,9 @@ func main() { ...@@ -93,6 +115,9 @@ func main() {
fmt.Println("Mode: Upload") fmt.Println("Mode: Upload")
Upload(sdnConfigPath) Upload(sdnConfigPath)
return return
case "get":
fmt.Println("Mode: Get")
GetMne("gnmi-target-switch0")
default: default:
fmt.Println("Unknown Mode!") fmt.Println("Unknown Mode!")
return return
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment