Giter VIP home page Giter VIP logo

netrasp's Introduction

netrasp

Netrasp is a package that communicates to network devices over SSH. It takes care of handling the pty terminal of network devices giving you an API with common actions such as executing commands and configuring devices.

Warning

Netrasp is in pre release mode so some parts of the API might change before the initial version is released.

Example

package main

import (
	"context"
	"fmt"
	"log"
	"time"

	"github.com/networklore/netrasp/pkg/netrasp"
)

func main() {
	device, err := netrasp.New("switch1",
		netrasp.WithUsernamePassword("my_user", "my_password123"),
		netrasp.WithDriver("ios"),
	)
	if err != nil {
		log.Fatalf("unable to create client: %v", err)
	}

	ctx, cancelOpen := context.WithTimeout(context.Background(), 2000*time.Millisecond)
	defer cancelOpen()
	err = device.Dial(ctx)
	if err != nil {
		fmt.Printf("unable to connect: %v\n", err)

		return
	}
	defer device.Close(context.Background())

	ctx, cancelRun := context.WithTimeout(context.Background(), 300*time.Millisecond)
	defer cancelRun()
	output, err := device.Run(ctx, "show running")
	if err != nil {
		fmt.Printf("unable to run command: %v\n", err)

		return
	}
	fmt.Println(output)
}

Network Device Support

The initial release of Netrasp comes with support for the following platforms:

  • Cisco IOS: netrasp.WithDriver("ios")
  • Cisco NXOS: netrasp.WithDriver("nxos")
  • Cisco ASA: netrasp.WithDriver("asa")
  • Nokia SR OS: netrasp.WithDriver("sros")

Use cases

You can use Netrasp as a package as in the example above of combine it with something like Gornir to get the same type of experience you'd have from using Netmiko and Nornir in the Python world.

Blog Posts

Credits

Netrasp was created by Patrick Ogenstad. Special thanks to David Barroso for providing feedback and recommendations of the structure and code.

netrasp's People

Contributors

ogenstad avatar albertodelacruz avatar hellt avatar karimra avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.