Giter Club home page Giter Club logo

napalm's People

Contributors

afourmy avatar benmaddison avatar bewing avatar bkeifer avatar chadell avatar chonty avatar ckishimo avatar dbarrosop avatar dependabot-preview[bot] avatar dependabot[bot] avatar exaneserverteam avatar fooelisa avatar ggabriele avatar inetuid avatar itdependsnetworks avatar jedelman8 avatar jobec avatar kircheneer avatar ktbyers avatar lokespotify avatar malanovo avatar minefuto avatar mirceaulinic avatar mzbenami avatar network-shark avatar nickethier avatar ogenstad avatar targuan avatar thomasbridge74 avatar ubajze 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  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  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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

napalm's Issues

unicode error

while deploying with a particular device, got an error in the napalm_install_config, the solution was adding encode:
diff = device.compare_config().encode('utf-8')

ValueError: requested attribute name cu already exists

If we call open() function twice(junos devices), it throws exception which doesn't give proper message atleast. Should be handled in better way

obj = driver('xxxx', 'xxx', 'xxxxx')
obj.open()

obj.open()
Traceback (most recent call last):
File "", line 1, in
File "/Users/nitinkr/Coding/PyEZ_env/napalm_env/env/lib/python2.7/site-packages/napalm/junos.py", line 43, in open
self.device.bind(cu=Config)
File "/Users/nitinkr/Coding/PyEZ_env/napalm_env/env/lib/python2.7/site-packages/jnpr/junos/device.py", line 756, in bind
name)
ValueError: requested attribute name cu already exists

Ansible module variables

Hello all,
Thanks for this project in the first place.

In the beginning I had problem with usage of the napalm_install_config module.
Just tried using variables "commit_changes" and "replace_config" with parameters "true" and "false".
I just get used to it with other unusable modules.

Is there any particular reason why only values True/False and 1/0 are only possible.

Just get simple PoC in my repo with adding type bool for these variables.
https://github.com/ppieprzycki/napalm/blob/master/ansible/napalm_install_config

In the book that I'm currently studying "Ansible up and running" i can find some explanation

Ansible is pretty flexible on how you represent truthy and falsey values in playbooks. Strictly speaking, >module arguments (like update_cache=yes) are treated differently from values elsewhere in playbooks >(like sudo: True). Values elsewhere are handled by the YAML parser and so use the YAML conventions >of truthiness, which are:
YAML truthy
true, True, TRUE, yes, Yes, YES, on, On, ON, y, Y YAML falsey
false, False, FALSE, no, No, NO, off, Off, OFF, n, N

Module arguments are passed as strings and use Ansible’s internal conventions, which are:

module arg truthy
yes, on, 1, true
module arg falsey
no, off, 0, false

I tend to follow the examples in the official Ansible documentation.
These typically use yes and no when passing arguments to modules
(since that’s consistent with the module documentation), and True and False elsewhere in playbooks.

Please share some thoughts about this

Regards
Piotr Pieprzycki

Install error using 'python setup.py install'

Started off with blank virtualenv
Did 'pip install -r requirements.txt' to install dependencies
Then did 'python setup.py install'...install completed without an issue.

Tried to load:

>>> from napalm import get_network_driver
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/kbyers/venv/napalm_test/local/lib/python2.7/site-packages/napalm-0.40-py2.7.egg/napalm/__init__.py", line 17, in <modul
    from junos import JunOSDriver
  File "/home/kbyers/venv/napalm_test/local/lib/python2.7/site-packages/napalm-0.40-py2.7.egg/napalm/junos.py", line 17, in <module>
    from utils import junos_views
  File "/home/kbyers/venv/napalm_test/local/lib/python2.7/site-packages/napalm-0.40-py2.7.egg/utils/junos_views.py", line 7, in <modu
    globals().update(loadyaml(_YAML_))
  File "/home/kbyers/venv/napalm_test/local/lib/python2.7/site-packages/jnpr/junos/factory/__init__.py", line 33, in loadyaml
    return FactoryLoader().load(yaml.load(open(path, 'r')))
IOError: [Errno 2] No such file or directory: '/home/kbyers/venv/napalm_test/local/lib/python2.7/site-packages/napalm-0.40-py2.7.egg/

I can fix the problem if I copy the 'junos_views.yml' file into the ./site-packages/napalm-0.40-py2.7.egg/utils directory.

There is no issue if I do 'pip install napalm', it works without an issue (the ./utils directory doesn't exist in this case).

replace_config required

Ansible task:

- name: Push configuration with napalm
  napalm_install_config:
    hostname: "{{ inventory_hostname }}.{{ domain }}"
    dev_os: ios
    username: "{{ user }}"
    password: "{{ password }}"
    config_file: cisco-configs/{{ inventory_hostname }}/configuration
    commit_changes: False
    diff_file: cisco-config/{{ inventory_hostname }}/diff

Ansible output:

TASK: [cisco-ios | Push configuration with napalm] **************************** 
failed: [host1] => {"failed": true}
msg: missing required arguments: replace_config
failed: [host2] => {"failed": true}
msg: missing required arguments: replace_config

but the code says

replace_config:
        description: If set to True the entire configuration on the device will be replaced during the commit. If
                     set to False, we will merge the new config with the existing one. Default: False.
        required: False

Cannot compare config on IOS

Ansible task:

- name: Push configuration with napalm
  napalm_install_config:
    hostname: "{{ inventory_hostname }}.{{ domain }}"
    dev_os: ios
    username: "{{ user }}"
    password: "{{ password }}"
    config_file: cisco-configs/{{ inventory_hostname }}/configuration
    commit_changes: False
    replace_config: False
    diff_file: cisco-config/{{ inventory_hostname }}/diff

Ansible output:

TASK: [cisco-ios | Push configuration with napalm] **************************** 
failed: [host2] => {"failed": true, "parsed": false}
SSH connection established to host2.example.org:22
Interactive SSH session established
+ hostname host2
Traceback (most recent call last):
  File "/home/t/.ansible/tmp/ansible-tmp-1451918787.56-76835226695125/napalm_install_config", line 1790, in <module>
    main()
  File "/home/t/.ansible/tmp/ansible-tmp-1451918787.56-76835226695125/napalm_install_config", line 161, in main
    diff = device.compare_config().encode('utf-8')
AttributeError: 'NoneType' object has no attribute 'encode'

Same happens with commit_changes: True

iosxr serial number

admin show inventory

not available though xml interface
% 'admin' exec command not supported through XML interface

Cisco IOS support and file transfer mechanism

cc: @GGabriele

Wanted a place to have a discussion on the Cisco IOS implementation in NAPALM related to the following methods:

load_merge_candidate(filename, config):
compare_config():
discard_config():
commit_commit():
rollback():

I have been thinking for Cisco IOS that we should do an SCP file transfer mechanism where the file gets transferred to the box (to flash: or whatever is appropriate probably user option).

transfer new file via SCP to remote network device

load_merge_candidate()

'show archive config differences' between running-config and uploaded file (assumes

complete configuration, however, could handle partial config by doing "more" on the uploaded file)

compare_config()

just don't do the merge/config replace (or potentially delete transferred file)

discard_config()

perform 'configure merge' or 'configure replace' depending on what is appropriate

commit_config()

I think rollback should really be a "configure replace" back to a previous known state

rollback()

Here are some issues that I see with the current method:

  1. Large config changes will be exceptionally slow using Netmiko (and probably any SSH screen scraping mechanism).
  2. Rollback using a 'no' to the command is very problematic (a lot of bad side effects will happen because of this).
  3. IMO the file transfer mechanism is more consistent with the NAPALM paradigm.

I have done proof of concept of a lot of the above, but definitely more work is needed.

I do have concerns about how reliable 'configure replace' is. How transparent is this to the network when you do this?

Wanted to see what people's thoughts are on this?

Cisco IOS driver (placeholder)

Just keeping track of some issues on new Cisco IOS driver:

  1. Need support for inline config merge, config replace (i.e. not from an external file, but from inline in-code).
  2. Unit testing is really slow.
  3. Should automate the testing at the ansible level.
  4. Update unittests to test that invalid commands in a replace config operation get rejected.
  5. There is no diff for a merge operation.
  6. Requirements.txt needs updated to required netmiko version.
  7. What is required to make SCP and TACACS+ work.

Don't have any 'write mem' operation. Fixed
IOS test I have hard-coded the 'flash:' Fixed
Need to test non-standard SSH port. Fixed using optional_args
Need to change order of configuration diff (so + and - sign so up appropriate way). Will need to update the unit test to reflect this also. Fixed
Should null out the merge_config file on discard operations. Fixed
Should really check 'file prompt quiet' initial state and restore to original state (as opposed to just blindly toggling). Did not do
Need to test using Ansible.
Timeout not wired in. Did not do
Is there a better way to implement the rollback function that more directly ties into the configuration archive. Did not do
Do you need 'archive' configured for any of this to work. Need to test on a new device. DBarroso stated silently failed without this. Yes, archive is required
Netmiko version will need to be the current version (need to push new Netmiko version to pypi).
DBarroso stated silently failed without version xx.y on CSR1000v
Test on Py3 (can't do because ncclient and consequently pyez have no py3 support)
Need to document 'ip scp server enable'

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.