Browse Source

Merge "Registering RouterInfo by L3 extention API"

Zuul 2 months ago
parent
commit
597f767e5c
1 changed files with 124 additions and 0 deletions
  1. 124
    0
      specs/stein/router-factory-with-l3-extension.rst

+ 124
- 0
specs/stein/router-factory-with-l3-extension.rst View File

@@ -0,0 +1,124 @@
1
+..
2
+ This work is licensed under a Creative Commons Attribution 3.0 Unported
3
+ License.
4
+
5
+ http://creativecommons.org/licenses/by/3.0/legalcode
6
+
7
+==========================================
8
+Registering RouterInfo by L3 extension API
9
+==========================================
10
+
11
+Launchpad blueprint:
12
+https://blueprints.launchpad.net/neutron/+spec/router-factory-with-l3-extension
13
+
14
+Currently, most plugin implementations related to L3 override the *L3NATAgent*
15
+class itself for their own logic since there is no proper interface to
16
+extend the *RouterInfo* class. This adds unnecessary complexity for developers
17
+who just want to extend the agent mechanism instead of the whole RPC related
18
+to L3 functionalities.
19
+
20
+This spec introduces the *RouterFactory* class which acts on the factory for
21
+creating the *RouterInfo* class, and adds a new parameter to the L3 agent
22
+extension API which enables it to dynamically register *RouterInfo* to the
23
+factory. Now plugin developers can use the new extension API for their own
24
+specific router.
25
+
26
+
27
+Problem Description
28
+===================
29
+
30
+Current L3 agent implementation in Neutron consists of two parts in general.
31
+One is to implement an RPC Plugin API from Neutron server, and the other is to
32
+create ports, namespaces, and iptables rules using the data obtained from the
33
+RPC API on the server. To be more specific, the former is the *L3NATAgent*
34
+class and the latter is the *RouterInfo* class.
35
+
36
+The problem is that the two parts mentioned are now tightly coupled which means
37
+there is no clear way to extend each part individually. A lot of projects
38
+related to Neutron called networking-* [1]_, [2]_, [3]_ are making new L3
39
+agent classes on their own by extending the *L3NATAgent* class even though
40
+they did not modify the RPC mechanism but only changed the *RouterInfo*
41
+mechanism running on their server.
42
+
43
+Also, the current *RouterInfo* class does not have an abstract interface which
44
+makes it harder to extend the class for plugin developers. They have to find
45
+what functions and variables in *RouterInfo* are externally used in the L3
46
+agent to extend the *RouterInfo* behaviors.
47
+
48
+
49
+Proposed Change
50
+===============
51
+
52
+Today, *RouterInfo* is extended in several ways according to specific router
53
+features such as distributed, ha, and distributed + ha. This document proposes
54
+changing the L3 agent to have a new class called ``RouterFactory`` which has
55
+several pre-registered classes to extend the *RouterInfo* class with certain
56
+features. When it comes to creating an actual *RouterInfo* instance, the L3
57
+agent create a new instance from the ``RouterFactory`` following the features
58
+of the router. There is no functional change for existing code.
59
+
60
+*L3AgentExtensionAPI* now has a new parameter ``router_factory`` and a new
61
+function ``register_router``. A new abstract class called ``BaseRouterInfo``
62
+will be added. It will declare interfaces that are currently used externally.
63
+
64
+An L3 extension can register their own *RouterInfo* class which implements
65
+``BaseRouterInfo`` using the ``register_router`` API which has two parameters.
66
+
67
+(1) ``router``: RouterInfo declared in extension which overrides the one
68
+    pre-registered at ``RouterFactory``
69
+
70
+(2) ``features``: features of RouterInfo. Currently it should be one of the
71
+    below.
72
+
73
+    Features should be a list of strings describing router characteristics, and
74
+    the ordering does not matter since it is interpreted as a *set* internally.
75
+    (``['ha', 'distributed']`` and ``['distributed', 'ha']`` are the same)
76
+
77
+    - ``[]``: No feature. (e.g. ``LegacyRouter``)
78
+    - ``['distributed']``: Distributed router. (e.g. ``DvrEdgeRouter``,
79
+                           ``DvrLocalRouter``)
80
+    - ``['ha']``: HA router. (e.g. ``HaRouter``)
81
+    - ``['ha', 'distributed']``: Distributed HA router. (e.g.
82
+                                 ``DvrEdgeHaRouter``, ``DvrLocalRouter``)
83
+
84
+    Note that a router with the feature of ``['ha', 'distributed']`` can be
85
+    ``DvrLocalRouter`` when L3 agent mode is not ``dvr_snat`` [4]_.
86
+
87
+L3 extensions can override the *RouterInfo* class implemented in the Neutron
88
+codebase when it is initialized using the *initialize* function.
89
+
90
+
91
+Implementation
92
+==============
93
+
94
+Assignee(s)
95
+-----------
96
+
97
+* Yang Youseok <ileixe@gmail.com>
98
+
99
+Work Items
100
+----------
101
+
102
+* Add *RouterInfo* registration in *L3AgentExensionAPI* and pre-register
103
+  existing *RouterInfo* to *L3NATAgent*. [5]_
104
+* Add new exception named *RouterNotFoundInRouterFactory* to *neutron_lib*.
105
+  [6]_
106
+
107
+
108
+References
109
+==========
110
+
111
+.. [1] `networking-odl`:
112
+        https://github.com/openstack/networking-odl/blob/master/networking_odl/l3/l3_odl_v2.py#L47
113
+
114
+.. [2] `networking-ovn`:
115
+        https://github.com/openstack/networking-ovn/blob/master/networking_ovn/l3/l3_ovn.py#L50
116
+
117
+.. [3] `networking-calico`:
118
+        https://github.com/openstack/networking-calico/blob/master/networking_calico/plugins/calico/plugin.py#L26
119
+
120
+.. [4] https://docs.openstack.org/neutron/latest/configuration/l3-agent.html#DEFAULT.agent_mode
121
+
122
+.. [5] https://review.openstack.org/#/c/620349/
123
+
124
+.. [6] https://review.openstack.org/#/c/620348/

Loading…
Cancel
Save