Skip to content
This repository was archived by the owner on Feb 10, 2018. It is now read-only.

Commit

Permalink
Merge pull request #162 from napalm-automation/develop
Browse files Browse the repository at this point in the history
Release 0.10.0
  • Loading branch information
mirceaulinic authored Jun 7, 2017
2 parents 5b3b034 + 12663f9 commit e0b6bdd
Show file tree
Hide file tree
Showing 22 changed files with 1,767 additions and 87 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,5 @@ env

test/unit/test_devices.py
report.json

tags
358 changes: 279 additions & 79 deletions napalm_junos/junos.py

Large diffs are not rendered by default.

18 changes: 16 additions & 2 deletions napalm_junos/utils/junos_views.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,17 @@ junos_bgp_uptime_view:

junos_bgp_table:
rpc: get-bgp-neighbor-information
args:
instance: ''
item: bgp-peer

key: peer-address
view: junos_bgp_view

junos_bgp_view:
fields:
remote_as: { peer-as: int }
description: description
peer_fwd_rti: peer-fwd-rti
is_up: { peer-state: True=Established }
is_enabled: { peer-state: False=True }
received_prefixes: { bgp-rib/received-prefix-count: int }
Expand Down Expand Up @@ -330,6 +332,8 @@ junos_bgp_tables_summary_view:

junos_bgp_neighbors_table:
rpc: get-bgp-neighbor-information
args:
instance: ''
args_key: neighbor_address
item: bgp-peer
key: peer-as
Expand All @@ -341,6 +345,7 @@ junos_bgp_neighbors_view:
local_as: {local-as: int}
remote_as: {peer-as: int}
router_id: {peer-id: unicode}
peer_fwd_rti: peer-fwd-rti
local_address: local-address
peer_address: peer-address
options: bgp-option-information/bgp-options
Expand All @@ -350,7 +355,6 @@ junos_bgp_neighbors_view:
output_messages: {output-messages: int}
input_updates: {input-updates: int}
output_updates: {output-updates: int}
messages_queued_out: {bgp-output-queue/count: int}
connection_state: {peer-state: unicode}
previous_connection_state: {last-state: unicode}
last_event: {last-event: unicode}
Expand All @@ -361,8 +365,18 @@ junos_bgp_neighbors_view:
keepalive: {keepalive-interval: int}
configured_keepalive: {keepalive-interval: int}
rib: junos_bgp_rib_table
queue: junos_bgp_queue_table
flap_count: {flap-count: int}

junos_bgp_queue_table:
item: bgp-output-queue
key: table-name
view: junos_bgp_queue_view

junos_bgp_queue_view:
fields:
messages_queued_out: {count: int}

junos_bgp_rib_table:
item: bgp-rib
key: name
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
napalm-base>=0.23.0
junos-eznc
napalm-base>=0.24.1
junos-eznc>=2.1.3
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

setup(
name="napalm-junos",
version="0.6.6",
version="0.10.0",
packages=find_packages(),
author="David Barroso, Mircea Ulinic",
author_email="dbarrosop@dravetech.com, mircea@cloudflare.com",
Expand Down
29 changes: 28 additions & 1 deletion test/unit/conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Test fixtures."""

import lxml
import yaml
import pytest
from napalm_base.test import conftest as parent_conftest

Expand Down Expand Up @@ -48,8 +49,9 @@ class FakeJunOSDevice(BaseTestDouble):
def __init__(self):
self.rpc = FakeRPCObject(self)
self._conn = FakeConnection(self.rpc)
self.alternative_facts_file = 'facts.yml'
self.ON_JUNOS = True # necessary for fake devices
self.facts = {
self.default_facts = {
'domain': None,
'hostname': 'vsrx',
'ifd_style': 'CLASSIC',
Expand All @@ -72,6 +74,20 @@ def __init__(self):
'personality': 'SRX_BRANCH'
}

@property
def facts(self):
try:
alt_facts_filepath = self.find_file(self.alternative_facts_file)
except IOError:
self._facts = self.default_facts
return self._facts
with open(alt_facts_filepath, 'r') as alt_facts:
try:
self._facts.update(yaml.load(alt_facts))
except (yaml.YAMLError, AttributeError):
self._facts = self.default_facts
return self._facts

def open(self):
pass

Expand Down Expand Up @@ -158,3 +174,14 @@ class FakeConnection:

def __init__(self, rpc):
self.rpc = FakeConnectionRPCObject(rpc)
self._session = FakeSession()


class FakeSession:
def __init__(self):
self.transport = FakeTransport()


class FakeTransport:
def set_keepalive(self, keepalive):
self.keepalive = keepalive
Original file line number Diff line number Diff line change
@@ -1 +1,180 @@
{"global": {"router_id": "10.255.255.1", "peers": {"192.168.0.0": {"is_enabled": true, "uptime": 699262, "remote_as": 30000, "description": "", "remote_id": "10.255.255.240", "local_as": 30001, "is_up": true, "address_family": {"ipv4": {"sent_prefixes": 9, "accepted_prefixes": 2, "received_prefixes": 2}}}, "10.3.1.254": {"is_enabled": true, "uptime": 12688391, "remote_as": 29999, "description": "", "remote_id": "10.48.71.105", "local_as": 30001, "is_up": true, "address_family": {"ipv4": {"sent_prefixes": 4, "accepted_prefixes": 7, "received_prefixes": 7}}}, "192.169.1.0": {"is_enabled": true, "uptime": 10808600, "remote_as": 30000, "description": "", "remote_id": "", "local_as": 30001, "is_up": false, "address_family": {}}}}, "frontend": {"router_id": "10.255.254.1", "peers": {"10.2.1.254": {"is_enabled": true, "uptime": 12688392, "remote_as": 29999, "description": "", "remote_id": "10.48.71.105", "local_as": 20001, "is_up": true, "address_family": {"ipv4": {"sent_prefixes": 7, "accepted_prefixes": 4, "received_prefixes": 4}}}, "192.168.0.0": {"is_enabled": true, "uptime": 696446, "remote_as": 20000, "description": "", "remote_id": "10.255.254.240", "local_as": 20001, "is_up": true, "address_family": {"ipv4": {"sent_prefixes": 8, "accepted_prefixes": 3, "received_prefixes": 3}, "ipv6": {"sent_prefixes": 1, "accepted_prefixes": 0, "received_prefixes": 0}}}, "10.2.1.253": {"is_enabled": true, "uptime": 12688372, "remote_as": 29998, "description": "", "remote_id": "10.255.254.252", "local_as": 20001, "is_up": true, "address_family": {"ipv4": {"sent_prefixes": 9, "accepted_prefixes": 2, "received_prefixes": 2}}}, "192.169.1.0": {"is_enabled": true, "uptime": 696506, "remote_as": 20000, "description": "", "remote_id": "", "local_as": 20001, "is_up": false, "address_family": {}}, "2a01:280:100::1": {"is_enabled": true, "uptime": 697008, "remote_as": 20000, "description": "", "remote_id": "", "local_as": 20001, "is_up": false, "address_family": {}}}}}
{
"global": {
"router_id": "10.255.255.1",
"peers": {
"192.168.0.0": {
"description": "",
"remote_id": "10.255.255.240",
"address_family": {
"ipv6": {
"received_prefixes": -1,
"sent_prefixes": -1,
"accepted_prefixes": -1
},
"ipv4": {
"received_prefixes": 2,
"sent_prefixes": 9,
"accepted_prefixes": 2
}
},
"remote_as": 30000,
"is_up": true,
"local_as": 30001,
"is_enabled": true,
"uptime": 699262
},
"10.3.1.254": {
"description": "",
"remote_id": "10.48.71.105",
"address_family": {
"ipv6": {
"received_prefixes": -1,
"sent_prefixes": -1,
"accepted_prefixes": -1
},
"ipv4": {
"received_prefixes": 7,
"sent_prefixes": 4,
"accepted_prefixes": 7
}
},
"remote_as": 29999,
"is_up": true,
"local_as": 30001,
"is_enabled": true,
"uptime": 12688391
},
"192.169.1.0": {
"description": "",
"remote_id": "",
"address_family": {
"ipv6": {
"received_prefixes": -1,
"sent_prefixes": -1,
"accepted_prefixes": -1
},
"ipv4": {
"received_prefixes": -1,
"sent_prefixes": -1,
"accepted_prefixes": -1
}
},
"remote_as": 30000,
"is_up": false,
"local_as": 30001,
"is_enabled": true,
"uptime": 10808600
}
}
},
"frontend": {
"router_id": "10.255.254.1",
"peers": {
"2a01:280:100::1": {
"description": "",
"remote_id": "",
"address_family": {
"ipv6": {
"received_prefixes": -1,
"sent_prefixes": -1,
"accepted_prefixes": -1
},
"ipv4": {
"received_prefixes": -1,
"sent_prefixes": -1,
"accepted_prefixes": -1
}
},
"remote_as": 20000,
"is_up": false,
"local_as": 20001,
"is_enabled": true,
"uptime": 697008
},
"10.2.1.254": {
"description": "",
"remote_id": "10.48.71.105",
"address_family": {
"ipv6": {
"received_prefixes": -1,
"sent_prefixes": -1,
"accepted_prefixes": -1
},
"ipv4": {
"received_prefixes": 4,
"sent_prefixes": 7,
"accepted_prefixes": 4
}
},
"remote_as": 29999,
"is_up": true,
"local_as": 20001,
"is_enabled": true,
"uptime": 12688392
},
"192.168.0.0": {
"description": "",
"remote_id": "10.255.254.240",
"address_family": {
"ipv6": {
"received_prefixes": 0,
"sent_prefixes": 1,
"accepted_prefixes": 0
},
"ipv4": {
"received_prefixes": 3,
"sent_prefixes": 8,
"accepted_prefixes": 3
}
},
"remote_as": 20000,
"is_up": true,
"local_as": 20001,
"is_enabled": true,
"uptime": 696446
},
"10.2.1.253": {
"description": "",
"remote_id": "10.255.254.252",
"address_family": {
"ipv6": {
"received_prefixes": -1,
"sent_prefixes": -1,
"accepted_prefixes": -1
},
"ipv4": {
"received_prefixes": 2,
"sent_prefixes": 9,
"accepted_prefixes": 2
}
},
"remote_as": 29998,
"is_up": true,
"local_as": 20001,
"is_enabled": true,
"uptime": 12688372
},
"192.169.1.0": {
"description": "",
"remote_id": "",
"address_family": {
"ipv6": {
"received_prefixes": -1,
"sent_prefixes": -1,
"accepted_prefixes": -1
},
"ipv4": {
"received_prefixes": -1,
"sent_prefixes": -1,
"accepted_prefixes": -1
}
},
"remote_as": 20000,
"is_up": false,
"local_as": 20001,
"is_enabled": true,
"uptime": 696506
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version: 12.2R6.6
Loading

0 comments on commit e0b6bdd

Please sign in to comment.