Gomiko is a Go
implementation of netmiko. It serves as multi-vendor networking SDK that helps communicate and execute commands via an interactive shell
without needing to care about handling device prompts and terminal modes.
- Cisco IOS
- Cisco IOS XR
- Cisco ASA
- Cisco NX-OS
- Mikrotik RouterOS
- Arista EOS
- Juniper JunOS
get gomiko pkg: go get -u github.com/Ali-aqrabawi/gomiko/pkg
.
import (
"fmt"
"log"
"github.com/Ali-aqrabawi/gomiko/pkg"
)
func main() {
device, err := gomiko.NewDevice("192.168.1.1", "admin", "password", "cisco_ios", 22)
if err != nil {
log.Fatal(err)
}
//Connect to device
if err := device.Connect(); err != nil {
log.Fatal(err)
}
// send command
output1, _ := device.SendCommand("show vlan")
// send a set of config commands
commands := []string{"vlan 120", "name v120"}
output2, _ := device.SendConfigSet(commands)
device.Disconnect()
fmt.Println(output1)
fmt.Println(output2)
}
import (
"fmt"
"log"
"github.com/Ali-aqrabawi/gomiko/pkg"
)
func main() {
device, err := gomiko.NewDevice("192.168.1.1", "admin", "password", "cisco_ios", 22, gomiko.SecretOption("enablePass"))
if err != nil {
log.Fatal(err)
}
}