Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nleiva/go-nso
Playing around with NSO REST-API and Go
https://github.com/nleiva/go-nso
cisco nso tail-f-systems
Last synced: about 2 months ago
JSON representation
Playing around with NSO REST-API and Go
- Host: GitHub
- URL: https://github.com/nleiva/go-nso
- Owner: nleiva
- Created: 2018-01-03T20:07:30.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-03T20:19:29.000Z (almost 7 years ago)
- Last Synced: 2024-06-20T05:10:17.268Z (6 months ago)
- Topics: cisco, nso, tail-f-systems
- Language: Go
- Size: 2.93 KB
- Stars: 0
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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
```go
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
```go
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
```go
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)
```