iosxecfg

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2017 License: Apache-2.0 Imports: 10 Imported by: 2

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

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

func NewSSHSession(host string, port uint32, userName string, password string) (*Session, error)

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

func NewSession(vty *vty.Session) (*Session, error)

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

func (s *Session) AddInterface(iface *iosxe.Interface) error

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

func (s *Session) CopyRunningToStartup() (err error)

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

func (s *Session) DeleteInterface(iface *iosxe.Interface) error

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

func (s *Session) DumpInterfaces() (map[string]*iosxe.Interface, error)

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

func (s *Session) ModifyInterface(oldIface, newIface *iosxe.Interface) error

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.

Directories

Path Synopsis
model
iosxe
Package iosxe is a generated protocol buffer package.
Package iosxe is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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