Giter VIP home page Giter VIP logo

napalm-vyos's Introduction

PyPI PyPI Build Status

napalm-vyos

Community NAPALM driver for the VyOS. https://vyos.io/

Also it can be used for other similar systems: Vyatta or EdgeOS

General support matrix

VyOS
Module Name napalm-vyos
Driver Name vyos
Structured data Yes
Minimum version 1.1.6
Backend library netmiko

Configuration support matrix

VyOS
Config. replace Yes
Config. merge Yes
Compare config Yes
Atomic Changes Yes
Rollback Yes

Optional arguments

NAPALM supports passing certain optional arguments to some drivers. To do that you have to pass a dictionary via the :code:optional_args parameter when creating the object::

>>> from napalm import get_network_driver
>>> driver = get_network_driver('vyos')
>>> optional_args = {'my_optional_arg1': 'my_value1', 'my_optional_arg2': 'my_value2'}
>>> device = driver('192.168.76.10', 'vagrant', 'this_is_not_a_secure_password', optional_args=optional_args)
>>> device.open()

List of supported optional arguments


  • :code:port (vyos) - Allows you to specify a port other than the default.
  • :code:key_file (vyos) - Netmiko/Paramiko argument, path to a private key file (default: 'False').

Prerequisites

VyOS has no native HTTP API or NETCONF capability. We are using Netmiko for ssh connections and scp file transfers. Having Netmiko installed in your working box is a prerequisite.

VyOS in version 1.1.x (tested 1.1.7)

napalm==2.* paramiko netmiko>=1.1.0 vyattaconfparser

Configuration file

Currently VyOS driver supports two different configuration formats:

  • load_replace_candidate - Full config file (with brackets) like in /config/config.boot Due to the OS nature, we do not support a replace using a set-style configuration format.
  • load_merge_candidate - Currently driver supports set-style configuration format. Example

set system login banner pre-login "test"

Vyos require configuration file (load_replace) to contain comment like following

/* Warning: Do not remove the following line. */ /* === vyatta-config-version: "cluster@1:config-management@1:conntrack-sync@1:conntrack@1:cron@1:dhcp-relay@1:dhcp-server@4:firewall@5:ipsec@4:nat@4:qos@1:quagga@2:system@6:vrrp@1:wanloadbalance@3:webgui@1:webproxy@1:zone-policy@1" === */ /* Release version: VyOS 1.1.7 */

Otherwise VyOS reject load operation

Notes

  • The NAPALM-vyos driver supports all Netmiko arguments as either standard arguments (hostname, username, password, timeout) or as optional_args (everything else).

  • The NAPALM-vyos driver supports authentication with ssh key. Please specify path to a key in optional_args 'optional_args': {'key_file': '/home/user/ssh_private_key'}

Configuration Examples

VyOS Community

Slack Channel https://slack.vyos.io

napalm-vyos's People

Contributors

dbarrosop avatar marcushoff avatar mirceaulinic avatar ppieprzycki avatar thomseddon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

napalm-vyos's Issues

Installation fails with pip 18.1

Installation fails when using pip 18.1 (with Python 3.6 in CentOS 7)

[vagrant@default ~]$ pip3 --version
pip 18.1 from /usr/local/lib/python3.6/site-packages/pip-18.1-py3.6.egg/pip (python 3.6)
[vagrant@default ~]$ pip3 install --user napalm-vyos
Collecting napalm-vyos
  Using cached https://files.pythonhosted.org/packages/e0/ff/2d70e5c7b9925688e000bcc89e140c3bddb61868b1b6cb25414080390700/napalm-vyos-0.1.5.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-kh0bects/napalm-vyos/setup.py", line 6, in <module>
        from pip.req import parse_requirements
    ModuleNotFoundError: No module named 'pip.req'
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-kh0bects/napalm-vyos/

napalm-vyos getter for bgp_neighbors returns NONE

Issue:- napalm-vyos getter for bgp_neighbors is not returning any information.

vyos version:- 1.3-rolling-202001081700

~/Automation/scripts_napalm  pip3 list | grep napalm                                                                           
napalm                3.2.0    
napalm-vyos           0.2.1    
 ~/Automation/scripts_napalm  pip3 list | grep netmiko                                                                           
netmiko               3.4.0    
 ~/Automation/scripts_napalm  

BGP output from vyos

vyos@vyos:~$ show ip bgp summary 

IPv4 Unicast Summary:
BGP router identifier 192.168.1.1, local AS number 65360 vrf-id 0
BGP table version 1042
RIB entries 2024, using 364 KiB of memory
Peers 2, using 41 KiB of memory

Neighbor        V         AS MsgRcvd MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd
172.16.12.2     4      65501   88274   88273        0    0    0 08w5d06h           18
172.16.13.2     4      65361   97094   88274        0    0    0 08w5d06h         1001

Total number of neighbors 2
vyos@vyos:~$ 

naplam output

napalm --user ansible --password ansible123  --vendor vyos vyos call get_bgp_neighbors       
{}

ownership for vyos driver

Hello,
community drivers are going to be maintained by the community or considered deprecated and unmaintained. For that reason we are looking for people willing to maintain this repo. Owners will have full admin rights on this repo and on its pypy package.

Pinging top contributors to see if they are interested; @mirceaulinic

If you have questions/comments let me know.

Regards

EdgeOS support

Is there any plan to support Ubiquiti EdgeOS (a fork of VyOS)? The main difference I've noted is that the terminal length command needs a workaround in netmiko (set terminal length isn't supported on EdgeOS).

Errors from failed commits are not returned

When applying a commit that ultimately fails the errors are not shown to the user, looking at Netmiko it does capture these errors and passes it back when a ValueError exception is raised https://github.com/ktbyers/netmiko/blob/5f9eaa9e54401a758375574c656655e44bee3746/netmiko/vyos/vyos_ssh.py#L94-L95

napalm-vyos just catches the ValueError and raises a CommitError with it's own message.

TASK [Apply Configuration] **********************************************
fatal: [dev]: FAILED! => changed=false 
  msg: 'cannot install config: Failed to commit config on the device'

Update to support napalm 3.x

In trying to deploy napalm-vyos as part of a Netbox deployment I've been doing recently, I noticed that napalm-vyos requires napalm==2.*, but the current Napalm release is 3.x.

napalm-vyos does not clean up candidate_running or backup_running

So one issue I experienced is that I applied a config from napalm-vyos with the vyos user which was to add my personal user. This works fine.

However on the next run if I try to do a diff/commit with my personal user I get an error

fatal: [router1]: FAILED! => changed=false 
  msg: |-
    cannot load config: scp: /var/tmp/candidate_running.conf: Permission denied

This seems to be because the /var/tmp/candidate_running.conf file is left around from previous runs and has 644 permissions, only allowing the vyos user to write to it. This wouldn't become an issue if these files were cleaned up after the operation(s) are finished, which it seems the code as of now does not do that.

vyos@dev:~$ ls -la /var/tmp
total 20
drwxrwxrwt  6 root  root   180 Jun 11 16:50 .
drwxr-xr-x  1 root  
-rwxr-xr-x  1 vyos  users 1896 Jun 11 16:48 backup_running.conf
-rw-r--r--  1 vyos  users 1784 Jun 11 16:48 candidate_running.conf
-rw-r--r--  1 yzguy users  182 Jun 11 16:50 test.sh

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.