Example #1
0
File: rip.go Project: udhos/nexthop
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)
}
Example #2
0
File: rip.go Project: udhos/nexthop
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
}
Example #3
0
File: bgp.go Project: udhos/nexthop
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
}