Skip to content

Commit

Permalink
pass
Browse files Browse the repository at this point in the history
  • Loading branch information
JordiSubira committed Feb 26, 2024
1 parent 16fa70e commit 233e444
Show file tree
Hide file tree
Showing 34 changed files with 365 additions and 1,085 deletions.
7 changes: 4 additions & 3 deletions acceptance/old_new_br/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,13 @@ def setup_prepare(self):

br_as_2_file = self.artifacts / "gen" / "ASff00_0_2" \
/ ("%s.toml" % br_as_2_id)
scion.update_toml({"router.endhost_start_port": 0}, [br_as_2_file])
scion.update_toml({"router.endhost_end_port": 0}, [br_as_2_file])
scion.update_toml({"router.endhost_start_port": 0,
"router.endhost_end_port": 0},
[br_as_2_file])

def setup_start(self):
super().setup_start()
time.sleep(10) # Give applications time to download configurations
time.sleep(10) # TODO(JordiSubira): Replace with self.await_connectivity() after rebasing

def _run(self):
ping_test = self.get_executable("end2end_integration")
Expand Down
10 changes: 6 additions & 4 deletions control/cmd/control/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ func realMain(ctx context.Context) error {
SCIONNetworkMetrics: metrics.SCIONNetworkMetrics,
SCIONPacketConnMetrics: metrics.SCIONPacketConnMetrics,
MTU: topo.MTU(),
Controller: controller{topo: topo},
CPInfoProvider: cpInfoProvider{topo: topo},
}
quicStack, err := nc.QUICStack()
if err != nil {
Expand Down Expand Up @@ -576,6 +576,8 @@ func realMain(ctx context.Context) error {
FetcherConfig: fetcherCfg,
IntraASTCPServer: tcpServer,
}

// (TODO)JordiSubira: Revisit after rebasing and move out to separate PR if applicable.
// (XXX)JordiSubira: We should revisit how we want to handle HP service,
// right now it only seems to be used within the CS. So perhaps we should treat
// it as a part of the CS (same as BS, CertServ, DRKey, etc). For the moment, we
Expand Down Expand Up @@ -951,16 +953,16 @@ func (h *healther) GetCAHealth(ctx context.Context) (api.CAHealthStatus, bool) {
return api.Unavailable, false
}

type controller struct {
type cpInfoProvider struct {
topo *topology.Loader
}

func (c controller) PortRange(_ context.Context) (uint16, uint16, error) {
func (c cpInfoProvider) PortRange(_ context.Context) (uint16, uint16, error) {
start, end := c.topo.PortRange()
return start, end, nil
}

func (c controller) Interfaces(_ context.Context) (map[uint16]*net.UDPAddr, error) {
func (c cpInfoProvider) Interfaces(_ context.Context) (map[uint16]*net.UDPAddr, error) {
ifMap := c.topo.InterfaceInfoMap()
ifsToUDP := make(map[uint16]*net.UDPAddr, len(ifMap))
for i, v := range ifMap {
Expand Down
2 changes: 0 additions & 2 deletions dispatcher/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ go_library(
"//pkg/slayers:go_default_library",
"//pkg/slayers/path/epic:go_default_library",
"//pkg/slayers/path/scion:go_default_library",
"//private/topology:go_default_library",
"@com_github_google_gopacket//:go_default_library",
"@org_golang_x_net//ipv4:go_default_library",
"@org_golang_x_net//ipv6:go_default_library",
Expand All @@ -29,7 +28,6 @@ go_test(
"//pkg/private/xtest:go_default_library",
"//pkg/snet:go_default_library",
"//pkg/snet/path:go_default_library",
"//private/topology:go_default_library",
"@com_github_stretchr_testify//assert:go_default_library",
"@com_github_stretchr_testify//require:go_default_library",
],
Expand Down
12 changes: 1 addition & 11 deletions dispatcher/cmd/dispatcher/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//tools/lint:go.bzl", "go_library", "go_test")
load("//tools/lint:go.bzl", "go_library")
load("//:scion.bzl", "scion_go_binary")

go_library(
Expand All @@ -18,7 +18,6 @@ go_library(
"//private/app:go_default_library",
"//private/app/launcher:go_default_library",
"//private/service:go_default_library",
"//private/topology:go_default_library",
"@com_github_go_chi_chi_v5//:go_default_library",
"@com_github_go_chi_cors//:go_default_library",
"@org_golang_x_sync//errgroup:go_default_library",
Expand All @@ -34,7 +33,6 @@ go_library(
"//private/app:go_default_library",
"//private/app/launcher:go_default_library",
"//private/service:go_default_library",
"//private/topology:go_default_library",
"@com_github_go_chi_chi_v5//:go_default_library",
"@com_github_go_chi_cors//:go_default_library",
"@org_golang_x_sync//errgroup:go_default_library",
Expand All @@ -50,7 +48,6 @@ go_library(
"//private/app:go_default_library",
"//private/app/launcher:go_default_library",
"//private/service:go_default_library",
"//private/topology:go_default_library",
"@com_github_go_chi_chi_v5//:go_default_library",
"@com_github_go_chi_cors//:go_default_library",
"@org_golang_x_sync//errgroup:go_default_library",
Expand All @@ -66,7 +63,6 @@ go_library(
"//private/app:go_default_library",
"//private/app/launcher:go_default_library",
"//private/service:go_default_library",
"//private/topology:go_default_library",
"@com_github_go_chi_chi_v5//:go_default_library",
"@com_github_go_chi_cors//:go_default_library",
"@org_golang_x_sync//errgroup:go_default_library",
Expand All @@ -80,9 +76,3 @@ scion_go_binary(
embed = [":go_default_library"],
visibility = ["//visibility:public"],
)

go_test(
name = "go_default_test",
srcs = ["main_test.go"],
embed = [":go_default_library"],
)
21 changes: 4 additions & 17 deletions dispatcher/cmd/dispatcher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"net"
"net/http"
_ "net/http/pprof"
"net/netip"

"github.com/go-chi/chi/v5"
"github.com/go-chi/cors"
Expand All @@ -40,7 +41,6 @@ import (
"github.com/scionproto/scion/private/app"
"github.com/scionproto/scion/private/app/launcher"
"github.com/scionproto/scion/private/service"
"github.com/scionproto/scion/private/topology"
)

var globalCfg config.Config
Expand All @@ -57,26 +57,13 @@ func main() {

func realMain(ctx context.Context) error {
path.StrictDecoding(false)
// TODO(JordiSubira): Take this from scion daemon directly as discussed in
// https://github.com/scionproto/scion/pull/4451
topos, err := globalCfg.Topologies(ctx)
if err != nil {
return err
}

var cleanup app.Cleanup
g, errCtx := errgroup.WithContext(ctx)
for _, topo := range topos {
t := topo
g.Go(func() error {
defer log.HandlePanic()
return t.Run(errCtx)
})
}
g.Go(func() error {
defer log.HandlePanic()
return RunDispatcher(
topos,
globalCfg.Dispatcher.ParsedServiceAddresses,
globalCfg.Dispatcher.UnderlayPort,
)
})
Expand Down Expand Up @@ -142,13 +129,13 @@ func realMain(ctx context.Context) error {
}
}

func RunDispatcher(topo map[addr.AS]*topology.Loader, underlayPort int) error {
func RunDispatcher(svcAddrs map[addr.Addr]netip.AddrPort, underlayPort int) error {
localAddr, err := net.ResolveUDPAddr("udp", fmt.Sprintf(":%d", underlayPort))
if err != nil {
return err
}
log.Debug("Dispatcher starting", "localAddr", localAddr)
return dispatcher.ListenAndServe(topo, localAddr)
return dispatcher.ListenAndServe(svcAddrs, localAddr)
}

func requiredIPs() ([]net.IP, error) {
Expand Down
Loading

0 comments on commit 233e444

Please sign in to comment.