├── napalm_junos
├── templates
│ ├── schedule_probes.j2
│ ├── set_hostname.j2
│ ├── set_ntp_peers.j2
│ ├── delete_ntp_peers.j2
│ ├── delete_probes.j2
│ └── set_probes.j2
├── utils
│ ├── __init__.py
│ ├── junos_views.py
│ └── junos_views.yml
└── __init__.py
├── requirements.txt
├── test
└── unit
│ ├── junos
│ ├── mock_data
│ │ ├── get-bgp-neighbor-informationbackend.txt
│ │ ├── get-bgp-summary-informationbackend.txt
│ │ ├── _configuration__snmp__community____snmp___configuration_.txt
│ │ ├── get-route-engine-information.txt
│ │ ├── _configuration__services__rpm__probe__test____probe___rpm___services___configuration_.txt
│ │ ├── get-arp-table-information.txt
│ │ ├── _configuration__system__login__user____login___system___configuration_.txt
│ │ ├── get-lldp-neighbors-information.txt
│ │ ├── get-instance-information.txt
│ │ ├── get-environment-information.txt
│ │ ├── get-lldp-interface-neighbors.txt
│ │ ├── get-temperature-threshold-information.txt
│ │ ├── get-lldp-interface-neighbors-information.txt
│ │ ├── _configuration__protocols__bgp__group____bgp___protocols___configuration_.txt
│ │ ├── _configuration__protocols__bgp__group__neighbor____group___bgp___protocols___configuration_.txt
│ │ ├── get-bgp-summary-informationmaster.txt
│ │ ├── get-interface-optics-diagnostics-information.txt
│ │ ├── _configuration__system__ntp__peer____ntp___system___configuration_.txt
│ │ ├── get-bgp-summary-informationfrontend.txt
│ │ ├── get-bgp-neighbor-informationmaster.txt
│ │ ├── _command_traceroute8.8.8.8__command_.txt
│ │ ├── show_ntp_associations_no-resolve.txt
│ │ ├── get-bgp-neighbor-information.txt
│ │ ├── get-route-information.txt
│ │ ├── get-bgp-neighbor-informationfrontend.txt
│ │ └── get-probe-results.txt
│ ├── new_good.diff
│ ├── merge_good.diff
│ ├── merge_good.conf
│ ├── merge_typo.conf
│ ├── initial.conf
│ ├── new_typo.conf
│ └── new_good.conf
│ └── TestJunOSDriver.py
├── AUTHORS
├── pylama.ini
├── MANIFEST.in
├── README.md
├── .gitignore
├── setup.py
├── .travis.yml
└── LICENSE
/napalm_junos/templates/schedule_probes.j2:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | napalm-base
2 | junos-eznc
3 |
--------------------------------------------------------------------------------
/napalm_junos/utils/__init__.py:
--------------------------------------------------------------------------------
1 | # TODO move utils folder inside napalm
--------------------------------------------------------------------------------
/test/unit/junos/mock_data/get-bgp-neighbor-informationbackend.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/AUTHORS:
--------------------------------------------------------------------------------
1 | David Barroso
2 | Elisa Jasinska
3 |
--------------------------------------------------------------------------------
/napalm_junos/templates/set_hostname.j2:
--------------------------------------------------------------------------------
1 | system {
2 | host-name {{hostname}};
3 | }
4 |
--------------------------------------------------------------------------------
/pylama.ini:
--------------------------------------------------------------------------------
1 | [pylama]
2 | linters = mccabe,pep257,pep8,pyflakes
3 | ignore = D203,
4 |
5 | [pylama:pep8]
6 | max_line_length = 120
7 |
--------------------------------------------------------------------------------
/test/unit/junos/new_good.diff:
--------------------------------------------------------------------------------
1 | [edit interfaces ge-0/0/1 unit 0]
2 | + family inet {
3 | + address 192.168.77.11/24;
4 | + }
5 |
--------------------------------------------------------------------------------
/napalm_junos/templates/set_ntp_peers.j2:
--------------------------------------------------------------------------------
1 | system {
2 | ntp {
3 | {% for peer in peers %}
4 | peer {{peer}};
5 | {% endfor %}
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/napalm_junos/templates/delete_ntp_peers.j2:
--------------------------------------------------------------------------------
1 | system {
2 | ntp {
3 | {% for peer in peers %}
4 | delete: peer {{peer}};
5 | {% endfor %}
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/MANIFEST.in:
--------------------------------------------------------------------------------
1 | include requirements.txt
2 | include napalm_junos/utils/*.yml
3 | include napalm_junos/templates/*.j2
4 | include napalm_junos/utils/textfsm_templates/*.tpl
5 |
--------------------------------------------------------------------------------
/test/unit/junos/merge_good.diff:
--------------------------------------------------------------------------------
1 | [edit system]
2 | - host-name junos-CHANGED;
3 | + host-name vsrx;
4 | [edit interfaces ge-0/0/1 unit 0]
5 | - family inet {
6 | - address 192.168.77.11/24;
7 | - }
8 |
--------------------------------------------------------------------------------
/test/unit/junos/mock_data/get-bgp-summary-informationbackend.txt:
--------------------------------------------------------------------------------
1 |
2 | 0
3 | 0
4 | 0
5 |
6 |
--------------------------------------------------------------------------------
/napalm_junos/utils/junos_views.py:
--------------------------------------------------------------------------------
1 | """
2 | Load tables/views
3 | """
4 | from jnpr.junos.factory import loadyaml
5 | from os.path import splitext
6 | _YAML_ = splitext(__file__)[0] + '.yml'
7 | globals().update(loadyaml(_YAML_))
8 |
--------------------------------------------------------------------------------
/test/unit/junos/merge_good.conf:
--------------------------------------------------------------------------------
1 | system {
2 | host-name junos-CHANGED;
3 | }
4 | interfaces {
5 | ge-0/0/1 {
6 | unit 0 {
7 | family inet {
8 | address 192.168.77.11/24;
9 | }
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/test/unit/junos/merge_typo.conf:
--------------------------------------------------------------------------------
1 | system {
2 | host-name junos-CHANGED;
3 | }
4 | interfaces {
5 | ge-0/0/1 {
6 | unt 0 {
7 | family inet {
8 | address 192.168.77.11/24;
9 | }
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/napalm_junos/templates/delete_probes.j2:
--------------------------------------------------------------------------------
1 | services {
2 | rpm {
3 | {% for probe_name, probe_test in probes.iteritems() %}
4 | probe {{probe_name}} {
5 | {% for test_name, test_details in probe_test.iteritems() %}
6 | delete: test {{test_name}};
7 | {% endfor %}
8 | }
9 | {% endfor %}
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://pypi.python.org/pypi/napalm-junos)
2 | [](https://pypi.python.org/pypi/napalm-junos)
3 | [](https://travis-ci.org/napalm-automation/napalm-junos)
4 |
5 |
6 | # napalm-junos
7 |
--------------------------------------------------------------------------------
/test/unit/junos/mock_data/_configuration__snmp__community____snmp___configuration_.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 | noc@cloudflare.com
4 | Stockholm, Sweden
5 | edge02.arn02
6 |
7 | hackme
8 | read-only
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/napalm_junos/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2016 Dravetech AB. All rights reserved.
2 | #
3 | # The contents of this file are licensed under the Apache License, Version 2.0
4 | # (the "License"); you may not use this file except in compliance with the
5 | # License. You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 | # License for the specific language governing permissions and limitations under
13 | # the License.
14 |
15 | """napalm_iosxr package."""
16 | from junos import JunOSDriver
17 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 |
5 | # C extensions
6 | *.so
7 |
8 | # Distribution / packaging
9 | .Python
10 | env/
11 | bin/
12 | build/
13 | develop-eggs/
14 | dist/
15 | eggs/
16 | lib/
17 | lib64/
18 | parts/
19 | sdist/
20 | var/
21 | *.egg-info/
22 | .installed.cfg
23 | *.egg
24 |
25 | # Installer logs
26 | pip-log.txt
27 | pip-delete-this-directory.txt
28 |
29 | # Unit test / coverage reports
30 | htmlcov/
31 | .tox/
32 | .coverage
33 | .cache
34 | nosetests.xml
35 | coverage.xml
36 |
37 | # Translations
38 | *.mo
39 |
40 | # Mr Developer
41 | .mr.developer.cfg
42 | .project
43 | .pydevproject
44 |
45 | # Rope
46 | .ropeproject
47 |
48 | # Django stuff:
49 | *.log
50 | *.pot
51 |
52 | # Sphinx documentation
53 | docs/_build/
54 |
55 | .idea
56 | .DS_Store
57 |
58 | env
59 | *.swp
60 |
61 | test/unit/test_devices.py
62 |
63 |
--------------------------------------------------------------------------------
/napalm_junos/templates/set_probes.j2:
--------------------------------------------------------------------------------
1 | services {
2 | rpm {
3 | {% for probe_name, probe_test in probes.iteritems() %}
4 | probe {{probe_name}} {
5 | {% for test_name, test_details in probe_test.iteritems() %}
6 | test {{test_name}} {
7 | {% if test_details.probe_type is defined %}
8 | probe-type {{test_details.probe_type}};
9 | {% endif %}
10 | target address {{test_details.target}};
11 | {% if test_details.probe_count is defined %}
12 | probe-count {{test_details.probe_count}};
13 | {% endif %}
14 | {% if test_details.test_interval is defined %}
15 | test-interval {{test_details.test_interval}};
16 | {% endif %}
17 | {% if test_details.source is defined %}
18 | source-address {{test_details.source}};
19 | {% endif %}
20 | }
21 | {% endfor %}
22 | }
23 | {% endfor %}
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/setup.py:
--------------------------------------------------------------------------------
1 | """setup.py file."""
2 |
3 | import uuid
4 |
5 | from setuptools import setup, find_packages
6 | from pip.req import parse_requirements
7 |
8 | __author__ = 'David Barroso '
9 |
10 | install_reqs = parse_requirements('requirements.txt', session=uuid.uuid1())
11 | reqs = [str(ir.req) for ir in install_reqs]
12 |
13 | setup(
14 | name="napalm-junos",
15 | version="0.2.1",
16 | packages=find_packages(),
17 | author="David Barroso",
18 | author_email="dbarrosop@dravetech.com",
19 | description="Network Automation and Programmability Abstraction Layer with Multivendor support",
20 | classifiers=[
21 | 'Topic :: Utilities',
22 | 'Programming Language :: Python',
23 | 'Operating System :: POSIX :: Linux',
24 | 'Operating System :: MacOS',
25 | ],
26 | url="https://github.com/napalm-automation/napalm-junos",
27 | include_package_data=True,
28 | install_requires=reqs,
29 | )
30 |
--------------------------------------------------------------------------------
/test/unit/junos/mock_data/get-route-engine-information.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 | 0
4 | master
5 | OK
6 | 36 degrees C / 96 degrees F
7 | 36 degrees C / 96 degrees F
8 | 1024
9 | 55
10 | 2
11 | 0
12 | 1
13 | 0
14 | 97
15 | EX4200-48T, 8 POE
16 | BP0213023897
17 | 2014-05-20 05:41:33 UTC
18 | 525 days, 1 hour, 51 minutes, 25 seconds
19 | Router rebooted after a normal shutdown.
20 | 0.13
21 | 0.17
22 | 0.15
23 |
24 |
25 |
--------------------------------------------------------------------------------
/test/unit/junos/mock_data/_configuration__services__rpm__probe__test____probe___rpm___services___configuration_.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | sjc-loops
6 |
7 | edge01.lax01
8 | icmp-ping
9 |
10 | 192.168.0.1
11 |
12 | 5
13 | 60
14 |
15 |
16 | edge01.pdx01
17 | icmp-ping
18 |
19 | 172.17.17.1
20 |
21 | 10
22 | 3600
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/test/unit/junos/mock_data/get-arp-table-information.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 | 02:01:00:00:00:05
4 | 172.17.17.1
5 | dummy-host
6 | em1.0
7 | 1031
8 |
9 |
10 |
11 |
12 |
13 | 00:0f:53:2b:c5:e1
14 | 172.17.17.3
15 | test-server
16 | ae7.10
17 | 1031
18 |
19 |
20 |
21 |
22 |
23 | 2c:60:0c:7a:7e:63
24 | 172.17.17.2
25 | another-server
26 | ae7.637
27 | 1031
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/test/unit/junos/mock_data/_configuration__system__login__user____login___system___configuration_.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | dummy-test
6 | 1717
7 | unauthorized
8 |
9 | $1$waUQAEpO$kSmdRL84F5sCoWKHZ8/kU1
10 |
11 |
12 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC4pFn+shPwTb2yELO4L7NtQrKOJXNeCl1jel9STXVaGnRAnuc2PXl35vnWmcUq6YbUEcgUTRzzXfmelJKuVJTJIlMXii7h2xkbQp0YZIEs4P8ipwnRBAxFfk/ZcDsN3mjep4/yjN56eorF5xs7zP9HbqbJ1dsqk1p3A/9LIL7l6YewLBCwJj6D+fWSJ0/YW+7oH17Fk2HH+tw0L5PcWLHkwA4t60iXn16qDbIk/ze6jv2hDGdCdz7oYQeCE55CCHOHMJWYfN3jcL4s0qv8/u6Ka1FVkV7iMmro7ChThoV/5snI4Ljf2wKqgHH7TfNaCfpU0WvHAnTs8zhOrGScSrtb mircea@master-roshi
13 |
14 |
15 |
16 |
17 | ssh-dss AAAAB3NzaC1kc3MAAACBAIiXYWuYhY7Wyd3E4JYpT/ilm7Q6G/wLlxPgbx4BWRQL8SbVvP/DVLv+1/4aHk4SvPJmYbcGQbx0tz0pHa3YLmGieLQLVZo44K3IvUXaLf7noUKogwDdGVJ6NRxCROo/uUaU9m8mm4vEQkPgkmrRzNHq1B56AvPmTrRFJc5xPewXAAAAFQDiqOM9bw03MbT4jf59lFSlexRiiQAAAIA0ZJ2dNV9IzeWNexsoQfSz2ABx3INnFvjUAMlWZQtIXAqwUhKAvQBFi6vTpWL9nK4nCUvENyHIgX8S8eG2F1+pRFUHILajiJWkb0+0hGXIgE+rtdsdSCbMzggTOnhr4nMuUqedtas7uwGgOkNoEtsC6uSe0iSf3QbGjyrp8423lAAAAIAR0X7xTJCnV25i14SfelgVztVCl44C/E2A9+EBBR2Dp4CEg3cbstf6Z768S2TxOMpWTr7c81zKI6Ij7qLWxiUlTO7yS3ikiBOpEHbihGeHLn01rHcuGh9+SmOFKeIoq6WJHfZQInO/++WLTtwaZgZzIa1mw18SiFlHFeIX0MfYcA== mircea@master-roshi
18 |
19 |
20 |
21 |
22 | ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFAvVeQxnECAx/HcSfcLdNqCqsjdm64QfVdxBT15pmvzw4eV2RWibqZTfCNbybM5FsB0/jEb2EH2JND4GCBzxUg= mircea@master-roshi
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/test/unit/junos/mock_data/get-lldp-neighbors-information.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 | xe-4/3/6
4 | -
5 | Mac address
6 | 00:1c:73:8f:0a:ed
7 | Interface name
8 | Ethernet1
9 | peer00.lab.demo
10 |
11 |
12 | me0.0
13 | -
14 | Mac address
15 | 00:23:47:50:21:40
16 | 27
17 | lom-bjg61-r1-1
18 |
19 |
20 | ge-0/0/0.0
21 | -
22 | Mac address
23 | 02:e4:c8:6c:a4:00
24 | GigabitEthernet0/0/0/0
25 | rtr00.demo
26 |
27 |
28 | xe-0/1/0.0
29 | -
30 | Mac address
31 | dc:38:e1:b7:26:16
32 | xe-0/0/0
33 | spine00
34 |
35 |
--------------------------------------------------------------------------------
/test/unit/junos/initial.conf:
--------------------------------------------------------------------------------
1 | version 12.1X47-D20.7;
2 | system {
3 | host-name vsrx;
4 | root-authentication {
5 | encrypted-password "$1$5MhDFyrI$NBBMndW1POqbN.0QEA4z0."; ## SECRET-DATA
6 | ssh-rsa "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGnRjHTifULSGZiJA53JQRYuUgqXFJUq74Ste+fY1VBjYPqrBPNWWCKxUZoiVktUxPw1htTQIqanGBAW4fuzum/s4ZbTwswTRkZYi96RKSx6RK8zlwoLKwKhCRrFJKijcKn0ygZWOrcS3LPSr64tjsJJmNdgmNX8QFP7IHVWFFSv2HRIYYc+ibtunwH30RzAsyPeLOTFgRihlnyarO6T6EJsihudMWbHyzQY6DeDvIqZ3QwpcFhrNkVq8hm1D3ozqOEk9IRetEc+DV0g5EGRXQZcQi8PraT8COR8qFijzUBXO2mjVW183JgtfPkkxiikzBtJD5rqj5ymSJHUXNdxzn vagrant"; ## SECRET-DATA
7 | }
8 | login {
9 | user vagrant {
10 | uid 2000;
11 | class super-user;
12 | authentication {
13 | encrypted-password "$1$KMQ6fIje$STNZNzDwjAb46xNonInGq/"; ## SECRET-DATA
14 | ssh-rsa "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key"; ## SECRET-DATA
15 | }
16 | }
17 | }
18 | services {
19 | ssh {
20 | root-login allow;
21 | }
22 | netconf {
23 | ssh;
24 | }
25 | }
26 | syslog {
27 | user * {
28 | any emergency;
29 | }
30 | file messages {
31 | any any;
32 | authorization info;
33 | }
34 | file interactive-commands {
35 | interactive-commands any;
36 | }
37 | }
38 | license {
39 | autoupdate {
40 | url https://ae1.juniper.net/junos/key_retrieval;
41 | }
42 | }
43 | }
44 | interfaces {
45 | ge-0/0/0 {
46 | unit 0 {
47 | family inet {
48 | dhcp;
49 | }
50 | }
51 | }
52 | ge-0/0/1 {
53 | unit 0;
54 | }
55 | }
56 | protocols {
57 | lldp {
58 | interface all;
59 | }
60 | }
61 | security {
62 | forwarding-options {
63 | family {
64 | inet6 {
65 | mode packet-based;
66 | }
67 | mpls {
68 | mode packet-based;
69 | }
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/test/unit/junos/mock_data/get-instance-information.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 | master
4 | forwarding
5 |
6 | inet.0
7 | 4
8 | 0
9 | 0
10 |
11 |
12 |
13 | __juniper_private1__
14 | forwarding
15 |
16 | __juniper_private1__.inet.0
17 | 4
18 | 0
19 | 0
20 |
21 |
22 |
23 | __juniper_private2__
24 | forwarding
25 |
26 | __juniper_private2__.inet.0
27 | 0
28 | 0
29 | 1
30 |
31 |
32 |
33 | __master.anon__
34 | forwarding
35 |
36 |
37 | backend
38 | virtual-router
39 |
40 | backend.inet.0
41 | 16
42 | 0
43 | 0
44 |
45 |
46 |
47 | frontend
48 | virtual-router
49 |
50 | frontend.inet.0
51 | 16
52 | 0
53 | 0
54 |
55 |
56 | frontend.inet6.0
57 | 5
58 | 0
59 | 0
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/test/unit/junos/new_typo.conf:
--------------------------------------------------------------------------------
1 | version 12.1X47-D20.7;
2 | system {
3 | host-name vsrx;
4 | root-authentication {
5 | encrypted-password "$1$5MhDFyrI$NBBMndW1POqbN.0QEA4z0."; ## SECRET-DATA
6 | ssh-rsa "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGnRjHTifULSGZiJA53JQRYuUgqXFJUq74Ste+fY1VBjYPqrBPNWWCKxUZoiVktUxPw1htTQIqanGBAW4fuzum/s4ZbTwswTRkZYi96RKSx6RK8zlwoLKwKhCRrFJKijcKn0ygZWOrcS3LPSr64tjsJJmNdgmNX8QFP7IHVWFFSv2HRIYYc+ibtunwH30RzAsyPeLOTFgRihlnyarO6T6EJsihudMWbHyzQY6DeDvIqZ3QwpcFhrNkVq8hm1D3ozqOEk9IRetEc+DV0g5EGRXQZcQi8PraT8COR8qFijzUBXO2mjVW183JgtfPkkxiikzBtJD5rqj5ymSJHUXNdxzn vagrant"; ## SECRET-DATA
7 | }
8 | login {
9 | user vagrant {
10 | uid 2000;
11 | class super-user;
12 | authentication {
13 | encrypted-password "$1$KMQ6fIje$STNZNzDwjAb46xNonInGq/"; ## SECRET-DATA
14 | ssh-rsa "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key"; ## SECRET-DATA
15 | }
16 | }
17 | }
18 | services {
19 | ssh {
20 | root-login allow;
21 | }
22 | netconf {
23 | ssh;
24 | }
25 | }
26 | syslog {
27 | user * {
28 | any emergency;
29 | }
30 | file messages {
31 | any any;
32 | authorization info;
33 | }
34 | file interactive-commands {
35 | interactive-commands any;
36 | }
37 | }
38 | license {
39 | autoupdate {
40 | url https://ae1.juniper.net/junos/key_retrieval;
41 | }
42 | }
43 | }
44 | interfaces {
45 | ge-0/0/0 {
46 | unit 0 {
47 | family inet {
48 | dhcp;
49 | }
50 | }
51 | }
52 | ge-0/0/1 {
53 | unt 0 {
54 | family inet {
55 | address 192.168.77.11/24;
56 | }
57 | }
58 | }
59 | }
60 | protocols {
61 | lldp {
62 | interface all;
63 | }
64 | }
65 | security {
66 | forwarding-options {
67 | family {
68 | inet6 {
69 | mode packet-based;
70 | }
71 | mpls {
72 | mode packet-based;
73 | }
74 | }
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/test/unit/junos/new_good.conf:
--------------------------------------------------------------------------------
1 | version 12.1X47-D20.7;
2 | system {
3 | host-name vsrx;
4 | root-authentication {
5 | encrypted-password "$1$5MhDFyrI$NBBMndW1POqbN.0QEA4z0."; ## SECRET-DATA
6 | ssh-rsa "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGnRjHTifULSGZiJA53JQRYuUgqXFJUq74Ste+fY1VBjYPqrBPNWWCKxUZoiVktUxPw1htTQIqanGBAW4fuzum/s4ZbTwswTRkZYi96RKSx6RK8zlwoLKwKhCRrFJKijcKn0ygZWOrcS3LPSr64tjsJJmNdgmNX8QFP7IHVWFFSv2HRIYYc+ibtunwH30RzAsyPeLOTFgRihlnyarO6T6EJsihudMWbHyzQY6DeDvIqZ3QwpcFhrNkVq8hm1D3ozqOEk9IRetEc+DV0g5EGRXQZcQi8PraT8COR8qFijzUBXO2mjVW183JgtfPkkxiikzBtJD5rqj5ymSJHUXNdxzn vagrant"; ## SECRET-DATA
7 | }
8 | login {
9 | user vagrant {
10 | uid 2000;
11 | class super-user;
12 | authentication {
13 | encrypted-password "$1$KMQ6fIje$STNZNzDwjAb46xNonInGq/"; ## SECRET-DATA
14 | ssh-rsa "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key"; ## SECRET-DATA
15 | }
16 | }
17 | }
18 | services {
19 | ssh {
20 | root-login allow;
21 | }
22 | netconf {
23 | ssh;
24 | }
25 | }
26 | syslog {
27 | user * {
28 | any emergency;
29 | }
30 | file messages {
31 | any any;
32 | authorization info;
33 | }
34 | file interactive-commands {
35 | interactive-commands any;
36 | }
37 | }
38 | license {
39 | autoupdate {
40 | url https://ae1.juniper.net/junos/key_retrieval;
41 | }
42 | }
43 | }
44 | interfaces {
45 | ge-0/0/0 {
46 | unit 0 {
47 | family inet {
48 | dhcp;
49 | }
50 | }
51 | }
52 | ge-0/0/1 {
53 | unit 0 {
54 | family inet {
55 | address 192.168.77.11/24;
56 | }
57 | }
58 | }
59 | ge-0/0/1 {
60 | unit 0;
61 | }
62 | }
63 | protocols {
64 | lldp {
65 | interface all;
66 | }
67 | }
68 | security {
69 | forwarding-options {
70 | family {
71 | inet6 {
72 | mode packet-based;
73 | }
74 | mpls {
75 | mode packet-based;
76 | }
77 | }
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: python
2 | python:
3 | - 2.7
4 | install:
5 | - pip install -r requirements.txt
6 | - pip install .
7 | - pip install -e git+https://github.com/napalm-automation/napalm-base.git@develop#egg=napalm-base
8 | deploy:
9 | provider: pypi
10 | user: dbarroso
11 | password:
12 | secure: gK2otiNZdUlFK/5smZ5iftd6zXRBzvTqA4Xw9OulVJmhIwRyMv0g/OSjLj29HYVZNr2bord7DPWD6iAeMXeHqjuiCKYmy2z4u2bIqPbRJ4G488dZM+lTGK46Uz7XtjGN24wt3EHsG++bj+Gc3aKy2K5UoxdlGaxAosr2WrGJmupLFN/upmVgJEHQFYm14ByQ4joUjPZW3zWYKOJJvCK4WY9l/v6ejYZMHlTgCFkhoxn2AjtFyItGO3YxNr6RH075d8j64WF2vihB9CBFpqqQVuzk3dSljePDF1W0goex5NqVyQa+6yRy7FAHpQbAPm6BkEbMdPIdmpThXN48M9vbZ/Avn4DXU3AZrJUw59U8vPe3IR3WrJzIjAJ1CnCoUgPZqgf0eZHezKNjs2ww1S7fVhX7iY6ahpUucGXp5Hffyv2uD9p4hT/Oiz4p2B5ZHQcN2D3AtWGYm2gNVfEPyZqZiSIel5a0BpYqPOBHiC9oKNEhTNRYU6oUL/jzZy3MJnc779qF/e70NdA4xq+TMYk6aF4yLSB0YaEjQq6dxPn6wwoPTwdrPvu8A00MSvzAZ/2mNb2KIi/dh7C3dXoxrIKN5gKJzf+YFFAgQNqtVDBrZdYghywkzH0evE8WbGSf/hv1OQsKf8TUGT0EH63n8qCdqoYjJBTjycvBdSkMXAZC5rA=
13 | on:
14 | tags: true
15 | branch: master
16 | script:
17 |
18 | - cd test/unit
19 | - nosetests -v TestJunOSDriver:TestGetterJunOSDriver.test_get_bgp_config
20 | - nosetests -v TestJunOSDriver:TestGetterJunOSDriver.test_get_bgp_neighbors
21 | - nosetests -v TestJunOSDriver:TestGetterJunOSDriver.test_get_bgp_neighbors_detail
22 | - nosetests -v TestJunOSDriver:TestGetterJunOSDriver.test_get_environment
23 | - nosetests -v TestJunOSDriver:TestGetterJunOSDriver.test_get_facts
24 | - nosetests -v TestJunOSDriver:TestGetterJunOSDriver.test_get_interfaces
25 | - nosetests -v TestJunOSDriver:TestGetterJunOSDriver.test_get_interfaces_counters
26 | - nosetests -v TestJunOSDriver:TestGetterJunOSDriver.test_get_lldp_neighbors
27 | - nosetests -v TestJunOSDriver:TestGetterJunOSDriver.test_get_lldp_neighbors_detail
28 | - nosetests -v TestJunOSDriver:TestGetterJunOSDriver.test_get_arp_table
29 | - nosetests -v TestJunOSDriver:TestGetterJunOSDriver.test_get_ntp_peers
30 | - nosetests -v TestJunOSDriver:TestGetterJunOSDriver.test_get_ntp_stats
31 | - nosetests -v TestJunOSDriver:TestGetterJunOSDriver.test_get_interfaces_ip
32 | - nosetests -v TestJunOSDriver:TestGetterJunOSDriver.test_get_mac_address_table
33 | - nosetests -v TestJunOSDriver:TestGetterJunOSDriver.test_get_route_to
34 | - nosetests -v TestJunOSDriver:TestGetterJunOSDriver.test_get_snmp_information
35 | - nosetests -v TestJunOSDriver:TestGetterJunOSDriver.test_get_probes_config
36 | - nosetests -v TestJunOSDriver:TestGetterJunOSDriver.test_get_probes_results
37 | - nosetests -v TestJunOSDriver:TestGetterJunOSDriver.test_traceroute
38 | - nosetests -v TestJunOSDriver:TestGetterJunOSDriver.test_get_users
39 | - nosetests -v TestJunOSDriver:TestGetterJunOSDriver.test_get_optics
40 | - cd ../..
41 |
--------------------------------------------------------------------------------
/test/unit/junos/mock_data/get-environment-information.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 | FPC 0 Power Supply 0
4 | Power
5 | OK
6 |
7 |
8 | FPC 0 Power Supply 1
9 | Power
10 | OK
11 |
12 |
13 | FPC 0 CPU
14 | Temp
15 | OK
16 | 36 degrees C / 96 degrees F
17 |
18 |
19 | FPC 0 EX-PFE1
20 | Temp
21 | OK
22 | 48 degrees C / 118 degrees F
23 |
24 |
25 | FPC 0 EX-PFE2
26 | Temp
27 | OK
28 | 67 degrees C / 152 degrees F
29 |
30 |
31 | FPC 0 EX-PFE3
32 | Temp
33 | OK
34 | 52 degrees C / 125 degrees F
35 |
36 |
37 | FPC 0 GEPHY Front Left
38 | Temp
39 | OK
40 | 41 degrees C / 105 degrees F
41 |
42 |
43 | FPC 0 GEPHY Front Middle
44 | Temp
45 | OK
46 | 51 degrees C / 123 degrees F
47 |
48 |
49 | FPC 0 GEPHY Front Right
50 | Temp
51 | OK
52 | 40 degrees C / 104 degrees F
53 |
54 |
55 | FPC 0 Uplink Conn
56 | Temp
57 | OK
58 | 45 degrees C / 113 degrees F
59 |
60 |
61 | FPC 0 Fan 1
62 | Fans
63 | OK
64 | Spinning at full speed
65 |
66 |
67 | FPC 0 Fan 2
68 | Fans
69 | OK
70 | Spinning at full speed
71 |
72 |
73 | FPC 0 Fan 3
74 | Fans
75 | OK
76 | Spinning at full speed
77 |
78 |
79 |
--------------------------------------------------------------------------------
/test/unit/junos/mock_data/get-lldp-interface-neighbors.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 | 115
4 | 120
5 | Mon Feb 22 12:29:41 2016
6 | 1
7 | xe-4/3/6
8 | ae7
9 | 922
10 | 0
11 | Mac address
12 | 00:1c:73:ee:c0:46
13 | Interface name
14 | Ethernet4/33/3
15 | core01.sjc01
16 |
17 | Arista Networks EOS version 4.14.8M running on an Arista Networks DCS-7504
18 |
19 | Bridge Router
20 | Bridge
21 | IPv4(1)
22 | 172.17.17.1
23 | 2000900
24 | ifIndex(2)
25 |
26 | 0080c2
27 | (1)
28 | 0001
29 | 1
30 | 00120f
31 | 3
32 | 3
33 | 1000100
34 | 2
35 | 00120f
36 | 4
37 | 9236
38 | 3
39 |
40 |
--------------------------------------------------------------------------------
/test/unit/junos/mock_data/get-temperature-threshold-information.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 | FPC 0 CPU
4 | 60
5 | 70
6 | 70
7 | 85
8 | 80
9 | 95
10 |
11 |
12 | FPC 0 EX-PFE1
13 | 60
14 | 70
15 | 70
16 | 85
17 | 80
18 | 95
19 |
20 |
21 | FPC 0 EX-PFE2
22 | 60
23 | 70
24 | 70
25 | 85
26 | 80
27 | 95
28 |
29 |
30 | FPC 0 EX-PFE3
31 | 60
32 | 70
33 | 70
34 | 85
35 | 80
36 | 95
37 |
38 |
39 | FPC 0 GEPHY Front Left
40 | 60
41 | 70
42 | 70
43 | 85
44 | 80
45 | 95
46 |
47 |
48 | FPC 0 GEPHY Front Middle
49 | 60
50 | 70
51 | 70
52 | 85
53 | 80
54 | 95
55 |
56 |
57 | FPC 0 GEPHY Front Right
58 | 60
59 | 70
60 | 70
61 | 85
62 | 80
63 | 95
64 |
65 |
66 | FPC 0 Uplink Conn
67 | 60
68 | 70
69 | 70
70 | 85
71 | 80
72 | 95
73 |
74 |
75 |
--------------------------------------------------------------------------------
/test/unit/junos/mock_data/get-lldp-interface-neighbors-information.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 | 23
4 | 120
5 | Mon Apr 18 10:04:06 2016
6 | 29
7 | xe-0/1/0.0
8 | ae0.0
9 | 600
10 | 0
11 | Mac address
12 | 00:1c:73:ee:c0:46
13 | Interface name
14 | Ethernet3/2/1
15 | Po1:sw21.tpe01:xe-0/1/0
16 | core05.tpe01
17 |
18 | Arista Networks EOS version 4.14.8M running on an Arista Networks DCS-7504
19 |
20 | Bridge Router
21 | Bridge
22 | IPv4
23 | 199.27.130.35
24 | 2000900
25 | 1
26 | ifIndex(2)
27 | 1.3.6.1.2.1.31.1.1.1.1.2000900
28 | 0.80.c2
29 | 1
30 | 1
31 | 0001
32 | 0.12.f
33 | 3
34 | 2
35 | 03000F4241
36 | 0.12.f
37 | 4
38 | 3
39 | 2414
40 |
41 |
42 |
--------------------------------------------------------------------------------
/test/unit/junos/mock_data/_configuration__protocols__bgp__group____bgp___protocols___configuration_.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | bgp
10 | 1000000
11 | 20
12 |
13 |
14 | keepalive
15 |
16 |
17 | state
18 |
19 |
20 | task
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 | PEERS-GROUP-NAME
38 | BGP-PREFIX-LIMIT
39 | external
40 | PUBLIC-PEER-IN
41 | PUBLIC-PEER-OUT
42 |
43 |
44 |
45 | 13335
46 |
47 |
48 |
49 |
50 | 192.168.0.1
51 | Facebook [CDN]
52 |
53 |
54 |
55 |
56 | 100
57 |
58 |
59 |
60 |
61 | 32934
62 |
63 |
64 | 172.17.17.1
65 | Twitter [CDN]
66 |
67 |
68 |
69 |
70 | 500
71 |
72 |
73 | IMPORT-FLOW-ROUTES
74 |
75 |
76 |
77 |
78 | 13414
79 |
80 |
81 |
82 |
83 |
--------------------------------------------------------------------------------
/test/unit/junos/mock_data/_configuration__protocols__bgp__group__neighbor____group___bgp___protocols___configuration_.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | bgp
10 | 1000000
11 | 20
12 |
13 |
14 | keepalive
15 |
16 |
17 | state
18 |
19 |
20 | task
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 | PEERS-GROUP-NAME
38 | BGP-PREFIX-LIMIT
39 | external
40 | PUBLIC-PEER-IN
41 | PUBLIC-PEER-OUT
42 |
43 |
44 |
45 | 13335
46 |
47 |
48 |
49 |
50 | 192.168.0.1
51 | Facebook [CDN]
52 |
53 |
54 |
55 |
56 | 100
57 |
58 |
59 |
60 |
61 | 32934
62 |
63 |
64 | 172.17.17.1
65 | Twitter [CDN]
66 |
67 |
68 |
69 |
70 | 500
71 |
72 |
73 | IMPORT-FLOW-ROUTES
74 |
75 |
76 |
77 |
78 | 13414
79 |
80 |
81 |
82 |
83 |
--------------------------------------------------------------------------------
/test/unit/junos/mock_data/get-bgp-summary-informationmaster.txt:
--------------------------------------------------------------------------------
1 |
2 | 2
3 | 3
4 | 1
5 |
6 | backend.inet.0
7 | 9
8 | 9
9 | 9
10 | 9
11 | 0
12 | 0
13 | 0
14 | 9
15 | 9
16 | 9
17 | 0
18 | 0
19 | 0
20 | 0
21 | 0
22 | 0
23 | BGP restart is complete
24 | VPN restart is complete
25 |
26 |
27 | backend.mdt.0
28 | 0
29 | 0
30 | 0
31 | 0
32 | 0
33 | 0
34 | 0
35 | 0
36 | 0
37 | 0
38 | 0
39 | 0
40 | 0
41 | 0
42 | 0
43 | 0
44 | BGP restart is complete
45 | VPN restart is complete
46 |
47 |
48 | 10.3.1.254
49 | 4290029999
50 | 483718
51 | 463556
52 | 0
53 | 0
54 | 20w6d20h
55 | Established
56 |
57 | backend.inet.0
58 | 7
59 | 7
60 | 7
61 | 0
62 |
63 |
64 |
65 | 192.168.0.0
66 | 4290030000
67 | 464786
68 | 463581
69 | 0
70 | 1
71 | 1w1d2h
72 | Established
73 |
74 | backend.inet.0
75 | 2
76 | 2
77 | 2
78 | 0
79 |
80 |
81 |
82 | 192.169.1.0
83 | 4290030000
84 | 42
85 | 47
86 | 0
87 | 11
88 | 17w6d2h
89 | Active
90 |
91 |
--------------------------------------------------------------------------------
/test/unit/junos/mock_data/get-interface-optics-diagnostics-information.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | xe-0/0/0
5 |
6 | 44.298
7 | 0.7320
8 | -1.35
9 | 45 degrees C / 113 degrees F
10 | 3.3150
11 | 0.4546
12 | -3.42
13 | off
14 | off
15 | off
16 | off
17 | off
18 | off
19 | off
20 | off
21 | off
22 | off
23 | off
24 | off
25 | off
26 | off
27 | off
28 | off
29 | off
30 | off
31 | off
32 | off
33 | 85.000
34 | 15.000
35 | 80.000
36 | 20.000
37 | 1.5840
38 | 2.00
39 | 0.1580
40 | -8.01
41 | 1.2580
42 | 1.00
43 | 0.1990
44 | -7.01
45 | 78 degrees C / 172 degrees F
46 | -13 degrees C / 9 degrees F
47 |
48 | 73 degrees C / 163 degrees F
49 |
50 | -8 degrees C / 18 degrees F
51 | 3.700
52 | 2.900
53 | 3.600
54 | 3.000
55 | 1.7783
56 | 2.50
57 | 0.0100
58 | -20.00
59 | 1.5849
60 | 2.00
61 | 0.0158
62 | -18.01
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/test/unit/junos/mock_data/_configuration__system__ntp__peer____ntp___system___configuration_.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 199.27.130.22
6 |
7 |
8 | 199.27.130.18
9 |
10 |
11 | 199.27.128.10
12 |
13 |
14 | 199.27.131.10
15 |
16 |
17 | 199.27.132.10
18 |
19 |
20 | 173.245.52.10
21 |
22 |
23 | 173.245.48.10
24 |
25 |
26 | 173.245.55.10
27 |
28 |
29 | 173.245.50.10
30 |
31 |
32 | 173.245.56.10
33 |
34 |
35 | 108.162.210.10
36 |
37 |
38 | 173.245.51.10
39 |
40 |
41 | 173.245.49.10
42 |
43 |
44 | 173.245.53.10
45 |
46 |
47 | 141.101.70.10
48 |
49 |
50 | 103.22.200.10
51 |
52 |
53 | 173.245.62.10
54 |
55 |
56 | 173.245.57.37
57 |
58 |
59 | 108.162.248.4
60 |
61 |
62 | 108.162.236.4
63 |
64 |
65 | 108.162.244.4
66 |
67 |
68 | 108.162.240.4
69 |
70 |
71 | 141.101.91.4
72 |
73 |
74 | 141.101.95.4
75 |
76 |
77 | 141.101.79.4
78 |
79 |
80 | 141.101.87.4
81 |
82 |
83 | 141.101.83.4
84 |
85 |
86 | 103.31.5.4
87 |
88 |
89 | 103.21.246.130
90 |
91 |
92 | 108.162.253.130
93 |
94 |
95 | 141.101.101.4
96 |
97 |
98 | 188.114.101.4
99 |
100 |
101 | 188.114.109.4
102 |
103 |
104 | 141.101.109.4
105 |
106 |
107 | 188.114.97.4
108 |
109 |
110 | 198.41.225.4
111 |
112 |
113 | 197.234.241.4
114 |
115 |
116 | 198.41.237.4
117 |
118 |
119 | 198.41.241.4
120 |
121 |
122 | 199.27.130.26
123 |
124 |
125 | 199.27.130.39
126 |
127 |
128 | 2400:cb00:4:1024::c71b:800a
129 |
130 |
131 | 2400:cb00:5:1024::c71b:830a
132 |
133 |
134 | 2400:cb00:6:1024::c71b:840a
135 |
136 |
137 | 2400:cb00:11:1024::adf5:340a
138 |
139 |
140 | 2400:cb00:12:1024::adf5:300a
141 |
142 |
143 | 2400:cb00:14:1024::adf5:370a
144 |
145 |
146 | 2400:cb00:15:1024::adf5:320a
147 |
148 |
149 | 2400:cb00:16:1024::adf5:380a
150 |
151 |
152 | 2400:cb00:17:1024::6ca2:d20a
153 |
154 |
155 | 2400:cb00:18:1024::adf5:330a
156 |
157 |
158 |
159 |
160 |
--------------------------------------------------------------------------------
/test/unit/TestJunOSDriver.py:
--------------------------------------------------------------------------------
1 | # Copyright 2015 Spotify AB. All rights reserved.
2 | #
3 | # The contents of this file are licensed under the Apache License, Version 2.0
4 | # (the "License"); you may not use this file except in compliance with the
5 | # License. You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 | # License for the specific language governing permissions and limitations under
13 | # the License.
14 |
15 | import unittest
16 |
17 | from napalm_junos.junos import JunOSDriver
18 | from napalm_base.test.base import TestConfigNetworkDriver, TestGettersNetworkDriver
19 |
20 | import lxml
21 |
22 |
23 | class TestConfigJunOSDriver(unittest.TestCase, TestConfigNetworkDriver):
24 |
25 | @classmethod
26 | def setUpClass(cls):
27 | hostname = '127.0.0.1'
28 | username = 'vagrant'
29 | password = 'vagrant123'
30 | cls.vendor = 'junos'
31 |
32 | optional_args = {'port': 12203,}
33 | cls.device = JunOSDriver(hostname, username, password, timeout=60, optional_args=optional_args)
34 | cls.device.open()
35 |
36 |
37 | class TestGetterJunOSDriver(unittest.TestCase, TestGettersNetworkDriver):
38 |
39 | @classmethod
40 | def setUpClass(cls):
41 | cls.mock = True
42 |
43 | hostname = '192.168.56.203'
44 | username = 'vagrant'
45 | password = 'vagrant123'
46 | cls.vendor = 'junos'
47 |
48 | cls.device = JunOSDriver(hostname, username, password, timeout=60)
49 |
50 | if cls.mock:
51 | cls.device.device = FakeJunOSDevice()
52 | else:
53 | cls.device.open()
54 |
55 |
56 | class FakeJunOSDevice:
57 |
58 | def __init__(self):
59 | self.rpc = FakeRPCObject(self)
60 | self._conn = FakeConnection(self.rpc)
61 | self.ON_JUNOS = True # necessary for fake devices
62 | self.facts = {
63 | 'domain': None,
64 | 'hostname': 'vsrx',
65 | 'ifd_style': 'CLASSIC',
66 | '2RE': False,
67 | 'serialnumber': 'beb914a9cca3',
68 | 'fqdn': 'vsrx',
69 | 'virtual': True,
70 | 'switch_style': 'NONE',
71 | 'version': '12.1X47-D20.7',
72 | 'HOME': '/cf/var/home/vagrant',
73 | 'srx_cluster': False,
74 | 'model': 'FIREFLY-PERIMETER',
75 | 'RE0': {
76 | 'status': 'Testing',
77 | 'last_reboot_reason': 'Router rebooted after a normal shutdown.',
78 | 'model': 'FIREFLY-PERIMETER RE',
79 | 'up_time': '1 hour, 13 minutes, 37 seconds'
80 | },
81 | 'vc_capable': False,
82 | 'personality': 'SRX_BRANCH'
83 | }
84 |
85 |
86 | def read_txt_file(self, filename):
87 | with open(filename) as data_file:
88 | return data_file.read()
89 |
90 |
91 | def cli(self, command=''):
92 | return self.read_txt_file(
93 | 'junos/mock_data/{parsed_command}.txt'.format(
94 | parsed_command = command.replace(' ', '_')
95 | )
96 | )
97 |
98 |
99 | class FakeRPCObject:
100 |
101 | """
102 | Fake RPC caller.
103 | """
104 |
105 | def __init__(self, device):
106 | self._device = device
107 |
108 |
109 | def __getattr__(self, item):
110 | self.item = item
111 | return self
112 |
113 |
114 | def response(self, **rpc_args):
115 | instance = rpc_args.pop('instance', '')
116 |
117 | xml_string = self._device.read_txt_file('junos/mock_data/{}{}.txt'.format(self.item, instance))
118 | return lxml.etree.fromstring(xml_string)
119 |
120 |
121 | def get_config(self, get_cmd='', options={}):
122 |
123 | # get_cmd is an XML tree that requests a specific part of the config
124 | # E.g.:
125 |
126 | get_cmd_str = lxml.etree.tostring(get_cmd)
127 | filename = get_cmd_str.replace('<', '_').replace('>', '_').replace('/', '_').replace('\n', '').replace(' ', '')
128 |
129 | xml_string = self._device.read_txt_file(
130 | 'junos/mock_data/{filename}.txt'.format(
131 | filename = filename[0:150]
132 | )
133 | )
134 | return lxml.etree.fromstring(xml_string)
135 |
136 |
137 | __call__ = response
138 |
139 |
140 | class FakeConnectionRPCObject:
141 |
142 | """
143 | Will make fake RPC requests that usually are directly made via netconf.
144 | """
145 |
146 | def __init__(self, rpc):
147 | self._rpc = rpc
148 |
149 |
150 | def response(self, non_std_command=None):
151 | class RPCReply:
152 | def __init__(self, reply):
153 | self._NCElement__doc = reply
154 | rpc_reply = RPCReply(self._rpc.get_config(get_cmd=non_std_command))
155 | return rpc_reply
156 |
157 |
158 | __call__ = response
159 |
160 |
161 | class FakeConnection:
162 |
163 | def __init__(self, rpc):
164 | self.rpc = FakeConnectionRPCObject(rpc)
165 |
--------------------------------------------------------------------------------
/test/unit/junos/mock_data/get-bgp-summary-informationfrontend.txt:
--------------------------------------------------------------------------------
1 |
2 | 3
3 | 5
4 | 2
5 |
6 | frontend.inet.0
7 | 9
8 | 9
9 | 9
10 | 9
11 | 0
12 | 0
13 | 0
14 | 9
15 | 9
16 | 9
17 | 0
18 | 0
19 | 0
20 | 0
21 | 0
22 | 0
23 | BGP restart is complete
24 | VPN restart is complete
25 |
26 |
27 | frontend.mdt.0
28 | 0
29 | 0
30 | 0
31 | 0
32 | 0
33 | 0
34 | 0
35 | 0
36 | 0
37 | 0
38 | 0
39 | 0
40 | 0
41 | 0
42 | 0
43 | 0
44 | BGP restart is complete
45 | VPN restart is complete
46 |
47 |
48 | frontend.inet6.0
49 | 0
50 | 0
51 | 0
52 | 0
53 | 0
54 | 0
55 | 0
56 | 0
57 | 0
58 | 0
59 | 0
60 | 0
61 | 0
62 | 0
63 | 0
64 | 0
65 | BGP restart is complete
66 | VPN restart is complete
67 |
68 |
69 | 10.2.1.253
70 | 4290029998
71 | 422682
72 | 463590
73 | 0
74 | 0
75 | 20w6d20h
76 | Established
77 |
78 | frontend.inet.0
79 | 2
80 | 2
81 | 2
82 | 0
83 |
84 |
85 |
86 | 10.2.1.254
87 | 4290029999
88 | 483697
89 | 463564
90 | 0
91 | 0
92 | 20w6d20h
93 | Established
94 |
95 | frontend.inet.0
96 | 4
97 | 4
98 | 4
99 | 0
100 |
101 |
102 |
103 | 192.168.0.0
104 | 4290020000
105 | 25531
106 | 25461
107 | 0
108 | 1
109 | 1w1d1h
110 | Established
111 |
112 | frontend.inet.0
113 | 3
114 | 3
115 | 3
116 | 0
117 |
118 |
119 | frontend.inet6.0
120 | 0
121 | 0
122 | 0
123 | 0
124 |
125 |
126 |
127 | 192.169.1.0
128 | 4290020000
129 | 0
130 | 0
131 | 0
132 | 0
133 | 1w1d1h
134 | Active
135 |
136 |
137 | 2a01:280:100::1
138 | 4290020000
139 | 81
140 | 90
141 | 0
142 | 1
143 | 1w1d1h
144 | Idle
145 |
146 |
147 |
--------------------------------------------------------------------------------
/test/unit/junos/mock_data/get-bgp-neighbor-informationmaster.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 | 10.3.1.254+1048
4 | 4290029999
5 | 10.3.1.1+179
6 | 4290030001
7 | External
8 | Established
9 | Sync
10 | OpenConfirm
11 | RecvKeepAlive
12 | None
13 |
14 | NORMAL-BACKEND
15 | Preference PeerAS Multipath Refresh
16 |
17 | 90
18 | 170
19 |
20 | 0
21 | 10.48.71.105
22 | 10.255.255.1
23 | 90
24 | 30
25 | 2
26 | 0
27 |
28 | disabled
29 | down
30 |
31 | vlan.3
32 | 614
33 | inet-unicast
34 | inet-unicast inet6-unicast
35 | inet-unicast
36 | 2
37 | 300
38 |
39 |
40 | 4290029999
41 |
42 |
43 | backend.inet.0
44 | 10001
45 | BGP restart is complete
46 | VPN restart is complete
47 | in sync
48 | 7
49 | 7
50 | 7
51 | 0
52 | 4
53 |
54 | 18
55 | 15
56 | 61
57 | 483718
58 | 35
59 | 0
60 | 9191647
61 | 463556
62 | 29
63 | 0
64 | 8808279
65 |
66 | 0
67 | 0
68 |
69 |
70 |
71 | 192.168.0.0+179
72 | 4290030000
73 | 192.168.0.1+56371
74 | 4290030001
75 | External
76 | Established
77 | Sync
78 | OpenConfirm
79 | RecvKeepAlive
80 | Cease
81 |
82 | NORMAL-BACKEND
83 | Preference PeerAS Multipath Refresh
84 |
85 | 90
86 | 170
87 |
88 | 1
89 | Stop
90 |
91 | Cease
92 | 1
93 | 0
94 |
95 | 10.255.255.240
96 | 10.255.255.1
97 | 90
98 | 30
99 | 0
100 | 0
101 |
102 | disabled
103 | down
104 |
105 | xe-0/1/0.3
106 | 608
107 | inet-unicast
108 | inet-unicast
109 | inet-unicast
110 | 2
111 | 300
112 |
113 | inet-unicast
114 | inet-unicast
115 | inet-unicast
116 |
117 | 4290030000
118 |
119 |
120 | backend.inet.0
121 | 10000
122 | BGP restart is complete
123 | VPN restart is complete
124 | in sync
125 | 2
126 | 2
127 | 2
128 | 0
129 | 9
130 |
131 | 8
132 | 27
133 | 59
134 | 464786
135 | 8
136 | 0
137 | 8831156
138 | 463581
139 | 39
140 | 0
141 | 8809363
142 |
143 | 0
144 | 0
145 |
146 |
147 |
148 | 192.169.1.0
149 | 4290030000
150 | 192.169.1.1
151 | 4290030001
152 | External
153 | Active
154 |
155 | Idle
156 | Start
157 | Cease
158 |
159 | NORMAL-BACKEND
160 | Preference PeerAS Multipath Refresh
161 |
162 | 90
163 | 170
164 |
165 | 11
166 | RecvNotify
167 |
168 | Cease
169 | 6
170 | 4
171 |
172 |
173 |
174 |
175 |
--------------------------------------------------------------------------------
/test/unit/junos/mock_data/_command_traceroute8.8.8.8__command_.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.8.8.8
5 |
6 |
7 | 8.8.8.8
8 |
9 |
10 | 30
11 |
12 |
13 | 40
14 |
15 |
16 |
17 | 1
18 |
19 |
20 | 198.32.176.31
21 |
22 |
23 | core2-1-1-0.pao.net.google.com
24 |
25 |
26 |
27 | 1
28 |
29 |
30 | 198.32.176.31
31 |
32 |
33 | core2-1-1-0.pao.net.google.com
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | 4103
43 |
44 |
45 |
46 |
47 |
48 | 2
49 |
50 |
51 | 198.32.176.31
52 |
53 |
54 | core2-1-1-0.pao.net.google.com
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 | 1310
64 |
65 |
66 |
67 |
68 |
69 |
70 | 1
71 |
72 |
73 | 206.223.116.21
74 |
75 |
76 | eqixsj-google-gige.google.com
77 |
78 |
79 |
80 | 3
81 |
82 |
83 | 206.223.116.21
84 |
85 |
86 | eqixsj-google-gige.google.com
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 | 517
96 |
97 |
98 |
99 |
100 |
101 |
102 | 2
103 |
104 |
105 | 209.85.244.23
106 |
107 |
108 | 209.85.244.23
109 |
110 |
111 |
112 | 1
113 |
114 |
115 | 209.85.244.23
116 |
117 |
118 | 209.85.244.23
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 | 1573
128 |
129 |
130 |
131 |
132 |
133 |
134 | 2
135 |
136 |
137 | 216.239.50.189
138 |
139 |
140 | 216.239.50.189
141 |
142 |
143 |
144 | 2
145 |
146 |
147 | 216.239.50.189
148 |
149 |
150 | 216.239.50.189
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 | 2200
160 |
161 |
162 |
163 |
164 |
165 |
166 | 2
167 |
168 |
169 | 209.85.244.23
170 |
171 |
172 | 209.85.244.23
173 |
174 |
175 |
176 | 3
177 |
178 |
179 | 209.85.244.23
180 |
181 |
182 | 209.85.244.23
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 | 1558
192 |
193 |
194 |
195 |
196 |
197 |
198 | 3
199 |
200 |
201 | 216.239.56.125
202 |
203 |
204 | 216.239.56.125
205 |
206 |
207 |
208 | 1
209 |
210 |
211 | 216.239.56.125
212 |
213 |
214 | 216.239.56.125
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 | 1999
224 |
225 |
226 |
227 |
228 |
229 |
230 | 3
231 |
232 |
233 | 209.85.255.255
234 |
235 |
236 | 209.85.255.255
237 |
238 |
239 |
240 | 2
241 |
242 |
243 | 209.85.255.255
244 |
245 |
246 | 209.85.255.255
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 | 2488
256 |
257 |
258 |
259 |
260 |
261 |
262 | 3
263 |
264 |
265 | 216.239.49.123
266 |
267 |
268 | 216.239.49.123
269 |
270 |
271 |
272 | 3
273 |
274 |
275 | 216.239.49.123
276 |
277 |
278 | 216.239.49.123
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 | 5750
288 |
289 |
290 |
291 |
292 |
293 |
294 | 4
295 |
296 |
297 | 8.8.8.8
298 |
299 |
300 | google-public-dns-a.google.com
301 |
302 |
303 |
304 | 1
305 |
306 |
307 | 8.8.8.8
308 |
309 |
310 | google-public-dns-a.google.com
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 | 1311
320 |
321 |
322 |
323 |
324 |
325 | 2
326 |
327 |
328 | 8.8.8.8
329 |
330 |
331 | google-public-dns-a.google.com
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 | 1582
341 |
342 |
343 |
344 |
345 |
346 | 3
347 |
348 |
349 | 8.8.8.8
350 |
351 |
352 | google-public-dns-a.google.com
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 | 1589
362 |
363 |
364 |
365 |
366 |
367 |
368 |
369 |
--------------------------------------------------------------------------------
/test/unit/junos/mock_data/show_ntp_associations_no-resolve.txt:
--------------------------------------------------------------------------------
1 | remote refid st t when poll reach delay offset jitter
2 | ==============================================================================
3 | 199.27.130.22 .INIT. 16 - - 1024 0 0.000 0.000 4000.00
4 | -199.27.130.18 199.27.130.1 4 - 311 1024 377 1.384 0.056 0.004
5 | -199.27.128.10 173.245.57.37 4 - 221 1024 377 0.477 3.263 0.007
6 | 199.27.131.10 .INIT. 16 - - 1024 0 0.000 0.000 4000.00
7 | 199.27.132.10 .INIT. 16 - - 1024 0 0.000 0.000 4000.00
8 | -173.245.52.10 173.245.55.10 5 - 759 1024 377 75.381 -0.161 0.010
9 | -173.245.48.10 173.245.57.37 4 - 225 1024 377 11.845 0.923 0.113
10 | -173.245.55.10 141.101.73.1 4 - 236 1024 377 55.228 -3.909 0.061
11 | -173.245.50.10 141.101.74.1 3 - 845 1024 377 42.638 -2.003 0.043
12 | -173.245.56.10 173.245.55.10 5 - 832 1024 377 80.510 -1.503 0.401
13 | -108.162.210.10 108.162.211.1 4 - 214 1024 377 72.038 -6.152 0.433
14 | 173.245.51.10 .INIT. 16 - - 1024 0 0.000 0.000 4000.00
15 | -173.245.49.10 141.101.67.1 4 - 236 1024 377 162.176 -6.724 0.271
16 | -173.245.53.10 162.158.101.4 6 - 222 1024 377 153.933 -2.711 0.565
17 | -141.101.70.10 173.245.49.10 5 - 852 1024 377 143.483 -3.221 0.051
18 | -103.22.200.10 141.101.76.1 4 - 228 1024 377 106.527 6.165 0.493
19 | -173.245.62.10 103.22.203.1 3 - 848 1024 377 173.806 0.223 2.780
20 | -173.245.57.37 173.245.57.4 3 - 214 1024 377 1.808 3.148 0.213
21 | -108.162.248.4 108.162.247.1 4 - 239 1024 377 155.867 -0.612 0.388
22 | -108.162.236.4 108.162.235.1 3 - 301 1024 377 66.426 0.607 0.844
23 | -108.162.244.4 173.245.57.37 4 - 310 1024 377 23.950 3.315 0.427
24 | -108.162.240.4 108.162.236.4 4 - 322 1024 377 65.363 -4.229 0.069
25 | -141.101.91.4 173.245.49.10 5 - 314 1024 377 174.387 -5.186 5.515
26 | -141.101.95.4 162.158.21.4 5 - 230 1024 377 176.248 -2.714 0.106
27 | -141.101.79.4 141.101.78.1 5 - 315 1024 377 178.191 -1.626 0.165
28 | 141.101.87.4 .INIT. 16 - 22d 1024 0 0.000 0.000 4000.00
29 | -141.101.83.4 103.22.200.10 5 - 334 1024 377 198.241 11.429 1.321
30 | -103.31.5.4 103.22.200.10 5 - 223 1024 177 181.757 8.521 5.462
31 | -103.21.246.130 199.27.128.10 5 - 327 1024 377 14.866 -0.650 0.299
32 | 108.162.253.130 .INIT. 16 - - 1024 0 0.000 0.000 4000.00
33 | -141.101.101.4 141.101.109.4 6 - 230 1024 377 170.893 -9.892 0.028
34 | -188.114.101.4 188.114.100.1 4 - 232 1024 377 169.733 -5.952 0.428
35 | -188.114.109.4 173.245.49.10 5 - 848 1024 377 170.063 -0.128 0.315
36 | -141.101.109.4 141.101.108.1 5 - 315 1024 377 121.496 -3.794 0.906
37 | -188.114.97.4 188.114.96.1 5 - 318 1024 377 194.354 -1.208 0.282
38 | -198.41.225.4 141.101.109.4 6 - 246 1024 377 133.292 -7.179 0.349
39 | -197.234.241.4 197.234.240.1 4 - 426 1024 377 316.153 -3.863 0.219
40 | -198.41.237.4 198.41.236.1 4 - 81 1024 377 133.367 2.881 0.220
41 | -198.41.241.4 162.158.37.4 5 - 216 1024 377 161.887 -4.115 2.539
42 | -199.27.130.26 199.27.130.1 6 - 241 1024 377 3.071 -1.930 2.536
43 | -199.27.130.39 199.27.130.1 4 - 235 1024 377 4.418 2.608 0.381
44 | 2400:cb00:4:102 .INIT. 16 u - 1024 0 0.000 0.000 4000.00
45 | 2400:cb00:5:102 .INIT. 16 u - 1024 0 0.000 0.000 4000.00
46 | 2400:cb00:6:102 .INIT. 16 u - 1024 0 0.000 0.000 4000.00
47 | 2400:cb00:11:10 .INIT. 16 u - 1024 0 0.000 0.000 4000.00
48 | 2400:cb00:12:10 .INIT. 16 u - 1024 0 0.000 0.000 4000.00
49 | 2400:cb00:14:10 .INIT. 16 u - 1024 0 0.000 0.000 4000.00
50 | 2400:cb00:15:10 .INIT. 16 u - 1024 0 0.000 0.000 4000.00
51 | 2400:cb00:16:10 .INIT. 16 u - 1024 0 0.000 0.000 4000.00
52 | 2400:cb00:17:10 .INIT. 16 u - 1024 0 0.000 0.000 4000.00
53 | 2400:cb00:18:10 .INIT. 16 u - 1024 0 0.000 0.000 4000.00
54 | 2400:cb00:19:10 .INIT. 16 u - 1024 0 0.000 0.000 4000.00
55 | 2400:cb00:20:10 .INIT. 16 u - 1024 0 0.000 0.000 4000.00
56 | 2400:cb00:21:10 .INIT. 16 u - 1024 0 0.000 0.000 4000.00
57 | 2400:cb00:22:10 .INIT. 16 u - 1024 0 0.000 0.000 4000.00
58 | 2400:cb00:23:10 .INIT. 16 u - 1024 0 0.000 0.000 4000.00
59 | 2400:cb00:25:10 .INIT. 16 u - 1024 0 0.000 0.000 4000.00
60 | 2400:cb00:26:10 .INIT. 16 u - 1024 0 0.000 0.000 4000.00
61 | 2400:cb00:27:10 .INIT. 16 u - 1024 0 0.000 0.000 4000.00
62 | 2400:cb00:28:10 .INIT. 16 u - 1024 0 0.000 0.000 4000.00
63 | 2400:cb00:29:10 .INIT. 16 u - 1024 0 0.000 0.000 4000.00
64 | 2400:cb00:30:10 .INIT. 16 u - 1024 0 0.000 0.000 4000.00
65 | 2400:cb00:31:10 .INIT. 16 u - 1024 0 0.000 0.000 4000.00
66 | 2400:cb00:32:10 .INIT. 16 u - 1024 0 0.000 0.000 4000.00
67 | 2400:cb00:33:10 .INIT. 16 u - 1024 0 0.000 0.000 4000.00
68 | 2400:cb00:34:10 .INIT. 16 u - 1024 0 0.000 0.000 4000.00
69 | 2400:cb00:24:10 .INIT. 16 u - 1024 0 0.000 0.000 4000.00
70 | 2400:cb00:37:10 .INIT. 16 u - 1024 0 0.000 0.000 4000.00
71 | 198.41.229.4 .INIT. 16 - 22d 1024 0 0.000 0.000 4000.00
72 | 2400:cb00:44:10 .INIT. 16 u - 1024 0 0.000 0.000 4000.00
73 | -103.21.247.2 103.21.247.12 4 - 52 512 377 16.948 33.273 1.056
74 | -103.21.247.3 103.21.247.12 4 - 78 1024 377 14.919 30.987 2.492
75 | 199.27.130.34 .INIT. 16 - - 1024 0 0.000 0.000 4000.00
76 | 199.27.130.35 .INIT. 16 - 158 1024 0 0.000 0.000 4000.00
77 | +199.27.130.45 199.27.130.1 6 - 118 1024 377 0.908 -0.039 0.016
78 | *199.27.130.42 199.27.130.1 4 - 455 1024 375 0.990 -0.058 0.020
79 | +199.27.130.40 199.27.130.1 6 - 5 1024 377 0.960 -0.040 0.069
80 | +199.27.130.19 199.27.130.1 6 - 208 1024 377 0.998 -0.079 0.005
81 | -199.27.130.44 199.27.130.1 4 - 221 1024 377 3.906 -1.556 0.296
82 | -199.27.130.46 199.27.130.1 6 - 235 1024 377 4.567 1.522 0.129
83 | 199.27.130.23 .INIT. 16 - - 1024 0 0.000 0.000 4000.00
84 | 199.27.130.24 .INIT. 16 - - 1024 0 0.000 0.000 4000.00
85 | 199.27.130.25 .INIT. 16 - 319 1024 0 0.000 0.000 4000.00
86 | 199.27.130.27 .INIT. 16 - - 1024 0 0.000 0.000 4000.00
87 | 199.27.130.28 .INIT. 16 - - 1024 0 0.000 0.000 4000.00
88 | 199.27.130.29 .INIT. 16 - - 1024 0 0.000 0.000 4000.00
89 | 199.27.130.30 .INIT. 16 - - 1024 0 0.000 0.000 4000.00
90 | 199.27.130.31 .INIT. 16 - - 1024 0 0.000 0.000 4000.00
91 | 199.27.130.32 .INIT. 16 - - 1024 0 0.000 0.000 4000.00
92 | 199.27.130.36 .INIT. 16 - 15h 1024 0 0.000 0.000 4000.00
93 | 199.27.130.37 .INIT. 16 - - 1024 0 0.000 0.000 4000.00
94 | 199.27.130.38 .INIT. 16 - - 1024 0 0.000 0.000 4000.00
95 | 199.27.130.41 .INIT. 16 - - 1024 0 0.000 0.000 4000.00
96 | 199.27.130.43 .INIT. 16 - - 1024 0 0.000 0.000 4000.00
97 | -17.151.16.22 17.150.231.5 2 - 844 1024 377 1.177 0.336 0.353
98 | 69.20.226.105 192.5.41.41 2 - 14 1024 377 84.725 15.435 2.206
99 |
100 |
--------------------------------------------------------------------------------
/test/unit/junos/mock_data/get-bgp-neighbor-information.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 | 192.168.100.1+50877
4 | 4436
5 | 192.168.100.2+179
6 | 13335
7 | External
8 | Established
9 | Sync RSync
10 | EstabSync
11 | RecvKeepAlive
12 | Cease
13 |
14 |
15 | 4-GTT-TRANSIT-OUT
16 |
17 |
18 | 4-GTT-TRANSIT-IN
19 |
20 | Preference RemovePrivateAS LogUpDown AddressFamily PeerAS Multipath LocalAS Refresh
21 |
22 |
23 | inet-unicast
24 | 90
25 | 170
26 | 13335
27 | 0
28 |
29 | 2
30 | Stop
31 |
32 | Open Message Error
33 | 1
34 | 0
35 |
36 |
37 | Cease
38 | 2
39 | 0
40 |
41 | 192.168.100.1
42 | 192.168.100.2
43 | 90
44 | 30
45 | 23
46 | 0
47 |
48 | disabled
49 | down
50 |
51 | irb.420
52 | 765
53 | inet-unicast
54 | inet-unicast
55 | inet-unicast
56 | 2
57 | 300
58 |
59 | inet-unicast
60 | inet-unicast
61 | inet-unicast
62 |
63 | 4436
64 |
65 |
66 | inet.0
67 | 10005
68 | BGP restart is complete
69 | in sync
70 | 101545
71 | 567257
72 | 567257
73 | 0
74 | 111
75 |
76 | 0
77 | 3
78 | 31
79 | 12094123
80 | 11951665
81 | 0
82 | 1244994779
83 | 141052
84 | 158
85 | 0
86 | 2694237
87 |
88 | 0
89 | 0
90 |
91 |
92 |
93 | 172.17.17.1+54687
94 | 1299
95 | 172.17.17.2+179
96 | 13335
97 | External
98 | Established
99 | Sync RSync
100 | OpenConfirm
101 | RecvKeepAlive
102 | None
103 |
104 |
105 | 4-TELIA-TRANSIT-OUT
106 |
107 |
108 | 4-TELIA-TRANSIT-IN
109 |
110 | Preference RemovePrivateAS LogUpDown AddressFamily PeerAS Multipath LocalAS Refresh
111 |
112 |
113 | inet-unicast
114 | 90
115 | 170
116 | 13335
117 | 0
118 |
119 | 0
120 | 172.17.17.1
121 | 172.17.17.2
122 | 90
123 | 30
124 | 0
125 | 0
126 |
127 | disabled
128 | down
129 |
130 | ae3.0
131 | 745
132 | inet-unicast
133 | inet-unicast
134 | inet-unicast
135 | 2
136 | 300
137 |
138 | inet-unicast
139 | inet-unicast
140 | inet-unicast
141 |
142 | 1299
143 |
144 |
145 | inet.0
146 | 10002
147 | BGP restart is complete
148 | in sync
149 | 37358
150 | 567162
151 | 566998
152 | 0
153 | 111
154 |
155 | 7
156 | 29
157 | 1
158 | 26006050
159 | 25604153
160 | 0
161 | 2153200326
162 | 383524
163 | 524
164 | 0
165 | 7342325
166 |
167 | 0
168 | 0
169 |
170 |
171 |
--------------------------------------------------------------------------------
/test/unit/junos/mock_data/get-route-information.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 | inet.0
4 | 591971
5 | 4001470
6 | 591761
7 | 4
8 | 989
9 |
201 |
202 |
203 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright {yyyy} {name of copyright owner}
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/test/unit/junos/mock_data/get-bgp-neighbor-informationfrontend.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 | 10.2.1.253+179
4 | 4290029998
5 | 10.2.1.1+49228
6 | 4290020001
7 | External
8 | Established
9 | Sync
10 | OpenConfirm
11 | RecvKeepAlive
12 | None
13 |
14 | NORMAL-FRONTEND
15 | Preference PeerAS Multipath Refresh
16 |
17 | 90
18 | 170
19 |
20 | 0
21 | 10.255.254.252
22 | 10.255.254.1
23 | 90
24 | 30
25 | 3
26 | 1
27 |
28 | disabled
29 | down
30 |
31 | vlan.2
32 | 613
33 | inet-unicast
34 | inet-unicast
35 | inet-unicast
36 | 2
37 | 300
38 |
39 |
40 | 4290029998
41 |
42 |
43 | frontend.inet.0
44 | 20001
45 | BGP restart is complete
46 | VPN restart is complete
47 | in sync
48 | 2
49 | 2
50 | 2
51 | 0
52 | 9
53 |
54 | 22
55 | 11
56 | 52
57 | 422682
58 | 1
59 | 0
60 | 8030995
61 | 463590
62 | 64
63 | 0
64 | 8809916
65 |
66 | 1
67 | 0
68 |
69 |
70 |
71 | 10.2.1.254+1047
72 | 4290029999
73 | 10.2.1.1+179
74 | 4290020001
75 | External
76 | Established
77 | Sync
78 | OpenConfirm
79 | RecvKeepAlive
80 | None
81 |
82 | NORMAL-FRONTEND
83 | Preference PeerAS Multipath Refresh
84 |
85 | 90
86 | 170
87 |
88 | 0
89 | 10.48.71.105
90 | 10.255.254.1
91 | 90
92 | 30
93 | 3
94 | 0
95 |
96 | disabled
97 | down
98 |
99 | vlan.2
100 | 613
101 | inet-unicast
102 | inet-unicast inet6-unicast
103 | inet-unicast
104 | 2
105 | 300
106 |
107 |
108 | 4290029999
109 |
110 |
111 | frontend.inet.0
112 | 20001
113 | BGP restart is complete
114 | VPN restart is complete
115 | in sync
116 | 4
117 | 4
118 | 4
119 | 0
120 | 7
121 |
122 | 22
123 | 3
124 | 65
125 | 483697
126 | 29
127 | 0
128 | 9191024
129 | 463564
130 | 36
131 | 0
132 | 8808653
133 |
134 | 1
135 | 0
136 |
137 |
138 |
139 | 192.168.0.0+57256
140 | 4290020000
141 | 192.168.0.1+179
142 | 4290020001
143 | External
144 | Established
145 | Sync
146 | OpenConfirm
147 | RecvKeepAlive
148 | None
149 |
150 | NORMAL-FRONTEND
151 | Preference AddressFamily PeerAS Multipath Refresh
152 |
153 | inet-unicast inet6-unicast
154 | 90
155 | 170
156 |
157 | 1
158 | RecvNotify
159 |
160 | Cease
161 | 0
162 | 1
163 |
164 | 10.255.254.240
165 | 10.255.254.1
166 | 90
167 | 30
168 | 1
169 | 0
170 |
171 | disabled
172 | down
173 |
174 | xe-0/1/0.2
175 | 607
176 | inet-unicast inet6-unicast
177 | inet-unicast inet6-unicast
178 | inet-unicast inet6-unicast
179 | 2
180 | 300
181 |
182 | inet-unicast inet6-unicast
183 | inet-unicast inet6-unicast
184 | inet-unicast inet6-unicast
185 |
186 | 4290020000
187 |
188 |
189 | frontend.inet.0
190 | 20000
191 | BGP restart is complete
192 | VPN restart is complete
193 | in sync
194 | 3
195 | 3
196 | 3
197 | 0
198 | 8
199 |
200 |
201 | frontend.inet6.0
202 | 50000
203 | BGP restart is complete
204 | VPN restart is complete
205 | in sync
206 | 0
207 | 0
208 | 0
209 | 0
210 | 1
211 |
212 | 8
213 | 22
214 | 59
215 | 25531
216 | 4
217 | 0
218 | 485218
219 | 25461
220 | 6
221 | 0
222 | 484121
223 |
224 | 1
225 | 0
226 |
227 |
228 | 4
229 | 0
230 |
231 |
232 |
233 | 192.169.1.0
234 | 4290020000
235 | 192.169.1.1
236 | 4290020001
237 | External
238 | Active
239 |
240 | Idle
241 | Start
242 | None
243 |
244 | NORMAL-FRONTEND
245 | Preference AddressFamily PeerAS Multipath Refresh
246 |
247 | inet-unicast inet6-unicast
248 | 90
249 | 170
250 |
251 | 0
252 |
253 |
254 | 2a01:280:100::1
255 | 4290020000
256 | 2a01:280:100::
257 | 4290020001
258 | External
259 | Idle
260 | PeerInterfaceError
261 | Connect
262 | Stop
263 | Hold Timer Expired Error
264 |
265 | Preference PeerAS Refresh
266 |
267 | 90
268 | 170
269 |
270 | 1
271 | HoldTime
272 |
273 | Hold Timer Expired Error
274 | 1
275 | 0
276 |
277 |
278 |
279 |
280 |
--------------------------------------------------------------------------------
/napalm_junos/utils/junos_views.yml:
--------------------------------------------------------------------------------
1 | ---
2 |
3 | ####
4 | #### Interface table
5 | ####
6 |
7 | junos_iface_table:
8 | rpc: get-interface-information
9 | args:
10 | extensive: True
11 | args_key: interface_name
12 | item: physical-interface
13 | view: junos_iface_view
14 |
15 | junos_iface_view:
16 | fields:
17 | is_up: { oper-status: True=up }
18 | is_enabled: { admin-status: True=up }
19 | description: { description: unicode }
20 | last_flapped: { interface-flapped/@seconds: int }
21 | #mode: logical-interface/address-family/address-family-name
22 | speed: speed
23 | mac_address: current-physical-address
24 |
25 | ####
26 | #### BGP tables
27 | ####
28 |
29 | junos_route_instance_table:
30 | rpc: get-instance-information
31 | item: instance-core
32 | key: instance-name
33 | view: junos_route_instance_view
34 |
35 | junos_route_instance_view:
36 | fields:
37 | name: instance-name
38 |
39 | junos_bgp_uptime_table:
40 | rpc: get-bgp-summary-information
41 | args:
42 | instance: ''
43 | item: bgp-peer
44 | key: peer-address
45 | view: junos_bgp_uptime_view
46 |
47 | junos_bgp_uptime_view:
48 | fields:
49 | uptime: { elapsed-time/@seconds: int }
50 | tables: bgp-rib/name
51 |
52 | junos_bgp_table:
53 | rpc: get-bgp-neighbor-information
54 | item: bgp-peer
55 |
56 | key: peer-address
57 | view: junos_bgp_view
58 |
59 | junos_bgp_view:
60 | fields:
61 | remote_as: { peer-as: int }
62 | description: description
63 | is_up: { peer-state: True=Established }
64 | is_enabled: { peer-state: False=True }
65 | received_prefixes: { bgp-rib/received-prefix-count: int }
66 | accepted_prefixes: { bgp-rib/accepted-prefix-count: int }
67 | sent_prefixes: { bgp-rib/advertised-prefix-count: int }
68 | tables: bgp-rib/name
69 | local_as: { local-as: int }
70 | peer_as: { peer-as: int }
71 | local_id: local-id
72 | remote_id: { peer-id: unicode }
73 |
74 | ####
75 | #### LLDP table
76 | ####
77 |
78 | junos_lldp_table:
79 | rpc: get-lldp-neighbors-information
80 | item: lldp-neighbor-information
81 | key: lldp-local-port-id | lldp-local-interface
82 | view: junos_lldp_view
83 |
84 | junos_lldp_view:
85 | fields:
86 | hostname: lldp-remote-system-name
87 | port: lldp-remote-port-description | lldp-remote-port-id
88 |
89 | ####
90 | #### Interface counters
91 | ####
92 |
93 | junos_iface_counter_table:
94 | rpc: get-interface-information
95 | args:
96 | extensive: True
97 | interface_name: '[vmfgx][mle]*'
98 | args_key: interface_name
99 | item: physical-interface
100 | view: junos_iface_counter_view
101 |
102 |
103 | junos_iface_counter_view:
104 | groups:
105 | ts: traffic-statistics
106 | rxerrs: input-error-list
107 | txerrs: output-error-list
108 | ethernet_traffic_types: ethernet-mac-statistics
109 |
110 |
111 | # fields that are part of groups are called
112 | # "fields_"
113 | fields_ethernet_traffic_types:
114 | rx_broadcast_packets: { input-broadcasts: int }
115 | tx_broadcast_packets: { output-broadcasts: int }
116 | rx_unicast_packets: { input-unicasts: int }
117 | tx_unicast_packets: { output-unicasts: int }
118 | rx_multicast_packets: { input-multicasts: int }
119 | tx_multicast_packets: { output-multicasts: int }
120 |
121 | fields_ts:
122 | rx_octets: { input-bytes: int }
123 | tx_octets: { output-bytes: int }
124 |
125 | fields_rxerrs:
126 | rx_errors: { input-errors: int }
127 | rx_discards: { input-discards: int }
128 |
129 | fields_txerrs:
130 | tx_errors: { output-errors: int }
131 | tx_discards: { output-drops: int }
132 |
133 | junos_enviroment_table:
134 | rpc: get-environment-information
135 | args:
136 | item: environment-item
137 | key: name
138 | view: junos_enviroment_view
139 |
140 | junos_enviroment_view:
141 | fields:
142 | class: class
143 | status: status
144 | temperature: { temperature/@celsius: int }
145 |
146 | junos_routing_engine_table:
147 | rpc: get-route-engine-information
148 | args:
149 | item: route-engine
150 | key: slot
151 | view: junos_routing_engine_view
152 |
153 | junos_routing_engine_view:
154 | fields:
155 | cpu-idle: { cpu-idle: int }
156 | memory-dram-size: memory-dram-size
157 | memory-buffer-utilization : { memory-buffer-utilization: int }
158 |
159 | junos_temperature_thresholds:
160 | rpc: get-temperature-threshold-information
161 | args:
162 | item: temperature-threshold
163 | key: name
164 | view: junos_temperature_thresholds_view
165 |
166 | junos_temperature_thresholds_view:
167 | fields:
168 | name: name
169 | yellow-alarm: { yellow-alarm: int }
170 | red-alarm: { red-alarm: int }
171 | tx_discards: { output-drops: int }
172 |
173 | ###
174 | ### NTP Peers Config
175 | ###
176 |
177 | junos_ntp_peers_config_table:
178 | get: system/ntp/peer
179 | view: junos_ntp_peers_config_view
180 |
181 | junos_ntp_peers_config_view:
182 | fields:
183 | peer: name
184 |
185 | ###
186 | ### LLDP Neighbors Detail
187 | ###
188 |
189 | junos_lldp_neighbors_detail_table:
190 | rpc: get-lldp-neighbors-information
191 | args:
192 | item: lldp-neighbor-information
193 | key: lldp-local-interface | lldp-local-port-id
194 | view: junos_lldp_neighbors_detail_view
195 |
196 | junos_lldp_neighbors_detail_view:
197 | fields:
198 | # interface: {lldp-local-port-id: unicode}
199 | interface_description: {lldp-local-interface: unicode}
200 | parent_interface: {lldp-local-parent-interface-name: unicode}
201 | remote_port: {lldp-remote-port-id: unicode}
202 | remote_chassis_id: {lldp-remote-chassis-id: unicode}
203 | remote_port_description: {lldp-remote-port-description: unicode}
204 | remote_system_name: {lldp-remote-system-name: unicode}
205 | remote_system_description: {lldp-system-description/lldp-remote-system-description: unicode}
206 | remote_system_capab: {lldp-remote-system-capabilities-supported: unicode}
207 | remote_system_enable_capab: {lldp-remote-system-capabilities-enabled: unicode}
208 |
209 | ###
210 | ### BGP config
211 | ###
212 |
213 | junos_bgp_config_table:
214 | get: protocols/bgp/group
215 | view: junos_bgp_config_view
216 |
217 | junos_bgp_config_group_table:
218 | get: protocols/bgp/group
219 | view: junos_bgp_config_view
220 | required_keys:
221 | group: name
222 |
223 | junos_bgp_config_view:
224 | fields:
225 | type: type
226 | description: description
227 | apply_groups: apply-groups
228 | local_address: local-address
229 | multihop_ttl: multihop/ttl
230 | local_as: local-as/as-number
231 | remote_as: peer-as
232 | multipath: multipath
233 | remove_private_as: remove-private
234 | import_policy: import
235 | export_policy: export
236 | inet_unicast_limit_prefix_limit: family/inet/unicast/prefix-limit/maximum
237 | inet_unicast_teardown_threshold_prefix_limit: family/inet/unicast/prefix-limit/teardown/limit-threshold
238 | inet_unicast_teardown_timeout_prefix_limit: family/inet/unicast/prefix-limit/teardown/idle-timeout/timeout
239 | inet_unicast_novalidate_prefix_limit: family/inet/unicast/prefix-limit/no-validate
240 | inet_flow_limit_prefix_limit: family/inet/flow/prefix-limit/maximum
241 | inet_flow_teardown_threshold_prefix_limit: family/inet/flow/prefix-limit/teardown/limit-threshold
242 | inet_flow_teardown_timeout_prefix_limit: family/inet/flow/prefix-limit/teardown/idle-timeout/timeout
243 | inet_flow_novalidate_prefix_limit: family/inet/flow/prefix-limit/no-validate
244 | inet6_unicast_limit_prefix_limit: family/inet6/unicast/prefix-limit/maximum
245 | inet6_unicast_teardown_threshold_prefix_limit: family/inet6/unicast/prefix-limit/teardown/limit-threshold
246 | inet6_unicast_teardown_timeout_prefix_limit: family/inet6/unicast/prefix-limit/teardown/idle-timeout/timeout
247 | inet6_unicast_novalidate_prefix_limit: family/inet6/unicast/prefix-limit/no-validate
248 | inet6_flow_limit_prefix_limit: family/inet6/flow/prefix-limit/maximum
249 | inet6_flow_teardown_threshold_prefix_limit: family/inet6/flow/prefix-limit/teardown/limit-threshold
250 | inet6_flow_teardown_timeout_prefix_limit: family/inet6/flow/prefix-limit/teardown/idle-timeout/timeout
251 | inet6_flow_novalidate_prefix_limit: family/inet6/flow/prefix-limit/no-validate
252 |
253 | junos_bgp_config_peers_table:
254 | get: protocols/bgp/group/neighbor
255 | view: junos_bgp_config_peers_view
256 |
257 | junos_bgp_config_peers_view:
258 | fields:
259 | group: ../name
260 | description: description
261 | import_policy: import
262 | export_policy: export
263 | local_address: neighbor/local-address
264 | local_as: local-as
265 | remote_as: peer-as
266 | authentication_key: authentication_key
267 | inet_unicast_limit_prefix_limit: family/inet/unicast/prefix-limit/maximum
268 | inet_unicast_teardown_threshold_prefix_limit: family/inet/unicast/prefix-limit/teardown/limit-threshold
269 | inet_unicast_teardown_timeout_prefix_limit: family/inet/unicast/prefix-limit/teardown/idle-timeout/timeout
270 | inet_unicast_novalidate_prefix_limit: family/inet/unicast/prefix-limit/no-validate
271 | inet_flow_limit_prefix_limit: family/inet/flow/prefix-limit/maximum
272 | inet_flow_teardown_threshold_prefix_limit: family/inet/flow/prefix-limit/teardown/limit-threshold
273 | inet_flow_teardown_timeout_prefix_limit: family/inet/flow/prefix-limit/teardown/idle-timeout/timeout
274 | inet_flow_novalidate_prefix_limit: family/inet/flow/prefix-limit/no-validate
275 | inet6_unicast_limit_prefix_limit: family/inet6/unicast/prefix-limit/maximum
276 | inet6_unicast_teardown_threshold_prefix_limit: family/inet6/unicast/prefix-limit/teardown/limit-threshold
277 | inet6_unicast_teardown_timeout_prefix_limit: family/inet6/unicast/prefix-limit/teardown/idle-timeout/timeout
278 | inet6_unicast_novalidate_prefix_limit: family/inet6/unicast/prefix-limit/no-validate
279 | inet6_flow_limit_prefix_limit: family/inet6/flow/prefix-limit/maximum
280 | inet6_flow_teardown_threshold_prefix_limit: family/inet6/flow/prefix-limit/teardown/limit-threshold
281 | inet6_flow_teardown_timeout_prefix_limit: family/inet6/flow/prefix-limit/teardown/idle-timeout/timeout
282 | inet6_flow_novalidate_prefix_limit: family/inet6/flow/prefix-limit/no-validate
283 |
284 | ####
285 | #### BGP Neighbors and Routing Tables Stats
286 | ####
287 |
288 | junos_bgp_tables_summary_table:
289 | rpc: get-bgp-summary-information
290 | args:
291 | instance: ''
292 | group: ''
293 | item: bgp-rib
294 | key: name
295 | view: junos_bgp_tables_summary_view
296 |
297 | junos_bgp_tables_summary_view:
298 | fields:
299 | routing_table: name
300 | total_prefix_count: {total-prefix-count: int}
301 | received_prefix_count: {received-prefix-countL: int}
302 | active_prefix_count: {active-prefix-count: int}
303 | suppressed_prefix_count: {suppressed-prefix-count: int}
304 | history_prefix_count: {history-prefix-count: int}
305 | damped_prefix_count: {damped-prefix-count: int}
306 | total_external_prefix_count: {total-external-prefix-count: int}
307 | active_external_prefix_count: {active-external-prefix-count: int}
308 | accepted_external_prefix_count: {accepted-external-prefix-count: int}
309 | suppressed_external_prefix_count: {suppressed-external-prefix-count: int}
310 | total_internal_prefix_count: {total-internal-prefix-count: int}
311 | active_internal_prefix_count: {active-internal-prefix-count: int}
312 | accepted_internal_prefix_count: {accepted-internal-prefix-count: int}
313 | suppressed_internal_prefix_count: {suppressed-internal-prefix-count: int}
314 | pending_prefix_count: {pending-prefix-count: int}
315 | bgp_rib_state: bgp-rib-state
316 |
317 | junos_bgp_neighbors_table:
318 | rpc: get-bgp-neighbor-information
319 | args_key: neighbor_address
320 | item: bgp-peer
321 | key: peer-as
322 | view: junos_bgp_neighbors_view
323 |
324 | junos_bgp_neighbors_view:
325 | fields:
326 | up: {peer-state: True=Established}
327 | local_as: {local-as: int}
328 | remote_as: {peer-as: int}
329 | router_id: {peer-id: unicode}
330 | local_address: local-address
331 | peer_address: peer-address
332 | options: bgp-option-information/bgp-options
333 | import_policy: {bgp-option-information/import-policy: unicode}
334 | export_policy: {bgp-option-information/export-policy: unicode}
335 | input_messages: {input-messages: int}
336 | output_messages: {output-messages: int}
337 | input_updates: {input-updates: int}
338 | output_updates: {output-updates: int}
339 | messages_queued_out: {bgp-output-queue/count: int}
340 | connection_state: {peer-state: unicode}
341 | previous_connection_state: {last-state: unicode}
342 | last_event: {last-event: unicode}
343 | 4byte_as: {peer-4byte-as-capability-advertised: int}
344 | local_as_prepend: {peer-addpath-not-supported: False=None}
345 | holdtime: {active-holdtime: int}
346 | configured_holdtime: {bgp-option-information/holdtime: int}
347 | keepalive: {keepalive-interval: int}
348 | configured_keepalive: {keepalive-interval: int}
349 | rib: junos_bgp_rib_table
350 | flap_count: {flap-count: int}
351 |
352 | junos_bgp_rib_table:
353 | item: bgp-rib
354 | key: name
355 | view: junos_bgp_rib_view
356 |
357 | junos_bgp_rib_view:
358 | active_prefix_count: {active-prefix-count: int}
359 | received_prefix_count: {received-prefix-count: int}
360 | accepted_prefix_count: {accepted-prefix-count: int}
361 | suppressed_prefix_count: {suppressed-prefix-count: int}
362 | advertised_prefix_count: {advertised-prefix-count: int}
363 |
364 | ###
365 | ### ARP Table
366 | ###
367 |
368 | junos_arp_table:
369 | rpc: get-arp-table-information
370 | args:
371 | expiration-time: true
372 | item: arp-table-entry
373 | key: interface-name
374 | view: junos_arp_view
375 |
376 | junos_arp_view:
377 | fields:
378 | interface: {interface-name: unicode}
379 | mac: {mac-address: unicode}
380 | ip: {ip-address: unicode}
381 | tte: {time-to-expire: float}
382 |
383 | ###
384 | ### Interfaces IPs
385 | ###
386 |
387 | junos_ip_interfaces_table:
388 | rpc: get-interface-information
389 | item: physical-interface/logical-interface/address-family/interface-address
390 | args:
391 | terse: True
392 | key: ifa-local
393 | view: junos_ip_interfaces_view
394 |
395 | junos_ip_interfaces_view:
396 | fields:
397 | family: ../address-family-name
398 | interface: ../../name
399 |
400 | ###
401 | ### MAC Address table
402 | ###
403 |
404 | junos_mac_address_table:
405 | rpc: get-bridge-mac-table
406 | item: l2ald-mac-entry
407 | args:
408 | extensive: True
409 | args_key:
410 | - interface
411 | - vlan_id
412 | key: l2-bridge-vlan
413 | view: junos_mac_address_view
414 |
415 | junos_mac_address_view:
416 | fields:
417 | interface: {l2-mac-logical-interface: unicode}
418 | mac: {l2-mac-address: unicode}
419 | vlan: {l2-bridge-vlan: int}
420 |
421 | # Different table struct & view for EX & QFX series
422 |
423 | junos_mac_address_table_switch:
424 | rpc: get-ethernet-switching-table-information
425 | item: ethernet-switching-table/mac-table-entry
426 | args:
427 | extensive: True
428 | args_key:
429 | - interface_name
430 | - vlan
431 | key: mac-vlan-tag
432 | view: junos_mac_address_view_switch
433 |
434 | junos_mac_address_view_switch:
435 | fields:
436 | interface: {mac-interface: unicode}
437 | mac: {mac-address: unicode}
438 | vlan: {mac-vlan-tag: int}
439 | static: {mac-type: True=Static}
440 |
441 | ###
442 | ### Route Information
443 | ###
444 |
445 | junos_route_table:
446 | rpc: get-route-information
447 | args:
448 | extensive: True
449 | args_key:
450 | destination
451 | item: route-table/rt/rt-entry/nh
452 | key: to
453 | view: junos_route_table_view
454 |
455 | junos_protocol_route_table:
456 | rpc: get-route-information
457 | args:
458 | extensive: True
459 | args_key:
460 | destination
461 | protocol
462 | item: route-table/rt/rt-entry/nh
463 | key: to
464 | view: junos_route_table_view
465 |
466 | junos_route_table_view:
467 | fields:
468 | ###
469 | ### Common fields
470 | ###
471 | destination: {../../rt-destination: unicode}
472 | prefix_length: {../../rt-prefix-length: int}
473 | protocol: {../protocol-name: unicode}
474 | current_active: {../current-active: True=current-active}
475 | last_active: {../last-active: True=last-active}
476 | age: {../age/@seconds: int}
477 | next_hop: {to: unicode}
478 | outgoing_interface: {via: unicode}
479 | selected_next_hop: {selected-next-hop: True=selected-next-hop}
480 | preference: {../preference: int}
481 | inactive_reason: {../inactive-reason: unicode}
482 | routing_table: {../../../table-name: unicode}
483 | ###
484 | ### BGP Specific fields
485 | ###
486 | as_path: {../as-path: unicode}
487 | local_as: {../local-as: int}
488 | remote_as: {../peer-as: int}
489 | local_preference: {../local-preference: int}
490 | communities: {../communities/community: unicode}
491 | preference2: {../preference2: int}
492 | remote_address: {../peer-id: unicode}
493 | metric: {../metric: int}
494 | metric2: {../metric2: int}
495 | ###
496 | ### ISIS Specific fields
497 | ###
498 | level: {../rt-isis-level: int}
499 |
500 | ###
501 | ### SNMP Config
502 | ###
503 |
504 | junos_snmp_config_table:
505 | get: snmp/community
506 | view: junos_snmp_config_view
507 |
508 | junos_snmp_config_view:
509 | fields:
510 | name: name
511 | authorization: authorization
512 | location: ../location
513 | contact: ../contact
514 | chassis: ../system-name
515 |
516 | ###
517 | ### RPM Probes Config
518 | ###
519 |
520 | junos_rpm_probes_config_table:
521 | get: services/rpm/probe/test
522 | view: junos_rpm_probes_config_view
523 |
524 | junos_rpm_probes_config_view:
525 | fields:
526 | probe_name: ../name
527 | probe_type: probe-type
528 | target: target/address
529 | probe_count: probe-count
530 | test_interval: test-interval
531 | source_address: source-address
532 |
533 | ###
534 | ### RPM Probes Results
535 | ###
536 |
537 | junos_rpm_probes_results_table:
538 | rpc: get-probe-results
539 | item: probe-test-results
540 | key: owner
541 | view: junos_rpm_probes_results_view
542 |
543 | junos_rpm_probes_results_view:
544 | fields:
545 | test_name: {test-name: unicode}
546 | target: {target-address: unicode}
547 | source: {source-address: unicode}
548 | probe_type: {probe-type: unicode}
549 | probe_count: {test-size: int}
550 | rtt: {probe-single-results/rtt: float}
551 | round_trip_jitter: {probe-single-results/round-trip-jitter: float}
552 | current_test_min_delay: {probe-test-current-results/probe-test-generic-results/probe-test-rtt/probe-summary-results/min-delay: float}
553 | current_test_max_delay: {probe-test-current-results/probe-test-generic-results/probe-test-rtt/probe-summary-results/max-delay: float}
554 | current_test_avg_delay: {probe-test-current-results/probe-test-generic-results/probe-test-rtt/probe-summary-results/avg-delay: float}
555 | last_test_min_delay: {probe-last-test-results/probe-test-generic-results/probe-test-rtt/probe-summary-results/min-delay: float}
556 | last_test_max_delay: {probe-last-test-results/probe-test-generic-results/probe-test-rtt/probe-summary-results/max-delay: float}
557 | last_test_avg_delay: {probe-last-test-results/probe-test-generic-results/probe-test-rtt/probe-summary-results/avg-delay: float}
558 | last_test_loss: {probe-last-test-results/probe-test-generic-results/loss-percentage: int}
559 | global_test_min_delay: {probe-test-global-results/probe-test-generic-results/probe-test-rtt/probe-summary-results/min-delay: float}
560 | global_test_max_delay: {probe-test-global-results/probe-test-generic-results/probe-test-rtt/probe-summary-results/max-delay: float}
561 | global_test_avg_delay: {probe-test-global-results/probe-test-generic-results/probe-test-rtt/probe-summary-results/avg-delay: float}
562 |
563 | ###
564 | ### Get Users
565 | ###
566 |
567 | junos_users_table:
568 | get: system/login/user
569 | view: junos_users_table_view
570 |
571 | junos_users_table_view:
572 | fields:
573 | class: class
574 | password: authentication/encrypted-password
575 | ssh_rsa: authentication/ssh-rsa/name
576 | ssh_dsa: authentication/ssh-dsa/name
577 | ssh_ecdsa: authentication/ssh-ecdsa/name
578 |
579 | ###
580 | ### Get Optics
581 | ###
582 |
583 | junos_intf_optics_table:
584 | rpc: get-interface-optics-diagnostics-information
585 | item: physical-interface
586 | view: junos_intf_optics_view
587 |
588 | junos_intf_optics_view:
589 | groups:
590 | optics: optics-diagnostics
591 | fields_optics:
592 | laser_bias_current: laser-bias-current
593 | output_power: laser-output-power-dbm
594 | input_power: rx-signal-avg-optical-power-dbm
595 |
--------------------------------------------------------------------------------
/test/unit/junos/mock_data/get-probe-results.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 | sjc-loops
4 | edge01.lax01
5 | 192.168.0.1
6 | icmp-ping
7 |
8 | 5
9 |
10 |
11 | Response received
12 |
13 | Mon Feb 29 11:14:44 2016
14 |
15 | No hardware timestamps
16 | 8118
17 | 350
18 | 553
19 |
20 |
21 |
22 | current test
23 | 4
24 | 4
25 | 0
26 |
27 |
28 | Round trip time
29 | 4
30 |
31 | 7756
32 |
33 |
34 | 8979
35 |
36 |
37 | 8155
38 |
39 |
40 | 1223
41 |
42 |
43 | 497
44 |
45 |
46 | 32621
47 |
48 |
49 |
50 |
51 |
52 | Positive round trip jitter
53 | 3
54 |
55 | 25
56 |
57 |
58 | 1223
59 |
60 |
61 | 533
62 |
63 |
64 | 1198
65 |
66 |
67 | 506
68 |
69 |
70 | 1598
71 |
72 |
73 |
74 |
75 |
76 | Negative round trip jitter
77 | 1
78 |
79 | 1211
80 |
81 |
82 | 1211
83 |
84 |
85 | 1211
86 |
87 |
88 | 0
89 |
90 |
91 | 0
92 |
93 |
94 | 1211
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 | last test
103 | 5
104 | 5
105 | 0
106 |
107 |
108 | Mon Feb 29 11:13:35 2016
109 |
110 |
111 |
112 |
113 | Round trip time
114 | 5
115 |
116 | 7727
117 |
118 |
119 | 8039
120 |
121 |
122 | 7796
123 |
124 |
125 | 312
126 |
127 |
128 | 122
129 |
130 |
131 | 38981
132 |
133 |
134 |
135 |
136 |
137 | Positive round trip jitter
138 | 3
139 |
140 | 4
141 |
142 |
143 | 307
144 |
145 |
146 | 109
147 |
148 |
149 | 303
150 |
151 |
152 | 140
153 |
154 |
155 | 327
156 |
157 |
158 |
159 |
160 |
161 | Negative round trip jitter
162 | 2
163 |
164 | 23
165 |
166 |
167 | 305
168 |
169 |
170 | 164
171 |
172 |
173 | 282
174 |
175 |
176 | 141
177 |
178 |
179 | 328
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 | all tests
188 | 617364
189 | 614320
190 | 0
191 |
192 |
193 | Round trip time
194 | 614320
195 |
196 | 7517
197 |
198 |
199 | 2604766
200 |
201 |
202 | 13134
203 |
204 |
205 | 2597249
206 |
207 |
208 | 24293
209 |
210 |
211 | 8068336360
212 |
213 |
214 |
215 |
216 |
217 | Positive round trip jitter
218 | 306591
219 |
220 | 0
221 |
222 |
223 | 2458850
224 |
225 |
226 | 968
227 |
228 |
229 | 2458850
230 |
231 |
232 | 12429
233 |
234 |
235 | 296911677
236 |
237 |
238 |
239 |
240 |
241 | Negative round trip jitter
242 | 307728
243 |
244 | 1
245 |
246 |
247 | 1561619
248 |
249 |
250 | 965
251 |
252 |
253 | 1561618
254 |
255 |
256 | 10719
257 |
258 |
259 | 296917194
260 |
261 |
262 |
263 |
264 |
265 | 0
266 | 0
267 | 0
268 | 1
269 | 1
270 |
271 |
272 | sjc-loops
273 | edge01.pdx01
274 | 172.17.17.1
275 | icmp-ping
276 |
277 | 10
278 |
279 |
280 | Response received
281 |
282 | Mon Feb 29 11:13:09 2016
283 |
284 | No hardware timestamps
285 | 9018
286 | 1288
287 | 116
288 |
289 |
290 |
291 | current test
292 | 10
293 | 10
294 | 0
295 |
296 |
297 | Round trip time
298 | 10
299 |
300 | 7697
301 |
302 |
303 | 9018
304 |
305 |
306 | 7894
307 |
308 |
309 | 1321
310 |
311 |
312 | 385
313 |
314 |
315 | 78944
316 |
317 |
318 |
319 |
320 |
321 | Positive round trip jitter
322 | 4
323 |
324 | 31
325 |
326 |
327 | 1288
328 |
329 |
330 | 422
331 |
332 |
333 | 1257
334 |
335 |
336 | 510
337 |
338 |
339 | 1687
340 |
341 |
342 |
343 |
344 |
345 | Negative round trip jitter
346 | 5
347 |
348 | 6
349 |
350 |
351 | 305
352 |
353 |
354 | 83
355 |
356 |
357 | 299
358 |
359 |
360 | 112
361 |
362 |
363 | 415
364 |
365 |
366 |
367 |
368 |
369 |
370 |
371 | last test
372 | 10
373 | 10
374 | 0
375 |
376 |
377 | Mon Feb 29 11:13:09 2016
378 |
379 |
380 |
381 |
382 | Round trip time
383 | 10
384 |
385 | 7697
386 |
387 |
388 | 9018
389 |
390 |
391 | 7894
392 |
393 |
394 | 1321
395 |
396 |
397 | 385
398 |
399 |
400 | 78944
401 |
402 |
403 |
404 |
405 |
406 | Positive round trip jitter
407 | 4
408 |
409 | 31
410 |
411 |
412 | 1288
413 |
414 |
415 | 422
416 |
417 |
418 | 1257
419 |
420 |
421 | 510
422 |
423 |
424 | 1687
425 |
426 |
427 |
428 |
429 |
430 | Negative round trip jitter
431 | 5
432 |
433 | 6
434 |
435 |
436 | 305
437 |
438 |
439 | 83
440 |
441 |
442 | 299
443 |
444 |
445 | 112
446 |
447 |
448 | 415
449 |
450 |
451 |
452 |
453 |
454 |
455 |
456 | all tests
457 | 10
458 | 10
459 | 0
460 |
461 |
462 | Round trip time
463 | 10
464 |
465 | 7697
466 |
467 |
468 | 9018
469 |
470 |
471 | 7894
472 |
473 |
474 | 1321
475 |
476 |
477 | 385
478 |
479 |
480 | 78944
481 |
482 |
483 |
484 |
485 |
486 | Positive round trip jitter
487 | 4
488 |
489 | 31
490 |
491 |
492 | 1288
493 |
494 |
495 | 422
496 |
497 |
498 | 1257
499 |
500 |
501 | 510
502 |
503 |
504 | 1687
505 |
506 |
507 |
508 |
509 |
510 | Negative round trip jitter
511 | 5
512 |
513 | 6
514 |
515 |
516 | 305
517 |
518 |
519 | 83
520 |
521 |
522 | 299
523 |
524 |
525 | 112
526 |
527 |
528 | 415
529 |
530 |
531 |
532 |
533 |
534 | 0
535 | 0
536 | 0
537 | 1
538 | 1
539 |
540 |
541 |
--------------------------------------------------------------------------------