Documentation ¶
Overview ¶
Package Yeoman provides a basic set of interfaces that you would normally find in elements such as routers and switches.
Index ¶
- Constants
- func ExpandVlansIntSlice(vlans string) ([]int, error)
- func GetUniqueIntSlice(intSlice []int) []int
- func InterfaceInSlice(interfaces []*Interface, interf *Interface) bool
- func VlanInSlice(vlan *Vlan, vlans []*Vlan) bool
- type Element
- type IP
- type Interface
- func (i *Interface) AddAllowedVlans(vlans []string)
- func (i *Interface) AllowsVlan(vlanId int) bool
- func (i *Interface) GetPrimaryV6AddressFirst() *IP
- func (i *Interface) IsLoopback() bool
- func (i *Interface) IsVirtual() bool
- func (i *Interface) TotalIPv4s() int
- func (i *Interface) TotalIPv6s() int
- func (i *Interface) TotalIps() int
- type Vlan
Constants ¶
const ( DeviceCiscoIOS = 1 DeviceCiscoIOSXR = 2 DeviceCiscoNexus = 3 DeviceJunos = 4 )
const ( VendorCisco = "Cisco" VendorJuniper = "Juniper" )
Variables ¶
This section is empty.
Functions ¶
func ExpandVlansIntSlice ¶
ExpandVlansIntSlice will take a string of vlans and return an int slice with the respective vlan ids
func GetUniqueIntSlice ¶
GetUniqueIntSlice returns a unique slice of integers from the given input
func InterfaceInSlice ¶
InterfaceInSlice returns true or false whether an interface is within a given slice or not
Types ¶
type Element ¶
type Element struct { DefaultMtu int `json:"default_mtu"` ManagementIP IP `json:"management_ip"` Vendor string `json:"Vendor"` OS string `json:"OS"` Hostname string `json:"hostname"` VlanIds string `json:"vlan_ids"` Vlans []*Vlan `json:"vlans"` Interfaces []*Interface `json:"interfaces"` DeviceType int `json:"device_type"` MtuHasEthernetHeaders bool `json:"mtu_has_ethernet_headers"` }
Element struct for network elements
func (*Element) CountInterfaces ¶
CountInterfaces returns the total number of networkInterfaces.
func (*Element) DoesVlanExist ¶
DoesVlanExist returns true or false whether a vlan exists in the vlan database or not
func (*Element) GetInterface ¶
GetInterface finds an interface by given name and returns it
type IP ¶
type IP struct { CIDR string `json:"cidr"` IPAddress string `json:"ip_address"` IPNetwork string `json:"ip_network"` IsPrimary bool `json:"is_primary"` IsIpv6 bool `json:"is_ipv6"` }
IP
type Interface ¶
type Interface struct { Name string `json:"name"` Description string `json:"description"` VRF string `json:"vrf"` SubInterface bool `json:"sub_interface"` Layer2 bool `json:"layer_2"` AccessPort bool `json:"access_port"` TrunkPort bool `json:"trunk_port"` VirtualInterface bool `json:"virtual_interface"` AllowedTrunkedVlans []int `json:"allowed_trunked_vlans"` Mtu int `json:"mtu"` Vlan *Vlan `json:"vlan"` IPv4Addresses []IP `json:"ipv4_addresses"` IPv6Addresses []IP `json:"ipv6_addresses"` PossiblyNoVlanDatabase bool `json:"possibly_no_vlan_database"` }
Interface struct for network networkInterfaces
func (*Interface) AddAllowedVlans ¶
AddAllowedVlans adds vlans to a trunk interface todo: need to check to see if any of these do NOT already exist & warn against for future potential cleanup.
func (*Interface) IsLoopback ¶
IsLoopback attempts to detect wether an interface is a loopback or not
func (*Interface) IsVirtual ¶
IsVirtual returns true if interface is virtual
func (*Interface) TotalIPv4s ¶
TotalIps returns total number of IPv4 addresses.
func (*Interface) TotalIPv6s ¶
TotalIps returns total number of IPv6 addresses.