Skip to content

Commit

Permalink
Merge pull request #311 from napalm-automation/develop
Browse files Browse the repository at this point in the history
Release 0.8.0
  • Loading branch information
mirceaulinic authored Nov 28, 2019
2 parents 1e44ce5 + 775bd89 commit 7cd2190
Show file tree
Hide file tree
Showing 120 changed files with 1,991 additions and 86 deletions.
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.git
.venv
*.yml
*.md
*.png
*.ini
docs
examples
tests
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ celerybeat-schedule
.env

# virtualenv
.venv/
venv/
ENV/

Expand All @@ -94,3 +95,5 @@ ENV/
.ropeproject
report.json

# PyCharm stuff
.idea
12 changes: 0 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
language: python
sudo: required
services:
- docker
python:
- 2.7
- 3.5
- 3.6
install:
- pip install tox-travis
- pip install coveralls
env:
global:
- secure: "aayKlfqIU/usydWSBz9FQnDWkzH6k4Uoz/aQmEDDB6ziSB9Y7AkszZKJ112aCGN2Zxqde0JTRIPQkAtniH8r1ZPvcoG+4ew31/cz8wolBE9OZs+wSsoWis57EwC/N/xjngvji5ENd3scRULOZciS8KUlqchRzAfcCM+sxPROJ38a3n2oA63IvSVMzbrSGyE2MukxE+bOyXeKtM9upyOC6nGEjcyb7nOdTQz8UcRzxnIIed4W9WpZqhK5gUbmZMlZSpXhu8upgXdrkooDgVLcpH65OaDfRMtExuTEV2CRxWPZLghxNaDgGVui9VbX9nUxOIe8nLwT0FpDr/fiDGn1StBBoy/6XbAbkWsy3PhLRNvXN9dvhKunCmjGs6W2qT6Ems0HmePrHJx2mtI/dGPQAxknDHY6YjMSqtMfbrOJFOerqQ6UI6YmYiBOMfgC36thIa11Pr6VFtGFtn12XTFw3ZmbBIrQ/EB7YtHAvK6w8oX1+Q//UJjTR9Vs8ZPZPcq376WxaNkc15EvHbQ28ZZOjtRyCDz8+0gNcBgx+EY9nt/1lWcLZ/wHLSFjGJtCMZhnfdE7IsJHnG31SpnumweSdQG4/Ngeo1fQYIXTX6eOt7hOJvkRCuzRJTxDQbD9KYXYs3ZmJYuAxVVlV25fmTaniHj6O5llbNwX5vvaYO6/YRY="
- secure: "T5Kbh4QRvETRSaRKVjeu6Tap8TLvtePHaxerJM9ZQn0mH5c+LLjbQvWhtMfZ+Te0GiTy4CZZFybPjt5qpNrQrk8bi2BOjwYNwL7gJyMHKC7hPLfx6zYn+6aZAIR82egz+wIh/LS8cHWbHFNKT1Yj34sUaqt+7PTtLdI8o/rk98R/yd0vQEHFiNy//PLvzHp5OJ40LuT+pYrD9swpQAMBKVHr5pFZEInZga66CT4FdHKs1fpzOWpYm+wDUJ1bhgZAESz+ ZaMNG+wGIRwJeete7A3Qglo2i07wGfpqi6m0pEt4H07uw+4q5EEqRVJq+V/uPC18CcTvjrHq7zcawPhP+Q57bIWd2tqMkEv+RqOIDG7xKU2USlex5AeJ8vUDQ3wq7FpcWXb0h9X8afUMRWOck9R3X0QJnXRtQ3M+bRwncmJHvk0Nb5VhTQ2vlewFrUISZEXdeambirsj1x1AMksIbQCnzQoALB8pzjgmfde5sgw5oBWbIv1EKYxmPa+kOayiXxNrKTgfUTaPMfAbN27uF y1CqrpcRUAMLurTitnbavZlFvyCO+wcdP/tB8E0jIQ2juFAp/8RKMI6Mf0LsVOWzsFrjYwhq6Ehc0QvJI8adE0QuBlV1dMjFwg1KIHrvFeFlKPuSB2w1SIrN51wcohMfETbpj7NAYTLVKEzQo/3Wxc="
deploy:
- provider: pypi
user: mirucha
Expand All @@ -21,11 +14,6 @@ deploy:
on:
tags: true
branch: master
- provider: script
script: bash docker_push.sh
on:
tags: true
branch: master
script:
- tox
after_success:
Expand Down
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM python:3.6-alpine

COPY docker/config.txt /etc/napalm/logs
COPY ./ /var/cache/napalm-logs/

# Install napalm-logs and pre-requisites
RUN apk add --no-cache \
libffi \
libffi-dev \
python-dev \
build-base \
&& pip --no-cache-dir install cffi /var/cache/napalm-logs/ \
&& rm -rf /var/cache/napalm-logs/

CMD napalm-logs --config-file /etc/napalm/logs
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2017 Napalm Automation Team
Copyright 2017-2019 Mircea Ulinic

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 2 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
napalm-logs
Copyright (c) 2017-2019, Mircea Ulinic
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# napalm-logs

napalm-logs is a Python library that listens to syslog messages from network
devices and returns strucuted data following the [OpenConfig](http://www.openconfig.net/)
devices and returns structured data following the [OpenConfig](http://www.openconfig.net/)
or [IETF](https://github.com/YangModels/yang/tree/master/standard/ietf) YANG models.

<img src="logo.png" data-canonical-src="logo.png" width="300" />
Expand Down
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

24 changes: 0 additions & 24 deletions docker/Dockerfile

This file was deleted.

10 changes: 4 additions & 6 deletions docker/Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
NAME := napalm_logs
# This is the version of napalm-logs that will be installed
VERSION ?= $(shell cat ../VERSION)
# This can be changed to build with different BUILD_REQS
INTERATION := 0
VERSION ?= $(shell git describe --tags $(git rev-list --tags --max-count=1))

## To specify which dependencies to install please set BUILD_REQS
## For example:
## make BUILD_REQS="kafka tornado" build

IMAGE = $(NAME):$(VERSION)-${INTERATION}
IMAGE = $(NAME):$(VERSION)
REPO ?= mirceaulinic/napalm-logs

DOCKERFILE ?= Dockerfile
DOCKER_BUILD_CONTEXT ?= .
DOCKER_BUILD_CONTEXT ?= $(dir $(abspath $(PWD)../))

.PHONY: build
build: clean
docker build -f $(DOCKERFILE) -t $(IMAGE) $(DOCKER_BUILD_CONTEXT) --build-arg requirements="${BUILD_REQS}" --build-arg version="${VERSION}"
docker build -f ../$(DOCKERFILE) -t $(IMAGE) $(DOCKER_BUILD_CONTEXT) --build-arg requirements="${BUILD_REQS}"

.PHONY: publish
publish: build
Expand Down
5 changes: 0 additions & 5 deletions docker_push.sh

This file was deleted.

6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,17 @@

# General information about the project.
project = u'napalm-logs'
copyright = u'2017, Mircea Ulinic'
copyright = u'2017-2019, Mircea Ulinic'
author = u'Mircea Ulinic'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = napalm_logs.__version__
# version = napalm_logs.__version__
# The full version, including alpha/beta/rc tags.
release = napalm_logs.__version__
# release = napalm_logs.__version__

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
7 changes: 4 additions & 3 deletions docs/developers/device_profiles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ values using replace functions found in napalm_logs.utils.Replace i.e
This is the YANG model to use to output the log message. You can find all
models and their structure here_.

.. _here: http://ops.openconfig.net/branches/master/
.. _here: https://yangcatalog.org/yang-search/

``mapping``
------------
Expand Down Expand Up @@ -245,9 +245,10 @@ parts extracted from the syslog message, without any further processing. The
following keys are mandatory:

- ``host``: the network device hostname, as provided in the syslog message
prefix section.
prefix section.
- ``tag``: which is the unique identification tag of the syslog message, e.g. in the message ``Mar 30 12:45:19 re0.edge01.bjm01 rpd[15852]: BGP_PREFIX_THRESH_EXCEEDED 1.2.3.4 (External AS 15169): Configured maximum prefix-limit threshold(160) exceeded for inet-unicast nlri: 181 (instance master)``, the ``tag`` is ``BGP_PREFIX_THRESH_EXCEEDED``. Other tag examples: ``bgp_read_message``, ``ROUTING-BGP-5-MAXPFX`` or even ``Alarm set``.
- ``message``: is the message that what we have defied earlier as *the message section*, e.g. ``User 'dummy' entering configuration mode``.
- ``message``: is the message that what we have defied earlier as *the message
section*, e.g. ``User 'dummy' entering configuration mode``.

.. note::

Expand Down
1 change: 1 addition & 0 deletions docs/device_config/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ systems:
ios
netiron
huawei
sonic

To see how to configure the network device, check the documents referenced
above. Note that the examples in each case represents the configuration used to
Expand Down
17 changes: 16 additions & 1 deletion docs/device_config/ios.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,19 @@
Cisco IOS
=========

.. versionadded:: 0.5.0
The following will configure IOS to send the syslog messages, over UDP, to the
IP Address ``10.10.10.1``, port 10101:


.. code-block:: text
logging host 10.10.10.1 transport udp port 10101
To correctly send the hostname information, it is also recommended to explicitly
configure the following:

.. code-block:: text
logging origin-id hostname
Otherwise the device won't send this information.
32 changes: 32 additions & 0 deletions docs/device_config/sonic.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.. _device-configuration-sonic:

===========
Azure SONiC
===========

.. versionadded:: 0.8.0

The following will configure Azure Sonic to send syslog messages, over UDP, to the
IP Address ``10.10.10.1``, port 514 and using the syslog-protocol-23 format.

The Rsyslogd is configured via the rsyslog.conf file, found in ``/etc``.


First, configure Rsyslogd to use the SyslogProtocol23Format template

.. code-block:: text
$template RSYSLOG_SyslogProtocol23Format,"<%PRI%>1 %TIMESTAMP:::date-rfc3339% %HOSTNAME% %APP-NAME% %PROCID% %MSGID% %STRUCTURED-DATA%%msg%\n"
Then, set the remote syslog server

.. code-block:: text
*.* @10.10.10.1:514;RSYSLOG_SyslogProtocol23Format
To correctly send the hostname information, it is also recommended to explicitly
configure the following:

.. code-block:: text
$PreserveFQDN on
6 changes: 3 additions & 3 deletions docs/docker/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ Use the official napalm-logs Docker image
.. versionadded: 0.5.0
Starting with :ref:`release-0.5.0`, there's a Docker image available at
`<https://hub.docker.com/r/mirceaulinic/napalm-logs/>`_.
`<https://hub.docker.com/r/napalmautomation/napalm-logs/>`_.

Pull the Docker image (example):

.. code-block:: bash
docker pull mirceaulinic/napalm-logs:0.5.0
docker pull napalmautomation/napalm-logs:0.5.0
The :ref:`configuration-options-config-file` can, for example, be mounted as
volume to the container:

.. code-block:: bash
docker run -d --name napalm-logs -v /path/to/napalm-logs/config/file:/etc/napalm/logs mirceaulinic/napalm-logs:0.5.0
docker run -d --name napalm-logs -v /path/to/napalm-logs/config/file:/etc/napalm/logs napalmautomation/napalm-logs:0.5.0
For further details, please check the `Docker run reference
<https://docs.docker.com/engine/reference/run/>`_ and how to `share filesystems
Expand Down
2 changes: 1 addition & 1 deletion docs/message_template.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
There is no YANG model available yet to map this class of messages.
Please check the :ref:`{{ error_name }}-json` section to see the structure.
{% else -%}
Maps to the ``{{ error_yang }}`` YANG model.
Maps to the `{{ error_yang }} <https://yangcatalog.org/yang-search/yang_tree/{{ error_yang }}>`__ YANG model.
{% endif %}

.. _{{ error_name }}-os-list:
Expand Down
5 changes: 3 additions & 2 deletions docs/messages_index_template.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ For example, the following syslog message:

``napalm-logs`` identifies that it was produced by a Junos device and assigns
the error tag ``BGP_PREFIX_LIMIT_EXCEEDED`` and then will try to map the
information into the OpenConfig model ``openconfig_bgp``:
information into the OpenConfig model
`openconfig-bgp <https://yangcatalog.org/yang-search/yang_tree/openconfig-bgp>`__:

.. code-block:: json

Expand Down Expand Up @@ -65,7 +66,7 @@ information into the OpenConfig model ``openconfig_bgp``:
"facility": 18,
"ip": "127.0.0.1",
"host": "vmx01",
"yang_model": "openconfig_bgp",
"yang_model": "openconfig-bgp",
"error": "BGP_PREFIX_THRESH_EXCEEDED",
"os": "junos",
"severity": 5
Expand Down
10 changes: 5 additions & 5 deletions docs/metrics/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
Metrics Collection
==================

Timeseries metrics my be optionally collected and exported from the server.
This feature is dissabled by default but can be enabled by passing `--enable-metrics`
Timeseries metrics may be optionally collected and exported from the server.
This feature is disabled by default but can be enabled by passing `--enable-metrics`
when envoking the server.

The metrics offer insight into how the server is processing messages. Each subsystem publishes
its own set of metrics. These are timeserises data so they are mostly counters of processed
its own set of metrics. These are timeseries data so they are mostly counters of processed
elements.

We use the Prometheus metrics format and the metrics are exposed by an HTTP server which by default
run on port tcp/9443. The implementation is fully complient with Prometheus scraping, so you need only
run on port tcp/9443. The implementation is fully compliant with Prometheus scraping, so you need only
point your Prometheus server to the exposed metrics to scrape them.

When using the feature, you must make a directory available which will be used to collect and store
Expand All @@ -32,7 +32,7 @@ napalm_logs_listener_logs_ingested
Count of ingested log messages. Labels are used to seperate metrics for each Listener process.

napalm_logs_listener_messages_published
Count of published messages. The are messages published to the message queue for processing by the Server Process.
Count of published messages. These are messages published to the message queue for processing by the Server Process.
Labels are used to seperate metrics for each Listener process.

Server Process
Expand Down
2 changes: 1 addition & 1 deletion docs/publisher/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ Configuration example:
.. _publisher-opts-no-encrypt:

``no_encrypt``: ``False``
------------------------
-------------------------

.. versionadded:: 0.4.2

Expand Down
Loading

0 comments on commit 7cd2190

Please sign in to comment.