Repository navigation
FRR: Implementation of BGP interface for FRR - #958
Conversation
5ae0b4c to
7385507
Compare
7385507 to
8ffccbf
Compare
614ff92 to
6d6d161
Compare
|
LGTM. This PR provides a good foundation. PR #935 will add the FRR reloader part and PR #969 will integrate the two by signaling the FRR reloader that an updated configuration has been generated and should be applied. Thank you very much for considering my review comments and cherry-picking suggested commits into this PR! |
Thanks for the review so far @johananl ! |
9315b42 to
a1945ea
Compare
|
You may want to add this too: fedepaol@2ba9195 |
Why is it so necessary to have an established BGP peering when there is no address family activated? |
It's not so necessary but would maintain parity with the current behaviour. Good point about v6 only, will change hte original commit to reflect that. |
Let's leave this as a follow-up commit. |
In preparation for introduction of FRR, reorganise the bgp directory structure. The "bgp" package will now consist of a sub-package containing the "native" BGP implementation. Code that is common to all implementations is pulled out into the "bgp" package. Signed-off-by: Mark Gray <mark.d.gray@redhat.com>
In order to configure the speaker application to use different BGP implementation types, add an option to allow the user to specify the implementation type on speaker startup. This option is set using an environment variable. It is set to "native" by default. As there are currently no other BGP implementations, setting this to another value will cause the speaker to not start. Signed-off-by: Mark Gray <mark.d.gray@redhat.com>
This adds a Commit() method to the Session interface. The purpose of this method is to allow clients to defer Set() operations until Commit() is called. As the native implementation of BGP does not support Commit(), its implementation is NOOP. Signed-off-by: Mark Gray <mark.d.gray@redhat.com>
As the ConfigMap defines MyASN as the local ASN and ASN as the remote ASN, use the same convention for BGP sessions. Signed-off-by: Mark Gray <mark.d.gray@redhat.com>
a1945ea to
b395ab5
Compare
This commit implements the MetalLB BGP interface by generating an FRR configuration file. It does this by maintaining an in-memory representation of the MetalLB BGP configuration that can be used to template the FRR configuration file. At each call of the MetalLB BGP interface, the in-memory state is regenerated and the config file is (re)created. Signed-off-by: Mark Gray <mark.d.gray@redhat.com> Signed-off-by: Carlos Goncalves <cgoncalves@redhat.com>
e1686b5 to
8c764c2
Compare
|
|
||
| // As the MetalLB controller should handle messages synchronously, there should | ||
| // no need to lock this data structure. TODO: confirm this. | ||
| type FRRSessionManager struct { |
There was a problem hiding this comment.
This can be just SessionManager I think
| } | ||
|
|
||
| // The 'Native' implementation does not require a session manager . | ||
| type NativeSessionManager struct { |
There was a problem hiding this comment.
I'd put this on top as it's the external interface
There was a problem hiding this comment.
Also, this can just be SessionManager I think
|
Looks great! Left a few comments, not really blocking. |
|
Great, I'll update |
8c764c2 to
821b295
Compare
In order to remove some package-scoped variables from the BGP FRR
implementation, this commit adds a SessionManager. The SessionManager
can be used to manage multiple BGP Sessions. The SessionManager is
created on creation of the BGP controller and is specific to the
BGP implementation. Currently, only the FRR BGP implementation
uses the SessionManager. In order for the BGP controller to create
BGP sessions, it must do so through the SessionManager.
The interface looks something like this:
sessionManager := newBgp("frr")
session := sessionManager.NewSession(...)
session.Set()
session.Close()
Signed-off-by: Mark Gray <mark.d.gray@redhat.com>
821b295 to
296ef0c
Compare
|
LGTM |
|
Thanks |
* bgp: Reorganise bgp directory structure
In preparation for introduction of FRR, reorganise the bgp directory
structure.
The "bgp" package will now consist of a sub-package containing
the "native" BGP implementation. Code that is common to all
implementations is pulled out into the "bgp" package.
Signed-off-by: Mark Gray <mark.d.gray@redhat.com>
* bgp: Add option to configure BGP speaker implementation type
In order to configure the speaker application to use different
BGP implementation types, add an option to allow the user to specify
the implementation type on speaker startup.
This option is set using an environment variable. It is set to "native"
by default. As there are currently no other BGP implementations, setting
this to another value will cause the speaker to not start.
Signed-off-by: Mark Gray <mark.d.gray@redhat.com>
* bgp: Extend Session interface with Commit() method
This adds a Commit() method to the Session interface. The purpose
of this method is to allow clients to defer Set() operations
until Commit() is called. As the native implementation of BGP does
not support Commit(), its implementation is NOOP.
Signed-off-by: Mark Gray <mark.d.gray@redhat.com>
* bgp: Change name convention for sessions
As the ConfigMap defines MyASN as the local ASN and ASN
as the remote ASN, use the same convention for BGP sessions.
Signed-off-by: Mark Gray <mark.d.gray@redhat.com>
* frr: Add initial FRR configuration templating engine
This commit implements the MetalLB BGP interface by generating
an FRR configuration file. It does this by maintaining an
in-memory representation of the MetalLB BGP configuration that
can be used to template the FRR configuration file. At each call
of the MetalLB BGP interface, the in-memory state is
regenerated and the config file is (re)created.
Signed-off-by: Mark Gray <mark.d.gray@redhat.com>
Signed-off-by: Carlos Goncalves <cgoncalves@redhat.com>
* bpg: Introduce SessionManager
In order to remove some package-scoped variables from the BGP FRR
implementation, this commit adds a SessionManager. The SessionManager
can be used to manage multiple BGP Sessions. The SessionManager is
created on creation of the BGP controller and is specific to the
BGP implementation. Currently, only the FRR BGP implementation
uses the SessionManager. In order for the BGP controller to create
BGP sessions, it must do so through the SessionManager.
The interface looks something like this:
sessionManager := newBgp("frr")
session := sessionManager.NewSession(...)
session.Set()
session.Close()
Signed-off-by: Mark Gray <mark.d.gray@redhat.com>
* bgp: Reorganise bgp directory structure
In preparation for introduction of FRR, reorganise the bgp directory
structure.
The "bgp" package will now consist of a sub-package containing
the "native" BGP implementation. Code that is common to all
implementations is pulled out into the "bgp" package.
Signed-off-by: Mark Gray <mark.d.gray@redhat.com>
* bgp: Add option to configure BGP speaker implementation type
In order to configure the speaker application to use different
BGP implementation types, add an option to allow the user to specify
the implementation type on speaker startup.
This option is set using an environment variable. It is set to "native"
by default. As there are currently no other BGP implementations, setting
this to another value will cause the speaker to not start.
Signed-off-by: Mark Gray <mark.d.gray@redhat.com>
* bgp: Extend Session interface with Commit() method
This adds a Commit() method to the Session interface. The purpose
of this method is to allow clients to defer Set() operations
until Commit() is called. As the native implementation of BGP does
not support Commit(), its implementation is NOOP.
Signed-off-by: Mark Gray <mark.d.gray@redhat.com>
* bgp: Change name convention for sessions
As the ConfigMap defines MyASN as the local ASN and ASN
as the remote ASN, use the same convention for BGP sessions.
Signed-off-by: Mark Gray <mark.d.gray@redhat.com>
* frr: Add initial FRR configuration templating engine
This commit implements the MetalLB BGP interface by generating
an FRR configuration file. It does this by maintaining an
in-memory representation of the MetalLB BGP configuration that
can be used to template the FRR configuration file. At each call
of the MetalLB BGP interface, the in-memory state is
regenerated and the config file is (re)created.
Signed-off-by: Mark Gray <mark.d.gray@redhat.com>
Signed-off-by: Carlos Goncalves <cgoncalves@redhat.com>
* bpg: Introduce SessionManager
In order to remove some package-scoped variables from the BGP FRR
implementation, this commit adds a SessionManager. The SessionManager
can be used to manage multiple BGP Sessions. The SessionManager is
created on creation of the BGP controller and is specific to the
BGP implementation. Currently, only the FRR BGP implementation
uses the SessionManager. In order for the BGP controller to create
BGP sessions, it must do so through the SessionManager.
The interface looks something like this:
sessionManager := newBgp("frr")
session := sessionManager.NewSession(...)
session.Set()
session.Close()
Signed-off-by: Mark Gray <mark.d.gray@redhat.com>
This pull request is an initial attempt at implementing the MetalLB BGP interface for FRR.
It is not complete as: