diff -pruN 4.21+dfsg1-4/debian/changelog 4.26+dfsg1-5/debian/changelog
--- 4.21+dfsg1-4/debian/changelog	2018-03-18 21:00:30.000000000 +0000
+++ 4.26+dfsg1-5/debian/changelog	2019-01-10 09:30:25.000000000 +0000
@@ -1,3 +1,44 @@
+ryu (4.26+dfsg1-5) unstable; urgency=medium
+
+  [ Ondřej Nový ]
+  * Running wrap-and-sort -bast.
+
+  [ Thomas Goirand ]
+  * Fix Breaks+Replaces to allow upgrade for Stretch (Closes: #917992).
+
+ -- Thomas Goirand <zigo@debian.org>  Thu, 10 Jan 2019 10:30:25 +0100
+
+ryu (4.26+dfsg1-4) unstable; urgency=medium
+
+  * Removed update-alternatives --install /usr/bin/ryu{,-manager}, as we don't
+    want it since removal of Python 2 support.
+
+ -- Thomas Goirand <zigo@debian.org>  Tue, 01 Jan 2019 05:59:04 +0100
+
+ryu (4.26+dfsg1-3) unstable; urgency=medium
+
+  * Removed Python 2 support.
+  * Add fix-ut-when-running-in-python-3.7-env.patch (Closes: #917661).
+
+ -- Thomas Goirand <zigo@debian.org>  Sun, 30 Dec 2018 06:01:35 +0100
+
+ryu (4.26+dfsg1-2) unstable; urgency=medium
+
+  * Uploading to unstable.
+
+ -- Thomas Goirand <zigo@debian.org>  Mon, 03 Sep 2018 23:44:47 +0200
+
+ryu (4.26+dfsg1-1) experimental; urgency=medium
+
+  [ Ondřej Nový ]
+  * d/control: Use team+openstack@tracker.debian.org as maintainer
+
+  [ Thomas Goirand ]
+  * New upstream release.
+  * Rebased both 2 patches.
+
+ -- Thomas Goirand <zigo@debian.org>  Thu, 23 Aug 2018 13:53:12 +0200
+
 ryu (4.21+dfsg1-4) unstable; urgency=medium
 
   * Fixed Python 3 shebang.
diff -pruN 4.21+dfsg1-4/debian/control 4.26+dfsg1-5/debian/control
--- 4.21+dfsg1-4/debian/control	2018-03-18 21:00:30.000000000 +0000
+++ 4.26+dfsg1-5/debian/control	2019-01-10 09:30:25.000000000 +0000
@@ -1,7 +1,7 @@
 Source: ryu
 Section: net
 Priority: optional
-Maintainer: Debian OpenStack <openstack-devel@lists.alioth.debian.org>
+Maintainer: Debian OpenStack <team+openstack@tracker.debian.org>
 Uploaders:
  Thomas Goirand <zigo@debian.org>,
  Dariusz Dwornikowski <dariusz.dwornikowski@cs.put.poznan.pl>,
@@ -9,94 +9,40 @@ Build-Depends:
  debhelper (>= 10),
  dh-python,
  openstack-pkg-tools,
- python-all,
- python-pbr,
- python-setuptools,
- python-sphinx <!nodoc>,
- python-sphinx-rtd-theme <!nodoc>,
  python3-all,
  python3-pbr,
  python3-setuptools,
+ python3-sphinx <!nodoc>,
+ python3-sphinx-rtd-theme <!nodoc>,
  sphinx-common,
 Build-Depends-Indep:
- python-eventlet <!nocheck>,
- python-eventlet <!nodoc>,
- python-formencode <!nocheck>,
- python-formencode <!nodoc>,
- python-lxml <!nocheck>,
- python-mock <!nocheck>,
- python-msgpack <!nocheck>,
- python-netaddr <!nocheck>,
- python-netaddr <!nodoc>,
- python-nose <!nocheck>,
- python-openvswitch <!nocheck>,
- python-oslo.config <!nocheck>,
- python-oslo.config <!nodoc>,
- python-paramiko <!nocheck>,
- python-pip <!nocheck>,
- python-pip <!nodoc>,
- python-routes <!nocheck>,
- python-routes <!nodoc>,
- python-six,
- python-tinyrpc <!nocheck>,
- python-tinyrpc <!nodoc>,
- python-webob <!nocheck>,
  python3-eventlet <!nocheck>,
+ python3-eventlet <!nodoc>,
  python3-formencode <!nocheck>,
+ python3-formencode <!nodoc>,
  python3-lxml <!nocheck>,
  python3-mock <!nocheck>,
  python3-msgpack <!nocheck>,
  python3-netaddr <!nocheck>,
+ python3-netaddr <!nodoc>,
  python3-nose <!nocheck>,
  python3-openvswitch <!nocheck>,
  python3-oslo.config <!nocheck>,
+ python3-oslo.config <!nodoc>,
  python3-paramiko <!nocheck>,
  python3-pip <!nocheck>,
+ python3-pip <!nodoc>,
  python3-routes <!nocheck>,
+ python3-routes <!nodoc>,
  python3-six <!nocheck>,
  python3-tinyrpc <!nocheck>,
+ python3-tinyrpc <!nodoc>,
  python3-webob <!nocheck>,
 Standards-Version: 4.1.1
 Vcs-Browser: https://salsa.debian.org/openstack-team/third-party/ryu
 Vcs-Git: https://salsa.debian.org/openstack-team/third-party/ryu.git
 Homepage: http://osrg.github.io/ryu/
 
-Package: python-ryu
-Architecture: all
-Section: python
-Depends:
- python-eventlet,
- python-lxml,
- python-msgpack,
- python-netaddr,
- python-openvswitch,
- python-oslo.config,
- python-paramiko,
- python-pip,
- python-routes,
- python-six,
- python-tinyrpc,
- python-webob,
- ${misc:Depends},
- ${python:Depends},
-Suggests:
- python-ryu-doc,
-Provides:
- ${python:Provides},
-Breaks:
- ryu-bin (<< 3.30+dfsg1-4~),
-Replaces:
- ryu-bin (<< 3.30+dfsg1-4~),
-Description: software defined networking framework - Python 2.7
- Ryu is a component-based software defined networking framework.
- Ryu provides software components with well defined API that make
- it easy for developers to create new network management and control
- applications. Ryu supports various protocols for managing network
- devices, such as OpenFlow, Netconf, OF-config, etc. About OpenFlow,
- Ryu supports fully 1.0, 1.2, 1.3, 1.4 and Nicira Extensions.
- .
- This package provides the Python 2.7 module.
-
 Package: python-ryu-doc
 Architecture: all
 Section: doc
@@ -138,9 +84,9 @@ Suggests:
 Provides:
  ${python3:Provides},
 Breaks:
- ryu-bin (<< 3.30+dfsg1-4~),
+ ryu-bin (<< 4.26+dfsg1-4~),
 Replaces:
- ryu-bin (<< 3.30+dfsg1-4~),
+ ryu-bin (<< 4.26+dfsg1-4~),
 Description: software defined networking framework - Python 3
  Ryu is a component-based software defined networking framework.
  Ryu provides software components with well defined API that make
@@ -155,7 +101,7 @@ Package: ryu-bin
 Architecture: all
 Depends:
  adduser,
- python3-ryu (= ${binary:Version}) | python-ryu (= ${binary:Version}),
+ python3-ryu (= ${binary:Version}),
  ${misc:Depends},
  ${ostack-lsb-base},
 Description: software defined networking framework - ryu binary
diff -pruN 4.21+dfsg1-4/debian/patches/fix-ut-when-running-in-python-3.7-env.patch 4.26+dfsg1-5/debian/patches/fix-ut-when-running-in-python-3.7-env.patch
--- 4.21+dfsg1-4/debian/patches/fix-ut-when-running-in-python-3.7-env.patch	1970-01-01 00:00:00.000000000 +0000
+++ 4.26+dfsg1-5/debian/patches/fix-ut-when-running-in-python-3.7-env.patch	2019-01-10 09:30:25.000000000 +0000
@@ -0,0 +1,25 @@
+Description: Fix UT when running in python 3.7 env
+ Due to change [1] in python 3.7 one of ryu's unit tests
+ was failing with this version of interpreter. It was like that
+ because of missing qualname attribute in functools.partial
+ object.
+ This patch fixes it by adding such attribute if it's not
+ set already.
+ .
+ [1] python/cpython#4496
+Author: Slawek Kaplonski <skaplons@redhat.com>
+Bug-Debian: https://bugs.debian.org/917661
+Origin: upstream, https://github.com/osrg/ryu/commit/bb3963b448b542c3aeac5fb9f3f15fcee5c2b423.patch
+Last-Update: 2018-12-30
+
+--- ryu-4.26+dfsg1.orig/ryu/tests/test_lib.py
++++ ryu-4.26+dfsg1/ryu/tests/test_lib.py
+@@ -267,6 +267,8 @@ def add_method(cls, method_name, method)
+     method.__name__ = method_name
+     if six.PY3:
+         methodtype = types.MethodType(method, cls)
++        if not hasattr(method, "__qualname__"):
++            method.__qualname__ = "%s.%s" % (cls.__qualname__, method_name)
+     else:
+         methodtype = types.MethodType(method, None, cls)
+     setattr(cls, method_name, methodtype)
diff -pruN 4.21+dfsg1-4/debian/patches/remove-failing-test.patch 4.26+dfsg1-5/debian/patches/remove-failing-test.patch
--- 4.21+dfsg1-4/debian/patches/remove-failing-test.patch	2018-03-18 21:00:30.000000000 +0000
+++ 4.26+dfsg1-5/debian/patches/remove-failing-test.patch	2019-01-10 09:30:25.000000000 +0000
@@ -6,17 +6,22 @@ Last-Update: 2018-02-16
 
 --- ryu-4.21+dfsg1.orig/ryu/tests/unit/lib/test_rpc.py
 +++ ryu-4.21+dfsg1/ryu/tests/unit/lib/test_rpc.py
-@@ -138,14 +138,6 @@ class Test_rpc(unittest.TestCase):
+@@ -138,19 +138,6 @@
          assert result == obj
          assert isinstance(result, numbers.Integral)
  
--    @raises(TypeError)
 -    def test_0_call_bytearray(self):
 -        c = rpc.Client(self._client_sock)
 -        obj = bytearray(b'foo')
--        result = c.call('resp', [obj])
--        assert result == obj
--        assert isinstance(result, str)
+-        # Note: msgpack-python version 0.50 or later supports bytearray
+-        # objects, here ignores TypeError for the backward compatibility.
+-        try:
+-            result = c.call('resp', [obj])
+-        except TypeError:
+-            # Case with msgpack-python version 0.4.x or earlier.
+-            return
+-        self.assertEqual(obj, result)
+-        self.assertIsInstance(result, six.binary_type)
 -
      def test_1_shutdown_wr(self):
          # test if the server shutdown on disconnect
diff -pruN 4.21+dfsg1-4/debian/patches/remove-test-requirements-units.patch 4.26+dfsg1-5/debian/patches/remove-test-requirements-units.patch
--- 4.21+dfsg1-4/debian/patches/remove-test-requirements-units.patch	2018-03-18 21:00:30.000000000 +0000
+++ 4.26+dfsg1-5/debian/patches/remove-test-requirements-units.patch	2019-01-10 09:30:25.000000000 +0000
@@ -7,7 +7,7 @@ Last-Update: 2018-02-16
 
 --- a/ryu/tests/unit/test_requirements.py	2018-02-16 16:23:17.620509503 +0000
 +++ /dev/null	2017-10-16 21:43:57.398818308 +0000
-@@ -1,86 +0,0 @@
+@@ -1,85 +0,0 @@
 -# Copyright (C) 2016 Nippon Telegraph and Telephone Corporation.
 -#
 -# Licensed under the Apache License, Version 2.0 (the "License");
@@ -29,8 +29,6 @@ Last-Update: 2018-02-16
 -import unittest
 -
 -import pkg_resources
--from pip.req import parse_requirements
--from pip.download import PipSession
 -from six.moves import urllib
 -
 -from nose.tools import ok_
@@ -38,7 +36,7 @@ Last-Update: 2018-02-16
 -
 -LOG = logging.getLogger(__name__)
 -
--MOD_DIR = os.path.dirname(sys.modules[__name__].__file__)
+-MOD_DIR = os.path.dirname('file://' + sys.modules[__name__].__file__)
 -_RYU_REQUIREMENTS_FILES = [
 -    '../../../tools/pip-requires',
 -    '../../../tools/optional-requires',
@@ -61,9 +59,10 @@ Last-Update: 2018-02-16
 -def _get_requirements(files):
 -    requirements = {}
 -    for f in files:
--        req = parse_requirements(f, session=PipSession())
--        for r in req:
--            requirements[r.name] = str(r.req)
+-        response = urllib.request.urlopen(f)
+-        contents = response.read().decode('utf-8')
+-        for r in pkg_resources.parse_requirements(contents):
+-            requirements[r.name] = str(r)
 -
 -    return requirements
 -
@@ -92,5 +91,5 @@ Last-Update: 2018-02-16
 -        except pkg_resources.VersionConflict as e:
 -            LOG.exception(
 -                'Some requirements of Ryu are conflicting with that of '
--                'OpenStack project: %s' % OPENSTACK_REQUIREMENTS_REPO)
+-                'OpenStack project: %s', OPENSTACK_REQUIREMENTS_REPO)
 -            raise e
diff -pruN 4.21+dfsg1-4/debian/patches/series 4.26+dfsg1-5/debian/patches/series
--- 4.21+dfsg1-4/debian/patches/series	2018-03-18 21:00:30.000000000 +0000
+++ 4.26+dfsg1-5/debian/patches/series	2019-01-10 09:30:25.000000000 +0000
@@ -1,2 +1,3 @@
 remove-test-requirements-units.patch
 remove-failing-test.patch
+fix-ut-when-running-in-python-3.7-env.patch
diff -pruN 4.21+dfsg1-4/debian/python3-ryu.postinst 4.26+dfsg1-5/debian/python3-ryu.postinst
--- 4.21+dfsg1-4/debian/python3-ryu.postinst	2018-03-18 21:00:30.000000000 +0000
+++ 4.26+dfsg1-5/debian/python3-ryu.postinst	1970-01-01 00:00:00.000000000 +0000
@@ -1,12 +0,0 @@
-#!/bin/sh
-
-set -e
-
-if [ "$1" = "configure" ] ; then
-	update-alternatives --install /usr/bin/ryu ryu /usr/bin/python3-ryu 400
-	update-alternatives --install /usr/bin/ryu-manager ryu-manager /usr/bin/python3-ryu-manager 400
-fi
-
-#DEBHELPER#
-
-exit 0
diff -pruN 4.21+dfsg1-4/debian/python-ryu.postinst 4.26+dfsg1-5/debian/python-ryu.postinst
--- 4.21+dfsg1-4/debian/python-ryu.postinst	2018-03-18 21:00:30.000000000 +0000
+++ 4.26+dfsg1-5/debian/python-ryu.postinst	1970-01-01 00:00:00.000000000 +0000
@@ -1,12 +0,0 @@
-#!/bin/sh
-
-set -e
-
-if [ "$1" = "configure" ] ; then
-	update-alternatives --install /usr/bin/ryu ryu /usr/bin/python2-ryu 300
-	update-alternatives --install /usr/bin/ryu-manager ryu-manager /usr/bin/python2-ryu-manager 300
-fi
-
-#DEBHELPER#
-
-exit 0
diff -pruN 4.21+dfsg1-4/debian/python-ryu.postrm 4.26+dfsg1-5/debian/python-ryu.postrm
--- 4.21+dfsg1-4/debian/python-ryu.postrm	2018-03-18 21:00:30.000000000 +0000
+++ 4.26+dfsg1-5/debian/python-ryu.postrm	1970-01-01 00:00:00.000000000 +0000
@@ -1,12 +0,0 @@
-#!/bin/sh
-
-set -e
-
-if [ "$1" = "remove" ] || [ "$1" = "disappear" ] ; then
-	update-alternatives --remove ryu /usr/bin/python2-ryu
-	update-alternatives --remove ryu-manager /usr/bin/python2-ryu-manager
-fi
-
-#DEBHELPER#
-
-exit 0
diff -pruN 4.21+dfsg1-4/debian/python-ryu.prerm 4.26+dfsg1-5/debian/python-ryu.prerm
--- 4.21+dfsg1-4/debian/python-ryu.prerm	2018-03-18 21:00:30.000000000 +0000
+++ 4.26+dfsg1-5/debian/python-ryu.prerm	1970-01-01 00:00:00.000000000 +0000
@@ -1,12 +0,0 @@
-#!/bin/sh
-
-set -e
-
-if [ "$1" = "remove" ] ; then
-	update-alternatives --remove ryu /usr/bin/python2-ryu
-	update-alternatives --remove ryu-manager /usr/bin/python2-ryu-manager
-fi
-
-#DEBHELPER#
-
-exit 0
diff -pruN 4.21+dfsg1-4/debian/rules 4.26+dfsg1-5/debian/rules
--- 4.21+dfsg1-4/debian/rules	2018-03-18 21:00:30.000000000 +0000
+++ 4.26+dfsg1-5/debian/rules	2019-01-10 09:30:25.000000000 +0000
@@ -7,15 +7,14 @@ LAST_CHANGE=$(shell dpkg-parsechangelog
 BUILD_DATE=$(shell LC_ALL=C date -u "+%B %d, %Y" -d "$(LAST_CHANGE)")
 
 %:
-	dh $@ --buildsystem=python_distutils --with python2,python3,sphinxdoc,systemd
+	dh $@ --buildsystem=python_distutils --with python3,sphinxdoc,systemd
 
 override_dh_auto_build:
-	dh_auto_build
 	/usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func ryu-bin.postinst
 
 override_dh_auto_test:
 ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
-	for i in $(PYTHONS) $(PYTHON3S) ; do \
+	for i in $(PYTHON3S) ; do \
 		http_proxy=127.0.0.1:9 https_proxy=127.0.0.1:9 PYTHONPATH=. python$$i ryu/tests/run_tests.py ; \
 	done
 endif
@@ -30,12 +29,12 @@ endif
 
 override_dh_sphinxdoc:
 ifeq (,$(findstring nodoc, $(DEB_BUILD_OPTIONS)))
-	PYTHONPATH=. sphinx-build -b html doc/source debian/python-ryu-doc/usr/share/doc/python-ryu-doc/html
+	PYTHONPATH=. PYTHON=python3 python3 -m sphinx -b html doc/source debian/python-ryu-doc/usr/share/doc/python-ryu-doc/html
 	dh_sphinxdoc
 endif
 
 override_dh_auto_install:
-	pkgos-dh_auto_install
+	pkgos-dh_auto_install --no-py2
 	rm -rf $(CURDIR)/debian/python3-ryu/usr/etc $(CURDIR)/debian/python-ryu/usr/etc
 
 override_dh_installinit:
@@ -50,17 +49,6 @@ override_dh_clean:
 
 override_dh_auto_clean:
 	rm -rf debian/ryu-manager.8 debian/ryu.8 debian/ryu-bin.postinst
-	http_proxy=127.0.0.1:9 https_proxy=127.0.0.1:9 dh_auto_clean
 
 override_dh_python3:
 	dh_python3 --shebang=/usr/bin/python3
-
-# Commands not to run
-override_dh_installcatalogs:
-override_dh_installemacsen override_dh_installifupdown:
-override_dh_installinfo override_dh_installmenu override_dh_installmime:
-override_dh_installmodules override_dh_installlogcheck:
-override_dh_installpam override_dh_installppp override_dh_installudev override_dh_installwm:
-override_dh_installxfonts override_dh_gconf override_dh_icons override_dh_perl override_dh_usrlocal:
-override_dh_installcron override_dh_installdebconf:
-override_dh_installgsettings:
diff -pruN 4.21+dfsg1-4/doc/source/app/bgp_application.rst 4.26+dfsg1-5/doc/source/app/bgp_application.rst
--- 4.21+dfsg1-4/doc/source/app/bgp_application.rst	1970-01-01 00:00:00.000000000 +0000
+++ 4.26+dfsg1-5/doc/source/app/bgp_application.rst	2018-08-23 11:52:05.000000000 +0000
@@ -0,0 +1,6 @@
+**************************************
+ryu.services.protocols.bgp.application
+**************************************
+
+.. automodule:: ryu.services.protocols.bgp.application
+   :members:
diff -pruN 4.21+dfsg1-4/doc/source/app.rst 4.26+dfsg1-5/doc/source/app.rst
--- 4.21+dfsg1-4/doc/source/app.rst	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/doc/source/app.rst	2018-08-23 11:52:05.000000000 +0000
@@ -12,3 +12,4 @@ Others provide some functionalities to o
    app/ofctl.rst
    app/ofctl_rest.rst
    app/rest_vtep.rst
+   app/bgp_application.rst
diff -pruN 4.21+dfsg1-4/doc/source/library_ovsdb.rst 4.26+dfsg1-5/doc/source/library_ovsdb.rst
--- 4.21+dfsg1-4/doc/source/library_ovsdb.rst	1970-01-01 00:00:00.000000000 +0000
+++ 4.26+dfsg1-5/doc/source/library_ovsdb.rst	2018-08-23 11:52:05.000000000 +0000
@@ -0,0 +1,76 @@
+*************
+OVSDB library
+*************
+
+Path: ``ryu.lib.ovs``
+
+Similar to the :doc:`library_ovsdb_manager`, this library enables your
+application to speak the OVSDB protocol (RFC7047_), but differ from the
+:doc:`library_ovsdb_manager`, this library will initiate connections from
+controller side as ovs-vsctl_ command does.
+Please make sure that your devices are listening on either the Unix domain
+socket or TCP/SSL port before calling the APIs of this library.
+
+.. code-block:: bash
+
+    # Show current configuration
+    $ ovs-vsctl get-manager
+
+    # Set TCP listen address
+    $ ovs-vsctl set-manager "ptcp:6640"
+
+See manpage of ovs-vsctl_ command for more details.
+
+.. _RFC7047: https://tools.ietf.org/html/rfc7047
+.. _ovs-vsctl: http://openvswitch.org/support/dist-docs/ovs-vsctl.8.txt
+
+Basic Usage
+===========
+
+1. Instantiate :py:mod:`ryu.lib.ovs.vsctl.VSCtl`.
+
+2. Construct commands with :py:mod:`ryu.lib.ovs.vsctl.VSCtlCommand`.
+   The syntax is almost the same as ovs-vsctl_ command.
+
+3. Execute commands via :py:mod:`ryu.lib.ovs.vsctl.VSCtl.run_command`.
+
+Example
+-------
+
+.. code-block:: python
+
+    from ryu.lib.ovs import vsctl
+
+    OVSDB_ADDR = 'tcp:127.0.0.1:6640'
+    ovs_vsctl = vsctl.VSCtl(OVSDB_ADDR)
+
+    # Equivalent to
+    # $ ovs-vsctl show
+    command = vsctl.VSCtlCommand('show')
+    ovs_vsctl.run_command([command])
+    print(command)
+    # >>> VSCtlCommand(args=[],command='show',options=[],result='830d781f-c3c8-4b4f-837e-106e1b33d058\n    ovs_version: "2.8.90"\n')
+
+    # Equivalent to
+    # $ ovs-vsctl list Port s1-eth1
+    command = vsctl.VSCtlCommand('list', ('Port', 's1-eth1'))
+    ovs_vsctl.run_command([command])
+    print(command)
+    # >>> VSCtlCommand(args=('Port', 's1-eth1'),command='list',options=[],result=[<ovs.db.idl.Row object at 0x7f525fb682e8>])
+    print(command.result[0].name)
+    # >>> s1-eth1
+
+API Reference
+=============
+
+ryu.lib.ovs.vsctl
+-----------------
+
+.. automodule:: ryu.lib.ovs.vsctl
+    :members:
+
+ryu.lib.ovs.bridge
+------------------
+
+.. automodule:: ryu.lib.ovs.bridge
+    :members:
diff -pruN 4.21+dfsg1-4/doc/source/library.rst 4.26+dfsg1-5/doc/source/library.rst
--- 4.21+dfsg1-4/doc/source/library.rst	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/doc/source/library.rst	2018-08-23 11:52:05.000000000 +0000
@@ -15,3 +15,4 @@ Ryu provides some useful library for you
    library_bgp_speaker_ref.rst
    library_mrt.rst
    library_ovsdb_manager.rst
+   library_ovsdb.rst
diff -pruN 4.21+dfsg1-4/doc/source/nicira_ext_ref.rst 4.26+dfsg1-5/doc/source/nicira_ext_ref.rst
--- 4.21+dfsg1-4/doc/source/nicira_ext_ref.rst	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/doc/source/nicira_ext_ref.rst	2018-08-23 11:52:05.000000000 +0000
@@ -54,6 +54,7 @@ The followings shows the supported NXAct
 .. autoclass:: NXActionCT
 .. autoclass:: NXActionNAT
 .. autoclass:: NXActionOutputTrunc
+.. autoclass:: NXActionDecNshTtl
 .. autoclass:: NXFlowSpecMatch
 .. autoclass:: NXFlowSpecLoad
 .. autoclass:: NXFlowSpecOutput
diff -pruN 4.21+dfsg1-4/ryu/app/ofctl/api.py 4.26+dfsg1-5/ryu/app/ofctl/api.py
--- 4.21+dfsg1-4/ryu/app/ofctl/api.py	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/ryu/app/ofctl/api.py	2018-08-23 11:52:05.000000000 +0000
@@ -16,22 +16,37 @@
 
 # client for ryu.app.ofctl.service
 
-import numbers
-
 from ryu.base import app_manager
 from . import event
 
 
-def get_datapath(app, dpid):
+def get_datapath(app, dpid=None):
     """
     Get datapath object by dpid.
 
     :param app: Client RyuApp instance
-    :param dpid: Datapath-id (in integer)
+    :param dpid: Datapath ID (int type) or None to get all datapath objects
+
+    Returns a object of datapath, a list of datapath objects when no dpid
+    given or None when error.
+
+    Raises an exception if any of the given values is invalid.
+
+    Example::
+
+        # ...(snip)...
+        import ryu.app.ofctl.api as ofctl_api
 
-    Returns None on error.
+
+        class MyApp(app_manager.RyuApp):
+
+            def _my_handler(self, ev):
+                # Get all datapath objects
+                result = ofctl_api.get_datapath(self)
+
+                # Get the datapath object which has the given dpid
+                result = ofctl_api.get_datapath(self, dpid=1)
     """
-    assert isinstance(dpid, numbers.Integral)
     return app.send_request(event.GetDatapathRequest(dpid=dpid))()
 
 
@@ -55,12 +70,19 @@ def send_msg(app, msg, reply_cls=None, r
 
     Example::
 
-        import ryu.app.ofctl.api as api
+        # ...(snip)...
+        import ryu.app.ofctl.api as ofctl_api
+
+
+        class MyApp(app_manager.RyuApp):
 
-        msg = parser.OFPPortDescStatsRequest(datapath=datapath)
-        result = api.send_msg(self, msg,
-                                    reply_cls=parser.OFPPortDescStatsReply,
-                                    reply_multi=True)
+            def _my_handler(self, ev):
+                # ...(snip)...
+                msg = parser.OFPPortDescStatsRequest(datapath=datapath)
+                result = ofctl_api.send_msg(
+                    self, msg,
+                    reply_cls=parser.OFPPortDescStatsReply,
+                    reply_multi=True)
     """
     return app.send_request(event.SendMsgRequest(msg=msg,
                                                  reply_cls=reply_cls,
diff -pruN 4.21+dfsg1-4/ryu/app/ofctl/event.py 4.26+dfsg1-5/ryu/app/ofctl/event.py
--- 4.21+dfsg1-4/ryu/app/ofctl/event.py	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/ryu/app/ofctl/event.py	2018-08-23 11:52:05.000000000 +0000
@@ -33,8 +33,8 @@ class _ReplyBase(event.EventReplyBase):
 # get datapath
 
 class GetDatapathRequest(_RequestBase):
-    def __init__(self, dpid):
-        assert isinstance(dpid, numbers.Integral)
+    def __init__(self, dpid=None):
+        assert dpid is None or isinstance(dpid, numbers.Integral)
         super(GetDatapathRequest, self).__init__()
         self.dpid = dpid
 
diff -pruN 4.21+dfsg1-4/ryu/app/ofctl/service.py 4.26+dfsg1-5/ryu/app/ofctl/service.py
--- 4.21+dfsg1-4/ryu/app/ofctl/service.py	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/ryu/app/ofctl/service.py	2018-08-23 11:52:05.000000000 +0000
@@ -99,15 +99,13 @@ class OfctlService(app_manager.RyuApp):
 
     @set_ev_cls(event.GetDatapathRequest, MAIN_DISPATCHER)
     def _handle_get_datapath(self, req):
-        id = req.dpid
-        assert isinstance(id, numbers.Integral)
-        try:
-            datapath = self._switches[id].datapath
-        except KeyError:
-            datapath = None
-        self.logger.debug('dpid %s -> datapath %s', id, datapath)
-        rep = event.Reply(result=datapath)
-        self.reply_to_request(req, rep)
+        result = None
+        if req.dpid is None:
+            result = [v.datapath for v in self._switches.values()]
+        else:
+            if req.dpid in self._switches:
+                result = self._switches[req.dpid].datapath
+        self.reply_to_request(req, event.Reply(result=result))
 
     @set_ev_cls(event.SendMsgRequest, MAIN_DISPATCHER)
     def _handle_send_msg(self, req):
diff -pruN 4.21+dfsg1-4/ryu/app/rest_qos.py 4.26+dfsg1-5/ryu/app/rest_qos.py
--- 4.21+dfsg1-4/ryu/app/rest_qos.py	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/ryu/app/rest_qos.py	2018-08-23 11:52:05.000000000 +0000
@@ -1147,13 +1147,13 @@ class Action(object):
         if REST_ACTION in flow:
             actions = []
             for act in flow[REST_ACTION]:
-                field_value = re.search('SET_FIELD: \{ip_dscp:(\d+)', act)
+                field_value = re.search(r'SET_FIELD: \{ip_dscp:(\d+)', act)
                 if field_value:
                     actions.append({REST_ACTION_MARK: field_value.group(1)})
-                meter_value = re.search('METER:(\d+)', act)
+                meter_value = re.search(r'METER:(\d+)', act)
                 if meter_value:
                     actions.append({REST_ACTION_METER: meter_value.group(1)})
-                queue_value = re.search('SET_QUEUE:(\d+)', act)
+                queue_value = re.search(r'SET_QUEUE:(\d+)', act)
                 if queue_value:
                     actions.append({REST_ACTION_QUEUE: queue_value.group(1)})
             action = {REST_ACTION: actions}
diff -pruN 4.21+dfsg1-4/ryu/controller/controller.py 4.26+dfsg1-5/ryu/controller/controller.py
--- 4.21+dfsg1-4/ryu/controller/controller.py	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/ryu/controller/controller.py	2018-08-23 11:52:05.000000000 +0000
@@ -23,15 +23,17 @@ The main component of OpenFlow controlle
 """
 
 import contextlib
-from ryu import cfg
 import logging
-from ryu.lib import hub
-from ryu.lib.hub import StreamServer
 import random
+from socket import IPPROTO_TCP
+from socket import TCP_NODELAY
+from socket import SHUT_WR
+from socket import timeout as SocketTimeout
 import ssl
-from socket import IPPROTO_TCP, TCP_NODELAY, SHUT_RDWR, timeout as SocketTimeout
 
-import netaddr
+from ryu import cfg
+from ryu.lib import hub
+from ryu.lib.hub import StreamServer
 
 import ryu.base.app_manager
 
@@ -194,12 +196,10 @@ def _deactivate(method):
             method(self)
         finally:
             try:
-                self.socket.shutdown(SHUT_RDWR)
-            except (EOFError, IOError):
+                self.socket.close()
+            except IOError:
                 pass
 
-            if not self.is_active:
-                self.socket.close()
     return deactivate
 
 
@@ -277,14 +277,24 @@ class Datapath(ofproto_protocol.Protocol
         self._ports = None
         self.flow_format = ofproto_v1_0.NXFF_OPENFLOW10
         self.ofp_brick = ryu.base.app_manager.lookup_service_brick('ofp_event')
+        self.state = None  # for pylint
         self.set_state(HANDSHAKE_DISPATCHER)
 
-    @_deactivate
+    def _close_write(self):
+        # Note: Close only further sends in order to wait for the switch to
+        # disconnect this connection.
+        try:
+            self.socket.shutdown(SHUT_WR)
+        except (EOFError, IOError):
+            pass
+
     def close(self):
-        if self.state != DEAD_DISPATCHER:
-            self.set_state(DEAD_DISPATCHER)
+        self.set_state(DEAD_DISPATCHER)
+        self._close_write()
 
     def set_state(self, state):
+        if self.state == state:
+            return
         self.state = state
         ev = ofp_event.EventOFPStateChange(self)
         ev.state = state
@@ -300,7 +310,7 @@ class Datapath(ofproto_protocol.Protocol
         while self.state != DEAD_DISPATCHER:
             try:
                 read_len = min_read_len
-                if (remaining_read_len > min_read_len):
+                if remaining_read_len > min_read_len:
                     read_len = remaining_read_len
                 ret = self.socket.recv(read_len)
             except SocketTimeout:
@@ -312,14 +322,14 @@ class Datapath(ofproto_protocol.Protocol
             except (EOFError, IOError):
                 break
 
-            if len(ret) == 0:
+            if not ret:
                 break
 
             buf += ret
             buf_len = len(buf)
             while buf_len >= min_read_len:
                 (version, msg_type, msg_len, xid) = ofproto_parser.header(buf)
-                if (msg_len < min_read_len):
+                if msg_len < min_read_len:
                     # Someone isn't playing nicely; log it, and try something sane.
                     LOG.debug("Message with invalid length %s received from switch at address %s",
                               msg_len, self.address)
@@ -335,7 +345,9 @@ class Datapath(ofproto_protocol.Protocol
                     ev = ofp_event.ofp_msg_to_ev(msg)
                     self.ofp_brick.send_event_to_observers(ev, self.state)
 
-                    dispatchers = lambda x: x.callers[ev.__class__].dispatchers
+                    def dispatchers(x):
+                        return x.callers[ev.__class__].dispatchers
+
                     handlers = [handler for handler in
                                 self.ofp_brick.get_handlers(ev) if
                                 self.state in dispatchers(handler)]
@@ -358,9 +370,11 @@ class Datapath(ofproto_protocol.Protocol
     def _send_loop(self):
         try:
             while self.state != DEAD_DISPATCHER:
-                buf = self.send_q.get()
+                buf, close_socket = self.send_q.get()
                 self._send_q_sem.release()
                 self.socket.sendall(buf)
+                if close_socket:
+                    break
         except SocketTimeout:
             LOG.debug("Socket timed out while sending data to switch at address %s",
                       self.address)
@@ -380,14 +394,14 @@ class Datapath(ofproto_protocol.Protocol
                     self._send_q_sem.release()
             except hub.QueueEmpty:
                 pass
-            # Finally, ensure the _recv_loop terminates.
-            self.close()
+            # Finally, disallow further sends.
+            self._close_write()
 
-    def send(self, buf):
+    def send(self, buf, close_socket=False):
         msg_enqueued = False
         self._send_q_sem.acquire()
         if self.send_q:
-            self.send_q.put(buf)
+            self.send_q.put((buf, close_socket))
             msg_enqueued = True
         else:
             self._send_q_sem.release()
@@ -402,13 +416,13 @@ class Datapath(ofproto_protocol.Protocol
         msg.set_xid(self.xid)
         return self.xid
 
-    def send_msg(self, msg):
+    def send_msg(self, msg, close_socket=False):
         assert isinstance(msg, self.ofproto_parser.MsgBase)
         if msg.xid is None:
             self.set_xid(msg)
         msg.serialize()
         # LOG.debug('send_msg %s', msg)
-        return self.send(msg.buf)
+        return self.send(msg.buf, close_socket=close_socket)
 
     def _echo_request_loop(self):
         if not self.max_unreplied_echo_requests:
@@ -424,7 +438,7 @@ class Datapath(ofproto_protocol.Protocol
     def acknowledge_echo_reply(self, xid):
         try:
             self.unreplied_echo_requests.remove(xid)
-        except:
+        except ValueError:
             pass
 
     def serve(self):
diff -pruN 4.21+dfsg1-4/ryu/controller/dpset.py 4.26+dfsg1-5/ryu/controller/dpset.py
--- 4.21+dfsg1-4/ryu/controller/dpset.py	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/ryu/controller/dpset.py	2018-08-23 11:52:05.000000000 +0000
@@ -165,10 +165,33 @@ class DPSet(app_manager.RyuApp):
     """
     DPSet application manages a set of switches (datapaths)
     connected to this controller.
+
+    Usage Example::
+
+        # ...(snip)...
+        from ryu.controller import dpset
+
+
+        class MyApp(app_manager.RyuApp):
+            _CONTEXTS = {
+                'dpset': dpset.DPSet,
+            }
+
+            def __init__(self, *args, **kwargs):
+                super(MyApp, self).__init__(*args, **kwargs)
+                # Stores DPSet instance to call its API in this app
+                self.dpset = kwargs['dpset']
+
+            def _my_handler(self):
+                # Get the datapath object which has the given dpid
+                dpid = 1
+                dp = self.dpset.get(dpid)
+                if dp is None:
+                    self.logger.info('No such datapath: dpid=%d', dpid)
     """
 
     def __init__(self, *args, **kwargs):
-        super(DPSet, self).__init__()
+        super(DPSet, self).__init__(*args, **kwargs)
         self.name = 'dpset'
 
         self.dps = {}   # datapath_id => class Datapath
@@ -238,9 +261,10 @@ class DPSet(app_manager.RyuApp):
         """
         This method returns a list of tuples which represents
         instances for switches connected to this controller.
-        The tuple consists of a Datapath Id and an instance of
+        The tuple consists of a Datapath ID and an instance of
         ryu.controller.controller.Datapath.
-        A return value looks like the following:
+
+        A return value looks like the following::
 
             [ (dpid_A, Datapath_A), (dpid_B, Datapath_B), ... ]
         """
diff -pruN 4.21+dfsg1-4/ryu/controller/ofp_handler.py 4.26+dfsg1-5/ryu/controller/ofp_handler.py
--- 4.21+dfsg1-4/ryu/controller/ofp_handler.py	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/ryu/controller/ofp_handler.py	2018-08-23 11:52:05.000000000 +0000
@@ -60,12 +60,13 @@ class OFPHandler(ryu.base.app_manager.Ry
         return hub.spawn(self.controller)
 
     def _hello_failed(self, datapath, error_desc):
-        self.logger.error(error_desc)
-        error_msg = datapath.ofproto_parser.OFPErrorMsg(datapath)
-        error_msg.type = datapath.ofproto.OFPET_HELLO_FAILED
-        error_msg.code = datapath.ofproto.OFPHFC_INCOMPATIBLE
-        error_msg.data = error_desc
-        datapath.send_msg(error_msg)
+        self.logger.error('%s on datapath %s', error_desc, datapath.address)
+        error_msg = datapath.ofproto_parser.OFPErrorMsg(
+            datapath=datapath,
+            type_=datapath.ofproto.OFPET_HELLO_FAILED,
+            code=datapath.ofproto.OFPHFC_INCOMPATIBLE,
+            data=error_desc)
+        datapath.send_msg(error_msg, close_socket=True)
 
     @set_ev_handler(ofp_event.EventOFPHello, HANDSHAKE_DISPATCHER)
     def hello_handler(self, ev):
diff -pruN 4.21+dfsg1-4/ryu/__init__.py 4.26+dfsg1-5/ryu/__init__.py
--- 4.21+dfsg1-4/ryu/__init__.py	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/ryu/__init__.py	2018-08-23 11:52:05.000000000 +0000
@@ -14,5 +14,5 @@
 # limitations under the License.
 
 
-version_info = (4, 21)
+version_info = (4, 26)
 version = '.'.join(map(str, version_info))
diff -pruN 4.21+dfsg1-4/ryu/lib/ofctl_string.py 4.26+dfsg1-5/ryu/lib/ofctl_string.py
--- 4.21+dfsg1-4/ryu/lib/ofctl_string.py	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/ryu/lib/ofctl_string.py	2018-08-23 11:52:05.000000000 +0000
@@ -39,7 +39,7 @@ def ofp_instruction_from_str(ofproto, ac
     action_str  An action string.
     =========== =================================================
     """
-    action_re = re.compile("([a-z_]+)(\([^)]*\)|[^a-z_,()][^,()]*)*")
+    action_re = re.compile(r"([a-z_]+)(\([^)]*\)|[^a-z_,()][^,()]*)*")
     result = []
     while len(action_str):
         m = action_re.match(action_str)
@@ -303,7 +303,7 @@ class OfctlActionConverter(object):
                     if k == 'table':
                         recirc_table = str_to_int(v)
                     elif k == 'zone':
-                        m = re.search('\[(\d*)\.\.(\d*)\]', v)
+                        m = re.search(r'\[(\d*)\.\.(\d*)\]', v)
                         if m:
                             zone_ofs_nbits = nicira_ext.ofs_nbits(
                                 int(m.group(1)), int(m.group(2)))
@@ -322,3 +322,7 @@ class OfctlActionConverter(object):
                                 'recirc_table': recirc_table,
                                 'alg': alg,
                                 'actions': ct_actions})
+
+    @classmethod
+    def ct_clear(cls, ofproto, action_str):
+        return dict(NXActionCTClear={})
diff -pruN 4.21+dfsg1-4/ryu/lib/ovs/bridge.py 4.26+dfsg1-5/ryu/lib/ovs/bridge.py
--- 4.21+dfsg1-4/ryu/lib/ovs/bridge.py	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/ryu/lib/ovs/bridge.py	2018-08-23 11:52:05.000000000 +0000
@@ -15,7 +15,7 @@
 # limitations under the License.
 
 """
-slimmed down version of OVSBridge in quantum agent
+Wrapper utility library of :py:mod:`ryu.lib.ovs.vsctl`
 """
 
 import functools
@@ -92,6 +92,26 @@ class TunnelPort(object):
 
 
 class OVSBridge(object):
+    """
+    Class to provide wrapper utilities of :py:mod:`ryu.lib.ovs.vsctl.VSCtl`
+
+    ``CONF`` is a instance of ``oslo_config.cfg.ConfigOpts``.
+    Mostly ``self.CONF`` is sufficient to instantiate this class from your Ryu
+    application.
+
+    ``datapath_id`` specifies Datapath ID of the target OVS instance.
+
+    ``ovsdb_addr`` specifies the address of the OVS instance.
+    Automatically validated when you call ``init()`` method.
+    Refer to :py:mod:`ryu.lib.ovs.vsctl.valid_ovsdb_addr` for the format of
+    this address.
+
+    if ``timeout`` is omitted, ``CONF.ovsdb_timeout`` will be used as the
+    default value.
+
+    Usage of ``timeout`` and ``exception`` is the same with ``timeout_sec``
+    and ``exception`` of :py:mod:`ryu.lib.ovs.vsctl.VSCtl.run_command`.
+    """
 
     def __init__(self, CONF, datapath_id, ovsdb_addr, timeout=None,
                  exception=None):
@@ -105,9 +125,25 @@ class OVSBridge(object):
         self.br_name = None
 
     def run_command(self, commands):
+        """
+        Executes the given commands and sends OVSDB messages.
+
+        ``commands`` must be a list of
+        :py:mod:`ryu.lib.ovs.vsctl.VSCtlCommand`.
+
+        The given ``timeout`` and ``exception`` when instantiation will be used
+        to call :py:mod:`ryu.lib.ovs.vsctl.VSCtl.run_command`.
+        """
         self.vsctl.run_command(commands, self.timeout, self.exception)
 
     def init(self):
+        """
+        Validates the given ``ovsdb_addr`` and connects to OVS instance.
+
+        If failed to connect to OVS instance or the given ``datapath_id`` does
+        not match with the Datapath ID of the connected OVS instance, raises
+        :py:mod:`ryu.lib.ovs.bridge.OVSBridgeNotFound` exception.
+        """
         if not valid_ovsdb_addr(self.ovsdb_addr):
             raise ValueError('Invalid OVSDB address: %s' % self.ovsdb_addr)
         if self.br_name is None:
@@ -126,16 +162,37 @@ class OVSBridge(object):
         return command.result[0].name
 
     def get_controller(self):
+        """
+        Gets the configured OpenFlow controller address.
+
+        This method is corresponding to the following ovs-vsctl command::
+
+            $ ovs-vsctl get-controller <bridge>
+        """
         command = ovs_vsctl.VSCtlCommand('get-controller', [self.br_name])
         self.run_command([command])
         return command.result[0]
 
     def set_controller(self, controllers):
+        """
+        Sets the OpenFlow controller address.
+
+        This method is corresponding to the following ovs-vsctl command::
+
+            $ ovs-vsctl set-controller <bridge> <target>...
+        """
         command = ovs_vsctl.VSCtlCommand('set-controller', [self.br_name])
         command.args.extend(controllers)
         self.run_command([command])
 
     def del_controller(self):
+        """
+        Deletes the configured OpenFlow controller address.
+
+        This method is corresponding to the following ovs-vsctl command::
+
+            $ ovs-vsctl del-controller <bridge>
+        """
         command = ovs_vsctl.VSCtlCommand('del-controller', [self.br_name])
         self.run_command([command])
 
@@ -245,30 +302,72 @@ class OVSBridge(object):
         self.run_command([command])
 
     def db_get_val(self, table, record, column):
+        """
+        Gets values of 'column' in 'record' in 'table'.
+
+        This method is corresponding to the following ovs-vsctl command::
+
+            $ ovs-vsctl get TBL REC COL
+        """
         command = ovs_vsctl.VSCtlCommand('get', (table, record, column))
         self.run_command([command])
         assert len(command.result) == 1
         return command.result[0]
 
     def db_get_map(self, table, record, column):
+        """
+        Gets dict type value of 'column' in 'record' in 'table'.
+
+        This method is corresponding to the following ovs-vsctl command::
+
+            $ ovs-vsctl get TBL REC COL
+        """
         val = self.db_get_val(table, record, column)
         assert isinstance(val, dict)
         return val
 
     def get_datapath_id(self):
+        """
+        Gets Datapath ID of OVS instance.
+
+        This method is corresponding to the following ovs-vsctl command::
+
+            $ ovs-vsctl get Bridge <bridge> datapath_id
+        """
         return self.db_get_val('Bridge', self.br_name, 'datapath_id')
 
     def delete_port(self, port_name):
+        """
+        Deletes a port on the OVS instance.
+
+        This method is corresponding to the following ovs-vsctl command::
+
+            $ ovs-vsctl --if-exists del-port <bridge> <port>
+        """
         command = ovs_vsctl.VSCtlCommand(
             'del-port', (self.br_name, port_name), '--if-exists')
         self.run_command([command])
 
     def get_ofport(self, port_name):
+        """
+        Gets the OpenFlow port number.
+
+        This method is corresponding to the following ovs-vsctl command::
+
+            $ ovs-vsctl get Interface <port> ofport
+        """
         ofport_list = self.db_get_val('Interface', port_name, 'ofport')
         assert len(ofport_list) == 1
         return int(ofport_list[0])
 
     def get_port_name_list(self):
+        """
+        Gets a list of all ports on OVS instance.
+
+        This method is corresponding to the following ovs-vsctl command::
+
+            $ ovs-vsctl list-ports <bridge>
+        """
         command = ovs_vsctl.VSCtlCommand('list-ports', (self.br_name, ))
         self.run_command([command])
         return command.result
@@ -297,6 +396,16 @@ class OVSBridge(object):
 
     def add_tunnel_port(self, name, tunnel_type, remote_ip,
                         local_ip=None, key=None, ofport=None):
+        """
+        Creates a tunnel port.
+
+        :param name: Port name to be created
+        :param tunnel_type: Type of tunnel (gre or vxlan)
+        :param remote_ip: Remote IP address of tunnel
+        :param local_ip: Local IP address of tunnel
+        :param key: Key of GRE or VNI of VxLAN
+        :param ofport: Requested OpenFlow port number
+        """
         options = 'remote_ip=%(remote_ip)s' % locals()
         if key:
             options += ',key=%(key)s' % locals()
@@ -314,15 +423,32 @@ class OVSBridge(object):
 
     def add_gre_port(self, name, remote_ip,
                      local_ip=None, key=None, ofport=None):
+        """
+        Creates a GRE tunnel port.
+
+        See the description of ``add_tunnel_port()``.
+        """
         self.add_tunnel_port(name, 'gre', remote_ip,
                              local_ip=local_ip, key=key, ofport=ofport)
 
     def add_vxlan_port(self, name, remote_ip,
                        local_ip=None, key=None, ofport=None):
+        """
+        Creates a VxLAN tunnel port.
+
+        See the description of ``add_tunnel_port()``.
+        """
         self.add_tunnel_port(name, 'vxlan', remote_ip,
                              local_ip=local_ip, key=key, ofport=ofport)
 
     def del_port(self, port_name):
+        """
+        Deletes a port on OVS instance.
+
+        This method is corresponding to the following ovs-vsctl command::
+
+            $ ovs-vsctl del-port <bridge> <port>
+        """
         command = ovs_vsctl.VSCtlCommand('del-port', (self.br_name, port_name))
         self.run_command([command])
 
@@ -396,6 +522,9 @@ class OVSBridge(object):
         return None
 
     def set_qos(self, port_name, type='linux-htb', max_rate=None, queues=None):
+        """
+        Sets a Qos rule and creates Queues on the given port.
+        """
         queues = queues if queues else []
         command_qos = ovs_vsctl.VSCtlCommand(
             'set-qos',
@@ -409,6 +538,9 @@ class OVSBridge(object):
         return None
 
     def del_qos(self, port_name):
+        """
+        Deletes the Qos rule on the given port.
+        """
         command = ovs_vsctl.VSCtlCommand(
             'del-qos',
             [port_name])
diff -pruN 4.21+dfsg1-4/ryu/lib/ovs/vsctl.py 4.26+dfsg1-5/ryu/lib/ovs/vsctl.py
--- 4.21+dfsg1-4/ryu/lib/ovs/vsctl.py	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/ryu/lib/ovs/vsctl.py	2018-08-23 11:52:05.000000000 +0000
@@ -14,6 +14,9 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+"""
+``ovs-vsctl`` command like library to speak OVSDB protocol
+"""
 
 from __future__ import print_function
 
@@ -53,9 +56,9 @@ def valid_ovsdb_addr(addr):
 
     The valid formats are:
 
-    - unix:file
-    - tcp:ip:port
-    - ssl:ip:port
+    - ``unix:file``
+    - ``tcp:ip:port``
+    - ``ssl:ip:port``
 
     If ip is IPv6 address, wrap ip with brackets (e.g., ssl:[::1]:6640).
 
@@ -63,12 +66,12 @@ def valid_ovsdb_addr(addr):
     :return: True if valid, otherwise False.
     """
     # Assumes Unix socket format: "unix:file"
-    m = re.match('unix:(\S+)', addr)
+    m = re.match(r'unix:(\S+)', addr)
     if m:
         file = m.group(1)
         return os.path.isfile(file)
     # Assumes TCP/SSL socket format: "tcp:ip:port" or "ssl:ip:port"
-    m = re.match('(tcp|ssl):(\S+):(\d+)', addr)
+    m = re.match(r'(tcp|ssl):(\S+):(\d+)', addr)
     if m:
         address = m.group(2)
         port = m.group(3)
@@ -959,6 +962,34 @@ class _VSCtlTable(object):
 
 
 class VSCtlCommand(StringifyMixin):
+    """
+    Class to describe artgumens similar to those of ``ovs-vsctl`` command.
+
+    ``command`` specifies the command of ``ovs-vsctl``.
+
+    ``args`` specifies a list or tuple of arguments for the given command.
+
+    ``options`` specifies a list or tuple of options for the given command.
+    Please note that NOT all options of ``ovs-vsctl`` are supported.
+    For example, ``--id`` option is not yet supported.
+    This class supports the followings.
+
+    ================= =========================================================
+    Option            Description
+    ================= =========================================================
+    ``--may-exist``   Does nothing when the given port already exists.
+                      The supported commands are ``add-port`` and
+                      ``add-bond``.
+    ``--fake-iface``  Creates a port as a fake interface.
+                      The supported command is ``add-bond``.
+    ``--must-exist``  Raises exception if the given port does not exist.
+                      The supported command is ``del-port``.
+    ``--with-iface``  Takes effect to the interface which has the same name.
+                      The supported command is ``del-port``.
+    ``--if-exists``   Ignores exception when not found.
+                      The supported command is ``get``.
+    ================= =========================================================
+    """
 
     def __init__(self, command, args=None, options=None):
         super(VSCtlCommand, self).__init__()
@@ -978,6 +1009,13 @@ class VSCtlCommand(StringifyMixin):
 
 
 class VSCtl(object):
+    """
+    A class to describe an Open vSwitch instance.
+
+    ``remote`` specifies the address of the OVS instance.
+    :py:mod:`ryu.lib.ovs.vsctl.valid_ovsdb_addr` is a convenient function to
+    validate this address.
+    """
 
     def _reset(self):
         self.schema_helper = None
@@ -1237,6 +1275,19 @@ class VSCtl(object):
         self._do_main(commands)
 
     def run_command(self, commands, timeout_sec=None, exception=None):
+        """
+        Executes the given commands and sends OVSDB messages.
+
+        ``commands`` must be a list of
+        :py:mod:`ryu.lib.ovs.vsctl.VSCtlCommand`.
+
+        If ``timeout_sec`` is specified, raises exception after the given
+        timeout [sec]. Additionally, if ``exception`` is specified, this
+        function will wraps exception using the given exception class.
+
+        Retruns ``None`` but fills ``result`` attribute for each command
+        instance.
+        """
         if timeout_sec is None:
             self._run_command(commands)
         else:
@@ -1563,7 +1614,9 @@ class VSCtl(object):
         self._pre_add_port(ctx, columns)
 
     def _cmd_add_port(self, ctx, command):
-        may_exist = command.has_option('--may_exist')
+        # '--may_exist' is a typo but for backword compatibility
+        may_exist = (command.has_option('--may_exist')
+                     or command.has_option('--may-exist'))
 
         br_name = command.args[0]
         port_name = command.args[1]
@@ -1577,7 +1630,9 @@ class VSCtl(object):
                      False, iface_names, settings)
 
     def _cmd_add_bond(self, ctx, command):
-        may_exist = command.has_option('--may_exist')
+        # '--may_exist' is a typo but for backword compatibility
+        may_exist = (command.has_option('--may_exist')
+                     or command.has_option('--may-exist'))
         fake_iface = command.has_option('--fake-iface')
 
         br_name = command.args[0]
diff -pruN 4.21+dfsg1-4/ryu/lib/packet/bmp.py 4.26+dfsg1-5/ryu/lib/packet/bmp.py
--- 4.21+dfsg1-4/ryu/lib/packet/bmp.py	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/ryu/lib/packet/bmp.py	2018-08-23 11:52:05.000000000 +0000
@@ -69,7 +69,7 @@ BMP_PEER_DOWN_REASON_REMOTE_NO_NOTIFICAT
 
 
 class BMPMessage(packet_base.PacketBase, TypeDisp):
-    """Base class for BGP Monitoring Protocol messages.
+    r"""Base class for BGP Monitoring Protocol messages.
 
     An instance has the following attributes at least.
     Most of them are same to the on-wire counterparts but in host byte
@@ -141,7 +141,7 @@ class BMPMessage(packet_base.PacketBase,
 
 
 class BMPPeerMessage(BMPMessage):
-    """BMP Message with Per Peer Header
+    r"""BMP Message with Per Peer Header
 
     Following BMP Messages contain Per Peer Header after Common BMP Header.
 
@@ -250,7 +250,7 @@ class BMPPeerMessage(BMPMessage):
 
 @BMPMessage.register_type(BMP_MSG_ROUTE_MONITORING)
 class BMPRouteMonitoring(BMPPeerMessage):
-    """BMP Route Monitoring Message
+    r"""BMP Route Monitoring Message
 
     ========================== ===============================================
     Attribute                  Description
@@ -308,7 +308,7 @@ class BMPRouteMonitoring(BMPPeerMessage)
 
 @BMPMessage.register_type(BMP_MSG_STATISTICS_REPORT)
 class BMPStatisticsReport(BMPPeerMessage):
-    """BMP Statistics Report Message
+    r"""BMP Statistics Report Message
 
     ========================== ===============================================
     Attribute                  Description
@@ -424,7 +424,7 @@ class BMPStatisticsReport(BMPPeerMessage
 
 @BMPMessage.register_type(BMP_MSG_PEER_DOWN_NOTIFICATION)
 class BMPPeerDownNotification(BMPPeerMessage):
-    """BMP Peer Down Notification Message
+    r"""BMP Peer Down Notification Message
 
     ========================== ===============================================
     Attribute                  Description
@@ -498,7 +498,7 @@ class BMPPeerDownNotification(BMPPeerMes
 
 @BMPMessage.register_type(BMP_MSG_PEER_UP_NOTIFICATION)
 class BMPPeerUpNotification(BMPPeerMessage):
-    """BMP Peer Up Notification Message
+    r"""BMP Peer Up Notification Message
 
     ========================== ===============================================
     Attribute                  Description
@@ -605,7 +605,7 @@ class BMPPeerUpNotification(BMPPeerMessa
 
 @BMPMessage.register_type(BMP_MSG_INITIATION)
 class BMPInitiation(BMPMessage):
-    """BMP Initiation Message
+    r"""BMP Initiation Message
 
     ========================== ===============================================
     Attribute                  Description
@@ -669,7 +669,7 @@ class BMPInitiation(BMPMessage):
 
 @BMPMessage.register_type(BMP_MSG_TERMINATION)
 class BMPTermination(BMPMessage):
-    """BMP Termination Message
+    r"""BMP Termination Message
 
     ========================== ===============================================
     Attribute                  Description
diff -pruN 4.21+dfsg1-4/ryu/lib/packet/ether_types.py 4.26+dfsg1-5/ryu/lib/packet/ether_types.py
--- 4.21+dfsg1-4/ryu/lib/packet/ether_types.py	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/ryu/lib/packet/ether_types.py	2018-08-23 11:52:05.000000000 +0000
@@ -26,3 +26,4 @@ ETH_TYPE_LLDP = 0x88cc
 ETH_TYPE_8021AH = 0x88e7
 ETH_TYPE_IEEE802_3 = 0x05dc
 ETH_TYPE_CFM = 0x8902
+ETH_TYPE_NSH = 0x894f  # RFC8300
diff -pruN 4.21+dfsg1-4/ryu/lib/packet/icmpv6.py 4.26+dfsg1-5/ryu/lib/packet/icmpv6.py
--- 4.21+dfsg1-4/ryu/lib/packet/icmpv6.py	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/ryu/lib/packet/icmpv6.py	2018-08-23 11:52:05.000000000 +0000
@@ -75,7 +75,7 @@ BLOCK_OLD_SOURCES = 6
 
 
 class icmpv6(packet_base.PacketBase):
-    """ICMPv6 (RFC 2463) header encoder/decoder class.
+    r"""ICMPv6 (RFC 2463) header encoder/decoder class.
 
     An instance has the following attributes at least.
     Most of them are same to the on-wire counterparts but in host byte order.
@@ -553,7 +553,7 @@ class nd_option_tla(nd_option_la):
 
 @nd_router_advert.register_nd_option_type
 class nd_option_pi(nd_option):
-    """ICMPv6 sub encoder/decoder class for Neighbor discovery
+    r"""ICMPv6 sub encoder/decoder class for Neighbor discovery
     Prefix Information Option. (RFC 4861)
 
     This is used with ryu.lib.packet.icmpv6.nd_router_advert.
@@ -884,7 +884,7 @@ class mldv2_report(mld):
 
 
 class mldv2_report_group(stringify.StringifyMixin):
-    """
+    r"""
     ICMPv6 sub encoder/decoder class for MLD v2 Lister Report Group
     Record messages. (RFC 3810)
 
diff -pruN 4.21+dfsg1-4/ryu/lib/packet/igmp.py 4.26+dfsg1-5/ryu/lib/packet/igmp.py
--- 4.21+dfsg1-4/ryu/lib/packet/igmp.py	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/ryu/lib/packet/igmp.py	2018-08-23 11:52:05.000000000 +0000
@@ -391,7 +391,7 @@ class igmpv3_report(igmp):
 
 
 class igmpv3_report_group(stringify.StringifyMixin):
-    """
+    r"""
     Internet Group Management Protocol(IGMP, RFC 3376)
     Membership Report Group Record message encoder/decoder class.
 
diff -pruN 4.21+dfsg1-4/ryu/lib/packet/ipv6.py 4.26+dfsg1-5/ryu/lib/packet/ipv6.py
--- 4.21+dfsg1-4/ryu/lib/packet/ipv6.py	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/ryu/lib/packet/ipv6.py	2018-08-23 11:52:05.000000000 +0000
@@ -274,7 +274,7 @@ class dst_opts(opt_header):
 
 
 class option(stringify.StringifyMixin):
-    """IPv6 (RFC 2460) Options header encoder/decoder class.
+    r"""IPv6 (RFC 2460) Options header encoder/decoder class.
 
     This is used with ryu.lib.packet.ipv6.hop_opts or
                       ryu.lib.packet.ipv6.dst_opts.
@@ -496,7 +496,7 @@ class routing_type3(header):
 
 @ipv6.register_header_type(inet.IPPROTO_FRAGMENT)
 class fragment(header):
-    """IPv6 (RFC 2460) fragment header encoder/decoder class.
+    r"""IPv6 (RFC 2460) fragment header encoder/decoder class.
 
     This is used with ryu.lib.packet.ipv6.ipv6.
 
diff -pruN 4.21+dfsg1-4/ryu/lib/packet/lldp.py 4.26+dfsg1-5/ryu/lib/packet/lldp.py
--- 4.21+dfsg1-4/ryu/lib/packet/lldp.py	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/ryu/lib/packet/lldp.py	2018-08-23 11:52:05.000000000 +0000
@@ -455,13 +455,12 @@ class SystemCapabilities(LLDPBasicTLV):
     Attribute         Description
     ================= =====================================
     buf               Binary data to parse.
-    subtype           Subtype.
     system_cap        System Capabilities.
     enabled_cap       Enabled Capabilities.
     ================= =====================================
     """
-    # chassis subtype(1) + system cap(2) + enabled cap(2)
-    _PACK_STR = '!BHH'
+    # system cap(2) + enabled cap(2)
+    _PACK_STR = '!HH'
     _PACK_SIZE = struct.calcsize(_PACK_STR)
     _LEN_MIN = _PACK_SIZE
     _LEN_MAX = _PACK_SIZE
@@ -481,10 +480,9 @@ class SystemCapabilities(LLDPBasicTLV):
     def __init__(self, buf=None, *args, **kwargs):
         super(SystemCapabilities, self).__init__(buf, *args, **kwargs)
         if buf:
-            (self.subtype, self.system_cap, self.enabled_cap) = \
-                struct.unpack(self._PACK_STR, self.tlv_info[:self._PACK_SIZE])
+            (self.system_cap, self.enabled_cap) = struct.unpack(
+                self._PACK_STR, self.tlv_info[:self._PACK_SIZE])
         else:
-            self.subtype = kwargs['subtype']
             self.system_cap = kwargs['system_cap']
             self.enabled_cap = kwargs['enabled_cap']
             self.len = self._PACK_SIZE
@@ -492,9 +490,8 @@ class SystemCapabilities(LLDPBasicTLV):
             self.typelen = (self.tlv_type << LLDP_TLV_TYPE_SHIFT) | self.len
 
     def serialize(self):
-        return struct.pack('!HBHH',
-                           self.typelen, self.subtype,
-                           self.system_cap, self.enabled_cap)
+        return struct.pack('!HHH',
+                           self.typelen, self.system_cap, self.enabled_cap)
 
 
 @lldp.set_tlv_type(LLDP_TLV_MANAGEMENT_ADDRESS)
diff -pruN 4.21+dfsg1-4/ryu/lib/stringify.py 4.26+dfsg1-5/ryu/lib/stringify.py
--- 4.21+dfsg1-4/ryu/lib/stringify.py	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/ryu/lib/stringify.py	2018-08-23 11:52:05.000000000 +0000
@@ -327,7 +327,7 @@ class StringifyMixin(object):
     @classmethod
     def from_jsondict(cls, dict_, decode_string=base64.b64decode,
                       **additional_args):
-        """Create an instance from a JSON style dict.
+        r"""Create an instance from a JSON style dict.
 
         Instantiate this class with parameters specified by the dict.
 
diff -pruN 4.21+dfsg1-4/ryu/ofproto/nicira_ext.py 4.26+dfsg1-5/ryu/ofproto/nicira_ext.py
--- 4.21+dfsg1-4/ryu/ofproto/nicira_ext.py	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/ryu/ofproto/nicira_ext.py	2018-08-23 11:52:05.000000000 +0000
@@ -62,6 +62,8 @@ NXAST_NAT = 36
 NXAST_CONTROLLER2 = 37
 NXAST_SAMPLE2 = 38
 NXAST_OUTPUT_TRUNC = 39
+NXAST_CT_CLEAR = 43
+NXAST_DEC_NSH_TTL = 48
 
 NX_ACTION_RESUBMIT_PACK_STR = '!HHIHHB3x'
 NX_ACTION_RESUBMIT_SIZE = 16
@@ -296,7 +298,7 @@ NXM_IP_FRAG_NOT_LATER = (0, FLOW_NW_FRAG
 
 
 def ofs_nbits(start, end):
-    """
+    r"""
     The utility method for ofs_nbits
 
     This method is used in the class to set the ofs_nbits.
@@ -590,6 +592,29 @@ tun_ipv6_dst     IPv6 address    Tunnel
                                  eth_type_nxm = 0x86dd (IPv6)
 _recirc_id       Integer 32bit   ID for recirculation.
 _dp_hash         Integer 32bit   Flow hash computed in Datapath.
+nsh_flags        Integer 8bit    Flags field in NSH Base Header.
+                                 Requires eth_type_nxm = 0x894f (NSH).
+                                 Since OpenFlow 1.3 and OVS v2.8.
+nsh_mdtype       Integer 8bit    Metadata Type in NSH Base Header.
+                                 Requires eth_type_nxm = 0x894f (NSH).
+                                 Since OpenFlow 1.3 and OVS v2.8.
+nsh_np           Integer 8bit    Next Protocol type in NSH Base Header.
+                                 Requires eth_type_nxm = 0x894f (NSH).
+                                 Since OpenFlow 1.3 and OVS v2.8.
+nsh_spi          Integer 32bit   Service Path Identifier in NSH Service Path
+                                 Header.
+                                 Requires eth_type_nxm = 0x894f (NSH).
+                                 Since OpenFlow 1.3 and OVS v2.8.
+nsh_si           Integer 8bit    Service Index in NSH Service Path Header.
+                                 Requires eth_type_nxm = 0x894f (NSH).
+                                 Since OpenFlow 1.3 and OVS v2.8.
+nsh_c<N>         Integer 32bit   Context fields in NSH Context Header.
+                                 <N> is a number of 1-4.
+                                 Requires eth_type_nxm = 0x894f (NSH).
+                                 Since OpenFlow 1.3 and OVS v2.8.
+nsh_ttl          Integer 8bit    TTL field in NSH Base Header.
+                                 Requires eth_type_nxm = 0x894f (NSH).
+                                 Since OpenFlow 1.3 and OVS v2.9.
 reg<idx>         Integer 32bit   Packet register.
                                  <idx> is register number 0-15.
 xxreg<idx>       Integer 128bit  Packet extended-extended register.
@@ -684,6 +709,21 @@ oxm_types = [
     # in wild.
     oxm_fields.NiciraExperimenter('_dp_hash', 0, type_desc.Int4),
 
+    # Nicira Experimenter for Network Service Header
+    oxm_fields.NiciraNshExperimenter('nsh_flags', 1, type_desc.Int1),
+    oxm_fields.NiciraNshExperimenter('nsh_mdtype', 2, type_desc.Int1),
+    oxm_fields.NiciraNshExperimenter('nsh_np', 3, type_desc.Int1),
+    # aka "nsp"
+    oxm_fields.NiciraNshExperimenter('nsh_spi', 4, type_desc.Int4),
+    # aka "nsi"
+    oxm_fields.NiciraNshExperimenter('nsh_si', 5, type_desc.Int1),
+    # aka "nshc<N>"
+    oxm_fields.NiciraNshExperimenter('nsh_c1', 6, type_desc.Int4),
+    oxm_fields.NiciraNshExperimenter('nsh_c2', 7, type_desc.Int4),
+    oxm_fields.NiciraNshExperimenter('nsh_c3', 8, type_desc.Int4),
+    oxm_fields.NiciraNshExperimenter('nsh_c4', 9, type_desc.Int4),
+    oxm_fields.NiciraNshExperimenter('nsh_ttl', 10, type_desc.Int1),
+
     # Support for matching/setting NX registers 0-15
     oxm_fields.NiciraExtended1('reg0', 0, type_desc.Int4),
     oxm_fields.NiciraExtended1('reg1', 1, type_desc.Int4),
diff -pruN 4.21+dfsg1-4/ryu/ofproto/nx_actions.py 4.26+dfsg1-5/ryu/ofproto/nx_actions.py
--- 4.21+dfsg1-4/ryu/ofproto/nx_actions.py	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/ryu/ofproto/nx_actions.py	2018-08-23 11:52:05.000000000 +0000
@@ -248,7 +248,7 @@ def generate(ofp_name, ofpp_name):
 
     # For OpenFlow1.0 only
     class NXActionSetQueue(NXAction):
-        """
+        r"""
         Set queue action
 
         This action sets the queue that should be used to queue
@@ -338,7 +338,7 @@ def generate(ofp_name, ofpp_name):
             return data
 
     class NXActionRegLoad(NXAction):
-        """
+        r"""
         Load literal value action
 
         This action loads a literal value into a field or part of a field.
@@ -405,7 +405,7 @@ def generate(ofp_name, ofpp_name):
             return data
 
     class NXActionRegLoad2(NXAction):
-        """
+        r"""
         Load literal value action
 
         This action loads a literal value into a field or part of a field.
@@ -474,7 +474,7 @@ def generate(ofp_name, ofpp_name):
             return data
 
     class NXActionNote(NXAction):
-        """
+        r"""
         Note action
 
         This action does nothing at all.
@@ -553,7 +553,7 @@ def generate(ofp_name, ofpp_name):
             return data
 
     class NXActionSetTunnel(_NXActionSetTunnelBase):
-        """
+        r"""
         Set Tunnel action
 
         This action sets the identifier (such as GRE) to the specified id.
@@ -561,10 +561,9 @@ def generate(ofp_name, ofpp_name):
         And equivalent to the followings action of ovs-ofctl command.
 
         .. note::
-            ovs-ofctl command of the OpenFlow1.0 is different from that
-            of OpenFlow1.2 or later.
-
-        OpenFlow1.0
+            This actions is supported by
+            ``OFPActionSetField``
+            in OpenFlow1.2 or later.
 
         ..
           set_tunnel:id
@@ -574,16 +573,6 @@ def generate(ofp_name, ofpp_name):
         | **set_tunnel**\:\ *id* |
         +------------------------+
 
-        OpenFlow1.2 or later
-
-        ..
-          set_field:value->tun_id
-        ..
-
-        +-----------------------------------+
-        | **set_field**\:\ *value*\->tun_id |
-        +-----------------------------------+
-
         ================ ======================================================
         Attribute        Description
         ================ ======================================================
@@ -600,7 +589,7 @@ def generate(ofp_name, ofpp_name):
         _fmt_str = '!2xI'
 
     class NXActionSetTunnel64(_NXActionSetTunnelBase):
-        """
+        r"""
         Set Tunnel action
 
         This action outputs to a port that encapsulates
@@ -609,10 +598,9 @@ def generate(ofp_name, ofpp_name):
         And equivalent to the followings action of ovs-ofctl command.
 
         .. note::
-            ovs-ofctl command of the OpenFlow1.0 is different from that
-            of OpenFlow1.2 or later.
-
-        OpenFlow1.0
+            This actions is supported by
+            ``OFPActionSetField``
+            in OpenFlow1.2 or later.
 
         ..
           set_tunnel64:id
@@ -622,16 +610,6 @@ def generate(ofp_name, ofpp_name):
         | **set_tunnel64**\:\ *id* |
         +--------------------------+
 
-        OpenFlow1.2 or later
-
-        ..
-          set_field:value->tun_id
-        ..
-
-        +-----------------------------------+
-        | **set_field**\:\ *value*\->tun_id |
-        +-----------------------------------+
-
         ================ ======================================================
         Attribute        Description
         ================ ======================================================
@@ -648,7 +626,7 @@ def generate(ofp_name, ofpp_name):
         _fmt_str = '!6xQ'
 
     class NXActionRegMove(NXAction):
-        """
+        r"""
         Move register action
 
         This action copies the src to dst.
@@ -737,7 +715,7 @@ def generate(ofp_name, ofpp_name):
             return data
 
     class NXActionResubmit(NXAction):
-        """
+        r"""
         Resubmit action
 
         This action searches one of the switch's flow tables.
@@ -786,7 +764,7 @@ def generate(ofp_name, ofpp_name):
             return data
 
     class NXActionResubmitTable(NXAction):
-        """
+        r"""
         Resubmit action
 
         This action searches one of the switch's flow tables.
@@ -840,7 +818,7 @@ def generate(ofp_name, ofpp_name):
             return data
 
     class NXActionOutputReg(NXAction):
-        """
+        r"""
         Add output action
 
         This action outputs the packet to the OpenFlow port number read from
@@ -914,7 +892,7 @@ def generate(ofp_name, ofpp_name):
             return data
 
     class NXActionOutputReg2(NXAction):
-        """
+        r"""
         Add output action
 
         This action outputs the packet to the OpenFlow port number read from
@@ -996,7 +974,7 @@ def generate(ofp_name, ofpp_name):
             return data
 
     class NXActionLearn(NXAction):
-        """
+        r"""
         Adds or modifies flow action
 
         This action adds or modifies a flow in OpenFlow table.
@@ -1260,7 +1238,7 @@ def generate(ofp_name, ofpp_name):
             return data
 
     class NXActionController(NXAction):
-        """
+        r"""
         Send packet in message action
 
         This action sends the packet to the OpenFlow controller as
@@ -1325,7 +1303,7 @@ def generate(ofp_name, ofpp_name):
             return data
 
     class NXActionController2(NXAction):
-        """
+        r"""
         Send packet in message action
 
         This action sends the packet to the OpenFlow controller as
@@ -1571,7 +1549,7 @@ def generate(ofp_name, ofpp_name):
             return data
 
     class NXActionDecTtlCntIds(NXAction):
-        """
+        r"""
         Decrement TTL action
 
         This action decrements TTL of IPv4 packet or
@@ -1682,7 +1660,7 @@ def generate(ofp_name, ofpp_name):
 
     # For OpenFlow1.0 only
     class NXActionPushMpls(NXActionMplsBase):
-        """
+        r"""
         Push MPLS action
 
         This action pushes a new MPLS header to the packet.
@@ -1717,7 +1695,7 @@ def generate(ofp_name, ofpp_name):
 
     # For OpenFlow1.0 only
     class NXActionPopMpls(NXActionMplsBase):
-        """
+        r"""
         Pop MPLS action
 
         This action pops the MPLS header from the packet.
@@ -1752,7 +1730,7 @@ def generate(ofp_name, ofpp_name):
 
     # For OpenFlow1.0 only
     class NXActionSetMplsTtl(NXAction):
-        """
+        r"""
         Set MPLS TTL action
 
         This action sets the MPLS TTL.
@@ -1851,7 +1829,7 @@ def generate(ofp_name, ofpp_name):
 
     # For OpenFlow1.0 only
     class NXActionSetMplsLabel(NXAction):
-        """
+        r"""
         Set MPLS Lavel action
 
         This action sets the MPLS Label.
@@ -1906,7 +1884,7 @@ def generate(ofp_name, ofpp_name):
 
     # For OpenFlow1.0 only
     class NXActionSetMplsTc(NXAction):
-        """
+        r"""
         Set MPLS Tc action
 
         This action sets the MPLS Tc.
@@ -2000,7 +1978,7 @@ def generate(ofp_name, ofpp_name):
             return data
 
     class NXActionStackPush(NXActionStackBase):
-        """
+        r"""
         Push field action
 
         This action pushes field to top of the stack.
@@ -2032,7 +2010,7 @@ def generate(ofp_name, ofpp_name):
         _subtype = nicira_ext.NXAST_STACK_PUSH
 
     class NXActionStackPop(NXActionStackBase):
-        """
+        r"""
         Pop field action
 
         This action pops field from top of the stack.
@@ -2064,7 +2042,7 @@ def generate(ofp_name, ofpp_name):
         _subtype = nicira_ext.NXAST_STACK_POP
 
     class NXActionSample(NXAction):
-        """
+        r"""
         Sample packets action
 
         This action samples packets and sends one sample for
@@ -2137,7 +2115,7 @@ def generate(ofp_name, ofpp_name):
             return data
 
     class NXActionSample2(NXAction):
-        """
+        r"""
         Sample packets action
 
         This action samples packets and sends one sample for
@@ -2218,7 +2196,7 @@ def generate(ofp_name, ofpp_name):
             return data
 
     class NXActionFinTimeout(NXAction):
-        """
+        r"""
         Change TCP timeout action
 
         This action changes the idle timeout or hard timeout or
@@ -2279,7 +2257,7 @@ def generate(ofp_name, ofpp_name):
             return data
 
     class NXActionConjunction(NXAction):
-        """
+        r"""
         Conjunctive matches action
 
         This action ties groups of individual OpenFlow flows into
@@ -2342,7 +2320,7 @@ def generate(ofp_name, ofpp_name):
             return data
 
     class NXActionMultipath(NXAction):
-        """
+        r"""
         Select multipath link action
 
         This action selects multipath link based on the specified parameters.
@@ -2528,7 +2506,7 @@ def generate(ofp_name, ofpp_name):
             return data
 
     class NXActionBundle(_NXActionBundleBase):
-        """
+        r"""
         Select bundle link action
 
         This action selects bundle link based on the specified parameters.
@@ -2581,7 +2559,7 @@ def generate(ofp_name, ofpp_name):
                 ofs_nbits=0, dst=0, slaves=slaves)
 
     class NXActionBundleLoad(_NXActionBundleBase):
-        """
+        r"""
         Select bundle link action
 
         This action has the same behavior as the bundle action,
@@ -2642,7 +2620,7 @@ def generate(ofp_name, ofpp_name):
                 ofs_nbits, dst, slaves)
 
     class NXActionCT(NXAction):
-        """
+        r"""
         Pass traffic to the connection tracker action
 
         This action sends the packet through the connection tracker.
@@ -2766,8 +2744,45 @@ def generate(ofp_name, ofpp_name):
                 a.serialize(data, len(data))
             return data
 
-    class NXActionNAT(NXAction):
+    class NXActionCTClear(NXAction):
         """
+        Clear connection tracking state action
+
+        This action clears connection tracking state from packets.
+
+        And equivalent to the followings action of ovs-ofctl command.
+
+        ..
+          ct_clear
+        ..
+
+        +--------------+
+        | **ct_clear** |
+        +--------------+
+
+        Example::
+
+            actions += [parser.NXActionCTClear()]
+        """
+        _subtype = nicira_ext.NXAST_CT_CLEAR
+
+        _fmt_str = '!6x'
+
+        def __init__(self,
+                     type_=None, len_=None, experimenter=None, subtype=None):
+            super(NXActionCTClear, self).__init__()
+
+        @classmethod
+        def parser(cls, buf):
+            return cls()
+
+        def serialize_body(self):
+            data = bytearray()
+            msg_pack_into(self._fmt_str, data, 0)
+            return data
+
+    class NXActionNAT(NXAction):
+        r"""
         Network address translation action
 
         This action sends the packet through the connection tracker.
@@ -2930,7 +2945,7 @@ def generate(ofp_name, ofpp_name):
             return data
 
     class NXActionOutputTrunc(NXAction):
-        """
+        r"""
         Truncate output action
 
         This action truncate a packet into the specified size and outputs it.
@@ -2984,6 +2999,41 @@ def generate(ofp_name, ofpp_name):
                           self.max_len)
             return data
 
+    class NXActionDecNshTtl(NXAction):
+        """
+        Decrement NSH TTL action
+
+        This action decrements the TTL in the Network Service Header(NSH).
+
+        This action was added in OVS v2.9.
+
+        And equivalent to the followings action of ovs-ofctl command.
+
+        ::
+
+            dec_nsh_ttl
+
+        Example::
+
+            actions += [parser.NXActionDecNshTtl()]
+        """
+        _subtype = nicira_ext.NXAST_DEC_NSH_TTL
+
+        _fmt_str = '!6x'
+
+        def __init__(self,
+                     type_=None, len_=None, vendor=None, subtype=None):
+            super(NXActionDecNshTtl, self).__init__()
+
+        @classmethod
+        def parser(cls, buf):
+            return cls()
+
+        def serialize_body(self):
+            data = bytearray()
+            msg_pack_into(self._fmt_str, data, 0)
+            return data
+
     def add_attr(k, v):
         v.__module__ = ofpp.__name__  # Necessary for stringify stuff
         setattr(ofpp, k, v)
@@ -3026,12 +3076,14 @@ def generate(ofp_name, ofpp_name):
         'NXActionBundle',
         'NXActionBundleLoad',
         'NXActionCT',
+        'NXActionCTClear',
         'NXActionNAT',
         'NXActionOutputTrunc',
         '_NXFlowSpec',  # exported for testing
         'NXFlowSpecMatch',
         'NXFlowSpecLoad',
         'NXFlowSpecOutput',
+        'NXActionDecNshTtl',
     ]
     vars = locals()
     for name in classes:
diff -pruN 4.21+dfsg1-4/ryu/ofproto/ofproto_common.py 4.26+dfsg1-5/ryu/ofproto/ofproto_common.py
--- 4.21+dfsg1-4/ryu/ofproto/ofproto_common.py	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/ryu/ofproto/ofproto_common.py	2018-08-23 11:52:05.000000000 +0000
@@ -32,5 +32,6 @@ OFP_SSL_PORT_OLD = 6633
 # Vendor/Experimenter IDs
 # https://rs.opennetworking.org/wiki/display/PUBLIC/ONF+Registry
 NX_EXPERIMENTER_ID = 0x00002320  # Nicira
+NX_NSH_EXPERIMENTER_ID = 0x005ad650  # Nicira Ext for Network Service Header
 BSN_EXPERIMENTER_ID = 0x005c16c7  # Big Switch Networks
 ONF_EXPERIMENTER_ID = 0x4f4e4600  # OpenFlow Extensions for 1.3.X Pack 1
diff -pruN 4.21+dfsg1-4/ryu/ofproto/ofproto_v1_0_parser.py 4.26+dfsg1-5/ryu/ofproto/ofproto_v1_0_parser.py
--- 4.21+dfsg1-4/ryu/ofproto/ofproto_v1_0_parser.py	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/ryu/ofproto/ofproto_v1_0_parser.py	2018-08-23 11:52:05.000000000 +0000
@@ -1258,6 +1258,8 @@ class OFPErrorMsg(MsgBase):
         super(OFPErrorMsg, self).__init__(datapath)
         self.type = type_
         self.code = code
+        if isinstance(data, six.string_types):
+            data = data.encode('ascii')
         self.data = data
 
     @classmethod
diff -pruN 4.21+dfsg1-4/ryu/ofproto/ofproto_v1_2_parser.py 4.26+dfsg1-5/ryu/ofproto/ofproto_v1_2_parser.py
--- 4.21+dfsg1-4/ryu/ofproto/ofproto_v1_2_parser.py	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/ryu/ofproto/ofproto_v1_2_parser.py	2018-08-23 11:52:05.000000000 +0000
@@ -141,6 +141,8 @@ class OFPErrorMsg(MsgBase):
         super(OFPErrorMsg, self).__init__(datapath)
         self.type = type_
         self.code = code
+        if isinstance(data, six.string_types):
+            data = data.encode('ascii')
         self.data = data
         if self.type == ofproto.OFPET_EXPERIMENTER:
             self.exp_type = kwargs.get('exp_type', None)
diff -pruN 4.21+dfsg1-4/ryu/ofproto/ofproto_v1_3_parser.py 4.26+dfsg1-5/ryu/ofproto/ofproto_v1_3_parser.py
--- 4.21+dfsg1-4/ryu/ofproto/ofproto_v1_3_parser.py	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/ryu/ofproto/ofproto_v1_3_parser.py	2018-08-23 11:52:05.000000000 +0000
@@ -251,6 +251,8 @@ class OFPErrorMsg(MsgBase):
         super(OFPErrorMsg, self).__init__(datapath)
         self.type = type_
         self.code = code
+        if isinstance(data, six.string_types):
+            data = data.encode('ascii')
         self.data = data
         if self.type == ofproto.OFPET_EXPERIMENTER:
             self.exp_type = kwargs.get('exp_type', None)
diff -pruN 4.21+dfsg1-4/ryu/ofproto/ofproto_v1_4_parser.py 4.26+dfsg1-5/ryu/ofproto/ofproto_v1_4_parser.py
--- 4.21+dfsg1-4/ryu/ofproto/ofproto_v1_4_parser.py	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/ryu/ofproto/ofproto_v1_4_parser.py	2018-08-23 11:52:05.000000000 +0000
@@ -262,6 +262,8 @@ class OFPErrorMsg(MsgBase):
         super(OFPErrorMsg, self).__init__(datapath)
         self.type = type_
         self.code = code
+        if isinstance(data, six.string_types):
+            data = data.encode('ascii')
         self.data = data
         if self.type == ofproto.OFPET_EXPERIMENTER:
             self.exp_type = kwargs.get('exp_type', None)
diff -pruN 4.21+dfsg1-4/ryu/ofproto/ofproto_v1_5_parser.py 4.26+dfsg1-5/ryu/ofproto/ofproto_v1_5_parser.py
--- 4.21+dfsg1-4/ryu/ofproto/ofproto_v1_5_parser.py	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/ryu/ofproto/ofproto_v1_5_parser.py	2018-08-23 11:52:05.000000000 +0000
@@ -262,6 +262,8 @@ class OFPErrorMsg(MsgBase):
         super(OFPErrorMsg, self).__init__(datapath)
         self.type = type_
         self.code = code
+        if isinstance(data, six.string_types):
+            data = data.encode('ascii')
         self.data = data
         if self.type == ofproto.OFPET_EXPERIMENTER:
             self.exp_type = kwargs.get('exp_type', None)
diff -pruN 4.21+dfsg1-4/ryu/ofproto/oxm_fields.py 4.26+dfsg1-5/ryu/ofproto/oxm_fields.py
--- 4.21+dfsg1-4/ryu/ofproto/oxm_fields.py	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/ryu/ofproto/oxm_fields.py	2018-08-23 11:52:05.000000000 +0000
@@ -132,6 +132,10 @@ class NiciraExperimenter(_Experimenter):
     experimenter_id = ofproto_common.NX_EXPERIMENTER_ID
 
 
+class NiciraNshExperimenter(_Experimenter):
+    experimenter_id = ofproto_common.NX_NSH_EXPERIMENTER_ID
+
+
 class NiciraExtended0(_OxmClass):
     """Nicira Extended Match (NXM_0)
 
diff -pruN 4.21+dfsg1-4/ryu/services/protocols/bgp/application.py 4.26+dfsg1-5/ryu/services/protocols/bgp/application.py
--- 4.21+dfsg1-4/ryu/services/protocols/bgp/application.py	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/ryu/services/protocols/bgp/application.py	2018-08-23 11:52:05.000000000 +0000
@@ -14,7 +14,103 @@
 # limitations under the License.
 
 """
-  Defines bases classes to create a BGP application.
+This module provides a convenient application for using Ryu BGPSpeaker and for
+writing your BGP application.
+
+It reads a configuration file which includes settings for neighbors, routes
+and some others.
+Please refer to ``ryu/services/protocols/bgp/bgp_sample_conf.py`` for the
+sample configuration.
+
+Usage Example::
+
+    $ ryu-manager ryu/services/protocols/bgp/application.py \\
+        --bgp-app-config-file ryu/services/protocols/bgp/bgp_sample_conf.py
+
+SSH Console
+===========
+
+You can also use the SSH console and see the RIB and do some operations from
+this console.
+The SSH port and username/password can be configured by the configuration file.
+You can check the help by hitting '?' key in this interface.
+
+Example::
+
+    $ ssh localhost -p 4990
+
+    Hello, this is Ryu BGP speaker (version 4.19).
+
+    bgpd> # Hit '?' key
+     clear - allows to reset BGP connections
+     help - show this help
+     quit - exit this session
+     set - set runtime settings
+     show - shows runtime state information
+    bgpd>
+    bgpd> show rib all
+    Status codes: * valid, > best
+    Origin codes: i - IGP, e - EGP, ? - incomplete
+         Network        Labels   Next Hop   Reason      Metric LocPrf Path
+     *>  10.10.1.0/24   None     0.0.0.0    Only Path                 i
+    bgpd>
+
+Integration with Other Applications
+===================================
+
+``ryu.services.protocols.bgp.application.RyuBGPSpeaker`` will notifies the
+following events to other Ryu applications.
+
+    - ``EventBestPathChanged``
+    - ``EventAdjRibInChanged``
+    - ``EventPeerDown``
+    - ``EventPeerUp``
+
+To catch these events, specify ``@set_ev_cls()`` decorator to the event
+handlers in the Ryu applications.
+
+Example Application::
+
+    # my_bgp_app.py
+
+    from ryu.base import app_manager
+    from ryu.controller.handler import set_ev_cls
+    from ryu.services.protocols.bgp import application as bgp_application
+
+
+    class MyBGPApp(app_manager.RyuApp):
+        _CONTEXTS = {
+            'ryubgpspeaker': bgp_application.RyuBGPSpeaker,
+        }
+
+        def __init__(self, *args, **kwargs):
+            super(MyBGPApp, self).__init__(*args, **kwargs)
+
+            # Stores "ryu.services.protocols.bgp.application.RyuBGPSpeaker"
+            # instance in order to call the APIs of
+            # "ryu.services.protocols.bgp.bgpspeaker.BGPSpeaker" via
+            # "self.app.speaker".
+            # Please note at this time, "BGPSpeaker" is NOT instantiated yet.
+            self.app = kwargs['ryubgpspeaker']
+
+        @set_ev_cls(bgp_application.EventBestPathChanged)
+        def _best_patch_changed_handler(self, ev):
+            self.logger.info(
+                'Best path changed: is_withdraw=%s, path=%s',
+                ev.is_withdraw, ev.path)
+
+Usage Example::
+
+    $ ryu-manager my_bgp_app.py \\
+        --bgp-app-config-file ryu/services/protocols/bgp/bgp_sample_conf.py
+
+.. note::
+
+    For the APIs for ``ryu.services.protocols.bgp.bgpspeaker.BGPSpeaker``,
+    please refer to :doc:`../library_bgp_speaker_ref`.
+
+API Reference
+=============
 """
 
 import logging
@@ -101,6 +197,33 @@ class EventBestPathChanged(EventBase):
         self.is_withdraw = is_withdraw
 
 
+class EventAdjRibInChanged(EventBase):
+    """
+    Event called when any adj-RIB-in path is changed due to UPDATE messages
+    or remote peer's down.
+
+    This event is the wrapper for ``adj_rib_in_change_handler`` of
+    ``bgpspeaker.BGPSpeaker``.
+
+    ``path`` attribute contains an instance of ``info_base.base.Path``
+    subclasses.
+
+    If ``is_withdraw`` attribute is ``True``, ``path`` attribute has the
+    information of the withdraw route.
+
+    ``peer_ip`` is the peer's IP address who sent this path.
+
+    ``peer_as`` is the peer's AS number who sent this path.
+    """
+
+    def __init__(self, path, is_withdraw, peer_ip, peer_as):
+        super(EventAdjRibInChanged, self).__init__()
+        self.path = path
+        self.is_withdraw = is_withdraw
+        self.peer_ip = peer_ip
+        self.peer_as = peer_as
+
+
 class EventPeerDown(EventBase):
     """
     Event called when the session to the remote peer goes down.
@@ -140,37 +263,10 @@ class EventPeerUp(EventBase):
 class RyuBGPSpeaker(RyuApp):
     """
     Base application for implementing BGP applications.
-
-    This application will notifies
-     - ``EventBestPathChanged``
-     - ``EventPeerDown``
-     - ``EventPeerUp``
-    to other BGP applications.
-    To catch these events, specify ``@set_ev_cls()`` decorator to the event
-    handlers in the Ryu applications.
-
-    Example::
-
-        ...
-        from ryu.base import app_manager
-        from ryu.controller.handler import set_ev_cls
-        from ryu.services.protocols.bgp import application as bgp_application
-        ...
-
-        class MyBGPApp(app_manager.RyuApp):
-            _CONTEXTS = {
-                'ryubgpspeaker': bgp_application.RyuBGPSpeaker,
-            }
-
-            ...
-            @set_ev_cls(bgp_application.EventBestPathChanged)
-            def _best_patch_changed_handler(self, ev):
-                self.logger.info(
-                    'Best path changed: is_withdraw=%s, path=%s',
-                    ev.is_withdraw, ev.path)
     """
     _EVENTS = [
         EventBestPathChanged,
+        EventAdjRibInChanged,
         EventPeerDown,
         EventPeerUp,
     ]
@@ -238,6 +334,8 @@ class RyuBGPSpeaker(RyuApp):
         settings.setdefault(
             'best_path_change_handler', self._notify_best_path_changed_event)
         settings.setdefault(
+            'adj_rib_in_change_handler', self._notify_adj_rib_in_changed_event)
+        settings.setdefault(
             'peer_down_handler', self._notify_peer_down_event)
         settings.setdefault(
             'peer_up_handler', self._notify_peer_up_event)
@@ -268,6 +366,10 @@ class RyuBGPSpeaker(RyuApp):
         ev = EventBestPathChanged(ev.path, ev.is_withdraw)
         self.send_event_to_observers(ev)
 
+    def _notify_adj_rib_in_changed_event(self, ev, peer_ip, peer_as):
+        ev = EventAdjRibInChanged(ev.path, ev.is_withdraw, peer_ip, peer_as)
+        self.send_event_to_observers(ev)
+
     def _notify_peer_down_event(self, remote_ip, remote_as):
         ev = EventPeerDown(remote_ip, remote_as)
         self.send_event_to_observers(ev)
diff -pruN 4.21+dfsg1-4/ryu/services/protocols/bgp/bgpspeaker.py 4.26+dfsg1-5/ryu/services/protocols/bgp/bgpspeaker.py
--- 4.21+dfsg1-4/ryu/services/protocols/bgp/bgpspeaker.py	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/ryu/services/protocols/bgp/bgpspeaker.py	2018-08-23 11:52:05.000000000 +0000
@@ -68,6 +68,7 @@ from ryu.services.protocols.bgp.api.pref
     FLOWSPEC_FAMILY_L2VPN,
     FLOWSPEC_RULES,
     FLOWSPEC_ACTIONS)
+from ryu.services.protocols.bgp.model import ReceivedRoute
 from ryu.services.protocols.bgp.rtconf.common import LOCAL_AS
 from ryu.services.protocols.bgp.rtconf.common import ROUTER_ID
 from ryu.services.protocols.bgp.rtconf.common import CLUSTER_ID
@@ -220,84 +221,90 @@ class EventPrefix(object):
 
 
 class BGPSpeaker(object):
-    def __init__(self, as_number, router_id,
-                 bgp_server_hosts=DEFAULT_BGP_SERVER_HOSTS,
-                 bgp_server_port=DEFAULT_BGP_SERVER_PORT,
-                 refresh_stalepath_time=DEFAULT_REFRESH_STALEPATH_TIME,
-                 refresh_max_eor_time=DEFAULT_REFRESH_MAX_EOR_TIME,
-                 best_path_change_handler=None,
-                 peer_down_handler=None,
-                 peer_up_handler=None,
-                 ssh_console=False,
-                 ssh_port=None, ssh_host=None, ssh_host_key=None,
-                 label_range=DEFAULT_LABEL_RANGE,
-                 allow_local_as_in_count=0,
-                 cluster_id=None,
-                 local_pref=DEFAULT_LOCAL_PREF):
-        """Create a new BGPSpeaker object with as_number and router_id to
-        listen on bgp_server_port.
+    """Class to provide the APIs of Ryu BGP Speaker.
 
-        ``as_number`` specifies an Autonomous Number. It must be an integer
-        between 1 and 65535.
+    ``as_number`` specifies an Autonomous Number. It must be an integer
+    between 1 and 65535.
 
-        ``router_id`` specifies BGP router identifier. It must be the
-        string representation of an IPv4 address (e.g. 10.0.0.1).
+    ``router_id`` specifies BGP router identifier. It must be the
+    string representation of an IPv4 address (e.g. 10.0.0.1).
 
-        ``bgp_server_host`` specifies a list of TCP listen host addresses.
+    ``bgp_server_host`` specifies a list of TCP listen host addresses.
 
-        ``bgp_server_port`` specifies TCP listen port number. 179 is
-        used if not specified.
+    ``bgp_server_port`` specifies TCP listen port number. 179 is
+    used if not specified.
 
-        ``refresh_stalepath_time`` causes the BGP speaker to remove
-        stale routes from the BGP table after the timer expires, even
-        if the speaker does not receive a Router-Refresh End-of-RIB
-        message. This feature is disabled (not implemented yet).
+    ``refresh_stalepath_time`` causes the BGP speaker to remove
+    stale routes from the BGP table after the timer expires, even
+    if the speaker does not receive a Router-Refresh End-of-RIB
+    message. This feature is disabled (not implemented yet).
 
-        ``refresh_max_eor_time`` causes the BGP speaker to generate a
-        Route-Refresh End-of-RIB message if it was not able to
-        generate one due to route flapping. This feature is disabled
-        (not implemented yet).
+    ``refresh_max_eor_time`` causes the BGP speaker to generate a
+    Route-Refresh End-of-RIB message if it was not able to
+    generate one due to route flapping. This feature is disabled
+    (not implemented yet).
 
-        ``best_path_change_handler``, if specified, is called when any
-        best remote path is changed due to an update message or remote
-        peer down. The handler is supposed to take one argument, the
-        instance of an EventPrefix class instance.
+    ``best_path_change_handler``, if specified, is called when any
+    best remote path is changed due to an update message or remote
+    peer down. The handler is supposed to take one argument, the
+    instance of an EventPrefix class instance.
 
-        ``peer_down_handler``, if specified, is called when BGP peering
-        session goes down.
+    ``adj_rib_in_change_handler``, if specified, is called when any
+    adj-RIB-in path is changed due to an update message or remote
+    peer down. The given handler should take three argument, the
+    instance of an EventPrefix class instance, str type peer's IP address
+    and int type peer's AS number.
 
-        ``peer_up_handler``, if specified, is called when BGP peering
-        session goes up.
+    ``peer_down_handler``, if specified, is called when BGP peering
+    session goes down.
 
-        ``ssh_console`` specifies whether or not SSH CLI need to be started.
+    ``peer_up_handler``, if specified, is called when BGP peering
+    session goes up.
 
-        ``ssh_port`` specifies the port number for SSH CLI server.
-        The default is bgp.operator.ssh.DEFAULT_SSH_PORT.
+    ``ssh_console`` specifies whether or not SSH CLI need to be started.
 
-        ``ssh_host`` specifies the IP address for SSH CLI server.
-        The default is bgp.operator.ssh.DEFAULT_SSH_HOST.
+    ``ssh_port`` specifies the port number for SSH CLI server.
+    The default is bgp.operator.ssh.DEFAULT_SSH_PORT.
 
-        ``ssh_host_key`` specifies the path to the host key added to
-        the keys list used by SSH CLI server.
-        The default is bgp.operator.ssh.DEFAULT_SSH_HOST_KEY.
+    ``ssh_host`` specifies the IP address for SSH CLI server.
+    The default is bgp.operator.ssh.DEFAULT_SSH_HOST.
 
-        ``label_range`` specifies the range of MPLS labels generated
-        automatically.
+    ``ssh_host_key`` specifies the path to the host key added to
+    the keys list used by SSH CLI server.
+    The default is bgp.operator.ssh.DEFAULT_SSH_HOST_KEY.
 
-        ``allow_local_as_in_count`` maximum number of local AS number
-        occurrences in AS_PATH.  This option is useful for e.g.  auto RD/RT
-        configurations in leaf/spine architecture with shared AS numbers.
-        The default is 0 and means "local AS number is not allowed in
-        AS_PATH".  To allow local AS, 3 is recommended (Cisco's default).
+    ``label_range`` specifies the range of MPLS labels generated
+    automatically.
 
-        ``cluster_id`` specifies the cluster identifier for Route Reflector.
-        It must be the string representation of an IPv4 address.
-        If omitted, "router_id" is used for this field.
+    ``allow_local_as_in_count`` maximum number of local AS number
+    occurrences in AS_PATH.  This option is useful for e.g.  auto RD/RT
+    configurations in leaf/spine architecture with shared AS numbers.
+    The default is 0 and means "local AS number is not allowed in
+    AS_PATH".  To allow local AS, 3 is recommended (Cisco's default).
 
-        ``local_pref`` specifies the default local preference. It must be an
-        integer.
-        """
+    ``cluster_id`` specifies the cluster identifier for Route Reflector.
+    It must be the string representation of an IPv4 address.
+    If omitted, "router_id" is used for this field.
 
+    ``local_pref`` specifies the default local preference. It must be an
+    integer.
+    """
+
+    def __init__(self, as_number, router_id,
+                 bgp_server_hosts=DEFAULT_BGP_SERVER_HOSTS,
+                 bgp_server_port=DEFAULT_BGP_SERVER_PORT,
+                 refresh_stalepath_time=DEFAULT_REFRESH_STALEPATH_TIME,
+                 refresh_max_eor_time=DEFAULT_REFRESH_MAX_EOR_TIME,
+                 best_path_change_handler=None,
+                 adj_rib_in_change_handler=None,
+                 peer_down_handler=None,
+                 peer_up_handler=None,
+                 ssh_console=False,
+                 ssh_port=None, ssh_host=None, ssh_host_key=None,
+                 label_range=DEFAULT_LABEL_RANGE,
+                 allow_local_as_in_count=0,
+                 cluster_id=None,
+                 local_pref=DEFAULT_LOCAL_PREF):
         super(BGPSpeaker, self).__init__()
 
         settings = {
@@ -315,6 +322,7 @@ class BGPSpeaker(object):
         self._core_start(settings)
         self._init_signal_listeners()
         self._best_path_change_handler = best_path_change_handler
+        self._adj_rib_in_change_handler = adj_rib_in_change_handler
         self._peer_down_handler = peer_down_handler
         self._peer_up_handler = peer_up_handler
         if ssh_console:
@@ -351,6 +359,15 @@ class BGPSpeaker(object):
         if self._best_path_change_handler:
             self._best_path_change_handler(ev)
 
+    def _notify_adj_rib_in_changed(self, peer, route):
+        if not isinstance(route, ReceivedRoute):
+            return
+
+        if self._adj_rib_in_change_handler:
+            self._adj_rib_in_change_handler(
+                EventPrefix(route.path, route.path.is_withdraw),
+                peer.ip_address, peer.remote_as)
+
     def _init_signal_listeners(self):
         CORE_MANAGER.get_core_service()._signal_bus.register_listener(
             BgpSignalBus.BGP_BEST_PATH_CHANGED,
@@ -359,6 +376,12 @@ class BGPSpeaker(object):
                                            info['is_withdraw'])
         )
         CORE_MANAGER.get_core_service()._signal_bus.register_listener(
+            BgpSignalBus.BGP_ADJ_RIB_IN_CHANGED,
+            lambda _, info:
+            self._notify_adj_rib_in_changed(info['peer'],
+                                            info['received_route'])
+        )
+        CORE_MANAGER.get_core_service()._signal_bus.register_listener(
             BgpSignalBus.BGP_ADJ_DOWN,
             lambda _, info:
             self._notify_peer_down(info['peer'])
diff -pruN 4.21+dfsg1-4/ryu/services/protocols/bgp/peer.py 4.26+dfsg1-5/ryu/services/protocols/bgp/peer.py
--- 4.21+dfsg1-4/ryu/services/protocols/bgp/peer.py	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/ryu/services/protocols/bgp/peer.py	2018-08-23 11:52:05.000000000 +0000
@@ -989,37 +989,32 @@ class Peer(Source, Sink, NeighborConfLis
         elif self.is_route_server_client:
             nlri_list = [path.nlri]
             new_pathattr.extend(pathattr_map.values())
-        elif self.is_route_reflector_client:
-            nlri_list = [path.nlri]
+        else:
+            if self.is_route_reflector_client:
+                # Append ORIGINATOR_ID attribute if not already exist.
+                if BGP_ATTR_TYPE_ORIGINATOR_ID not in pathattr_map:
+                    originator_id = path.source
+                    if originator_id is None:
+                        originator_id = self._common_conf.router_id
+                    elif isinstance(path.source, Peer):
+                        originator_id = path.source.ip_address
+                    new_pathattr.append(
+                        BGPPathAttributeOriginatorId(value=originator_id))
 
-            # Append ORIGINATOR_ID attribute if not already exists.
-            if BGP_ATTR_TYPE_ORIGINATOR_ID not in pathattr_map:
-                originator_id = path.source
-                if originator_id is None:
-                    originator_id = self._common_conf.router_id
-                elif isinstance(path.source, Peer):
-                    originator_id = path.source.ip_address
-                new_pathattr.append(
-                    BGPPathAttributeOriginatorId(value=originator_id))
-
-            # Append CLUSTER_LIST attribute if not already exists.
-            if BGP_ATTR_TYPE_CLUSTER_LIST not in pathattr_map:
-                new_pathattr.append(
-                    BGPPathAttributeClusterList(
-                        [self._common_conf.cluster_id]))
-
-            for t, path_attr in pathattr_map.items():
-                if t == BGP_ATTR_TYPE_CLUSTER_LIST:
-                    # Append own CLUSTER_ID into CLUSTER_LIST attribute
-                    # if already exists.
-                    cluster_list = list(path_attr.value)
+                # Preppend own CLUSTER_ID into CLUSTER_LIST attribute if exist.
+                # Otherwise append CLUSTER_LIST attribute.
+                cluster_lst_attr = pathattr_map.get(BGP_ATTR_TYPE_CLUSTER_LIST)
+                if cluster_lst_attr:
+                    cluster_list = list(cluster_lst_attr.value)
                     if self._common_conf.cluster_id not in cluster_list:
-                        cluster_list.append(self._common_conf.cluster_id)
+                        cluster_list.insert(0, self._common_conf.cluster_id)
                     new_pathattr.append(
                         BGPPathAttributeClusterList(cluster_list))
                 else:
-                    new_pathattr.append(path_attr)
-        else:
+                    new_pathattr.append(
+                        BGPPathAttributeClusterList(
+                            [self._common_conf.cluster_id]))
+
             # Supported and un-supported/unknown attributes.
             origin_attr = None
             nexthop_attr = None
@@ -2005,8 +2000,8 @@ class Peer(Source, Sink, NeighborConfLis
             # Open/Notification messages are currently handled by protocol and
             # nothing is done inside peer, so should not see them here.
             raise ValueError('Peer does not support handling of %s'
-                             ' message during % state' %
-                             (msg, self.state.bgp_state()))
+                             ' message during %s state' %
+                             (msg, self.state.bgp_state))
 
     def _handle_err_sor_msg(self, afi, safi):
         # Check if ERR capability is enabled for this peer.
diff -pruN 4.21+dfsg1-4/ryu/tests/integrated/test_vrrp_linux_multi.py 4.26+dfsg1-5/ryu/tests/integrated/test_vrrp_linux_multi.py
--- 4.21+dfsg1-4/ryu/tests/integrated/test_vrrp_linux_multi.py	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/ryu/tests/integrated/test_vrrp_linux_multi.py	2018-08-23 11:52:05.000000000 +0000
@@ -14,7 +14,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-"""
+r"""
 Usage:
 PYTHONPATH=. ./bin/ryu-manager --verbose \
              ryu.services.protocols.vrrp.dumper \
diff -pruN 4.21+dfsg1-4/ryu/tests/integrated/test_vrrp_multi.py 4.26+dfsg1-5/ryu/tests/integrated/test_vrrp_multi.py
--- 4.21+dfsg1-4/ryu/tests/integrated/test_vrrp_multi.py	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/ryu/tests/integrated/test_vrrp_multi.py	2018-08-23 11:52:05.000000000 +0000
@@ -14,7 +14,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-"""
+r"""
 Usage:
 PYTHONPATH=. ./bin/ryu-manager --verbose \
              ryu.topology.switches \
Binary files 4.21+dfsg1-4/ryu/tests/packet_data/of13/ovs-ofctl-of13-action_ct_clear.packet and 4.26+dfsg1-5/ryu/tests/packet_data/of13/ovs-ofctl-of13-action_ct_clear.packet differ
diff -pruN 4.21+dfsg1-4/ryu/tests/packet_data_generator3/gen.py 4.26+dfsg1-5/ryu/tests/packet_data_generator3/gen.py
--- 4.21+dfsg1-4/ryu/tests/packet_data_generator3/gen.py	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/ryu/tests/packet_data_generator3/gen.py	2018-08-23 11:52:05.000000000 +0000
@@ -131,6 +131,13 @@ MESSAGES = [
                'importance=39032'] +
               ['dl_type=0x86dd'] +
               ['actions=ct(commit,nat(dst=2001:1::1-2001:1::ffff)'])},
+    {'name': 'action_ct_clear',
+     'versions': [4],
+     'cmd': 'add-flow',
+     'args': (['table=3,',
+               'importance=39032'] +
+              ['dl_type=0x0800,ct_state=+trk'] +
+              ['actions=ct_clear'])},
     {'name': 'action_note',
      'versions': [4],
      'cmd': 'add-flow',
@@ -312,7 +319,7 @@ if __name__ == '__main__':
                                    stdout=subprocess.PIPE)
     has_names = False
     try:
-        ver_tuple = re.search('\s(\d+)\.(\d+)(\.\d*|\s*$)',
+        ver_tuple = re.search(r'\s(\d+)\.(\d+)(\.\d*|\s*$)',
                               ovs_version.stdout.readline().decode()).groups()
         if int(ver_tuple[0]) > 2 or \
            int(ver_tuple[0]) == 2 and int(ver_tuple[1]) >= 8:
diff -pruN 4.21+dfsg1-4/ryu/tests/unit/lib/test_rpc.py 4.26+dfsg1-5/ryu/tests/unit/lib/test_rpc.py
--- 4.21+dfsg1-4/ryu/tests/unit/lib/test_rpc.py	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/ryu/tests/unit/lib/test_rpc.py	2018-08-23 11:52:05.000000000 +0000
@@ -138,13 +138,18 @@ class Test_rpc(unittest.TestCase):
         assert result == obj
         assert isinstance(result, numbers.Integral)
 
-    @raises(TypeError)
     def test_0_call_bytearray(self):
         c = rpc.Client(self._client_sock)
         obj = bytearray(b'foo')
-        result = c.call('resp', [obj])
-        assert result == obj
-        assert isinstance(result, str)
+        # Note: msgpack-python version 0.50 or later supports bytearray
+        # objects, here ignores TypeError for the backward compatibility.
+        try:
+            result = c.call('resp', [obj])
+        except TypeError:
+            # Case with msgpack-python version 0.4.x or earlier.
+            return
+        self.assertEqual(obj, result)
+        self.assertIsInstance(result, six.binary_type)
 
     def test_1_shutdown_wr(self):
         # test if the server shutdown on disconnect
diff -pruN 4.21+dfsg1-4/ryu/tests/unit/ofproto/json/of13/ovs-ofctl-of13-action_ct_clear.packet.json 4.26+dfsg1-5/ryu/tests/unit/ofproto/json/of13/ovs-ofctl-of13-action_ct_clear.packet.json
--- 4.21+dfsg1-4/ryu/tests/unit/ofproto/json/of13/ovs-ofctl-of13-action_ct_clear.packet.json	1970-01-01 00:00:00.000000000 +0000
+++ 4.26+dfsg1-5/ryu/tests/unit/ofproto/json/of13/ovs-ofctl-of13-action_ct_clear.packet.json	2018-08-23 11:52:05.000000000 +0000
@@ -0,0 +1,55 @@
+{
+   "OFPFlowMod": {
+      "buffer_id": 4294967295, 
+      "command": 0, 
+      "cookie": 0, 
+      "cookie_mask": 0, 
+      "flags": 0, 
+      "hard_timeout": 0, 
+      "idle_timeout": 0, 
+      "instructions": [
+         {
+            "OFPInstructionActions": {
+               "actions": [
+                  {
+                     "NXActionCTClear": {
+                        "experimenter": 8992, 
+                        "len": 16, 
+                        "subtype": 43, 
+                        "type": 65535
+                     }
+                  }
+               ], 
+               "len": 24, 
+               "type": 4
+            }
+         }
+      ], 
+      "match": {
+         "OFPMatch": {
+            "length": 22, 
+            "oxm_fields": [
+               {
+                  "OXMTlv": {
+                     "field": "eth_type", 
+                     "mask": null, 
+                     "value": 2048
+                  }
+               }, 
+               {
+                  "OXMTlv": {
+                     "field": "ct_state", 
+                     "mask": 32, 
+                     "value": 32
+                  }
+               }
+            ], 
+            "type": 1
+         }
+      }, 
+      "out_group": 4294967295, 
+      "out_port": 4294967295, 
+      "priority": 32768, 
+      "table_id": 3
+   }
+}
diff -pruN 4.21+dfsg1-4/ryu/tests/unit/packet/test_lldp.py 4.26+dfsg1-5/ryu/tests/unit/packet/test_lldp.py
--- 4.21+dfsg1-4/ryu/tests/unit/packet/test_lldp.py	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/ryu/tests/unit/packet/test_lldp.py	2018-08-23 11:52:05.000000000 +0000
@@ -227,8 +227,7 @@ class TestLLDPOptionalTLV(unittest.TestC
                     + b'\x73\x74\x65\x72\x20\x30\x35\x2f' \
                     + b'\x32\x37\x2f\x30\x35\x20\x30\x34' \
                     + b'\x3a\x35\x33\x3a\x31\x31\x00\x0e' \
-                    + b'\x05\x01\x00\x14\x00\x14\x10\x0e' \
-                    + b'\x07' \
+                    + b'\x04\x00\x14\x00\x14\x10\x0e\x07' \
                     + b'\x06\x00\x01\x30\xf9\xad\xa0\x02' \
                     + b'\x00\x00\x03\xe9\x00\xfe\x07\x00' \
                     + b'\x12\x0f\x02\x07\x01\x00\xfe\x09' \
@@ -274,7 +273,6 @@ class TestLLDPOptionalTLV(unittest.TestC
 
         # SystemCapabilities
         eq_(tlvs[6].tlv_type, lldp.LLDP_TLV_SYSTEM_CAPABILITIES)
-        eq_(tlvs[6].subtype, lldp.ChassisID.SUB_CHASSIS_COMPONENT)
         eq_(tlvs[6].system_cap & lldp.SystemCapabilities.CAP_MAC_BRIDGE,
             lldp.SystemCapabilities.CAP_MAC_BRIDGE)
         eq_(tlvs[6].enabled_cap & lldp.SystemCapabilities.CAP_MAC_BRIDGE,
@@ -322,7 +320,6 @@ class TestLLDPOptionalTLV(unittest.TestC
             system_description=b'Summit300-48 - Version 7.4e.1 (Build 5) '
                                + b'by Release_Master 05/27/05 04:53:11\x00')
         tlv_system_capabilities = lldp.SystemCapabilities(
-            subtype=lldp.ChassisID.SUB_CHASSIS_COMPONENT,
             system_cap=0x14,
             enabled_cap=0x14)
         tlv_management_address = lldp.ManagementAddress(
@@ -360,7 +357,6 @@ class TestLLDPOptionalTLV(unittest.TestC
             system_description=b'Summit300-48 - Version 7.4e.1 (Build 5) '
                                + b'by Release_Master 05/27/05 04:53:11\x00')
         sys_cap = lldp.SystemCapabilities(
-            subtype=lldp.ChassisID.SUB_CHASSIS_COMPONENT,
             system_cap=0x14,
             enabled_cap=0x14)
         man_addr = lldp.ManagementAddress(
@@ -434,8 +430,7 @@ class TestLLDPOptionalTLV(unittest.TestC
                                        _sys_desc_str)
 
         # SystemCapabilities string
-        sys_cap_values = {'subtype': lldp.ChassisID.SUB_CHASSIS_COMPONENT,
-                          'system_cap': 0x14,
+        sys_cap_values = {'system_cap': 0x14,
                           'enabled_cap': 0x14,
                           'len': sys_cap.len,
                           'typelen': sys_cap.typelen}
@@ -515,7 +510,6 @@ class TestLLDPOptionalTLV(unittest.TestC
             system_description=b'Summit300-48 - Version 7.4e.1 (Build 5) '
                                + b'by Release_Master 05/27/05 04:53:11\x00')
         sys_cap = lldp.SystemCapabilities(
-            subtype=lldp.ChassisID.SUB_CHASSIS_COMPONENT,
             system_cap=0x14,
             enabled_cap=0x14)
         man_addr = lldp.ManagementAddress(
diff -pruN 4.21+dfsg1-4/ryu/tests/unit/test_requirements.py 4.26+dfsg1-5/ryu/tests/unit/test_requirements.py
--- 4.21+dfsg1-4/ryu/tests/unit/test_requirements.py	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/ryu/tests/unit/test_requirements.py	2018-08-23 11:52:05.000000000 +0000
@@ -19,8 +19,6 @@ import sys
 import unittest
 
 import pkg_resources
-from pip.req import parse_requirements
-from pip.download import PipSession
 from six.moves import urllib
 
 from nose.tools import ok_
@@ -28,7 +26,7 @@ from nose.tools import ok_
 
 LOG = logging.getLogger(__name__)
 
-MOD_DIR = os.path.dirname(sys.modules[__name__].__file__)
+MOD_DIR = os.path.dirname('file://' + sys.modules[__name__].__file__)
 _RYU_REQUIREMENTS_FILES = [
     '../../../tools/pip-requires',
     '../../../tools/optional-requires',
@@ -51,9 +49,10 @@ OPENSTACK_REQUIREMENTS_FILES = [
 def _get_requirements(files):
     requirements = {}
     for f in files:
-        req = parse_requirements(f, session=PipSession())
-        for r in req:
-            requirements[r.name] = str(r.req)
+        response = urllib.request.urlopen(f)
+        contents = response.read().decode('utf-8')
+        for r in pkg_resources.parse_requirements(contents):
+            requirements[r.name] = str(r)
 
     return requirements
 
@@ -82,5 +81,5 @@ class TestRequirements(unittest.TestCase
         except pkg_resources.VersionConflict as e:
             LOG.exception(
                 'Some requirements of Ryu are conflicting with that of '
-                'OpenStack project: %s' % OPENSTACK_REQUIREMENTS_REPO)
+                'OpenStack project: %s', OPENSTACK_REQUIREMENTS_REPO)
             raise e
diff -pruN 4.21+dfsg1-4/ryu/utils.py 4.26+dfsg1-5/ryu/utils.py
--- 4.21+dfsg1-4/ryu/utils.py	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/ryu/utils.py	2018-08-23 11:52:05.000000000 +0000
@@ -126,34 +126,3 @@ def binary_str(data):
     """
     # convert data into bytearray explicitly
     return ''.join('\\x%02x' % byte for byte in bytearray(data))
-
-
-def parse_requirements(requirements_files=None):
-    """
-    Parses requirements files and returns a list of requirements.
-
-    Returned list would be like::
-
-        ['foo', 'bar>=X.X', ...]
-
-    :param requirements_files: List of requirements files. The default
-     is ['requirements.txt', 'tools/pip-requires'].
-    :return: List of requirements.
-    """
-    from pip import req as pip_req
-    from pip.download import PipSession
-
-    requirements_files = requirements_files or [
-        'requirements.txt',
-        'tools/pip-requires',
-    ]
-
-    requirements = []
-    for f in requirements_files:
-        if not os.path.isfile(f):
-            continue
-
-        for r in pip_req.parse_requirements(f, session=PipSession()):
-            requirements.append(str(r.req))
-
-    return requirements
diff -pruN 4.21+dfsg1-4/tools/pip-requires 4.26+dfsg1-5/tools/pip-requires
--- 4.21+dfsg1-4/tools/pip-requires	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/tools/pip-requires	2018-08-23 11:52:05.000000000 +0000
@@ -1,8 +1,8 @@
-# NOTE: OpenStack avoids the newer versions of eventlet, because of the
+# NOTE: OpenStack avoids some versions of eventlet, because of the
 # following issue.
 # https://github.com/eventlet/eventlet/issues/401
-eventlet!=0.18.3,>=0.18.2,!=0.20.1,<0.21.0
-msgpack-python>=0.3.0  # RPC library, BGP speaker(net_cntl)
+eventlet!=0.18.3,>=0.18.2,!=0.20.1,!=0.21.0,!=0.23.0
+msgpack>=0.3.0  # RPC library, BGP speaker(net_cntl)
 netaddr
 oslo.config>=1.15.0
 ovs>=2.6.0  # OVSDB
diff -pruN 4.21+dfsg1-4/tox.ini 4.26+dfsg1-5/tox.ini
--- 4.21+dfsg1-4/tox.ini	2018-02-16 16:19:44.000000000 +0000
+++ 4.26+dfsg1-5/tox.ini	2018-08-23 11:52:05.000000000 +0000
@@ -52,14 +52,15 @@ commands =
 
 [pycodestyle]
 exclude = pbr-*,.venv,.tox,.git,doc,dist,tools,vcsversion.py,.pyc,ryu/contrib
-# W503: line break occurred before a binary operator
+# W503: line break before binary operator
+# W504: line break after binary operator
 # E116: unexpected indentation (comment)
 # E402: module level import not at top of file
 # E501: line too long (>79 characters)
 # E722: do not use bare except, specify exception instead
 # E731: do not assign a lambda expression, use a def
 # E741: do not use variables named 'l', 'O', or 'I'
-ignore = W503,E116,E402,E501,E722,E731,E741
+ignore = W503,W504,E116,E402,E501,E722,E731,E741
 
 [pep8]
 exclude = pbr-*,.venv,.tox,.git,doc,dist,tools,vcsversion.py,.pyc,ryu/contrib
