Documentation
¶
Index ¶
- func CreateRouterMap(cfg *utils.Config) utils.RouterMap
- func Get(name string) utils.Router
- type Yaml
- func (rt *Yaml) BGPASPath(cfg *utils.RouterConfig, aspath string) ([]string, error)
- func (rt *Yaml) BGPCommunity(cfg *utils.RouterConfig, community string) ([]string, error)
- func (rt *Yaml) BGPRoute(cfg *utils.RouterConfig, ip *utils.IPNet) ([]string, error)
- func (rt *Yaml) Ping(cfg *utils.RouterConfig, ip *utils.IPNet) ([]string, error)
- func (rt *Yaml) Traceroute(cfg *utils.RouterConfig, ip *utils.IPNet) ([]string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Yaml ¶
type Yaml struct {
Path string // Path represents the file path.
Template struct {
Name string `yaml:"name"` // Name represents the template name.
Ping struct {
Any []string `yaml:"any"` // Any represents the list of ping targets for any IP address.
IPv4 []string `yaml:"ipv4"` // IPv4 represents the list of ping targets for IPv4 addresses.
IPv6 []string `yaml:"ipv6"` // IPv6 represents the list of ping targets for IPv6 addresses.
} `yaml:"ping"` // Ping represents the ping section in the template.
Traceroute struct {
Any []string `yaml:"any"` // Any represents the list of traceroute targets for any IP address.
IPv4 []string `yaml:"ipv4"` // IPv4 represents the list of traceroute targets for IPv4 addresses.
IPv6 []string `yaml:"ipv6"` // IPv6 represents the list of traceroute targets for IPv6 addresses.
} `yaml:"traceroute"` // Traceroute represents the traceroute section in the template.
BGP struct {
Route []string `yaml:"route"` // Route represents the list of BGP routes.
Community []string `yaml:"community"` // Community represents the list of BGP communities.
ASPath []string `yaml:"aspath"` // ASPath represents the list of BGP AS paths.
} `yaml:"bgp"` // BGP represents the BGP section in the template.
}
}
Yaml represents the structure of a YAML file.
func (*Yaml) BGPASPath ¶
BGPASPath returns a slice of strings representing the BGP AS path for the given router configuration and AS path string. It uses the "_tpl" method to render the "bgp.aspath" template with the provided configuration and AS path.
func (*Yaml) BGPCommunity ¶
BGPCommunity returns a list of strings representing the BGP community values for the given router configuration and community.
func (*Yaml) BGPRoute ¶
BGPRoute generates BGP route configuration based on the provided RouterConfig and IPNet. It returns a slice of strings representing the generated configuration and an error if any.
func (*Yaml) Ping ¶
Ping sends a ping request to the specified IP address using the provided router configuration. It returns a slice of strings representing the ping response and an error if any.
func (*Yaml) Traceroute ¶
Traceroute performs a traceroute operation using the provided router configuration and IP address. It returns a slice of strings representing the traceroute results and an error if any.