func cmdShowRipRoutes(ctx command.ConfContext, node *command.CmdNode, line string, c command.CmdClient) { rip := ctx.(*Rip) if rip.router == nil { c.Sendln("RIP not running") return } rip.router.ShowRoutes(c) }
func ripCtx(ctx command.ConfContext, c command.CmdClient) *Rip { if rip, ok := ctx.(*Rip); ok { return rip } // non-rip context is a bogus state used for unit testing err := fmt.Errorf("ripCtx: not a true Rip context: %v", ctx) log.Printf("%v", err) c.Sendln(fmt.Sprintf("%v", err)) return nil }
func bgpCtx(ctx command.ConfContext, c command.CmdClient) *Bgp { if bgp, ok := ctx.(*Bgp); ok { return bgp } // non-bgp context is a bogus state used for unit testing err := fmt.Errorf("bgpCtx: not a true Bgp context: %v", ctx) log.Printf("%v", err) c.Sendln(fmt.Sprintf("%v", err)) return nil }