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

Fix topology by adding a name to the link

parent 722c252a
No related branches found
No related tags found
No related merge requests found
......@@ -62,6 +62,11 @@ func main() {
fmt.Printf("Error occured while trying to construct topology in realnet: %v\n", err)
return
}
err = realnet.CreateDevices()
if err != nil {
fmt.Printf("Error: Couldn't create devices!")
return
}
err = realnet.UploadTopology()
if err != nil {
fmt.Printf("Error occured while trying to upload realnet topology to DB: %v\n", err)
......
......@@ -260,16 +260,20 @@ func (v *VEnv) DeriveTopologyFromClabData() error {
}
return nil
}
func (v *VEnv) UploadTopology() error {
conn := v.auth.GetConn()
topoService := topoPb.NewTopologyServiceClient(conn)
for _, link := range v.topology.Links {
ctx := v.auth.CreateContextWithAuthorization()
l := link.Convert()
l.Name = l.SourceNode.Name + ":" + l.TargetNode.Name
l.SourcePort.Configuration = &topoPb.Configuration{Ip: "192.168.178.2", PrefixLength: 24}
l.TargetPort.Configuration = &topoPb.Configuration{Ip: "192.168.178.3", PrefixLength: 24}
addLinkRequest := &topoPb.AddLinkRequest{
Timestamp: util.Now(),
Link: link.Convert(),
Link: l,
}
fmt.Println("AddLink is:", addLinkRequest.String())
topoResponse, err := topoService.AddLink(ctx, addLinkRequest)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment