package routers import ( "fmt" Ipam "utils/ipam" ) func RunRouters(ipam *Ipam.Ipam) error { routers := ipam.Routers fmt.Printf("digraph {\n") //fmt.Printf(" layout=dot\n") //fmt.Printf(" layout=twopi\n") fmt.Printf(" layout=fdp\n") //fmt.Printf(" layout=circo\n") //fmt.Printf(" layout=neato\n") //fmt.Printf(" ranksep=3\n") //fmt.Printf(" ratio=auto\n") //fmt.Printf(" rankdir=LR\n") //fmt.Printf(" rankdir=RL\n") fmt.Printf(" rankdir=TB\n") //fmt.Printf(" sep=3\n") //fmt.Printf(" overlap_scaling=-10\n") fmt.Printf("node [len=10];") fmt.Printf("node [shape=box];") fmt.Printf("overlap=false") fmt.Printf("\n") fmt.Printf(" # Nodes\n") for _, r := range routers { fmt.Printf(" %s [ label = \"%s\"];\n", r.Name, r.Name) } fmt.Printf("\n") fmt.Printf(" # Connections\n") for _, n := range routers { fmt.Printf(" %s [ root = true ];\n", n.Name) } fmt.Printf("\n") fmt.Printf(" # Peers\n") for _, r := range routers { for _, p := range r.Peers { fmt.Printf(" %s -> %s", r.Name, p.Name) fmt.Printf(";\n") } } fmt.Printf("}\n") return nil }