napalm-automation / napalm

Network Automation and Programmability Abstraction Layer with Multivendor support
Apache License 2.0
2.25k stars 555 forks source link

get_bgp_config get non committed configuration on JunOS #1026

Closed kpetremann closed 5 years ago

kpetremann commented 5 years ago

Description of Issue/Question

get_bgp_config is getting the configuration from the candidate configuration (not committed) instead of the real configuration on JunOS.

Did you follow the steps from https://github.com/napalm-automation/napalm#faq

Setup

napalm version

(Paste verbatim output from pip freeze | grep napalm between quotes below)

napalm==2.4.0

Network operating system version

(Paste verbatim output from show version - or equivalent - between quotes below)

Model: qfx5100-48s-6q
Junos: 17.4R1-S3.3
JUNOS Base OS boot [17.4R1-S3.3]
JUNOS Base OS Software Suite [17.4R1-S3.3]
JUNOS Crypto Software Suite [17.4R1-S3.3]
JUNOS Online Documentation [17.4R1-S3.3]
JUNOS Crypto Software Suite [17.4R1-S3.3]
JUNOS Kernel Software Suite [17.4R1-S3.3]
JUNOS Packet Forwarding Engine Support (qfx-ex-x86-32) [17.4R1-S3.3]
JUNOS Routing Software Suite [17.4R1-S3.3]
JUNOS jsd [i386-17.4R1-S3.3-jet-1]
JUNOS SDN Software Suite [17.4R1-S3.3]
JUNOS Enterprise Software Suite [17.4R1-S3.3]
JUNOS py-base-i386 [17.4R1-S3.3]
JUNOS py-extensions-i386 [17.4R1-S3.3]
JUNOS Host Software [17.4R1-S3.3]
Junos for Automation Enhancement

Steps to Reproduce the Issue

Script:

import napalm

driver = napalm.get_network_driver('junos')
device1 = driver(hostname="", username="", password="")

device1.open()
device1.get_bgp_config()

Execution:

  1. When there is no configuration in protocols bgp:
> empty
  1. Script output is ok:

    $ python test.py
    {}
  2. We load configuration in the Juniper device without committing it:

    
    # load patch terminal
    [Type ^D at a new line to end input]
    [edit protocols]
    +   bgp {
    +       group TOTO {
    +           neighbor 169.254.254.169;
    +       }
    +   }
    ctrl+D

show | compare

[edit protocols]

run show configuration protocols bgp

empty

  1. Napalm sees the non-committed session:
    $ python test.py
    {'TOTO': {'type': '', 'apply_groups': [], 'remove_private_as': False, 'multipath': False, 'multihop_ttl': 0, 'description': '', 'local_address': '', 'local_as': 0, 'remote_as': 0, 'import_policy': '', 'export_policy': '', 'prefix_limit': {}, 'neighbors': {'169.254.254.169': {'authentication_key': '', 'route_reflector_client': False, 'nhs': False, 'description': '', 'local_address': '', 'local_as': 0, 'remote_as': 0, 'import_policy': '', 'export_policy': '', 'prefix_limit': {}}}}}
mirceaulinic commented 5 years ago

Solved via https://github.com/napalm-automation/napalm/pull/1035.