Skip to content

Commit

Permalink
Fixing and unifying hummingbird integration-tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
juagargi committed Dec 3, 2024
1 parent 3e2dd6c commit 5911b4a
Show file tree
Hide file tree
Showing 11 changed files with 310 additions and 1,154 deletions.
2 changes: 0 additions & 2 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,6 @@ pkg_tar(
"//tools/braccept",
"//tools/buildkite/cmd/buildkite_artifacts",
"//tools/end2end",
"//tools/end2end_hbird",
"//tools/end2end_hbird_integration",
"//tools/end2end_integration",
"//tools/pktgen/cmd/pktgen",
"//tools/scion_integration",
Expand Down
1 change: 1 addition & 0 deletions tools/end2end/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ load("//:scion.bzl", "scion_go_binary")
go_library(
name = "go_default_library",
srcs = [
"extras.go",
"fabrid.go",
"main.go",
],
Expand Down
22 changes: 22 additions & 0 deletions tools/end2end/extras.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright 2024 ETH Zurich
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package main

func bToi(b bool) int {
if b {
return 1
}
return 0
}
51 changes: 47 additions & 4 deletions tools/end2end/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ var (
scmpErrorsCounter = scionPacketConnMetrics.SCMPErrors
epic bool
fabrid bool
hummingbird bool
)

func main() {
Expand Down Expand Up @@ -112,6 +113,7 @@ func addFlags() {
flag.Var(timeout, "timeout", "The timeout for each attempt")
flag.BoolVar(&epic, "epic", false, "Enable EPIC")
flag.BoolVar(&fabrid, "fabrid", false, "Enable FABRID")
flag.BoolVar(&hummingbird, "hummingbird", false, "Enable Hummingbird")
}

func validateFlags() {
Expand All @@ -126,10 +128,10 @@ func validateFlags() {
integration.LogFatal("Invalid timeout provided", "timeout", timeout)
}
}
if epic && fabrid {
integration.LogFatal("FABRID is incompatible with EPIC")
}
log.Info("Flags", "timeout", timeout, "epic", epic, "fabrid", fabrid, "remote", remote)
if bToi(epic)+bToi(fabrid)+bToi(hummingbird) > 1 {
integration.LogFatal("Only one of EPIC, FABRID, HUMMINGBIRD flags is allowed")
}
}

type server struct{}
Expand Down Expand Up @@ -425,14 +427,55 @@ func (c *client) getRemote(ctx context.Context, n int) (snet.Path, error) {
fabridPath, err := snetpath.NewFABRIDDataplanePath(scionPath, hops,
policies, fabridConfig)
if err != nil {
return nil, serrors.New("Error creating FABRID path", "err", err)
return nil, serrors.WrapStr("Error creating FABRID path", err)
}
remote.Path = fabridPath
fabridPath.RegisterDRKeyFetcher(c.sdConn.FabridKeys)
} else {
log.Info("FABRID flag was set for client in non-FABRID AS. Proceeding without FABRID.")
remote.Path = path.Dataplane()
}
} else if hummingbird {
// This works:
// Directly query the scion daemon.
reservations, err := c.sdConn.GetReservations(ctx, integration.Local.IA, remote.IA, 1, true)
if err != nil {
return nil, serrors.WrapStr("getting reservations from daemon", err)
}
reservation := reservations[0]

// // This works:
// // Build with no flyovers.
// reservation, err := hummingbird.NewReservation(
// hummingbird.WithScionPath(path, nil))
// if err != nil {
// logger.Error("Error converting path to Hummingbird", "err", err)
// return false
// }

// // This works:
// // Get flyovers and build path.
// flyovers, err := c.sdConn.ListFlyovers(ctx)
// if err != nil {
// logger.Error("listing flyovers", "err", err)
// return false
// }
// reservation, err := hummingbird.NewReservation(
// hummingbird.WithScionPath(path, hummingbird.FlyoversToMap(flyovers)))
// if err != nil {
// logger.Error("Error converting path to Hummingbird", "err", err)
// return false
// }

decoded := reservation.DeriveDataPlanePath(113, time.Now())
raw := snetpath.Hummingbird{
Raw: make([]byte, decoded.Len()),
}
err = decoded.SerializeTo(raw.Raw)
if err != nil {
return nil, serrors.WrapStr("Error assembling hummingbird path", err)
}
remote.Path = raw
} else {
remote.Path = path.Dataplane()
}
Expand Down
31 changes: 0 additions & 31 deletions tools/end2end_hbird/BUILD.bazel

This file was deleted.

Loading

0 comments on commit 5911b4a

Please sign in to comment.