Documentation ¶
Overview ¶
Package iosxecfg provides a configuration interface to the IOS XE Router using the high-level protobuf API. The connection to the router can be based on an existing VTY session (which allows to use any type of the transport that the VTY package offers), or created from scratch via SSH using the NewSSHSession() method:
s, err := NewSSHSession("10.195.94.48", 22, "cisco", "cisco") // check error! defer s.Close()
Once there is a configuration session open, one can use its method to configure the router, e.g.:
err = s.AddStaticRoute(&iosxe.StaticRoute{ DstAddress: "1.2.3.4/32", NextHopAddress: "8.8.8.8", })
Index ¶
- type Session
- func (s *Session) AddBridgeDomain(bd *iosxe.BridgeDomain) error
- func (s *Session) AddInterface(iface *iosxe.Interface) error
- func (s *Session) AddStaticRoute(route *iosxe.StaticRoute) error
- func (s *Session) Close()
- func (s *Session) CopyRunningToStartup() (err error)
- func (s *Session) DeleteBridgeDomain(bd *iosxe.BridgeDomain) error
- func (s *Session) DeleteInterface(iface *iosxe.Interface) error
- func (s *Session) DeleteStaticRoute(route *iosxe.StaticRoute) error
- func (s *Session) DumpBridgeDomains() (map[uint32]*iosxe.BridgeDomain, error)
- func (s *Session) DumpInterfaces() (map[string]*iosxe.Interface, error)
- func (s *Session) DumpStaticRoutes() (map[string]*iosxe.StaticRoute, error)
- func (s *Session) ModifyBridgeDomain(oldBd, newBd *iosxe.BridgeDomain) error
- func (s *Session) ModifyInterface(oldIface, newIface *iosxe.Interface) error
- func (s *Session) ModifyStaticRoute(oldRoute, newRoute *iosxe.StaticRoute) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session represents a configuration session with an IOS XE Router.
func NewSSHSession ¶
NewSSHSession connects to the router via SSH and creates a new configuration session with the IOS XE Router. The session should be closed with the Close() method.
func NewSession ¶
NewSession creates a new configuration session with an IOS XE Router from an existing (open) VTY session. The session should be closed with the Close() method.
func (*Session) AddBridgeDomain ¶
func (s *Session) AddBridgeDomain(bd *iosxe.BridgeDomain) error
AddBridgeDomain adds a new bridge domain into the router's configuration.
func (*Session) AddInterface ¶
AddInterface adds a new interface into the router's configuration.
func (*Session) AddStaticRoute ¶
func (s *Session) AddStaticRoute(route *iosxe.StaticRoute) error
AddStaticRoute adds a new static route into the router's configuration.
func (*Session) Close ¶
func (s *Session) Close()
Close closes the session and releases all resources tied to it.
func (*Session) CopyRunningToStartup ¶
CopyRunningToStartup copies running configuration into the starup configuration of the router. It does the equivalent to the following CLI config:
copy running-config startup-config
func (*Session) DeleteBridgeDomain ¶
func (s *Session) DeleteBridgeDomain(bd *iosxe.BridgeDomain) error
DeleteBridgeDomain deletes the bridge domain from the router's configuration.
func (*Session) DeleteInterface ¶
DeleteInterface deletes the interface from the router's configuration.
func (*Session) DeleteStaticRoute ¶
func (s *Session) DeleteStaticRoute(route *iosxe.StaticRoute) error
DeleteStaticRoute deletes the static route from the router's configuration.
func (*Session) DumpBridgeDomains ¶
func (s *Session) DumpBridgeDomains() (map[uint32]*iosxe.BridgeDomain, error)
DumpBridgeDomains dumps all existing bridge domains from the router into a map indexed by bridge domain IDs.
func (*Session) DumpInterfaces ¶
DumpInterfaces dumps all existing interfaces from the router into a map indexed by interface names.
func (*Session) DumpStaticRoutes ¶
func (s *Session) DumpStaticRoutes() (map[string]*iosxe.StaticRoute, error)
DumpStaticRoutes dumps all existing static routes from the router into a map indexed by destination prefix.
func (*Session) ModifyBridgeDomain ¶
func (s *Session) ModifyBridgeDomain(oldBd, newBd *iosxe.BridgeDomain) error
ModifyBridgeDomain modifies the existing bridge domain config to a new version of it.
func (*Session) ModifyInterface ¶
ModifyInterface modifies the existing interface config to a new version of it.
func (*Session) ModifyStaticRoute ¶
func (s *Session) ModifyStaticRoute(oldRoute, newRoute *iosxe.StaticRoute) error
ModifyStaticRoute modifies the existing static route config to a new version of it.