Adding support for Discovery calls

Support for the DiscoveryNew and DiscoverDelete methods as
defined in the libnetwork released with Docker 1.9.0 is added.
Neutron does not require using such informaton. Nor is it capable
of using such information with its current API.

Change-Id: Icca7858e2f0f5c686a841f4611b9e2cfc9a47368
This commit is contained in:
Mohammad Banikazemi 2015-11-16 15:45:56 -05:00
parent 58057cd711
commit 32f1b3fe51
3 changed files with 45 additions and 0 deletions

View File

@ -297,6 +297,19 @@ visible and editable resource entity attachable to containers from users'
perspective. Sandbox manages information exposed by Endpoint behind the scene perspective. Sandbox manages information exposed by Endpoint behind the scene
automatically. automatically.
Notes on implementing the libnetwork remote driver API in Kuryr
---------------------------------------------------------------
1. DiscoverNew Notification:
Neutron does not use the informaton related to discovery of new resources such
as new nodes and therefore the implementation of this API method does nothing.
2. DiscoverDelete Notification:
Neutron does not use the informaton related to discovery of resources such as
nodes being deleted and therefore the implementation of this API method does
nothing.
.. _libnetwork remote network driver: https://github.com/docker/libnetwork/blob/master/docs/remote.md .. _libnetwork remote network driver: https://github.com/docker/libnetwork/blob/master/docs/remote.md
.. _libnetwork IPAM driver: https://github.com/docker/libnetwork/blob/master/docs/ipam.md .. _libnetwork IPAM driver: https://github.com/docker/libnetwork/blob/master/docs/ipam.md
.. _Neutron: https://wiki.openstack.org/wiki/Neutron .. _Neutron: https://wiki.openstack.org/wiki/Neutron

View File

@ -306,6 +306,36 @@ def plugin_scope():
return flask.jsonify(capabilities) return flask.jsonify(capabilities)
@app.route('/NetworkDriver.DiscoverNew', methods=['POST'])
def network_driver_discover_new():
"""The callback function for the DiscoverNew notification.
The DiscoverNew notification includes the type of the
resource that has been newly discovered and possibly other
information associated with the resource.
See the following link for more details about the spec:
https://github.com/docker/libnetwork/blob/master/docs/remote.md#discovernew-notification # noqa
"""
return flask.jsonify(constants.SCHEMA['SUCCESS'])
@app.route('/NetworkDriver.DiscoverDelete', methods=['POST'])
def network_driver_discover_delete():
"""The callback function for the DiscoverDelete notification.
The DiscoverDelete notification includes the type of the
resource that has been deleted and possibly other
information associated with the resource.
See the following link for more details about the spec:
https://github.com/docker/libnetwork/blob/master/docs/remote.md#discoverdelete-notification # noqa
"""
return flask.jsonify(constants.SCHEMA['SUCCESS'])
@app.route('/NetworkDriver.CreateNetwork', methods=['POST']) @app.route('/NetworkDriver.CreateNetwork', methods=['POST'])
def network_driver_create_network(): def network_driver_create_network():
"""Creates a new Neutron Network which name is the given NetworkID. """Creates a new Neutron Network which name is the given NetworkID.

View File

@ -43,6 +43,8 @@ class TestKuryr(base.TestKuryrBase):
- POST /NetworkDriver.Leave - POST /NetworkDriver.Leave
""" """
@ddt.data(('/Plugin.Activate', constants.SCHEMA['PLUGIN_ACTIVATE']), @ddt.data(('/Plugin.Activate', constants.SCHEMA['PLUGIN_ACTIVATE']),
('/NetworkDriver.DiscoverNew', constants.SCHEMA['SUCCESS']),
('/NetworkDriver.DiscoverDelete', constants.SCHEMA['SUCCESS']),
('/NetworkDriver.EndpointOperInfo', ('/NetworkDriver.EndpointOperInfo',
constants.SCHEMA['ENDPOINT_OPER_INFO'])) constants.SCHEMA['ENDPOINT_OPER_INFO']))
@ddt.unpack @ddt.unpack