<
[email protected]> | ENOG#49@嵐渓荘 2018/02/23 54 4. Add SRv6 CLI format and functions > zebra/rib/api.go func InitAPI() { Parser = cmd.NewParser() Parser.InstallCmd([]string{"routing-options", "ipv6", "route-srv6", "X:X::X:X/M", "nexthop", "X:X::X:X", "seg6", "WORD", "segments", "X:X::X:X", "&"}, IPv6RouteSeg6SegmentsApi) Parser.InstallCmd([]string{"routing-options", "ipv6", "localsid", "X:X::X:X/M", "nexthop", "X:X::X:X", "action", "End"}, Seg6LocalEndApi) Parser.InstallCmd([]string{"routing-options", "ipv6", "localsid", "X:X::X:X/M", "nexthop", "X:X::X:X", "action", "End.X", "nh6", "X:X::X:X"}, Seg6LocalEndXApi) ... 1. Add “Parser.InstallCmd([]string{...}, <function>)” per command 2. Add “<function>” which will be called when command was entered via CLI func Seg6LocalEndXApi(Cmd int, Args cmd.Args) int { prefix := Args[0].(*netutil.Prefix) nexthop := Args[1].(net.IP) nh6 := Args[2].(net.IP) ... if Cmd == cmd.Set { server.StaticSeg6LocalAdd(prefix, nexthop, seg6local) } else { server.StaticSeg6LocalDelete(prefix, nexthop) } 1 2