gomiko

module
v0.0.0-...-a02e82a Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2023 License: MIT

README

Gomiko

Build Status GolangCI published

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.

Supports

  • Cisco IOS
  • Cisco IOS XR
  • Cisco ASA
  • Cisco NX-OS
  • Mikrotik RouterOS
  • Arista EOS
  • Juniper JunOS

Installation

get gomiko pkg: go get -u github.com/0x234/gomiko/pkg.

Examples :

import (
	"fmt"
	"log"
	"github.com/0x234/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)
 
}

create device with enable password:

import (
	"fmt"
	"log"
	"github.com/0x234/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)
     }     

}

create device with custom timeout:

import (
	"fmt"
	"log"
	"github.com/0x234/gomiko/pkg"
)

func main() {
	
     device, err := gomiko.NewDevice("192.168.1.1", "admin", "password", "cisco_ios", 22, gomiko.SecretOption("enablePass"), gomiko.TimeoutOption(10))
     
     if err != nil {
     	log.Fatal(err)
     }     

}

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

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