Skip to content

nleiva/go-nso

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-nso

Playing around with NSO REST-API and Go. This is work in progress, will make it more user-friendly soon.

Configure static routes

u := new(url.URL)
u.Scheme = "http"
u.Host = "mrstn-nso.cisco.com:8080"
u.User = url.UserPassword("admin", "admin")
device := "mrstn-5501-1.cisco.com"

var netClient = &http.Client{
	Timeout: time.Second * 20,
}

// Generate the message payload
config, err := generateStatic("2001:420::/32", "2001:420:2cff:1204::1")
...

// Use NSO REST-API to configure the route
req, err := setRouterConfig(u, device, "static", config)
...
resp, err := netClient.Do(req)

Sync from device

u := new(url.URL)
u.Scheme = "http"
u.Host = "mrstn-nso.cisco.com:8080"
u.User = url.UserPassword("admin", "admin")
device := "mrstn-5501-1.cisco.com"

var netClient = &http.Client{
	Timeout: time.Second * 20,
}

// Use NSO REST-API to Sync from device
req, err := syncFrom(u, device)
...
resp, err := netClient.Do(req)

Request device config

u := new(url.URL)
u.Scheme = "http"
u.Host = "mrstn-nso.cisco.com:8080"
u.User = url.UserPassword("admin", "admin")
device := "mrstn-5501-1.cisco.com"

var netClient = &http.Client{
	Timeout: time.Second * 20,
}

// Use NSO REST-API to Sync from device
req, err := routerConfig(u, device)
...
resp, err := netClient.Do(req)

About

Playing around with NSO REST-API and Go

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages