f-41: l3vni: suppression d'une VPC routée sans section bgp #41
All checks were successful
Documentation / publish (push) Successful in 1m28s
Release Pipeline / set-release-target (push) Successful in 2s
Release Pipeline / upload-assets (agent.service, systemd/agent.service) (push) Successful in 7s
Release Pipeline / upload-assets (dhcp@.service, systemd/dhcp@.service) (push) Successful in 7s
Release Pipeline / upload-assets (dnsmasq@.service, systemd/dnsmasq@.service) (push) Successful in 7s
Release Pipeline / upload-assets (metadata@.service, systemd/metadata@.service) (push) Successful in 7s
Release Pipeline / upload-assets (run-dhcp-in-netns.sh, scripts/run-dhcp-in-netns.sh) (push) Successful in 7s
Release Pipeline / upload-assets (run-dnsmasq-in-netns.sh, scripts/run-dnsmasq-in-netns.sh) (push) Successful in 7s
Release Pipeline / build (agent, amd64, linux) (push) Successful in 0s
Release Pipeline / build (dhcp, amd64, linux) (push) Successful in 0s
Release Pipeline / build (metadata, amd64, linux) (push) Successful in 0s
Release Pipeline / checksums (push) Successful in 8s
Release Pipeline / build (push) Successful in 2m21s
Release Pipeline / release (push) Successful in 31s
Release Pipeline / publish (push) Successful in 0s
All checks were successful
Documentation / publish (push) Successful in 1m28s
Release Pipeline / set-release-target (push) Successful in 2s
Release Pipeline / upload-assets (agent.service, systemd/agent.service) (push) Successful in 7s
Release Pipeline / upload-assets (dhcp@.service, systemd/dhcp@.service) (push) Successful in 7s
Release Pipeline / upload-assets (dnsmasq@.service, systemd/dnsmasq@.service) (push) Successful in 7s
Release Pipeline / upload-assets (metadata@.service, systemd/metadata@.service) (push) Successful in 7s
Release Pipeline / upload-assets (run-dhcp-in-netns.sh, scripts/run-dhcp-in-netns.sh) (push) Successful in 7s
Release Pipeline / upload-assets (run-dnsmasq-in-netns.sh, scripts/run-dnsmasq-in-netns.sh) (push) Successful in 7s
Release Pipeline / build (agent, amd64, linux) (push) Successful in 0s
Release Pipeline / build (dhcp, amd64, linux) (push) Successful in 0s
Release Pipeline / build (metadata, amd64, linux) (push) Successful in 0s
Release Pipeline / checksums (push) Successful in 8s
Release Pipeline / build (push) Successful in 2m21s
Release Pipeline / release (push) Successful in 31s
Release Pipeline / publish (push) Successful in 0s
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
b530428de2
commit
eb89a2220c
9 changed files with 56 additions and 28 deletions
|
|
@ -115,12 +115,8 @@ func createL3(h host, cfg *configuration.Config, v l3VPC) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func deleteL3(h host, cfg *configuration.Config, v l3VPC) error {
|
||||
asn, err := bgpASN(cfg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
frrVRF := frr.VRF{ASN: asn, ID: v.id}
|
||||
func deleteL3(h host, v l3VPC) error {
|
||||
frrVRF := frr.VRF{ID: v.id}
|
||||
if err := h.WithdrawVRF(frrVRF); err != nil {
|
||||
return fmt.Errorf("l3vni %d: withdraw frr: %w", v.vni, err)
|
||||
}
|
||||
|
|
@ -143,12 +139,12 @@ func Create(db *badger.DB, vpcName string, cfg *configuration.Config) error {
|
|||
return createL3(newSystem(), cfg, v)
|
||||
}
|
||||
|
||||
func Delete(db *badger.DB, vpcName string, cfg *configuration.Config) error {
|
||||
func Delete(db *badger.DB, vpcName string) error {
|
||||
v, ok, err := loadRouted(db, vpcName)
|
||||
if err != nil || !ok {
|
||||
return err
|
||||
}
|
||||
return deleteL3(newSystem(), cfg, v)
|
||||
return deleteL3(newSystem(), v)
|
||||
}
|
||||
|
||||
type Routing struct {
|
||||
|
|
|
|||
|
|
@ -173,16 +173,16 @@ func TestCreateL3StopsAtTheFirstFailure(t *testing.T) {
|
|||
|
||||
func TestDeleteL3WithdrawsFRRThenTheKernelThenTheVRF(t *testing.T) {
|
||||
f := &fakeHost{}
|
||||
if err := deleteL3(f, bgpConfig(), labL3(t)); err != nil {
|
||||
if err := deleteL3(f, labL3(t)); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
want := []string{
|
||||
"frr withdraw asn=64600 id=s7 vni=0",
|
||||
"frr withdraw asn=0 id=s7 vni=0",
|
||||
"del l3-s7-o",
|
||||
"del vxl3-s7",
|
||||
"del brl3-s7",
|
||||
"del vrf-s7",
|
||||
"frr remove asn=64600 id=s7 vni=0",
|
||||
"frr remove asn=0 id=s7 vni=0",
|
||||
}
|
||||
if !reflect.DeepEqual(f.calls, want) {
|
||||
t.Errorf("appels :\n%s\nattendu :\n%s", strings.Join(f.calls, "\n"), strings.Join(want, "\n"))
|
||||
|
|
@ -191,7 +191,7 @@ func TestDeleteL3WithdrawsFRRThenTheKernelThenTheVRF(t *testing.T) {
|
|||
|
||||
func TestDeleteL3KeepsTheKernelWhenFRRRefusesTheWithdrawal(t *testing.T) {
|
||||
f := &fakeHost{fail: map[string]error{"frr withdraw": errors.New("% Please unconfigure l3vni 2700")}}
|
||||
err := deleteL3(f, bgpConfig(), labL3(t))
|
||||
err := deleteL3(f, labL3(t))
|
||||
if err == nil || !strings.Contains(err.Error(), "withdraw frr") {
|
||||
t.Errorf("erreur %v", err)
|
||||
}
|
||||
|
|
@ -202,7 +202,7 @@ func TestDeleteL3KeepsTheKernelWhenFRRRefusesTheWithdrawal(t *testing.T) {
|
|||
|
||||
func TestDeleteL3KeepsTheFRRVRFWhenAKernelLinkCannotBeDeleted(t *testing.T) {
|
||||
f := &fakeHost{fail: map[string]error{"del brl3-s7": errors.New("device busy")}}
|
||||
if err := deleteL3(f, bgpConfig(), labL3(t)); err == nil || !strings.Contains(err.Error(), "delete brl3-s7") {
|
||||
if err := deleteL3(f, labL3(t)); err == nil || !strings.Contains(err.Error(), "delete brl3-s7") {
|
||||
t.Errorf("erreur %v", err)
|
||||
}
|
||||
for _, c := range f.calls {
|
||||
|
|
@ -212,9 +212,9 @@ func TestDeleteL3KeepsTheFRRVRFWhenAKernelLinkCannotBeDeleted(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestDeleteL3RequiresTheBGPSection(t *testing.T) {
|
||||
func TestDeleteL3DoesNotDependOnTheAgentBGPSection(t *testing.T) {
|
||||
f := &fakeHost{}
|
||||
if err := deleteL3(f, &configuration.Config{}, labL3(t)); err == nil || len(f.calls) != 0 {
|
||||
if err := deleteL3(f, labL3(t)); err != nil || len(f.calls) != 6 {
|
||||
t.Errorf("erreur %v, appels %q", err, f.calls)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue