structs

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 1, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigConflict               string = "配置冲突"
	MissRoute                    string = "路由缺失"
	SimylationVerificationFailed string = "仿真验证失败"
	PolicyDeny                   string = "Deny策略"
	RouteLoop                    string = "路由环路"
	RouteQuery                   string = "路由查询失败"
	SrcNodePoositionErr          string = "源节点定位失败"
	NextHop_Empty                string = "下一跳路由为空"
	Not_Support_Multi_Route      string = "不支持多路由"
)
View Source
const (
	ResultTypeTable   = ResultType("Table")
	ResultTypeString  = ResultType("String")
	ResultTypeMap     = ResultType("Map")
	ResultTypeJSON    = ResultType("Json")
	ResultTypeListMap = ResultType("ListMap")
)
View Source
const (
	JSON       = ExpectedType("JSON")
	SNMPList   = ExpectedType("SNMPList")
	SNMPSingle = ExpectedType("SNMPSingle")
)
View Source
const (
	SNMP   = CollectMethod("SNMP")
	SSH    = CollectMethod("SSH")
	TELNET = CollectMethod("TELNET")
	API    = CollectMethod("API")
)
View Source
const (
	SSHServer        = SSHMode("SSHServer")
	SSHNetworkDevice = SSHMode("SSHNetworkDevice")
)
View Source
const (
	Src  = MatchType("src")
	Dst  = MatchType("dst")
	Both = MatchType("both")

	Tcp  = Protocol("tcp")
	Udp  = Protocol("udp")
	Icmp = Protocol("icmp")

	Permit         = Action("permit")
	Deny           = Action("deny")
	Reject         = Action("reject")
	ImplicitPermit = Action("implicit_permit")
	ImplicitDeny   = Action("implicit_deny")
	NatMatched     = Action("nat_matched")
	NatNoMatched   = Action("nat_nomatched")

	Overlap          = MatchStrategy("overlap")
	Contains         = MatchStrategy("contains")
	ContainedBy      = MatchStrategy("containedby")
	Exact            = MatchStrategy("exact")
	Threshold        = MatchStrategy("threshold")
	OverlapIgnoreAny = MatchStrategy("overlapignoreany")
	IsolatedInQuery  = MatchStrategy("isolatedinquery") // 孤立地址在查询范围内
)
View Source
const (
	SYSTEM_NAME       = "SYSTEM_NAME"
	IFTABLE           = "IFTABLE"
	DOT1DPORTS        = "DOT1DPORTS"
	PORTIP            = "PORTIP"
	VLAN              = "VLAN"
	STP               = "STP"
	MACTABLE          = "MACTABLE"
	ARP               = "ARP"
	NEIGHBOR_CDP      = "NEIGHBOR_CDP"
	NEIGHBOR_CDP2     = "NEIGHBOR_CDP2"
	NEIGHBOR          = "NEIGHBOR"
	NEIGHBOR_LLDP     = "NEIGHBOR_LLDP"
	OTHER             = "OTHER"
	YAML_ARP          = "YAML_ARP"
	PORT_STATISTICS   = "PORT_STATISTICS"
	PORT_CHANNEL      = "PORT_CHANNEL"
	PORT_INFO         = "PORT_INFO"
	IPV6_NEIGHBOR     = "IPV6_NEIGHBOR"
	SH_RUN            = "SH_RUN"
	MAKE_L3_TEMPLATES = "MAKE_L3_TEMPLATES"
	L3_NODEMAP_QUERY  = "L3_NODEMAP_QUERY"

	VMWARE_RESOURCES          = "VMWARE_RESOURCES"
	VMWARE_VM                 = "VMWARE_VM"
	VMWARE_TEMPLATE           = "VMWARE_TEMPLATE"
	VMWARE_DATASTORE          = "VMWARE_DATASTORE"
	VMWARE_INFO               = "VMWARE_INFO"
	VMWARE_INTERFACES         = "VMWARE_INTERFACES"
	VMWARE_HOST               = "VMWARE_HOST"
	VMWARE_CLUSTER            = "VMWARE_CLUSTER"
	VMHOST_BASE_VALUE         = "VMHOST_BASE_VALUE"
	VMWARE_IPDATA             = "VMWARE_IPDATA"
	LINUX_IFCONFIG_INTERFACES = "LINUX_IFCONFIG_INTERFACES"
	LINUX_BATCH_CMD           = "LINUX_BATCH_CMD"
	LINUX_STEP_CMD            = "LINUX_STEP_CMD"
	LINUX_STEP_WITH_COMMAND   = "LINUX_STEP_WITH_COMMAND"
	LINUX_STACKUP_CMD         = "LINUX_STACKUP_CMD"
	LINUX_INTERACTIVE_CMD     = "LINUX_INTERACTIVE_CMD"
	VZENTRY                   = "VZENTRY"

	SDN_FABRIC      = "SDN_FABRIC"
	SDN_VPC         = "SDN_VPC"
	SDN_LOGICROUTER = "SDN_LOGICROUTER"
	SDN_LOGICSWITCH = "SDN_LOGICSWITCH"
	SDN_LOGICPORT   = "SDN_LOGICPORT"
	SDN_DEVICE      = "SDN_DEVICE"
	SDN_DEVICEPORT  = "SDN_DEVICEPORT"
	SDN_SUBNET      = "SDN_SUBNET"
	SDN_CREATEPORT  = "SDN_CREATEPORT"
	SDN_DELETEPORT  = "SDN_DELETEPORT"

	SDN_GET             = "SDN_GET"
	SDN_FABRICAPATHEP   = "SDN_FABRICAPATHEP"
	SDN_FABRICINST      = "SDN_FABRICINST"
	SDN_EPTRACKER       = "SDN_EPTRACKER"
	SDN_VZBRCP          = "SDN_VZBRCP"
	SDN_FABRICPATHEP    = "SDN_FABRICPATHEP"
	SDN_CONTROLLER      = "SDN_CONTROLLER"
	SDN_CONTROLLERSSIZE = "SDN_CONTROLLERSSIZE"
	SDN_FVAP            = "SDN_FVAP"
	SDN_FVSUBNET        = "SDN_FVSUBNET"
	SDN_FORTIPOLICY     = "SDN_FORTIPOLICY"
	SDN_FORTISUBNET     = "SDN_FORTISUBNET"
	SDN_FORTISERVICE    = "SDN_FORTISERVICE"
	SDN_FIRMWARE        = "SDN_FIRMWARE"
	SDN_VZFILTER        = "SDN_VZFILTER"
	SDN_VZENTRY         = "SDN_VZENTRY"
	SDN_CONTRACT        = "SDN_CONTRACT"
	SDN_INFRA           = "SDN_INFRA"
	SDN_FABRIC2         = "SDN_FABRIC2"

	CHECKDEVICE = "CHECKDEVICE"

	REDFISH_CPU                = "REDFISH_CPU"
	REDFISH_MEM                = "REDFISH_MEM"
	REDFISH_DISK               = "REDFISH_DISK"
	REDFISH_VERSION            = "REDFISH_VERSION"
	REDFISH_NETWORKINTERFACE   = "REDFISH_NETWORKINTERFACE"
	REDFISH_BMC                = "REDFISH_BMC"
	REDFISH_BASEINFO           = "REDFISH_BASEINFO"
	REDFISH_NETWORK            = "REDFISH_NETWORK"
	REDFISH_POWER              = "REDFISH_POWER"
	OOB_GPU                    = "OOB_GPU"
	SWITCH_CONFIG              = "SWITCH_CONFIG"
	ASA_CONFIG                 = "ASA_CONFIG"
	F5_CONFIG                  = "F5_CONFIG"
	FORTI_CONFIG               = "FORTI_CONFIG"
	SECPATH_CONFIG             = "SECPATH_CONFIG"
	SANGFOROS_CONFIG           = "SANGFOROS_CONFIG"
	USG_CONFIG                 = "USG_CONFIG"
	DPTECH_CONFIG              = "DPTECH_CONFIG"
	SWITCH_CONFIG_WITH_COMMAND = "SWITCH_CONFIG_WITH_COMMAND"
	SWITCH_EXEC                = "SWITCH_EXEC"
	SWITCH_IMPORT              = "SWITCH_IMPORT"
	SWITCH_VERSION             = "SWITCH_VERSION"
	SWITCH_SNMP_VERSION        = "SWITCH_SNMP_VERSION"
	SWITCH_EXEC_TIMEOUT        = "SWITCH_EXEC_TIMEOUT"
	SWITCH_REBOOT              = "SWITCH_REBOOT"
	SWITCH_PATCH_VERSION       = "SWITCH_PATCH_VERSION"
	SWITCH_DIR                 = "SWITCH_DIR"
	SWITCH_STATUS              = "SWITCH_STATUS"
	SWITCH_INSTALL             = "SWITCH_INSTALL"
	SWITCH_INSTALL_HOTFIX      = "SWITCH_INSTALL_HOTFIX"
	SWITCH_BOOT                = "SWITCH_BOOT"
	SWITCH_IMPACT              = "SWITCH_IMPACT"
	SWITCH_EXEC_MAP            = "SWITCH_EXEC_MAP"
	SWITCH_CONFIG_TERMINAL     = "SWITCH_CONFIG_TERMINAL"
	SWITCH_EXEC_TERMINAL       = "SWITCH_EXEC_TERMINAL"
	ORCH_PUSH                  = "ORCH_PUSH"

	SUP_PIPE_FILE   = "SUP_PIPE_FILE"
	SUP_REMOTE_LIST = "SUP_REMOTE_LIST"
	// SUP_REMOTE_CONFIG  = "SUP_REMOTE_CONFIG"
	SUP_REMOTE_NAME    = "SUP_REMOTE_NAME"
	STREAM_INTERACTIVE = "STREAM_INTERACTIVE"
	STREAM_PECO        = "STREAM_PECO"
	// IB网络相关
	IB_NET_COMMAND = "IB_NET_COMMAND"
)

Variables

This section is empty.

Functions

func NewValidator

func NewValidator() *normalValidator

func ToDeviceIDList

func ToDeviceIDList(devList []DeviceWithPlatform2) []string

Types

type APIOptions

type APIOptions struct {
	Method      string            `yaml:"method"`      // HTTP 方法:GET, POST, PUT, DELETE 等
	URL         string            `yaml:"url"`         // API 端点 URL
	Headers     map[string]string `yaml:"headers"`     // 自定义 HTTP 头
	QueryParams map[string]string `yaml:"queryParams"` // URL 查询参数
	Body        []byte            `yaml:"body"`        // 请求体
	Timeout     time.Duration     `yaml:"timeout"`     // 请求超时时间

	// 认证选项
	AuthType string `yaml:"authType"` // 认证类型:Basic, Bearer, Custom
	Username string `yaml:"username"` // 用于 Basic 认证
	Password string `yaml:"password"` // 用于 Basic 认证
	Token    string `yaml:"token"`    // 用于 Bearer Token 认证

	// TLS/SSL 选项
	InsecureSkipVerify bool   `yaml:"insecureSkipVerify"` // 是否跳过 SSL 证书验证
	CertFile           string `yaml:"certFile"`           // 客户端证书文件路径
	KeyFile            string `yaml:"keyFile"`            // 客户端密钥文件路径
	CAFile             string `yaml:"caFile"`             // CA 证书文件路径

	// 重试选项
	MaxRetries int           `yaml:"maxRetries"` // 最大重试次数
	RetryDelay time.Duration `yaml:"retryDelay"` // 重试间隔

	// 代理设置
	ProxyURL string `yaml:"proxyURL"` // 代理服务器 URL

	// 响应处理选项
	ExpectedStatusCodes []int  `yaml:"expectedStatusCodes"` // 预期的 HTTP 状态码
	ResponseFormat      string `yaml:"responseFormat"`      // 期望的响应格式:JSON, XML, Text 等

	// 调试选项
	Debug bool `yaml:"debug"` // 是否启用调试模式
}

type AbbrDeviceInterface

type AbbrDeviceInterface interface {
	ParsePlatform(interface{}) (string, error)
	ParseMeta(interface{}) (*L2DeviceMeta, error)
	ParseCatalog(interface{}) (string, error)
	ParseSite(interface{}) (string, error)
	ParseEnv(interface{}) (string, error)
	ParseRemoteInfo(interface{}, string, string) (*L2DeviceRemoteInfo, error)
}

type Action

type Action string

type AliveCheckConfig

type AliveCheckConfig struct {
	AliveCheckItem *AliveCheckItem `yaml:"aliveCheckItem"`
}

func (*AliveCheckConfig) GetInputFields

func (acc *AliveCheckConfig) GetInputFields() []Field

func (*AliveCheckConfig) GetOutputFields

func (acc *AliveCheckConfig) GetOutputFields() []Field

type AliveCheckItem

type AliveCheckItem struct {
	Name    string             `yaml:"name"`
	Method  CollectMethod      `yaml:"method"`   // "SNMP", "SSH", "TELNET", "API", etc.
	Type    DataType           `yaml:"dataType"` // "string", "integer", "float", "boolean", "json", etc.
	Target  string             `yaml:"target"`   // OID for SNMP, command for SSH, endpoint for API
	Options CollectItemOptions `yaml:"options"`  // Additional options specific to the method
}

type AnsibleHost

type AnsibleHost struct {
	Host  string         `json:"host"`
	Tasks []*AnsibleTask `json:"tasks"`
}

type AnsibleTask

type AnsibleTask struct {
	Task   string `json:"task"`
	Msg    string `json:"msg"`
	Stdout string `json:"stdout"`
	StdErr string `json:"std_err"`
	Failed bool   `json:"failed"`
}

type AnsibleTaskResult

type AnsibleTaskResult struct {
	Hosts []*AnsibleHost `json:"hosts"`
	// Tasks []*AnsibleTask
	Stats map[string]*AnsibleTaskStatus `json:"stats"`
	Start string                        `json:"start"`
	End   string                        `json:"end"`
}

type AnsibleTaskStatus

type AnsibleTaskStatus struct {
	Changed     int `json:"changed"`
	Failures    int `json:"failures"`
	Ignored     int `json:"ignored"`
	Ok          int `json:"ok"`
	Rescued     int `json:"rescued"`
	Skipped     int `json:"skipped"`
	Unreachable int `json:"unreachable"`
}

type Args

type Args struct {
	ServiceType string `log:"service_type"`
	Uuid        string
	Id          uint
	Ip          string `log:"ip"`
	Platform    string `log:"platform"`
	IsRedfish   bool
	Remote      *L2DeviceRemoteInfo `log:"remote"`
	Meta        *L2DeviceMeta       `log:"-"`
	DevType     string
	Options     []interface{} `log:"-"`
	DeviceConfig
}

func (*Args) ActionID

func (a *Args) ActionID() action_id.ActionID

func (*Args) Env

func (a *Args) Env() string

func (*Args) KeyMap

func (a *Args) KeyMap() (m map[string]string)

func (*Args) Site

func (a *Args) Site() string

type BaseDevice

type BaseDevice struct {
	AbbrDeviceInterface
	// contains filtered or unexported fields
}

func (*BaseDevice) ParseCatalog

func (b *BaseDevice) ParseCatalog(data interface{}) (string, error)

func (*BaseDevice) ParseMeta

func (b *BaseDevice) ParseMeta(data interface{}) (*L2DeviceMeta, error)

func (*BaseDevice) ParsePlatform

func (b *BaseDevice) ParsePlatform(data interface{}) (string, error)

func (*BaseDevice) ParseRemoteInfo

func (b *BaseDevice) ParseRemoteInfo(data interface{}, secretRole, snmpRole string) (*L2DeviceRemoteInfo, error)

func (*BaseDevice) WithParseCatalog

func (b *BaseDevice) WithParseCatalog(f func(interface{}) (string, error))

func (*BaseDevice) WithParseEnv

func (b *BaseDevice) WithParseEnv(f func(interface{}) (string, error))

func (*BaseDevice) WithParseMeta

func (b *BaseDevice) WithParseMeta(f func(interface{}) (*L2DeviceMeta, error))

func (*BaseDevice) WithParsePlatform

func (b *BaseDevice) WithParsePlatform(f func(interface{}) (string, error))

func (*BaseDevice) WithParseSite

func (b *BaseDevice) WithParseSite(f func(interface{}) (string, error))

func (*BaseDevice) WithRemoteInfo

func (b *BaseDevice) WithRemoteInfo(f func(interface{}, string, string) (*L2DeviceRemoteInfo, error))

type ClusterInfo

type ClusterInfo struct {
	Cluster      Self
	Name         string
	Parent       Self
	ResourcePool Self
	Hosts        []types.ManagedObjectReference
	Datastore    []types.ManagedObjectReference
}

type CmdInteraction

type CmdInteraction struct {
	Name            string        `json:"name"`              // 命令名
	Cmd             string        `json:"cmd"`               // 输入的命令
	Prompt          string        `json:"prompt"`            // 正则匹配的提示
	TimeOut         int           `json:"time_out"`          // 超时
	MultipleCmdList []MultipleCmd `json:"multiple_cmd_list"` // 多次回调命令
}

type CollectConfig

type CollectConfig struct {
	CollectItems []CollectItem `yaml:"collectItems"`
}

func (*CollectConfig) GetInputFields

func (cc *CollectConfig) GetInputFields() []Field

func (*CollectConfig) GetOutputFields

func (cc *CollectConfig) GetOutputFields() []Field

type CollectContext

type CollectContext struct {
	Item   CollectItem
	Config *CollectConfig
}

type CollectItem

type CollectItem struct {
	Name                 string             `yaml:"name"`
	Method               CollectMethod      `yaml:"method"` // "SNMP", "SSH", "TELNET", "API", etc.
	Target               string             `yaml:"target"` // OID for SNMP, command for SSH, endpoint for API
	LoginTimeout         int                `yaml:"loginTimeout"`
	NoOutputTimeout      int                `yaml:"noOutputTimeout"`
	ExpectedType         ExpectedType       `yaml:"expectedType"` // "String", "SNMPList", "SNMPSingle", "JSON"
	Options              CollectItemOptions `yaml:"options"`      // Additional options specific to the method
	ModeConfig           ModeConfig         `yaml:"modeConfig"`
	HubConfig            HubConfig          `yaml:"hubConfig"`
	ModeConfigFile       string             `yaml:"modeConfigFile,omitempty"`
	ConnectionOptionName string             `yaml:"connectionOptionName,omitempty"`
	HubConfigFile        string             `yaml:"hubConfigFile,omitempty"`
	Type                 DataType           `yaml:"dataType"` // "string", "integer", "float", "boolean", "json", etc.
}

type CollectItemOptions

type CollectItemOptions struct {
	SNMPOptions   *SNMPOptions   `yaml:"snmpOptions,omitempty"`
	SSHOptions    *SSHOptions    `yaml:"sshOptions,omitempty"`
	APIOptions    *APIOptions    `yaml:"apiOptions,omitempty"`
	TelnetOptions *TelnetOptions `yaml:"telnetOptions,omitempty"`
}

type CollectMethod

type CollectMethod string

type Condition

type Condition struct {
	IpRanges      string        `json:"ip_ranges"`
	Protocol      Protocol      `json:"protocol"`
	Port          string        `json:"port"`
	Action        Action        `json:"action"`
	MatchStrategy MatchStrategy `json:"match_strategy"`
	Threshold     float64       `json:"threshold"`
	MatchType     MatchType     `json:"match_type"`
	PolicyName    string        `json:"policy_name"`
}

type CreateMap

type CreateMap struct {
	TempName    string
	Datacenter  string
	Cluster     string
	Host        string
	Resources   string
	Storage     string
	VmName      string
	SysHostName string
	Network     string
}

type CsvInfo

type CsvInfo struct {
	NewFolder    string
	OldFolder    string
	FileNameList []string
	CsvData      [][]string
}

type DataCenter

type DataCenter struct {
	Datacenter      Self
	Name            string
	VmFolder        Self
	HostFolder      Self
	DatastoreFolder Self
}

type DataType

type DataType string
const (
	TypeString                   DataType = "string"
	TypeInteger                  DataType = "integer"
	TypeFloat                    DataType = "float"
	TypeBoolean                  DataType = "boolean"
	TypeStringSlice              DataType = "[]string"
	TypeMapStringString          DataType = "map[string]string"
	TypeSliceMapStringString     DataType = "[]map[string]string"
	TypeMapStringMapStringString DataType = "map[string]map[string]string"
	TypeMapSliceMapstringString  DataType = "map[string][]map[string]string"
)

type Datastore

type Datastore struct {
	Type  string `json:"Type"`
	Value string `json:"Value"`
}

type DatastoreSummary

type DatastoreSummary struct {
	Datastore          Datastore `json:"Datastore"`
	Name               string    `json:"Name"`
	URL                string    `json:"Url"`
	Capacity           int64     `json:"Capacity"`
	FreeSpace          int64     `json:"FreeSpace"`
	Uncommitted        int64     `json:"Uncommitted"`
	Accessible         bool      `json:"Accessible"`
	MultipleHostAccess bool      `json:"MultipleHostAccess"`
	Type               string    `json:"Type"`
	MaintenanceMode    string    `json:"MaintenanceMode"`
	DatastoreSelf      types.ManagedObjectReference
}

type DeriveConfig

type DeriveConfig struct {
	DeriveItems []DeriveItem `yaml:"deriveItems"`
}

func (*DeriveConfig) GetInputFields

func (dc *DeriveConfig) GetInputFields() []Field

func (*DeriveConfig) GetOutputFields

func (dc *DeriveConfig) GetOutputFields() []Field

type DeriveItem

type DeriveItem struct {
	Name   string         `yaml:"name"` // 派生项的名称
	Fields []DerivedField `yaml:"fields"`
}

func (*DeriveItem) GetInputFields

func (di *DeriveItem) GetInputFields() []Field

func (*DeriveItem) GetOutputFields

func (di *DeriveItem) GetOutputFields() []Field

type DerivedField

type DerivedField struct {
	Name         string   `yaml:"name"`
	SourceFields []string `yaml:"sourceFields"`
	Expression   string   `yaml:"expression"`
	Regex        string   `yaml:"regex"`
	Parser       string   `yaml:"parser"`
}

type DeviceBase

type DeviceBase struct {
	Host      string `json:"host" mapstructure:"host"`
	Username  string `json:"username" mapstructure:"username"`
	Password  string `json:"password" mapstructure:"password"`
	AuthPass  string `json:"auth_pass" mapstructure:"auth_pass"`
	Port      int    `json:"port" mapstructure:"port"`
	Community string `json:"community" mapstructure:"community"`
	Mode      string `json:"mode" mapstructure:"mode"`
	Telnet    bool   `json:"telnet" mapstructure:"telnet"`
	Token     string `json:"token" mapstructure:"token"`
}

DeviceBase DeviceBase结构体,设备的基础信息

type DeviceConfig

type DeviceConfig struct {
	// 基本信息
	Vendor   string `yaml:"vendor"`
	Platform string `yaml:"platform"`
	Version  string `yaml:"version"`

	Fields []string `yaml:"fields"`

	// 数据采集和处理流水线
	Pipeline []PipelineStage `yaml:"pipeline"`

	// 结果处理
	ResultType ResultType `yaml:"resultType"`

	// 调试选项
	Debug          bool `yaml:"debug"`
	VerboseLogging bool `yaml:"verboseLogging"`

	// 用于存储 CollectItem 的选项
	CollectItemOptionsMap map[string]CollectItemOptions `yaml:"collectItemOptionsMap"`
}

type DeviceInfo

type DeviceInfo struct {
	DeviceBase       DeviceBase                  `json:"device_base" mapstructure:"device_base"`
	ConfigText       string                      `json:"config_text" mapstructure:"config_text"`
	DeviceRemoteInfo L2DeviceRemoteInfo          `json:"device_remote_info" mapstructure:"device_remote_info"`
	Connection       []config.ConnectionInfo     `json:"connection" mapstructure:"connection"`
	VsRange          []config.VsInfo             `json:"vs_range" mapstructure:"vs_range"`
	Ipv4Area         []config.AreaInfo           `json:"ipv4_area" mapstructure:"ipv4_area"`
	Ipv6Area         []config.AreaInfo           `json:"ipv6_area" mapstructure:"ipv6_area"`
	Ipv4Stub         []config.StubConfigInfo     `json:"ipv4_stub" mapstructure:"ipv4_stub"`
	Ipv6Stub         []config.StubConfigInfo     `json:"ipv6_stub" mapstructure:"ipv6_stub"`
	MetaData         map[string]interface{}      `json:"meta_data" mapstructure:"meta_data"`
	SecurityZones    map[string]SecurityZoneInfo `json:"security_zones" mapstructure:"security_zones"`
}

DeviceInfo DeviceInfo结构体,l3服务所需的设备信息封装

type DevicePolicy

type DevicePolicy struct {
	Device   string          `json:"device"`
	Policies []PolicyDetails `json:"policies"`
}

type DeviceWithMeta

type DeviceWithMeta interface {
	Meta() *L2DeviceMeta
}

type DeviceWithPlatform

type DeviceWithPlatform interface {
	Catalog() string
	Platform() string
	Manufacturer() string
	DeviceType() string
	DeviceID() uint
	OutOfBound() string
	InBound() string
	DeviceName() string
	StructType() string
	Env() string
	Site() string
}

type DeviceWithPlatform2

type DeviceWithPlatform2 interface {
	CatalogName() string
	PlatformName() string
	ManufacturerName() string
	DeviceModelName() string
	DeviceCode() string
	DeviceID() string
	OutOfBound() string
	InBound() string
	DevName() string
	StructType() string
	// Env() string
	SiteName() string
	Login() string
	OutBandVersion() string
	InBandVersion() string
}

type DispatchConfig

type DispatchConfig struct {
	Name   string   `yaml:"name"`
	Regex  []string `yaml:"regex"`
	Action string   `yaml:"action"`
}

type ExcelStruct

type ExcelStruct struct {
	Address []map[string]string
	Prefix  []map[string]string
}

type ExitInfoAPI

type ExitInfoAPI struct {
	Timestamp time.Time         `json:"timestamp"`
	Reason    string            `json:"reason"`
	Node      string            `json:"node"`
	Port      string            `json:"port"`
	VRF       string            `json:"vrf"`
	Details   map[string]string `json:"details"`
	Success   bool              `json:"success"`
	ErrorMsg  string            `json:"error_msg,omitempty"`
}

ExitInfoAPI 退出信息 - API格式

type ExpectedType

type ExpectedType string

type Field

type Field struct {
	Name string   `yaml:"name" json:"name"`
	Type DataType `yaml:"type" json:"type"`
}

Field 定义了一个通用的字段结构

type FieldMapping

type FieldMapping struct {
	InputField   string `yaml:"inputField"`
	OutputField  string `yaml:"outputField"`
	Regex        string `yaml:"regex"`
	Parser       string `yaml:"parser"`
	Unchanged    bool   `yaml:"unchanged"`    // 指示是否需要对该字段进行任何更改
	FlattenSlice bool   `yaml:"flattenSlice"` //用于控制是否将 []map[string]string 扁平化为 map[string]string
}

type FileInfo

type FileInfo struct {
	FileName string
	FileMD5  string
}

type FileUrl

type FileUrl struct {
	Protocol ProtocolModel
	Host     string
	Path     string
	User     string
	Pwd      string
}

func (FileUrl) Url

func (furl FileUrl) Url() string

copy ftp://1.1.1.1/public/a.iso bootflash://a.iso copy ftp://dev:dev@1.1.1.1/public/a.iso bootflash://a.iso copy scp://dev@1.1.1.1/public/a.iso bootlfalsh://a.iso copy bootflash://a.iso ftp://1.1.1.1/public/ copy bootflash://a.iso tftp://1.1.1.1/public/

type FolderInfo

type FolderInfo struct {
	Folder      Self
	Name        string
	ChildEntity []types.ManagedObjectReference
	Parent      Self
	FolderSelf  types.ManagedObjectReference
}

type Host

type Host struct {
	Type  string `json:"Type"`
	Value string `json:"Value"`
}

type HostSummary

type HostSummary struct {
	Host               Host   `json:"Host"`
	Name               string `json:"Name"`
	UsedCPU            int64  `json:"UsedCPU"`
	TotalCPU           int64  `json:"TotalCPU"`
	FreeCPU            int64  `json:"FreeCPU"`
	UsedMemory         int64  `json:"UsedMemory"`
	TotalMemory        int64  `json:"TotalMemory"`
	FreeMemory         int64  `json:"FreeMemory"`
	PowerState         string `json:"PowerState"`
	ManagementServerIp string `json:"ManagementServerIp"`
	HostIp             string `json:"HostIp"`
	HostSelf           types.ManagedObjectReference
}

type HostVM

type HostVM struct {
	Host map[string][]VMS
}

type HubConfig

type HubConfig struct {
	Dispatches []DispatchConfig `yaml:"dispatches"`
}

type IntentPair

type IntentPair struct {
	Key  string        `json:"key" mapstructure:"key" comment:"工单项key键"`
	Info policy.Intent `json:"info" mapstructure:"info" comment:"工单项信息"`
}

type IntentParamPair

type IntentParamPair struct {
	Key  string              `json:"key" mapstructure:"key" comment:"工单项key键"`
	Info policy.IntentParams `json:"info" mapstructure:"info" comment:"工单项信息"`
}

type InterfaceVM

type InterfaceVM struct {
	MacAddress  string
	IpAddress   []string
	Network     string
	VmName      string
	VmIpAddress []VmIpAddress
}

type JoinConfig

type JoinConfig struct {
	JoinItems []JoinItem `yaml:"joinItems"`
}

func (*JoinConfig) GetInputFields

func (jc *JoinConfig) GetInputFields() []Field

func (*JoinConfig) GetOutputFields

func (jc *JoinConfig) GetOutputFields() []Field

type JoinItem

type JoinItem struct {
	Name        string           `yaml:"name"`
	LeftInput   string           `yaml:"leftInput"`   // 左表输入字段
	RightInputs []RightInputInfo `yaml:"rightInputs"` // 右表输入字段信息(可以有多个)
	OutputField string           `yaml:"outputField"`
	JoinType    string           `yaml:"joinType"` // 例如: "inner", "left", "right", "full"
	LeftKey     string           `yaml:"leftKey"`  // 左表的 join key
}

type L2DeviceMeta

type L2DeviceMeta struct {
	ID                             uint           `gorm:"primarykey" mapstructure:"id"`
	CreatedAt                      time.Time      `mapstructure:"createdAt"`
	UpdatedAt                      time.Time      `mapstructure:"updatedAt"`
	DeletedAt                      gorm.DeletedAt `gorm:"index" json:"-" mapstructure:"deletedAt"`
	Meta                           `mapstructure:", squash"`
	DcimDeviceID                   *uint  `json:"dcim_device_id" form:"dcim_device_id" gorm:"column:dcim_device_id;comment:;type:int;" mapstructure:"dcim_device_id"`
	RedfishVersion                 string `` /* 143-byte string literal not displayed */
	VirtualizationClusterID        *uint  `` /* 165-byte string literal not displayed */
	SdnControllerID                *uint  `` /* 133-byte string literal not displayed */
	VirtualizationVirtualmachineID *uint  `` /* 143-byte string literal not displayed */

}

type L2DeviceRemoteInfo

type L2DeviceRemoteInfo struct {
	ID             uint               `yaml:"id" json:"id" mapstructure:"id"`
	Uuid           string             `yaml:"uuid" mapstructure:"uuid"`
	Ip             string             `yaml:"ip" mapstructure:"ip" json:"ip" log:"ip"`
	DeviceName     string             `yaml:"device_name" mapstructure:"device_name" json:"device_name" log:"device_name"`
	Username       string             `yaml:"username" mapstructure:"username" json:"username" log:"username"`
	Password       string             `yaml:"password" mapstructure:"password" json:"password" log:"password"`
	AuthPass       string             `yaml:"auth_pass" mapstructure:"auth_pass" json:"auth_pass" log:"auth_pass"`
	PrivateKey     string             `yaml:"private_key" json:"private_key" mapstructure:"private_key"`
	Community      []string           `yaml:"community" mapstructure:"community" json:"community" log:"community"`
	Platform       string             `yaml:"platform" mapstructure:"platform" json:"platform" log:"platform"`
	Catalog        string             `yaml:"catalog" json:"catalog" mapstructure:"catalog" log:"catalog"`
	Manufacturer   string             `yaml:"manufacturer" json:"manufacturer" mapstructure:"manufacturer" log:"manufacturer"`
	RedfishVersion string             `yaml:"redfish_version" mapstructure:"redfish_version" json:"redfish_version" log:"redfish_version"`
	MetaID         uint               `yaml:"meta_id" json:"meta_id" mapstructure:"meta_id"`
	IsRedfish      bool               `yaml:"is_redfish" json:"is_redfish" mapstructure:"is_redfish" log:"is_redfish"`
	Meta           Meta               `yaml:"meta" mapstructure:"meta" json:"meta" log:"meta"`
	TaskId         string             `yaml:"task_id" json:"task_id" mapstructure:"task_id"`
	DeviceType     string             `yaml:"device_type" json:"device_type" mapstructure:"device_type" log:"device_type"`
	Site           string             `yaml:"site" mapstructure:"site" json:"site"`
	Env            string             `yaml:"env" mapstructure:"env" json:"env"`
	ActionID       action_id.ActionID `yaml:"action_id" mapstructure:"action_id" json:"action_id"`
	AuthCmd        string             `json:"auth_cmd" yaml:"auth_cmd" mapstructure:"auth_cmd"`
	Token          string             `json:"token" yaml:"token" mapstructure:"token"`
	TimeOut        int                `json:"time_out" yaml:"time_out" mapstructure:"time_out"`
	Snmp           Snmp               `json:"snmp" yaml:"snmp" mapstructure:"snmp"`
}

type L2NodemapInstanceInterface

type L2NodemapInstanceInterface interface {
	Process(remote *L2DeviceRemoteInfo, taskConfig L2NodemapTaskConfigInterface, options ...interface{}) (*clitask.Table, error)
}

type L2NodemapServiceCenterInterface

type L2NodemapServiceCenterInterface interface {
	Select(ctx context.Context, remote *L2DeviceRemoteInfo, srv string) (L2NodemapServiceInterface, OK)
}

type L2NodemapServiceInterface

type L2NodemapServiceInterface interface {
	ServiceName() string
	Run(remote *L2DeviceRemoteInfo, options ...interface{}) (*clitask.Table, error)
}

type L2NodemapTaskConfigInterface

type L2NodemapTaskConfigInterface interface {
	IsSelected(string, string) bool
	GetMethod() string
	// NewSnmpTask(host, community string) *snmp.SnmpTask
	// NewSSHTask(reote l2model.structs.L2DeviceRemoteInfo) (*terminal.Execute, error)
	NewExecutor(remote *L2DeviceRemoteInfo) (clitask.Executor, error)
	GetMainConfig() L2NodemapServiceCenterInterface
	// NewRedfishTask(remote l2model.structs.L2DeviceRemoteInfo) *redfish.RedfishTask
	WithMainConfig(L2NodemapServiceCenterInterface)
	GetSubOid(key string) string
	SupportVersion() []string
	IsPretty() bool
}

type L3Config

type L3Config struct {
	NodeMap struct {
		Name   string `yaml:"name"`
		Force  bool   `yaml:"force"`
		TaskID uint   `yaml:"task_id"`
	} `yaml:"nodemap"`
	Policy struct {
		Source       string `yaml:"source"`
		Destination  string `yaml:"destination"`
		RealIp       string `yaml:"realIp"`
		RealPort     string `yaml:"realPort"`
		TicketNumber string `yaml:"ticketNumber"`
		SubTicket    string `yaml:"subTicket"`
		Service      struct {
			Protocol string `yaml:"protocol"`
			Port     string `yaml:"port"`
		} `yaml:"service"`
		Snat string `yaml:"snat"`
	} `yaml:"policy"`
}

type L3Query

type L3Query struct {
	QueryKey      string                `json:"query_key"`
	Condition     Condition             `json:"condition"`
	L3Config      L3Config              `json:"l3config"`
	DeviceConfigs []config.DeviceConfig `json:"device_configs"`
}

func (L3Query) ActionID

func (lq L3Query) ActionID() action_id.ActionID

func (L3Query) Env

func (lq L3Query) Env() string

func (L3Query) Site

func (lq L3Query) Site() string

type L3TemplatesReplay

type L3TemplatesReplay struct {
	// Results *nodemap.TraverseResult
	Results           []byte
	Result            model.TemplateResult
	RouteDecisionInfo map[string][]RouteDecisionInfo `json:"route_decision_info,omitempty"` // 路由跟踪信息
}

type MatchDetailInfo

type MatchDetailInfo struct {
	MatcherName   string                 `json:"matcherName"`
	Matched       bool                   `json:"matched"`
	MatcherType   string                 `json:"matcherType"`
	MatcherValue  string                 `json:"matcherValue"`
	OverlapDetail float64                `json:"overlapDetail"`
	MatchType     string                 `json:"matchType"`
	ExtraInfo     map[string]interface{} `json:"extraInfo"`
}

type MatchStrategy

type MatchStrategy string

type MatchType

type MatchType string

type Meta

type Meta struct {
	RestfullPort   int    `yaml:"restfull_port" json:"restfull_port" mapstructure:"restfull_port"`
	NetconfPort    int    `yaml:"netconf_port" json:"netconf_port" mapstructure:"netconf_port"`
	TelnetPort     int    `yaml:"telnet_port" json:"telnet_port" mapstructure:"telnet_port"`
	SSHPort        int    `yaml:"ssh_port" json:"ssh_port" mapstructure:"ssh_port"`
	IPMIPort       int    `yaml:"ipmi_port" json:"ipmi_port" mapstructure:"ipmi_port"`
	RedfishPort    int    `yaml:"redfish_port" json:"redfish_port" mapstructure:"redfish_port"`
	Enable         *bool  `json:"enable" yaml:"enable" mapstructure:"enable" log:"enable"`
	EnableSSH      *bool  `yaml:"enable_ssh" json:"enable_ssh" mapstructure:"enable_ssh" log:"enable_ssh"`
	EnableTelnet   *bool  `yaml:"enable_telnet" json:"enable_telnet" mapstructure:"enable_telnet"`
	EnableNetconf  *bool  `yaml:"enable_netconf" json:"enable_netconf" mapstructure:"enable_netconf"`
	EnableRestfull *bool  `yaml:"enable_restfull" json:"enable_restfull" mapstructure:"enable_restfull"`
	EnableIPMI     *bool  `json:"enable_ipmi" yaml:"enable_ipmi" mapstructure:"enable_ipmi"`
	EnableSnmp     *bool  `yaml:"enable_snmp" json:"enable_snmp" mapstructure:"enable_snmp"`
	EnableRedfish  *bool  `yaml:"enable_redfish" json:"enable_redfish" mapstructure:"enable_redfish" log:"enable_redfish"`
	Version        string `yaml:"version" json:"version" mapstructure:"version" log:"version"`
	PatchVersion   string `yaml:"patch_version" json:"patch_version" mapstructure:"patch_version" log:"patch_version"`
	RedfishVersion string `yaml:"redfish_version" mapstructure:"redfish_version" json:"redfish_version" log:"redfish_version"`
	SNMPVersion    string `yaml:"snmp_version" json:"snmp_version" mapstructure:"snmp_version" log:"snmp_version"`
	SNMPTimeout    int    `yaml:"snmp_timeout" json:"snmp_timeout" mapstructure:"snmp_timeout"`
	SNMPRetries    int    `yaml:"snmp_retries" json:"snmp_retries" mapstructure:"snmp_retries"`
	SNMPPort       int    `yaml:"snmp_port" json:"snmp_port" mapstructure:"snmp_port"`
}

type MetaReply

type MetaReply struct {
	Meta *Meta
	Metrics
}

type Metrics

type Metrics struct {
	Method     string    `json:"method"`
	StartTime  time.Time `json:"start_time"`
	EndTime    time.Time `json:"end_time"`
	Duration   float64   `json:"duration"`
	Error      error     `json:"error"`
	Total      int       `json:"total"`
	Success    int       `json:"success"`
	Failed     int       `json:"failed"`
	Challenged int       `json:"challenged"`
}

type ModeConfig

type ModeConfig struct {
	Type            string   `yaml:"type"`
	Prompts         []string `yaml:"prompts"`
	ErrPrompts      []string `yaml:"err_prompts"`
	IgnorePrompts   []string `yaml:"ignore_prompts"`
	PossiblePrompts []string `yaml:"possible_prompts"`
	PagerPrompts    []string `yaml:"pager_prompts"`
	PagerCommand    string   `yaml:"pager_command"`
	InitCommands    []string `yaml:"init_commands"`
	SaveCommands    []string `yaml:"save_commands"`
	FirstChain      []string `yaml:"first_chain"`
	LastChain       []string `yaml:"last_chain"`
	AuthCmd         string   `yaml:"auth_cmd"`
}

type MultipleCmd

type MultipleCmd struct {
	Name    string `json:"name"`
	Want    string `json:"want"`
	Prompt  string `json:"prompt"`
	Cmd     string `json:"cmd"`
	TimeOut int    `json:"time_out"`
	Close   bool   `json:"close"`
}

type NetworkSegmentInfo

type NetworkSegmentInfo struct {
	Code           string `json:"code" mapstructure:"code"`
	Name           string `json:"name" mapstructure:"name"`
	NetworkSegment string `json:"network_segment" mapstructure:"network_segment"`
}

type NodemapInfo

type NodemapInfo struct {
	OrderID       string                `json:"order_id" mapstructure:"order_id" comment:"工单ID"`
	DeviceInfos   []DeviceInfo          `json:"device_infos" mapstructure:"device_infos" comment:"源设备信息"`
	IntentInfos   []IntentParamPair     `json:"intent_infos" mapstructure:"intent_infos" comment:"工单数据"`
	DeviceConfigs []config.DeviceConfig `json:"device_configs" mapstructure:"device_configs" comment:"设备配置信息"`
}

NodemapInfo NodemapInfo结构体,用于统一访问l3nodemap服务

func (NodemapInfo) ActionID

func (n NodemapInfo) ActionID() action_id.ActionID

func (NodemapInfo) Env

func (n NodemapInfo) Env() string

func (NodemapInfo) Site

func (n NodemapInfo) Site() string

type OK

type OK interface {
	Error() error
	Ok() bool
}

type ObjectRelation

type ObjectRelation struct {
	Type       string `json:"type"`       // "source", "destination", or "service"
	Name       string `json:"name"`       // Object name in the policy
	CLI        string `json:"cli"`        // CLI of the object
	PolicyLine string `json:"policyLine"` // The line in the policy that references this object
}

type OrchArgs

type OrchArgs struct {
	OrderID  string `json:"order_id"`
	EndPoint string `json:"end_point"`
	LuaPath  string `json:"lua_path"`
}

func (*OrchArgs) ActionID

func (a *OrchArgs) ActionID() action_id.ActionID

func (*OrchArgs) Env

func (a *OrchArgs) Env() string

func (*OrchArgs) Site

func (a *OrchArgs) Site() string

type OrchReply

type OrchReply struct {
	Result []map[string]string
}

type ParseConfig

type ParseConfig struct {
	ParseItems []ParseItem `yaml:"parseItems"`
}

func (*ParseConfig) GetInputFields

func (pc *ParseConfig) GetInputFields() []Field

func (*ParseConfig) GetOutputFields

func (pc *ParseConfig) GetOutputFields() []Field

type ParseItem

type ParseItem struct {
	Name           string `yaml:"name"`           // 解析项的名称
	InputField     string `yaml:"inputField"`     // 输入字段名
	OutputField    string `yaml:"outputField"`    // 输出字段名
	ExpectedType   string `yaml:"expectedType"`   // 期望的输出类型,如 "String", "Integer", "Float", "Boolean", "List", "Map"
	Operation      string `yaml:"operation"`      // 解析操作类型,如 "Regex", "Split", "Trim", "Replace", "Extract"
	Pattern        string `yaml:"pattern"`        // 用于操作的模式,如正则表达式、分隔符等
	PreprocessFunc string `yaml:"preprocessFunc"` // 预处理函数名,用于在主要操作之前对输入进行处理
}

func (*ParseItem) GetInputFields

func (pi *ParseItem) GetInputFields() []Field

func (*ParseItem) GetOutputFields

func (pi *ParseItem) GetOutputFields() []Field

type PipelineData

type PipelineData struct {
	// contains filtered or unexported fields
}

func NewPipelineData

func NewPipelineData() *PipelineData

func (*PipelineData) AddError

func (pd *PipelineData) AddError(err error)

AddError 添加错误

func (*PipelineData) AddStageResult

func (pd *PipelineData) AddStageResult(stageName string, data interface{})

AddStageResult 添加阶段结果

func (*PipelineData) Data

func (pd *PipelineData) Data() map[string]interface{}

func (*PipelineData) Get

func (pd *PipelineData) Get(key string) (interface{}, bool)

Get 获取数据,返回 interface{} 和是否存在的标志

func (*PipelineData) GetErrors

func (pd *PipelineData) GetErrors() []error

GetErrors 获取所有错误

func (*PipelineData) GetFloat

func (pd *PipelineData) GetFloat(key string) (float64, bool)

GetFloat 获取浮点数类型的数据

func (*PipelineData) GetInt

func (pd *PipelineData) GetInt(key string) (int, bool)

GetInt 获取整数类型的数据

func (*PipelineData) GetLastStageResult

func (pd *PipelineData) GetLastStageResult() *StageResult

GetLastStageResult 获取最后一个阶段的结果

func (*PipelineData) GetMetadata

func (pd *PipelineData) GetMetadata(key string) (interface{}, bool)

GetMetadata 获取元数据

func (*PipelineData) GetStageResults

func (pd *PipelineData) GetStageResults() []StageResult

GetStageResults 获取所有阶段的结果

func (*PipelineData) GetString

func (pd *PipelineData) GetString(key string) (string, bool)

GetString 获取字符串类型的数据

func (*PipelineData) GetStringSlice

func (pd *PipelineData) GetStringSlice(key string) ([]string, bool)

GetStringSlice 获取字符串切片类型的数据

func (*PipelineData) HasErrors

func (pd *PipelineData) HasErrors() bool

HasErrors 检查是否有错误

func (*PipelineData) MetaData

func (pd *PipelineData) MetaData() map[string]interface{}

func (*PipelineData) Set

func (pd *PipelineData) Set(key string, value interface{})

Set 设置数据

func (*PipelineData) SetMetadata

func (pd *PipelineData) SetMetadata(key string, value interface{})

SetMetadata 设置元数据

func (*PipelineData) Validate

func (pd *PipelineData) Validate(schema map[string]string) error

Validate 验证数据是否符合预期

type PipelineResult

type PipelineResult struct {
	Data          interface{}            // 最终处理后的数据
	Errors        []error                // 执行过程中的所有错误
	StageResults  map[string]interface{} // 每个阶段的中间结果
	ExecutionTime time.Duration          // 总执行时间
	LastStage     string                 // 最后执行的阶段名称
}

type PipelineStage

type PipelineStage struct {
	Type        string              `yaml:"type" json:"type"`
	Config      PipelineStageConfig `yaml:"config" json:"config"`
	InputFields []string            `yaml:"inputFields" json:"inputFields"`
	Fields      []string            `yaml:"fields" json:"fields"`
}

PipelineStage 结构升级

func (*PipelineStage) GetInputFields

func (ps *PipelineStage) GetInputFields() []Field

func (*PipelineStage) GetOutputFields

func (ps *PipelineStage) GetOutputFields() []Field

type PipelineStageConfig

type PipelineStageConfig struct {
	AliveCheckConfig  *AliveCheckConfig  `yaml:"aliveCheckConfig,omitempty" json:"aliveCheckConfig,omitempty"`
	CollectConfig     *CollectConfig     `yaml:"collectConfig,omitempty" json:"collectConfig,omitempty"`
	ParseConfig       *ParseConfig       `yaml:"parseConfig,omitempty" json:"parseConfig,omitempty"`
	TransformConfig   *TransformConfig   `yaml:"transformConfig,omitempty" json:"transformConfig,omitempty"`
	DeriveConfig      *DeriveConfig      `yaml:"deriveConfig,omitempty" json:"deriveConfig,omitempty"`
	TextFSMConfig     *TextFSMConfig     `yaml:"textFSMConfig,omitempty" json:"textFSMConfig,omitempty"`
	SnmpProcessConfig *SnmpProcessConfig `yaml:"snmpProcessConfig,omitempty" json:"snmpProcessConfig,omitempty"`
	JoinConfig        *JoinConfig        `yaml:"joinConfig,omitempty" json:"joinConfig,omitempty"`
}

更新 PipelineStageConfig 以包含每种类型的配置

type PipelineStageInf

type PipelineStageInf interface {
	Process(input *PipelineData, config PipelineStageConfig) error
}

type PipelineStageSelectConfig

type PipelineStageSelectConfig struct {
	Stage  string
	Method string
}

type PolicyData

type PolicyData struct {
	Result []DevicePolicy `json:"result"`
}

type PolicyDetails

type PolicyDetails struct {
	Cli             string            `json:"cli"`
	RuleName        string            `json:"ruleName"`
	Action          string            `json:"action"`
	Source          string            `json:"source"`
	Destination     string            `json:"destination"`
	Service         string            `json:"service"`
	MatchType       string            `json:"matchType"`
	OverallMatch    bool              `json:"overallMatch"`
	MatchedAddress  string            `json:"matchedAddress,omitempty"`
	ObjectRelations []ObjectRelation  `json:"objectRelations"`
	MatchDetails    []MatchDetailInfo `json:"matchDetails"`
}

type Protocol

type Protocol string

type ProtocolModel

type ProtocolModel string
const (
	FTP       ProtocolModel = "ftp"
	SFTP      ProtocolModel = "sftp"
	SCP       ProtocolModel = "scp"
	HTTP      ProtocolModel = "http"
	HTTPS     ProtocolModel = "https"
	BOOTFLASH ProtocolModel = "bootflash"
	FLASH     ProtocolModel = "flash"
)

type Reply

type Reply struct {
	Table       *clitask.Table
	Result      []map[string]string
	RawData     []byte
	FileData    map[string][][]string
	FileNameMap map[string][]string
	Uuid        string
	MasterKey   string
	Metrics
	Meta *Meta
}

type RepoResult

type RepoResult struct {
	Type        string        `json:"type"`
	PlayBook    []interface{} `json:"playbook"`
	NomadScript string        `json:"nomad_script"`
	Config      struct {
		Type     string   `json:"type"`
		Desc     string   `json:"desc"`
		File     string   `json:"file"`
		FileName string   `json:"file_name"`
		Resource []string `json:"resource"`
		Args     []struct {
			Key      string `json:"key"`
			Label    string `json:"label"`
			Type     string `json:"type"`
			Required bool   `json:"required"`
			Rule     string `json:"rule"`
			Default  string `json:"default"`
			Desc     string `json:"desc"`
		} `json:"args"`
	} `json:"config"`
	OrderID               string                 `json:"order_id" mapstructure:"order_id" log:"order_id"`
	EnvValue              string                 `json:"env_value" mapstructure:"env_value" log:"env_value"`
	SiteValue             string                 `json:"site_value" mapstructure:"site_value" log:"site_value"`
	Inventory             []string               `json:"inventory" mapstructure:"inventory" log:"inventory"`
	FileContent           []map[string][]byte    `json:"file_content" mapstructure:"file_content" log:"file_content"`
	ExtraVars             map[string]interface{} `json:"extra_vars" mapstructure:"extra_vars" log:"extra_vars"`
	AnsibleConnUser       string                 `json:"ansible_conn_user" mapstructure:"ansible_conn_user" log:"ansible_conn_user"`
	AnsibleConnPrivateKey string                 `json:"ansible_conn_private_key" mapstructure:"ansible_conn_private_key" log:"ansible_conn_private_keyr"`
	AnsibleTimeOut        int                    `json:"ansible_time_out" mapstructure:"ansible_time_out" log:"ansible_time_out"`
}

func (RepoResult) ActionID

func (n RepoResult) ActionID() action_id.ActionID

func (RepoResult) Env

func (n RepoResult) Env() string

func (RepoResult) Site

func (n RepoResult) Site() string

type RepoResultTaskReplay

type RepoResultTaskReplay struct {
	AnsibleTaskResult *AnsibleTaskResult
}
type AnsibleTaskReply struct {
	TaskName  string `json:"task_name"`
	Host      string `json:"host"`
	ResultMsg string `json:"result_msg"`
	Stdout    string `json:"stdout"`
}
type AnsibleTaskResult struct {
	Host        string              `json:"host"`
	Failures    int                 `json:"failures"`
	Ignored     int                 `json:"ignored"`
	Ok          int                 `json:"ok"`
	Rescued     int                 `json:"rescued"`
	Skipped     int                 `json:"skipped"`
	Unreachable int                 `json:"unreachable"`
	Info        []*AnsibleTaskReply `json:"info"`
}

type Request

type Request interface {
	ActionID() action_id.ActionID
	Site() string
	Env() string
}

type ResourcePoolInfo

type ResourcePoolInfo struct {
	ResourcePool     Self
	Name             string
	Parent           Self
	ResourcePoolList []types.ManagedObjectReference
	Resource         types.ManagedObjectReference
}

type ResultType

type ResultType string

type RightInputInfo

type RightInputInfo struct {
	Name   string `yaml:"name"`   // 右表名称
	Key    string `yaml:"key"`    // 该右表的 join key
	Prefix string `yaml:"prefix"` // 可选:用于在输出中为该表的字段添加前缀
}

type RouteDecisionInfo

type RouteDecisionInfo struct {
	Timestamp    time.Time         `json:"timestamp"`
	DecisionType string            `json:"decision_type"`
	Node         string            `json:"node"`
	Port         string            `json:"port"`
	VRF          string            `json:"vrf"`
	Area         string            `json:"area"`
	Criteria     map[string]string `json:"criteria"`
	Result       string            `json:"result"`
	Reason       string            `json:"reason"`
	Details      map[string]string `json:"details"`
}

RouteDecisionInfo 路由决策信息 - API格式

type RouteHopInfo

type RouteHopInfo struct {
	InPort  string `json:"in_port"`
	Node    string `json:"node"`
	OutPort string `json:"out_port"`
}

RouteHopInfo 路由跳信息 - API格式

type RouteTraceInfo

type RouteTraceInfo struct {
	IntentID       string              `json:"intent_id"`
	Duration       time.Duration       `json:"duration"`
	StartTime      time.Time           `json:"start_time"`
	EndTime        time.Time           `json:"end_time"`
	RouteHops      []RouteHopInfo      `json:"route_hops"`
	RoutePath      string              `json:"route_path"`
	RouteDecisions []RouteDecisionInfo `json:"route_decisions"`
	ExitInfo       *ExitInfoAPI        `json:"exit_info"`
	NodesVisited   []string            `json:"nodes_visited"`
	DecisionCounts map[string]int      `json:"decision_counts"`
	Success        bool                `json:"success"`
	ErrorMessage   string              `json:"error_message,omitempty"`
}

RouteTraceInfo 路由跟踪信息 - 用于返回给运维平台

type SNMPOptions

type SNMPOptions struct {
	Name      string `yaml:"name"`
	Version   string `yaml:"version"`
	Community string `yaml:"community"`
	Timeout   int    `yaml:"timeout"`
	Retries   int    `yaml:"retries"`
	Host      string `yaml:"host"`
	Port      int    `yaml:"port"`
}

type SSHMode

type SSHMode string

type SSHOptions

type SSHOptions struct {
	Name         string  `yaml:"name"`
	Username     string  `yaml:"username"`
	Password     string  `yaml:"password"`
	PrivateKey   string  `yaml:"privateKey"`
	Host         string  `yaml:"host"`
	Port         int     `yaml:"port"`
	AuthPassword string  `yaml:"authPassword"`
	Timeout      int     `yaml:"timeout"`
	Mode         SSHMode `yaml:"mode"`
}

type SecurityZoneInfo

type SecurityZoneInfo struct {
	Code            string               `json:"code" mapstructure:"code"`
	Name            string               `json:"name" mapstructure:"name"`
	ConfigZoneName  string               `json:"config_zone_name" mapstructure:"config_zone_name"`
	NetworkSegments []NetworkSegmentInfo `json:"network_segments" mapstructure:"network_segments"`
}

type Self

type Self struct {
	Type  string
	Value string
}

type ServiceDescrib

type ServiceDescrib struct {
	ResultType ResultType
}

type Snmp

type Snmp struct {
	SnmpVersion  string `yaml:"snmp_version" json:"snmp_version" mapstructure:"snmp_version"`
	AuthProtocol string `yaml:"auth_protocol" json:"auth_protocol" mapstructure:"auth_protocol"`
	PrivProtocol string `yaml:"priv_protocol" json:"priv_protocol" mapstructure:"priv_protocol"`
	PrivPass     string `yaml:"priv_pass" json:"priv_pass" mapstructure:"priv_pass"`
}

type SnmpProcessConfig

type SnmpProcessConfig struct {
	ProcessItems []SnmpProcessItem `yaml:"processItems"`
}

func (*SnmpProcessConfig) GetInputFields

func (sc *SnmpProcessConfig) GetInputFields() []Field

func (*SnmpProcessConfig) GetOutputFields

func (sc *SnmpProcessConfig) GetOutputFields() []Field

type SnmpProcessItem

type SnmpProcessItem struct {
	InputField string `yaml:"inputField"` // 输入字段名

	Name string `yaml:"name"` // 处理项的名称

	// IndexPositions 存储用于从 OID 后缀中提取索引值的位置
	IndexPositions []int `yaml:"indexPositions"`

	// ClassifierPositions 存储用于从 OID 后缀中提取前缀值的位置
	ClassifierPositions []int `yaml:"classifierPositions"`

	// ClassifierToNameMap 将前缀映射到对应的名称
	ClassifierToNameMap map[string]string `yaml:"classifierToNameMap"`

	// ClassifierProcessors 存储与特定前缀关联的处理函数名称
	ClassifierProcessors map[string]string `yaml:"classifierProcessors"`

	// CustomIndexProcessor 是一个可选的函数名称,用于自定义索引处理
	CustomIndexProcessor string `yaml:"customIndexProcessor"`

	// AppendProcessors 是一个可选的函数名称,用于自定义处理
	AppendProcessors []string `yaml:"appendProcessors"`

	// ValueMapping 用于定义值的映射规则
	ValueMapping map[string]map[string]string `yaml:"valueMapping"`
}

func (*SnmpProcessItem) GetInputFields

func (spi *SnmpProcessItem) GetInputFields() []Field

func (*SnmpProcessItem) GetOutputFields

func (spi *SnmpProcessItem) GetOutputFields() []Field

type SourceInfo

type SourceInfo struct {
	TotalSpace         string
	FreeSpace          string
	UseSpace           string
	TotalCpu           string
	UseCpu             string
	FreeCpu            string
	TotalMem           string
	UseMem             string
	FreeMem            string
	HostTotal          string
	ConnTotal          string
	DisconnTotal       string
	MaintainTotal      string
	VmTotal            string
	ManagementServerIp string
}

type StageResult

type StageResult struct {
	StageName string
	Data      interface{}
	Error     error
}

func (*StageResult) GetMapStringString

func (sr *StageResult) GetMapStringString() (map[string]string, bool)

func (*StageResult) GetSliceMapStringString

func (sr *StageResult) GetSliceMapStringString() ([]map[string]string, bool)

type SyncArgs

type SyncArgs struct {
	ServiceType SyncServerType
	Id          uint
	Ip          string
	StructType  string
	Platform    string
	DataMap     map[string]string
	BulkGetPath map[string][]string
	CsvInfo     CsvInfo
}

type SyncReply

type SyncReply struct {
	ExcelStruct    *ExcelStruct
	Result         []map[string]string
	FileData       map[string][][]string
	FileNameMap    map[string][]string
	ValidateResult map[string][]string
	MasterKey      string
	FileSizeMap    map[string]string
	ZipDataMap     map[string][]byte
	WorkorderData  []*WorkorderData
}

type SyncServerType

type SyncServerType int
const (
	IPAddressManager SyncServerType
	DIR
	GET
	PUT
	BULK_GET
	WorkorderDir
)

type TelnetOptions

type TelnetOptions struct {
	Name         string `yaml:"name"`
	Username     string `yaml:"username"`
	Password     string `yaml:"password"`
	Host         string `yaml:"host"`
	Port         int    `yaml:"port"`
	AuthPassword string `yaml:"authPassword"`
	Timeout      int    `yaml:"timeout"`
}

type TemplateInfo

type TemplateInfo struct {
	Name       string `json:"Name"`
	System     string `json:"System"`
	CreateDate string `json:"CreateDate"`
	CPU        int    `json:"CPU"`
	Mem        int    `json:"Mem"`
	Disk       int    `json:"DISK"`
	Self       Self
	VM         types.ManagedObjectReference
	IPV4       string `json:"IPV4"`
	Mac        string `json:"Mac"`
}

type TextFSMConfig

type TextFSMConfig struct {
	TextFSMItems []TextFSMItem `yaml:"textFSMItems"`
}

func (*TextFSMConfig) GetInputFields

func (tc *TextFSMConfig) GetInputFields() []Field

func (*TextFSMConfig) GetOutputFields

func (tc *TextFSMConfig) GetOutputFields() []Field

type TextFSMItem

type TextFSMItem struct {
	Name       string   `yaml:"name"`       // TextFSM项的名称
	Template   string   `yaml:"template"`   // TextFSM模板内容
	InputField string   `yaml:"inputField"` // 指定要处理的输入字段名
	RowFields  []string `yaml:"rowFields"`  // 指定TextFSM处理后应输出的字段名列表
}

func (*TextFSMItem) GetInputFields

func (ti *TextFSMItem) GetInputFields() []Field

func (*TextFSMItem) GetOutputFields

func (ti *TextFSMItem) GetOutputFields() []Field

type TransformConfig

type TransformConfig struct {
	TransformItems []TransformItem `yaml:"transformItems"`
}

func (*TransformConfig) GetInputFields

func (tc *TransformConfig) GetInputFields() []Field

func (*TransformConfig) GetOutputFields

func (tc *TransformConfig) GetOutputFields() []Field

type TransformItem

type TransformItem struct {
	Name     string         `yaml:"name"` // 转换项的名称
	Mappings []FieldMapping `yaml:"mappings"`
}

func (*TransformItem) GetInputFields

func (ti *TransformItem) GetInputFields() []Field

func (*TransformItem) GetOutputFields

func (ti *TransformItem) GetOutputFields() []Field

type VMS

type VMS struct {
	Name  string
	Value string
}

type ValidateFunc

type ValidateFunc func(map[string]interface{}) validator.Result

type VirtualMachines

type VirtualMachines struct {
	Name       string `json:"Name"`
	System     string `json:"System"`
	CPU        int    `json:"CPU"`
	Mem        int    `json:"Mem"`
	PowerState int    `json:"PowerState"`
	Self       Self   `json:"Self"`
	VM         types.ManagedObjectReference
	Disk       int    `json:"DISK"`
	IPV4       string `json:"IPV4"`
	Mac        string `json:"Mac"`
}

type VmIpAddress

type VmIpAddress struct {
	Name      string
	IpAddress []string
}

type WorkorderData

type WorkorderData struct {
	WorkorderDir string
	CsvData      [][]string
	ZipData      []byte
	FileInfos    []*FileInfo
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL