Skip to content

Commit 4e50347

Browse files
authored
Merge pull request #924 from napalm-automation/develop
NAPALM Release 2.4.0
2 parents a1d68e0 + 2e98a86 commit 4e50347

File tree

164 files changed

+26614
-9394
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

164 files changed

+26614
-9394
lines changed

.editorconfig

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# http://editorconfig.org
2+
#
3+
# This file contains directions for an editor (if it supports it)
4+
# about how to manage indents, new lines, etc
5+
# It aids in having consistency amongst developers
6+
7+
root = true
8+
9+
[*]
10+
indent_style = space
11+
indent_size = 4
12+
insert_final_newline = true
13+
trim_trailing_whitespace = true
14+
end_of_line = lf
15+
charset = utf-8
16+
17+
[*.py]
18+
max_line_length = 100
19+
20+
[*.json]
21+
indent_size = 2
22+
23+
[*.{yml,yaml}]
24+
indent_size = 2
25+
26+
# Makefiles always use tabs for indentation
27+
[Makefile]
28+
indent_style = tab
29+
30+
[*.txt]
31+
insert_final_newline = false

.travis.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,27 @@ language: python
22

33
python:
44
- 2.7
5-
- 3.4
65
- 3.5
76
- 3.6
87

98
matrix:
109
include:
11-
- python: 3.6
12-
env: TOXENV=sphinx
10+
- python: 3.6
11+
env: TOXENV=pylama
12+
- python: 3.6
13+
env: TOXENV=black
14+
- python: 3.6
15+
env: TOXENV=sphinx
1316

1417
install:
15-
- pip install tox==3.0.0 tox-travis coveralls
18+
- pip install tox==3.7.0 tox-travis coveralls
1619

1720
deploy:
1821
provider: pypi
1922
user: dbarroso
2023
password:
2124
secure: kt2RgomUtrf5zXo3CyF8B7SkolvKgALAO0s72WuMd0wTGmgOvoBlt10Vfc+G+wuVAYvW/JKdsYRceancAFyWLFgjLtNxbV4cJF2RXN956sYFSJ2VrtUiB19WuKZjX6024gMs780hC/3bdK1SDg/NAAHSR7u2cma3QgRcW6O+UG4=
25+
distributions: "sdist bdist_wheel"
2226
on:
2327
tags: true
2428
branch: master

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[![PyPI](https://img.shields.io/pypi/v/napalm.svg)](https://pypi.python.org/pypi/napalm)
22
[![Build Status](https://travis-ci.org/napalm-automation/napalm.svg?branch=master)](https://travis-ci.org/napalm-automation/napalm)
33
[![Coverage Status](https://coveralls.io/repos/github/napalm-automation/napalm/badge.svg)](https://coveralls.io/github/napalm-automation/napalm)
4+
[![Code Style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
45

56

67
NAPALM

docs/conf.py

Lines changed: 81 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -34,40 +34,37 @@
3434
# If your documentation needs a minimal Sphinx version, state it here.
3535
# needs_sphinx = '1.0'
3636

37-
autoclass_content = 'both'
37+
autoclass_content = "both"
3838

3939
# Add any Sphinx extension module names here, as strings. They can be
4040
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
4141
# ones.
42-
extensions = [
43-
'sphinx.ext.autodoc',
44-
'sphinx.ext.napoleon',
45-
]
42+
extensions = ["sphinx.ext.autodoc", "sphinx.ext.napoleon"]
4643

4744
# Add any paths that contain templates here, relative to this directory.
48-
templates_path = ['_templates']
45+
templates_path = ["_templates"]
4946

5047
# The suffix of source filenames.
51-
source_suffix = '.rst'
48+
source_suffix = ".rst"
5249

5350
# The encoding of source files.
5451
# source_encoding = 'utf-8-sig'
5552

5653
# The master toctree document.
57-
master_doc = 'index'
54+
master_doc = "index"
5855

5956
# General information about the project.
60-
project = u'NAPALM'
61-
copyright = u'2016, David Barroso'
57+
project = u"NAPALM"
58+
copyright = u"2016, David Barroso"
6259

6360
# The version info for the project you're documenting, acts as replacement for
6461
# |version| and |release|, also used in various other places throughout the
6562
# built documents.
6663
#
6764
# The short X.Y version.
68-
version = '0'
65+
version = "0"
6966
# The full version, including alpha/beta/rc tags.
70-
release = '1'
67+
release = "1"
7168

7269
# The language for content autogenerated by Sphinx. Refer to documentation
7370
# for a list of supported languages.
@@ -81,7 +78,7 @@
8178

8279
# List of patterns, relative to source directory, that match files and
8380
# directories to ignore when looking for source files.
84-
exclude_patterns = ['_build', 'napalm_ansible_repo']
81+
exclude_patterns = ["_build", "napalm_ansible_repo"]
8582

8683
# The reST default role (used for this markup: `text`) to use for all
8784
# documents.
@@ -99,7 +96,7 @@
9996
# show_authors = False
10097

10198
# The name of the Pygments (syntax highlighting) style to use.
102-
pygments_style = 'sphinx'
99+
pygments_style = "sphinx"
103100

104101
# A list of ignored prefixes for module index sorting.
105102
# modindex_common_prefix = []
@@ -112,14 +109,15 @@
112109

113110
# The theme to use for HTML and HTML Help pages. See the documentation for
114111
# a list of builtin themes.
115-
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
112+
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
116113

117114
if not on_rtd: # only import and set the theme if we're building docs locally
118115
import sphinx_rtd_theme
119-
html_theme = 'sphinx_rtd_theme'
116+
117+
html_theme = "sphinx_rtd_theme"
120118
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
121119
else:
122-
html_theme = 'default'
120+
html_theme = "default"
123121

124122
# Theme options are theme-specific and customize the look and feel of a theme
125123
# further. For a list of options available for each theme, see the
@@ -148,7 +146,7 @@
148146
# Add any paths that contain custom static files (such as style sheets) here,
149147
# relative to this directory. They are copied after the builtin static files,
150148
# so a file named "default.css" will overwrite the builtin "default.css".
151-
html_static_path = ['_static']
149+
html_static_path = ["_static"]
152150

153151
# Add any extra paths that contain custom files (such as robots.txt or
154152
# .htaccess) here, relative to this directory. These files are copied
@@ -197,18 +195,16 @@
197195
# html_file_suffix = None
198196

199197
# Output file base name for HTML help builder.
200-
htmlhelp_basename = 'napalmdoc'
198+
htmlhelp_basename = "napalmdoc"
201199

202200

203201
# -- Options for LaTeX output ---------------------------------------------
204202

205203
latex_elements = {
206204
# The paper size ('letterpaper' or 'a4paper').
207205
# 'papersize': 'letterpaper',
208-
209206
# The font size ('10pt', '11pt' or '12pt').
210207
# 'pointsize': '10pt',
211-
212208
# Additional stuff for the LaTeX preamble.
213209
# 'preamble': '',
214210
}
@@ -217,8 +213,7 @@
217213
# (source start file, target name, title,
218214
# author, documentclass [howto, manual, or own class]).
219215
latex_documents = [
220-
('index', 'napalm.tex', u'NAPALM Documentation',
221-
u'David Barroso', 'manual'),
216+
("index", "napalm.tex", u"NAPALM Documentation", u"David Barroso", "manual")
222217
]
223218

224219
# The name of an image file (relative to this directory) to place at the top of
@@ -246,10 +241,7 @@
246241

247242
# One entry per manual page. List of tuples
248243
# (source start file, name, description, authors, manual section).
249-
man_pages = [
250-
('index', 'napalm', u'NAPALM Documentation',
251-
[u'David Barroso'], 1)
252-
]
244+
man_pages = [("index", "napalm", u"NAPALM Documentation", [u"David Barroso"], 1)]
253245

254246
# If true, show URL addresses after external links.
255247
# man_show_urls = False
@@ -261,9 +253,15 @@
261253
# (source start file, target name, title, author,
262254
# dir menu entry, description, category)
263255
texinfo_documents = [
264-
('index', 'napalm', u'NAPALM Documentation',
265-
u'David Barroso', 'napalm', 'One line description of project.',
266-
'Miscellaneous'),
256+
(
257+
"index",
258+
"napalm",
259+
u"NAPALM Documentation",
260+
u"David Barroso",
261+
"napalm",
262+
"One line description of project.",
263+
"Miscellaneous",
264+
)
267265
]
268266

269267
# Documents to append as an appendix to all manuals.
@@ -282,26 +280,38 @@
282280
enable_pdf_build = False
283281
enable_epub_build = False
284282

285-
EXCLUDE_METHODS = ('cli', 'close', 'commit_config', 'compare_config',
286-
'discard_config', 'load_merge_candidate',
287-
'load_replace_candidate', 'load_template', 'open',
288-
'rollback', 'compliance_report', 'connection_tests',
289-
'post_connection_tests', 'pre_connection_tests')
290-
291-
EXCLUDE_IN_REPORT = ('test_method_signatures')
283+
EXCLUDE_METHODS = (
284+
"cli",
285+
"close",
286+
"commit_config",
287+
"compare_config",
288+
"discard_config",
289+
"load_merge_candidate",
290+
"load_replace_candidate",
291+
"load_template",
292+
"open",
293+
"rollback",
294+
"compliance_report",
295+
"connection_tests",
296+
"post_connection_tests",
297+
"pre_connection_tests",
298+
)
299+
300+
EXCLUDE_IN_REPORT = "test_method_signatures"
292301

293302
METHOD_ALIASES = {
294-
'get_config_filtered': 'get_config',
303+
"get_config_filtered": "get_config",
304+
"get_arp_table_with_vrf": "get_arp_table",
295305
}
296306

297307

298308
def _merge_results(last, intermediate):
299-
if intermediate == 'failed':
300-
return 'failed'
301-
elif intermediate == 'skipped':
302-
return 'failed' if last == 'failed' else 'skipped'
303-
elif intermediate == 'passed':
304-
return 'ok' if last == 'ok' else last
309+
if intermediate == "failed":
310+
return "failed"
311+
elif intermediate == "skipped":
312+
return "failed" if last == "failed" else "skipped"
313+
elif intermediate == "passed":
314+
return "ok" if last == "ok" else last
305315
else:
306316
return last
307317

@@ -310,23 +320,25 @@ def build_napalm_ansible_module_docs(app):
310320
"""Create documentation for Ansible modules."""
311321

312322
# Add script to clone napalm-ansible repo
313-
status = subprocess.call("./build-ansible-module-docs.sh", stdout=sys.stdout, stderr=sys.stderr)
323+
status = subprocess.call(
324+
"./build-ansible-module-docs.sh", stdout=sys.stdout, stderr=sys.stderr
325+
)
314326

315327
if status != 0:
316328
print("Something bad happened when processing the Ansible modules.")
317329
sys.exit(-1)
318330

319331
env = Environment(loader=FileSystemLoader("."))
320332

321-
modules_dir = './integrations/ansible/modules/source'
322-
module_files = glob('{0}/*.json'.format(modules_dir))
333+
modules_dir = "./integrations/ansible/modules/source"
334+
module_files = glob("{0}/*.json".format(modules_dir))
323335
for module_file in module_files:
324-
with open(module_file, 'r') as f:
325-
module = module_file.split('/')[-1].split('.')[0]
336+
with open(module_file, "r") as f:
337+
module = module_file.split("/")[-1].split(".")[0]
326338
data = json.loads(f.read())
327-
data['name'] = module
339+
data["name"] = module
328340

329-
module_dir = './integrations/ansible/modules/{0}'.format(module)
341+
module_dir = "./integrations/ansible/modules/{0}".format(module)
330342

331343
try:
332344
os.stat(module_dir)
@@ -336,7 +348,7 @@ def build_napalm_ansible_module_docs(app):
336348
template_file = env.get_template("ansible-module.j2")
337349
rendered_template = template_file.render(**data)
338350

339-
with open('{0}/index.rst'.format(module_dir), 'w') as f:
351+
with open("{0}/index.rst".format(module_dir), "w") as f:
340352
f.write(rendered_template)
341353

342354

@@ -349,26 +361,28 @@ def build_getters_support_matrix(app):
349361
sys.exit(-1)
350362

351363
drivers = set()
352-
matrix = {m: defaultdict(dict) for m in dir(NetworkDriver)
353-
if not (m.startswith('_') or
354-
m in EXCLUDE_METHODS)}
364+
matrix = {
365+
m: defaultdict(dict)
366+
for m in dir(NetworkDriver)
367+
if not (m.startswith("_") or m in EXCLUDE_METHODS)
368+
}
355369

356370
regex_name = re.compile(r"(?P<driver>\w+)\/.*::test_(?P<getter>\w+)")
357371

358-
filename = './support/tests/report.json'
359-
with open(filename, 'r') as f:
372+
filename = "./support/tests/report.json"
373+
with open(filename, "r") as f:
360374
data = json.loads(f.read())
361375
for test in data["report"]["tests"]:
362-
match = regex_name.search(test['name'])
376+
match = regex_name.search(test["name"])
363377
if match:
364-
driver = match.group('driver')
378+
driver = match.group("driver")
365379
drivers.add(driver)
366-
method = match.group('getter')
380+
method = match.group("getter")
367381
else:
368382
continue
369383
if method in EXCLUDE_IN_REPORT:
370384
continue
371-
result = test['outcome']
385+
result = test["outcome"]
372386

373387
if method in METHOD_ALIASES.keys():
374388
method = METHOD_ALIASES[method]
@@ -380,17 +394,18 @@ def build_getters_support_matrix(app):
380394
drivers = sorted(drivers)
381395
env = Environment(loader=FileSystemLoader("."))
382396
template_file = env.get_template("matrix.j2")
383-
rendered_template = template_file.render(matrix=matrix, drivers=drivers,
384-
sorted_methods=sorted_methods)
397+
rendered_template = template_file.render(
398+
matrix=matrix, drivers=drivers, sorted_methods=sorted_methods
399+
)
385400

386-
with open('support/matrix.rst', 'w') as f:
401+
with open("support/matrix.rst", "w") as f:
387402
f.write(rendered_template)
388403

389404

390405
def setup(app):
391406
"""Map methods to states of the documentation build."""
392-
app.connect('builder-inited', build_getters_support_matrix)
393-
app.connect('builder-inited', build_napalm_ansible_module_docs)
407+
app.connect("builder-inited", build_getters_support_matrix)
408+
app.connect("builder-inited", build_napalm_ansible_module_docs)
394409

395410

396411
build_getters_support_matrix(None)

docs/support/eos.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ EOS
44
Minimum Version
55
~~~~~~~~~~~~~~~
66

7-
To be able to support the ``compare_config`` method you will require to run at least EOS version `4.15.0F`.
7+
To be able to support the ``compare_config``, ``load_merge_candidate`` or ``load_replace_candidate`` methods you will require to run at least EOS version `4.15.0F`.
88

99
Multi-line/HEREDOC
1010
~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)