package main

import (
	"fmt"
	"strconv"
)

// 假设的 VXLAN 信息结构体
type VXLANInfo struct {
	VxLANPortName string
	VID           uint32
	GroupIp       string
	LocalIp       string
}

// 假设的全局配置结构体
type SysBasicConf struct {
	BusinessOvsName string
}

var Global = SysBasicConf{
	BusinessOvsName: "eth0", // 示例值，根据实际情况修改
}

func main() {
	// 示例 VXLAN 信息
	vxLANInfo := VXLANInfo{
		VxLANPortName: "vxlan0",
		VID:           1000,
		GroupIp:       "239.1.1.1",
		LocalIp:       "192.168.1.1",
	}

	// 构建命令参数
	commandArg := []string{}
	commandArg = append(commandArg, "ip")
	commandArg = append(commandArg, "link")
	commandArg = append(commandArg, "add")
	commandArg = append(commandArg, vxLANInfo.VxLANPortName)
	commandArg = append(commandArg, "type")
	commandArg = append(commandArg, "vxlan")
	commandArg = append(commandArg, "id")
	commandArg = append(commandArg, strconv.Itoa(int(vxLANInfo.VID)))
	commandArg = append(commandArg, "group")
	commandArg = append(commandArg, vxLANInfo.GroupIp)
	commandArg = append(commandArg, "local")
	commandArg = append(commandArg, vxLANInfo.LocalIp)
	commandArg = append(commandArg, "dstport")
	commandArg = append(commandArg, "4789")
	commandArg = append(commandArg, "dev")
	commandArg = append(commandArg, Global.BusinessOvsName)

	fmt.Println("commandArg:", commandArg)
}
