Skip to content

Commit

Permalink
Merge pull request #7 from nights99/try_netconf_v2
Browse files Browse the repository at this point in the history
Try netconf v2
  • Loading branch information
nights99 authored Oct 5, 2024
2 parents 724a76d + 280b7ea commit d7cce63
Show file tree
Hide file tree
Showing 24 changed files with 839 additions and 427 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every week
interval: "weekly"
3 changes: 0 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ name: "CodeQL"

on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '36 0 * * 3'
workflow_dispatch:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ pyvxr.log
netconf-go
cpu.prof
netconf-cli.test
__debug_bin
.vscode
7 changes: 7 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[submodule "go-netconf"]
path = go-netconf
url = ./go-netconf/

[submodule "go-netconf-v2"]
path = go-netconf-v2
url = ./go-netconf-v2/
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"recommendations": [
"actboy168.tasks"
"actboy168.tasks",
"gruntfuggly.todo-tree"
]
}
101 changes: 0 additions & 101 deletions Cisco-IOS-XR-cdp-cfg.yang

This file was deleted.

56 changes: 0 additions & 56 deletions Cisco-IOS-XR-shellutil-cfg.yang

This file was deleted.

38 changes: 31 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,40 @@ I have a separate Flutter web app that does this, which I hope to also make a pu
## Usage

```
Usage of /home/jon/go/bin/netconf-go:
-address string
Address or host to connect to (default "localhost")
-debug string
debug level (default "info")
-port int
Port number to connect to (default 10555)
Usage of netconf-go:
--address string Address or host to connect to (default "localhost")
--debug string debug level (default "info")
--host string Hostname referring to hosts.yaml entry
--password string Password
--port int Port number to connect to (default 22)
--t Use telnet to connect
--user string Username
```

## Augment handling

TODO

## Hosts file

Host details can be saved into a Yaml file `hosts.yaml` in the current directory.

Each host should have a key that is then passed to the 'hosts' command-line parameter to select the entry.

The entries under the key should match the equivalent command-line parameters.

The user can mix both the hosts file and command-line parameters, in which case
if both are specified the command-line parameter will override the hosts entry.

## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Currently virtually no automated unit-tests, but adding tests would be welcome.

# To-do list

- rearrange to use proper Go module structure and packages
- upstream goyang changes
- implement config files for hosts
- improve augment handling
- add tests
1 change: 1 addition & 0 deletions go-netconf
Submodule go-netconf added at 2fdbf8
1 change: 1 addition & 0 deletions go-netconf-v2
Submodule go-netconf-v2 added at 9e1c7e
76 changes: 50 additions & 26 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,53 +1,77 @@
module netconf-go

go 1.18
go 1.21

toolchain go1.23.1

require (
github.com/chzyer/readline v1.5.1
github.com/gobwas/ws v1.2.1
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/openconfig/goyang v1.4.5
github.com/peterh/liner v1.2.2
github.com/rivo/uniseg v0.4.4 // indirect
github.com/sirupsen/logrus v1.9.3
github.com/stretchr/testify v1.9.0
golang.org/x/crypto v0.27.0
golang.org/x/sys v0.25.0 // indirect
nhooyr.io/websocket v1.8.10
)

require (
github.com/Juniper/go-netconf v0.3.0
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e
github.com/gin-gonic/gin v1.9.1 // indirect
github.com/gobwas/ws v1.1.0
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/openconfig/goyang v0.3.2
github.com/peterh/liner v1.2.2
github.com/rivo/uniseg v0.2.0 // indirect
github.com/sirupsen/logrus v1.8.1
github.com/stretchr/testify v1.8.3
golang.org/x/crypto v0.17.0
golang.org/x/sys v0.15.0 // indirect
nhooyr.io/websocket v1.8.7
)

require github.com/ziutek/telnet v0.0.0-20180329124119-c3b780dc415b
require (
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.18.2
github.com/ziutek/telnet v0.0.0-20180329124119-c3b780dc415b
)

require (
github.com/chzyer/logex v1.2.0 // indirect
github.com/chzyer/test v0.0.0-20210722231415-061457976a23 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/gobwas/httphead v0.1.0 // indirect
github.com/gobwas/pool v0.2.1 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.7 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/klauspost/compress v1.16.5 // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/openconfig/gnmi v0.0.0-20210914185457-51254b657b7d // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/klauspost/compress v1.17.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/nemith/netconf v0.0.2-0.20240909031326-9e1c7e00bf1a // indirect
github.com/openconfig/gnmi v0.10.0 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sergi/go-diff v1.3.1 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
golang.org/x/text v0.18.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

// go mod edit -replace github.com/openconfig/goyang=github.com/nights99/goyang@dynamic_read
// replace github.com/openconfig/goyang => ./goyang/

// replace github.com/openconfig/goyang => ./src/github.com/openconfig/goyang/
replace github.com/openconfig/goyang => github.com/nights99/goyang v0.2.5-0.20220723135300-f046d3f17ec9
replace github.com/openconfig/goyang => github.com/nights99/goyang v0.2.5-0.20230528130339-76fd486cbc28

// replace github.com/peterh/liner => ./src/github.com/peterh/liner

// go mod edit -replace github.com/Juniper/go-netconf=github.com/nights99/go-netconf@master
// replace github.com/Juniper/go-netconf => ./src/github.com/Juniper/go-netconf/
// replace github.com/Juniper/go-netconf => ./go-netconf/
// replace github.com/nemith/netconf => ./go-netconf-v2/

replace github.com/Juniper/go-netconf => github.com/nights99/go-netconf v0.1.2-0.20220723134019-7f4f80450f34
// replace github.com/Juniper/go-netconf => github.com/nights99/go-netconf v0.1.2-0.20220723134019-7f4f80450f34
Loading

0 comments on commit d7cce63

Please sign in to comment.