Add -vppcfg flag to set ifAlias from the 'description' fields in vppcfg.yaml

This commit is contained in:
Pim van Pelt
2025-06-09 19:12:05 +02:00
parent 069b1b6fc2
commit 458168e308
6 changed files with 136 additions and 2 deletions

View File

@ -16,6 +16,7 @@ import (
func main() {
addr := flag.String("agentx-addr", "localhost:705", "Address to connect to (hostname:port or Unix socket path)")
debug := flag.Bool("debug", false, "Enable debug logging")
vppcfg := flag.String("vppcfg", "", "VPP configuration YAML file to read interface descriptions from")
flag.Parse()
// Set global debug flag
@ -40,6 +41,13 @@ func main() {
// Create the interface MIB
interfaceMIB := ifmib.NewInterfaceMIB()
// Load VPP config if specified
if *vppcfg != "" {
if err := interfaceMIB.LoadVPPConfig(*vppcfg); err != nil {
log.Fatalf("Failed to load VPP config: %v", err)
}
}
// Register the interface MIB with the AgentX client
if err := interfaceMIB.RegisterWithClient(client); err != nil {
log.Fatalf("Failed to register interface MIB: %v", err)