diff --git a/acceptance/router_benchmark/cases/BUILD.bazel b/acceptance/router_benchmark/cases/BUILD.bazel index 0fdf993ff6..08e299a31c 100644 --- a/acceptance/router_benchmark/cases/BUILD.bazel +++ b/acceptance/router_benchmark/cases/BUILD.bazel @@ -19,7 +19,6 @@ go_library( "//pkg/addr:go_default_library", "//pkg/log:go_default_library", "//pkg/private/util:go_default_library", - "//pkg/private/xtest:go_default_library", "//pkg/scrypto:go_default_library", "//pkg/slayers:go_default_library", "//pkg/slayers/path:go_default_library", diff --git a/acceptance/router_benchmark/cases/topo.go b/acceptance/router_benchmark/cases/topo.go index 70f35b877a..ef32c98209 100644 --- a/acceptance/router_benchmark/cases/topo.go +++ b/acceptance/router_benchmark/cases/topo.go @@ -29,7 +29,6 @@ import ( "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/log" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/scrypto" ) @@ -103,9 +102,9 @@ func InternalIPPort(AS byte, routerIndex byte) (netip.Addr, layers.UDPPort) { // All are in ISD-1, except AS 4. func ISDAS(AS byte) addr.IA { if AS == 4 { - return xtest.MustParseIA(fmt.Sprintf("2-ff00:0:%d", AS)) + return addr.MustParseIA(fmt.Sprintf("2-ff00:0:%d", AS)) } - return xtest.MustParseIA(fmt.Sprintf("1-ff00:0:%d", AS)) + return addr.MustParseIA(fmt.Sprintf("1-ff00:0:%d", AS)) } func FakeMAC(AS byte) hash.Hash { diff --git a/control/BUILD.bazel b/control/BUILD.bazel index 57b4489eb5..8b4da3dd47 100644 --- a/control/BUILD.bazel +++ b/control/BUILD.bazel @@ -65,7 +65,7 @@ go_test( data = glob(["testdata/**"]), deps = [ ":go_default_library", - "//pkg/private/xtest:go_default_library", + "//pkg/addr:go_default_library", "//private/app/command:go_default_library", "//private/storage/trust/sqlite:go_default_library", "//scion-pki/testcrypto:go_default_library", diff --git a/control/beacon/BUILD.bazel b/control/beacon/BUILD.bazel index 543cb27bf2..4f192f0492 100644 --- a/control/beacon/BUILD.bazel +++ b/control/beacon/BUILD.bazel @@ -36,7 +36,6 @@ go_test( ":go_default_library", "//control/beacon/mock_beacon:go_default_library", "//pkg/addr:go_default_library", - "//pkg/private/xtest:go_default_library", "//pkg/private/xtest/graph:go_default_library", "//pkg/segment:go_default_library", "@com_github_golang_mock//gomock:go_default_library", diff --git a/control/beacon/policy_test.go b/control/beacon/policy_test.go index c2c3a62de8..7647d24e32 100644 --- a/control/beacon/policy_test.go +++ b/control/beacon/policy_test.go @@ -21,18 +21,17 @@ import ( "github.com/scionproto/scion/control/beacon" "github.com/scionproto/scion/pkg/addr" - "github.com/scionproto/scion/pkg/private/xtest" seg "github.com/scionproto/scion/pkg/segment" ) var ( - ia110 = xtest.MustParseIA("1-ff00:0:110") - ia111 = xtest.MustParseIA("1-ff00:0:111") - ia112 = xtest.MustParseIA("1-ff00:0:112") - ia113 = xtest.MustParseIA("1-ff00:0:113") - ia210 = xtest.MustParseIA("2-ff00:0:210") - ia310 = xtest.MustParseIA("3-ff00:0:310") - ia311 = xtest.MustParseIA("3-ff00:0:311") + ia110 = addr.MustParseIA("1-ff00:0:110") + ia111 = addr.MustParseIA("1-ff00:0:111") + ia112 = addr.MustParseIA("1-ff00:0:112") + ia113 = addr.MustParseIA("1-ff00:0:113") + ia210 = addr.MustParseIA("2-ff00:0:210") + ia310 = addr.MustParseIA("3-ff00:0:310") + ia311 = addr.MustParseIA("3-ff00:0:311") false_val = false true_val = true diff --git a/control/beacon/store_test.go b/control/beacon/store_test.go index 2765d002b2..0d26853116 100644 --- a/control/beacon/store_test.go +++ b/control/beacon/store_test.go @@ -25,7 +25,6 @@ import ( "github.com/scionproto/scion/control/beacon" "github.com/scionproto/scion/control/beacon/mock_beacon" "github.com/scionproto/scion/pkg/addr" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/private/xtest/graph" seg "github.com/scionproto/scion/pkg/segment" ) @@ -165,7 +164,7 @@ func testCoreStoreSelection(t *testing.T, // Ensure remote out if is set in last AS entry. stub := graph.If_210_X_220_X - ia120 := xtest.MustParseIA("1-ff00:0:120") + ia120 := addr.MustParseIA("1-ff00:0:120") beacons120 := []beacon.Beacon{ testBeacon(g, graph.If_120_A_110_X, graph.If_110_X_210_X, stub), testBeacon(g, graph.If_120_B_220_X, graph.If_220_X_210_X, stub), @@ -177,7 +176,7 @@ func testCoreStoreSelection(t *testing.T, testBeacon(g, graph.If_120_A_110_X, graph.If_110_X_210_X, stub), } - ia130 := xtest.MustParseIA("1-ff00:0:130") + ia130 := addr.MustParseIA("1-ff00:0:130") beacons130 := []beacon.Beacon{ testBeacon(g, graph.If_130_A_110_X, graph.If_110_X_210_X, stub), testBeacon(g, graph.If_130_B_120_A, graph.If_120_A_110_X, graph.If_110_X_210_X, stub), diff --git a/control/beaconing/BUILD.bazel b/control/beaconing/BUILD.bazel index 48714517f5..2cae4b8238 100644 --- a/control/beaconing/BUILD.bazel +++ b/control/beaconing/BUILD.bazel @@ -65,7 +65,6 @@ go_test( "//pkg/private/common:go_default_library", "//pkg/private/serrors:go_default_library", "//pkg/private/util:go_default_library", - "//pkg/private/xtest:go_default_library", "//pkg/private/xtest/graph:go_default_library", "//pkg/proto/crypto:go_default_library", "//pkg/scrypto:go_default_library", diff --git a/control/beaconing/handler_test.go b/control/beaconing/handler_test.go index be05584631..487f28f388 100644 --- a/control/beaconing/handler_test.go +++ b/control/beaconing/handler_test.go @@ -26,8 +26,8 @@ import ( "github.com/scionproto/scion/control/beaconing" "github.com/scionproto/scion/control/beaconing/mock_beaconing" "github.com/scionproto/scion/control/ifstate" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/serrors" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/private/xtest/graph" seg "github.com/scionproto/scion/pkg/segment" "github.com/scionproto/scion/pkg/snet" @@ -37,7 +37,7 @@ import ( ) var ( - localIA = xtest.MustParseIA("1-ff00:0:110") + localIA = addr.MustParseIA("1-ff00:0:110") localIF = graph.If_110_X_120_A ) @@ -158,7 +158,7 @@ func TestHandlerHandleBeacon(t *testing.T) { }), InIfId: localIF, } - b.Segment.ASEntries[b.Segment.MaxIdx()].Local = xtest.MustParseIA("1-ff00:0:111") + b.Segment.ASEntries[b.Segment.MaxIdx()].Local = addr.MustParseIA("1-ff00:0:111") return b }, @@ -187,7 +187,7 @@ func TestHandlerHandleBeacon(t *testing.T) { }), InIfId: localIF, } - b.Segment.ASEntries[b.Segment.MaxIdx()].Next = xtest.MustParseIA("1-ff00:0:111") + b.Segment.ASEntries[b.Segment.MaxIdx()].Next = addr.MustParseIA("1-ff00:0:111") return b }, Peer: func() *snet.UDPAddr { diff --git a/control/drkey/grpc/drkey_service_test.go b/control/drkey/grpc/drkey_service_test.go index d9690769b8..9f3f28785c 100644 --- a/control/drkey/grpc/drkey_service_test.go +++ b/control/drkey/grpc/drkey_service_test.go @@ -37,8 +37,8 @@ import ( ) var ( - ia111 = xtest.MustParseIA("1-ff00:0:111") - ia112 = xtest.MustParseIA("1-ff00:0:112") + ia111 = addr.MustParseIA("1-ff00:0:111") + ia112 = addr.MustParseIA("1-ff00:0:112") tcpHost1 = netip.MustParseAddrPort("127.0.0.1:12345") tcpHost2 = netip.MustParseAddrPort("127.0.0.2:12345") ) diff --git a/control/drkey/grpc/fetcher_test.go b/control/drkey/grpc/fetcher_test.go index fc1d919f10..ce35a466c0 100644 --- a/control/drkey/grpc/fetcher_test.go +++ b/control/drkey/grpc/fetcher_test.go @@ -31,6 +31,7 @@ import ( csdrkey "github.com/scionproto/scion/control/drkey" dk_grpc "github.com/scionproto/scion/control/drkey/grpc" "github.com/scionproto/scion/control/drkey/grpc/mock_grpc" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/drkey" "github.com/scionproto/scion/pkg/private/xtest" cppb "github.com/scionproto/scion/pkg/proto/control_plane" @@ -136,7 +137,7 @@ func TestLevel1KeyFetching(t *testing.T) { meta := drkey.Level1Meta{ ProtoId: drkey.Generic, Validity: time.Now(), - SrcIA: xtest.MustParseIA("1-ff00:0:111"), + SrcIA: addr.MustParseIA("1-ff00:0:111"), } _, err = fetcher.Level1(context.Background(), meta) tc.assertErr(t, err) diff --git a/control/drkey/grpc/protobuf_test.go b/control/drkey/grpc/protobuf_test.go index ca8f2e8d9a..e56d632801 100644 --- a/control/drkey/grpc/protobuf_test.go +++ b/control/drkey/grpc/protobuf_test.go @@ -23,6 +23,7 @@ import ( "google.golang.org/protobuf/types/known/timestamppb" "github.com/scionproto/scion/control/drkey/grpc" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/drkey" "github.com/scionproto/scion/pkg/private/util" "github.com/scionproto/scion/pkg/private/xtest" @@ -31,8 +32,8 @@ import ( ) var ( - dstIA = xtest.MustParseIA("1-ff00:0:110") - srcIA = xtest.MustParseIA("1-ff00:0:111") + dstIA = addr.MustParseIA("1-ff00:0:110") + srcIA = addr.MustParseIA("1-ff00:0:111") k = xtest.MustParseHexString("c584cad32613547c64823c756651b6f5") // just a key strAddr = "127.0.0.1" ) diff --git a/control/drkey/prefetcher_test.go b/control/drkey/prefetcher_test.go index c645649041..4db36eb240 100644 --- a/control/drkey/prefetcher_test.go +++ b/control/drkey/prefetcher_test.go @@ -23,8 +23,8 @@ import ( cs_drkey "github.com/scionproto/scion/control/drkey" "github.com/scionproto/scion/control/drkey/mock_drkey" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/drkey" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/private/periodic" ) @@ -39,7 +39,7 @@ func TestPrefetcherRun(t *testing.T) { prefetcher := cs_drkey.Prefetcher{ Engine: mock_engine, - LocalIA: xtest.MustParseIA("1-ff00:0:110"), + LocalIA: addr.MustParseIA("1-ff00:0:110"), KeyDuration: time.Hour, } @@ -47,7 +47,7 @@ func TestPrefetcherRun(t *testing.T) { cachedKeys := []cs_drkey.Level1PrefetchInfo{ { - IA: xtest.MustParseIA("1-ff00:0:112"), + IA: addr.MustParseIA("1-ff00:0:112"), Proto: drkey.SCMP, }, } @@ -55,7 +55,7 @@ func TestPrefetcherRun(t *testing.T) { firstCached).Times(1).Return(cachedKeys) cachedKeys = append(cachedKeys, cs_drkey.Level1PrefetchInfo{ - IA: xtest.MustParseIA("1-ff00:0:111"), + IA: addr.MustParseIA("1-ff00:0:111"), Proto: drkey.SCMP, }) mock_engine.EXPECT().GetLevel1PrefetchInfo().After( diff --git a/control/drkey/service_engine_test.go b/control/drkey/service_engine_test.go index ddf71e4b0b..0a699b055c 100644 --- a/control/drkey/service_engine_test.go +++ b/control/drkey/service_engine_test.go @@ -25,6 +25,7 @@ import ( cs_drkey "github.com/scionproto/scion/control/drkey" "github.com/scionproto/scion/control/drkey/mock_drkey" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/drkey" "github.com/scionproto/scion/pkg/private/serrors" "github.com/scionproto/scion/pkg/private/util" @@ -35,8 +36,8 @@ import ( var ( masterKey = xtest.MustParseHexString("305554050357005ae398259bcdae7468") - srcIA = xtest.MustParseIA("1-ff00:0:112") - dstIA = xtest.MustParseIA("1-ff00:0:111") + srcIA = addr.MustParseIA("1-ff00:0:112") + dstIA = addr.MustParseIA("1-ff00:0:111") srcHost = "10.1.1.12" ) @@ -253,7 +254,7 @@ func TestGetLevel1Key(t *testing.T) { // Requesting local key should not update the cache locallvl1Meta := drkey.Level1Meta{ SrcIA: dstIA, - DstIA: xtest.MustParseIA("1-ff00:0:111"), + DstIA: addr.MustParseIA("1-ff00:0:111"), ProtoId: drkey.Generic, Validity: util.SecsToTime(1).UTC(), } diff --git a/control/mgmtapi/BUILD.bazel b/control/mgmtapi/BUILD.bazel index aacf0f2fdc..0d932801cb 100644 --- a/control/mgmtapi/BUILD.bazel +++ b/control/mgmtapi/BUILD.bazel @@ -63,6 +63,7 @@ go_test( "//control/mgmtapi/mock_mgmtapi:go_default_library", "//control/trust:go_default_library", "//control/trust/mock_trust:go_default_library", + "//pkg/addr:go_default_library", "//pkg/private/serrors:go_default_library", "//pkg/private/xtest:go_default_library", "//pkg/scrypto/cppki:go_default_library", diff --git a/control/mgmtapi/api_test.go b/control/mgmtapi/api_test.go index 0135d2199c..c31cc20d17 100644 --- a/control/mgmtapi/api_test.go +++ b/control/mgmtapi/api_test.go @@ -36,6 +36,7 @@ import ( "github.com/scionproto/scion/control/mgmtapi/mock_mgmtapi" cstrust "github.com/scionproto/scion/control/trust" "github.com/scionproto/scion/control/trust/mock_trust" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/serrors" "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/scrypto/cppki" @@ -293,7 +294,7 @@ func TestAPI(t *testing.T) { s.SetNowProvider(func() time.Time { return now }) g.EXPECT().Generate(gomock.Any()).AnyTimes().Return( []trust.Signer{{ - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), Algorithm: signed.ECDSAWithSHA512, Subject: pkix.Name{ Country: []string{"CH"}, @@ -921,8 +922,8 @@ func createBeacons(t *testing.T) []beacon.Beacon { }, ASEntries: []seg.ASEntry{ { - Local: xtest.MustParseIA("1-ff00:0:110"), - Next: xtest.MustParseIA("1-ff00:0:111"), + Local: addr.MustParseIA("1-ff00:0:110"), + Next: addr.MustParseIA("1-ff00:0:111"), HopEntry: seg.HopEntry{ HopField: seg.HopField{ ConsIngress: 0, @@ -932,8 +933,8 @@ func createBeacons(t *testing.T) []beacon.Beacon { }, }, { - Local: xtest.MustParseIA("1-ff00:0:111"), - Next: xtest.MustParseIA("1-ff00:0:112"), + Local: addr.MustParseIA("1-ff00:0:111"), + Next: addr.MustParseIA("1-ff00:0:112"), HopEntry: seg.HopEntry{ HopField: seg.HopField{ ConsIngress: 2, @@ -957,8 +958,8 @@ func createBeacons(t *testing.T) []beacon.Beacon { }, ASEntries: []seg.ASEntry{ { - Local: xtest.MustParseIA("2-ff00:0:220"), - Next: xtest.MustParseIA("3-ff00:0:330"), + Local: addr.MustParseIA("2-ff00:0:220"), + Next: addr.MustParseIA("3-ff00:0:330"), HopEntry: seg.HopEntry{ HopField: seg.HopField{ ConsIngress: 0, @@ -967,8 +968,8 @@ func createBeacons(t *testing.T) []beacon.Beacon { }, }, { - Local: xtest.MustParseIA("3-ff00:0:330"), - Next: xtest.MustParseIA("4-ff00:0:440"), + Local: addr.MustParseIA("3-ff00:0:330"), + Next: addr.MustParseIA("4-ff00:0:440"), HopEntry: seg.HopEntry{ HopField: seg.HopField{ ConsIngress: 6, diff --git a/control/segreq/BUILD.bazel b/control/segreq/BUILD.bazel index 61a39ac332..1e973a211e 100644 --- a/control/segreq/BUILD.bazel +++ b/control/segreq/BUILD.bazel @@ -40,7 +40,6 @@ go_test( embed = [":go_default_library"], deps = [ "//pkg/addr:go_default_library", - "//pkg/private/xtest:go_default_library", "//pkg/segment:go_default_library", "//private/trust:go_default_library", "//private/trust/mock_trust:go_default_library", diff --git a/control/segreq/forwarder_test.go b/control/segreq/forwarder_test.go index 66ed9c7502..49e4b53c93 100644 --- a/control/segreq/forwarder_test.go +++ b/control/segreq/forwarder_test.go @@ -23,22 +23,21 @@ import ( "github.com/stretchr/testify/require" "github.com/scionproto/scion/pkg/addr" - "github.com/scionproto/scion/pkg/private/xtest" seg "github.com/scionproto/scion/pkg/segment" "github.com/scionproto/scion/private/trust" "github.com/scionproto/scion/private/trust/mock_trust" ) var ( - core110 = xtest.MustParseIA("1-ff00:0:110") - core120 = xtest.MustParseIA("1-ff00:0:120") - core130 = xtest.MustParseIA("1-ff00:0:130") - core210 = xtest.MustParseIA("2-ff00:0:210") + core110 = addr.MustParseIA("1-ff00:0:110") + core120 = addr.MustParseIA("1-ff00:0:120") + core130 = addr.MustParseIA("1-ff00:0:130") + core210 = addr.MustParseIA("2-ff00:0:210") - nonCore111 = xtest.MustParseIA("1-ff00:0:111") - nonCore112 = xtest.MustParseIA("1-ff00:0:112") - nonCore211 = xtest.MustParseIA("2-ff00:0:211") - nonCore212 = xtest.MustParseIA("2-ff00:0:212") + nonCore111 = addr.MustParseIA("1-ff00:0:111") + nonCore112 = addr.MustParseIA("1-ff00:0:112") + nonCore211 = addr.MustParseIA("2-ff00:0:211") + nonCore212 = addr.MustParseIA("2-ff00:0:212") cores = map[addr.IA]struct{}{ core110: {}, diff --git a/control/segreq/helpers_test.go b/control/segreq/helpers_test.go index 339eb03388..842b4a722f 100644 --- a/control/segreq/helpers_test.go +++ b/control/segreq/helpers_test.go @@ -25,7 +25,6 @@ import ( "github.com/scionproto/scion/control/segreq" "github.com/scionproto/scion/pkg/addr" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/private/trust/mock_trust" ) @@ -37,13 +36,13 @@ func TestCoreChecker(t *testing.T) { ExpectedCore bool }{ "Wildcard": { - IA: xtest.MustParseIA("1-0"), + IA: addr.MustParseIA("1-0"), PrepareInspector: func(i *mock_trust.MockInspector) {}, ErrorAssertion: require.NoError, ExpectedCore: true, }, "InspectorError": { - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), PrepareInspector: func(i *mock_trust.MockInspector) { i.EXPECT().HasAttributes(gomock.Any(), gomock.Any(), gomock.Any()). Return(false, errors.New("test error")) @@ -52,7 +51,7 @@ func TestCoreChecker(t *testing.T) { ExpectedCore: false, }, "Core": { - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), PrepareInspector: func(i *mock_trust.MockInspector) { i.EXPECT().HasAttributes(gomock.Any(), gomock.Any(), gomock.Any()). Return(true, nil) @@ -61,7 +60,7 @@ func TestCoreChecker(t *testing.T) { ExpectedCore: true, }, "Non-Core": { - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), PrepareInspector: func(i *mock_trust.MockInspector) { i.EXPECT().HasAttributes(gomock.Any(), gomock.Any(), gomock.Any()). Return(false, nil) diff --git a/control/trust/grpc/BUILD.bazel b/control/trust/grpc/BUILD.bazel index d97dd7cdf8..ef921c4c39 100644 --- a/control/trust/grpc/BUILD.bazel +++ b/control/trust/grpc/BUILD.bazel @@ -34,7 +34,6 @@ go_test( embed = [":go_default_library"], deps = [ "//pkg/addr:go_default_library", - "//pkg/private/xtest:go_default_library", "//pkg/proto/control_plane:go_default_library", "//pkg/scrypto/cppki:go_default_library", "@com_github_golang_protobuf//ptypes:go_default_library_gen", diff --git a/control/trust/grpc/proto_test.go b/control/trust/grpc/proto_test.go index 4c5cfce3ff..2370ed3e68 100644 --- a/control/trust/grpc/proto_test.go +++ b/control/trust/grpc/proto_test.go @@ -25,7 +25,6 @@ import ( trustgrpc "github.com/scionproto/scion/control/trust/grpc" "github.com/scionproto/scion/pkg/addr" - "github.com/scionproto/scion/pkg/private/xtest" cppb "github.com/scionproto/scion/pkg/proto/control_plane" "github.com/scionproto/scion/pkg/scrypto/cppki" ) @@ -38,7 +37,7 @@ func TestReqToChainQuery(t *testing.T) { require.NoError(t, err) req := &cppb.ChainsRequest{ - IsdAs: uint64(xtest.MustParseIA("1-ff00:0:110")), + IsdAs: uint64(addr.MustParseIA("1-ff00:0:110")), SubjectKeyId: []byte("tank"), AtLeastValidSince: validSince, AtLeastValidUntil: validUntil, diff --git a/control/trust_test.go b/control/trust_test.go index 1d951225e9..b275bec011 100644 --- a/control/trust_test.go +++ b/control/trust_test.go @@ -23,7 +23,7 @@ import ( "github.com/stretchr/testify/require" cs "github.com/scionproto/scion/control" - "github.com/scionproto/scion/pkg/private/xtest" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/private/app/command" "github.com/scionproto/scion/private/storage/trust/sqlite" "github.com/scionproto/scion/scion-pki/testcrypto" @@ -36,7 +36,7 @@ func TestNewSigner(t *testing.T) { require.NoError(t, err) signer := cs.NewSigner( - xtest.MustParseIA("1-ff00:0:110"), + addr.MustParseIA("1-ff00:0:110"), db, filepath.Join(dir, "/ISD1/ASff00_0_110"), ) diff --git a/dispatcher/BUILD.bazel b/dispatcher/BUILD.bazel index d091d76e49..527c8bce4a 100644 --- a/dispatcher/BUILD.bazel +++ b/dispatcher/BUILD.bazel @@ -25,7 +25,6 @@ go_test( embed = [":go_default_library"], deps = [ "//pkg/addr:go_default_library", - "//pkg/private/xtest:go_default_library", "//pkg/snet:go_default_library", "//pkg/snet/path:go_default_library", "@com_github_stretchr_testify//assert:go_default_library", diff --git a/dispatcher/dispatcher_test.go b/dispatcher/dispatcher_test.go index a3905a2712..b45f45f2cd 100644 --- a/dispatcher/dispatcher_test.go +++ b/dispatcher/dispatcher_test.go @@ -23,7 +23,6 @@ import ( "github.com/stretchr/testify/require" "github.com/scionproto/scion/pkg/addr" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/snet" "github.com/scionproto/scion/pkg/snet/path" ) @@ -93,11 +92,11 @@ func TestValidateAddr(t *testing.T) { Pkt: &snet.Packet{ PacketInfo: snet.PacketInfo{ Source: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:2"), + IA: addr.MustParseIA("1-ff00:0:2"), Host: clientHost, }, Destination: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:1"), + IA: addr.MustParseIA("1-ff00:0:1"), Host: dispIPv4Host, }, Payload: snet.UDPPayload{ @@ -117,11 +116,11 @@ func TestValidateAddr(t *testing.T) { Pkt: &snet.Packet{ PacketInfo: snet.PacketInfo{ Source: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:2"), + IA: addr.MustParseIA("1-ff00:0:2"), Host: clientHost, }, Destination: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:1"), + IA: addr.MustParseIA("1-ff00:0:1"), Host: addr.MustParseHost("127.0.0.2"), }, Payload: snet.UDPPayload{ @@ -141,22 +140,22 @@ func TestValidateAddr(t *testing.T) { Pkt: &snet.Packet{ PacketInfo: snet.PacketInfo{ Source: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:2"), + IA: addr.MustParseIA("1-ff00:0:2"), Host: clientHost, }, Destination: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:1"), + IA: addr.MustParseIA("1-ff00:0:1"), Host: dispIPv4Host, }, Payload: snet.SCMPDestinationUnreachable{ Payload: MustPack(snet.Packet{ PacketInfo: snet.PacketInfo{ Source: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:2"), + IA: addr.MustParseIA("1-ff00:0:2"), Host: dispIPv4Host, }, Destination: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:1"), + IA: addr.MustParseIA("1-ff00:0:1"), Host: clientHost, }, Payload: snet.SCMPEchoRequest{Identifier: 0xdead}, @@ -177,22 +176,22 @@ func TestValidateAddr(t *testing.T) { Pkt: &snet.Packet{ PacketInfo: snet.PacketInfo{ Source: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:2"), + IA: addr.MustParseIA("1-ff00:0:2"), Host: clientHost, }, Destination: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:1"), + IA: addr.MustParseIA("1-ff00:0:1"), Host: addr.MustParseHost("127.0.0.2"), }, Payload: snet.SCMPDestinationUnreachable{ Payload: MustPack(snet.Packet{ PacketInfo: snet.PacketInfo{ Source: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:2"), + IA: addr.MustParseIA("1-ff00:0:2"), Host: dispIPv4Host, }, Destination: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:1"), + IA: addr.MustParseIA("1-ff00:0:1"), Host: clientHost, }, Payload: snet.SCMPEchoRequest{Identifier: 0xdead}, @@ -213,11 +212,11 @@ func TestValidateAddr(t *testing.T) { Pkt: &snet.Packet{ PacketInfo: snet.PacketInfo{ Source: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:2"), + IA: addr.MustParseIA("1-ff00:0:2"), Host: clientIPv6Host, }, Destination: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:1"), + IA: addr.MustParseIA("1-ff00:0:1"), Host: dispIPv6Host, }, Payload: snet.UDPPayload{ @@ -237,11 +236,11 @@ func TestValidateAddr(t *testing.T) { Pkt: &snet.Packet{ PacketInfo: snet.PacketInfo{ Source: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:2"), + IA: addr.MustParseIA("1-ff00:0:2"), Host: clientHost, }, Destination: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:1"), + IA: addr.MustParseIA("1-ff00:0:1"), Host: addr.MustParseHost("::2"), }, Payload: snet.UDPPayload{ @@ -261,22 +260,22 @@ func TestValidateAddr(t *testing.T) { Pkt: &snet.Packet{ PacketInfo: snet.PacketInfo{ Source: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:2"), + IA: addr.MustParseIA("1-ff00:0:2"), Host: clientIPv6Host, }, Destination: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:1"), + IA: addr.MustParseIA("1-ff00:0:1"), Host: dispIPv6Host, }, Payload: snet.SCMPDestinationUnreachable{ Payload: MustPack(snet.Packet{ PacketInfo: snet.PacketInfo{ Source: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:2"), + IA: addr.MustParseIA("1-ff00:0:2"), Host: dispIPv6Host, }, Destination: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:1"), + IA: addr.MustParseIA("1-ff00:0:1"), Host: clientIPv6Host, }, Payload: snet.SCMPEchoRequest{Identifier: 0xdead}, @@ -297,22 +296,22 @@ func TestValidateAddr(t *testing.T) { Pkt: &snet.Packet{ PacketInfo: snet.PacketInfo{ Source: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:2"), + IA: addr.MustParseIA("1-ff00:0:2"), Host: clientIPv6Host, }, Destination: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:1"), + IA: addr.MustParseIA("1-ff00:0:1"), Host: addr.MustParseHost("::2"), }, Payload: snet.SCMPDestinationUnreachable{ Payload: MustPack(snet.Packet{ PacketInfo: snet.PacketInfo{ Source: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:2"), + IA: addr.MustParseIA("1-ff00:0:2"), Host: dispIPv6Host, }, Destination: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:1"), + IA: addr.MustParseIA("1-ff00:0:1"), Host: clientIPv6Host, }, Payload: snet.SCMPEchoRequest{Identifier: 0xdead}, @@ -333,11 +332,11 @@ func TestValidateAddr(t *testing.T) { Pkt: &snet.Packet{ PacketInfo: snet.PacketInfo{ Source: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:2"), + IA: addr.MustParseIA("1-ff00:0:2"), Host: clientHost, }, Destination: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:1"), + IA: addr.MustParseIA("1-ff00:0:1"), Host: addr.HostIP(netip.AddrFrom16(dispIPv4Addr.As16())), }, Payload: snet.UDPPayload{ @@ -357,11 +356,11 @@ func TestValidateAddr(t *testing.T) { Pkt: &snet.Packet{ PacketInfo: snet.PacketInfo{ Source: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:2"), + IA: addr.MustParseIA("1-ff00:0:2"), Host: clientHost, }, Destination: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:1"), + IA: addr.MustParseIA("1-ff00:0:1"), Host: dispIPv4Host, }, Payload: snet.UDPPayload{ diff --git a/gateway/BUILD.bazel b/gateway/BUILD.bazel index a41c7e3655..e42b0471c6 100644 --- a/gateway/BUILD.bazel +++ b/gateway/BUILD.bazel @@ -53,6 +53,7 @@ go_test( "//gateway/control/mock_control:go_default_library", "//gateway/mock_gateway:go_default_library", "//gateway/routing:go_default_library", + "//pkg/addr:go_default_library", "//pkg/private/serrors:go_default_library", "//pkg/private/xtest:go_default_library", "@com_github_golang_mock//gomock:go_default_library", diff --git a/gateway/control/aggregator_test.go b/gateway/control/aggregator_test.go index dcb3cf8027..ee33a98916 100644 --- a/gateway/control/aggregator_test.go +++ b/gateway/control/aggregator_test.go @@ -34,8 +34,8 @@ const ( ) var ( - ia1 = xtest.MustParseIA("1-ff00:0:110") - ia2 = xtest.MustParseIA("1-ff00:0:111") + ia1 = addr.MustParseIA("1-ff00:0:110") + ia2 = addr.MustParseIA("1-ff00:0:111") gateway1 = control.Gateway{Control: &net.UDPAddr{IP: []byte{1, 2, 3, 4}, Port: 12345}} gateway2 = control.Gateway{Control: &net.UDPAddr{IP: []byte{5, 6, 7, 8}, Port: 54321}} gateway3 = control.Gateway{Control: &net.UDPAddr{IP: []byte{10, 11, 12, 13}, Port: 23456}} diff --git a/gateway/control/configpublisher_test.go b/gateway/control/configpublisher_test.go index 55fec16d0e..b2487a18f6 100644 --- a/gateway/control/configpublisher_test.go +++ b/gateway/control/configpublisher_test.go @@ -42,7 +42,7 @@ func TestConfigPublisherSubscribeRemoteIAs(t *testing.T) { func TestConfigPublisherPublish(t *testing.T) { expectedSP := control.SessionPolicies{ { - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), TrafficMatcher: pktcls.CondTrue, PerfPolicy: dummyPerfPolicy{}, PathPolicy: control.DefaultPathPolicy, @@ -95,9 +95,9 @@ func TestConfigPublisherPublish(t *testing.T) { go func() { // wait on ias2 first to check for HOL blocking. actual := <-ias2 - assert.Equal(t, []addr.IA{xtest.MustParseIA("1-ff00:0:110")}, actual) + assert.Equal(t, []addr.IA{addr.MustParseIA("1-ff00:0:110")}, actual) actual = <-ias1 - assert.Equal(t, []addr.IA{xtest.MustParseIA("1-ff00:0:110")}, actual) + assert.Equal(t, []addr.IA{addr.MustParseIA("1-ff00:0:110")}, actual) }() go func() { n.Publish(expectedSP, nil) diff --git a/gateway/control/enginecontroller_test.go b/gateway/control/enginecontroller_test.go index c981be84cd..443606c800 100644 --- a/gateway/control/enginecontroller_test.go +++ b/gateway/control/enginecontroller_test.go @@ -27,6 +27,7 @@ import ( "github.com/scionproto/scion/gateway/control" "github.com/scionproto/scion/gateway/control/mock_control" "github.com/scionproto/scion/gateway/pktcls" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/xtest" ) @@ -157,7 +158,7 @@ func TestBuildRoutingChains(t *testing.T) { { ID: 23, PolicyID: 0, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), TrafficMatcher: pktcls.CondTrue, PerfPolicy: control.DefaultPerfPolicy, PathPolicy: control.DefaultPathPolicy, @@ -169,7 +170,7 @@ func TestBuildRoutingChains(t *testing.T) { }, Chains: []*control.RoutingChain{ { - RemoteIA: xtest.MustParseIA("1-ff00:0:110"), + RemoteIA: addr.MustParseIA("1-ff00:0:110"), Prefixes: xtest.MustParseCIDRs(t, "10.99.0.0/16"), TrafficMatchers: []control.TrafficMatcher{{ID: 1, Matcher: pktcls.CondTrue}}, }, @@ -183,7 +184,7 @@ func TestBuildRoutingChains(t *testing.T) { { ID: 23, PolicyID: 0, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), TrafficMatcher: pktcls.CondTrue, PerfPolicy: control.DefaultPerfPolicy, PathPolicy: control.DefaultPathPolicy, @@ -195,7 +196,7 @@ func TestBuildRoutingChains(t *testing.T) { }, Chains: []*control.RoutingChain{ { - RemoteIA: xtest.MustParseIA("1-ff00:0:110"), + RemoteIA: addr.MustParseIA("1-ff00:0:110"), Prefixes: xtest.MustParseCIDRs(t, "10.98.0.0/16", "10.99.0.0/16"), TrafficMatchers: []control.TrafficMatcher{{ID: 1, Matcher: pktcls.CondTrue}}, }, @@ -209,7 +210,7 @@ func TestBuildRoutingChains(t *testing.T) { { ID: 21, PolicyID: 0, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), TrafficMatcher: &pktcls.CondIPv4{Predicate: &pktcls.IPv4MatchDSCP{DSCP: 42}}, PerfPolicy: control.DefaultPerfPolicy, PathPolicy: control.DefaultPathPolicy, @@ -221,7 +222,7 @@ func TestBuildRoutingChains(t *testing.T) { { ID: 23, PolicyID: 0, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), TrafficMatcher: pktcls.CondTrue, PerfPolicy: control.DefaultPerfPolicy, PathPolicy: control.DefaultPathPolicy, @@ -233,7 +234,7 @@ func TestBuildRoutingChains(t *testing.T) { }, Chains: []*control.RoutingChain{ { - RemoteIA: xtest.MustParseIA("1-ff00:0:110"), + RemoteIA: addr.MustParseIA("1-ff00:0:110"), Prefixes: xtest.MustParseCIDRs(t, "10.98.0.0/16", "10.99.0.0/16"), TrafficMatchers: []control.TrafficMatcher{ { @@ -254,7 +255,7 @@ func TestBuildRoutingChains(t *testing.T) { { ID: 100, PolicyID: 1, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), TrafficMatcher: &pktcls.CondIPv4{Predicate: &pktcls.IPv4MatchDSCP{DSCP: 1}}, PerfPolicy: control.DefaultPerfPolicy, PathPolicy: control.DefaultPathPolicy, // via R1 and R1 @@ -267,7 +268,7 @@ func TestBuildRoutingChains(t *testing.T) { { ID: 101, PolicyID: 1, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), TrafficMatcher: &pktcls.CondIPv4{Predicate: &pktcls.IPv4MatchDSCP{DSCP: 1}}, PerfPolicy: control.DefaultPerfPolicy, PathPolicy: control.DefaultPathPolicy, // via R1 and R2 @@ -280,7 +281,7 @@ func TestBuildRoutingChains(t *testing.T) { { ID: 102, PolicyID: 0, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), TrafficMatcher: pktcls.CondTrue, PerfPolicy: control.DefaultPerfPolicy, PathPolicy: control.DefaultPathPolicy, // via (R1 or R2) and R1 @@ -293,7 +294,7 @@ func TestBuildRoutingChains(t *testing.T) { { ID: 103, PolicyID: 0, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), TrafficMatcher: pktcls.CondTrue, PerfPolicy: control.DefaultPerfPolicy, PathPolicy: control.DefaultPathPolicy, // via (R1 or R2) and R2 @@ -306,7 +307,7 @@ func TestBuildRoutingChains(t *testing.T) { }, Chains: []*control.RoutingChain{ { - RemoteIA: xtest.MustParseIA("1-ff00:0:110"), + RemoteIA: addr.MustParseIA("1-ff00:0:110"), Prefixes: xtest.MustParseCIDRs(t, "10.98.0.0/16", "10.99.0.0/16"), TrafficMatchers: []control.TrafficMatcher{ { @@ -317,7 +318,7 @@ func TestBuildRoutingChains(t *testing.T) { }, }, { - RemoteIA: xtest.MustParseIA("1-ff00:0:110"), + RemoteIA: addr.MustParseIA("1-ff00:0:110"), Prefixes: xtest.MustParseCIDRs(t, "10.1.0.0/16"), TrafficMatchers: []control.TrafficMatcher{ { @@ -328,7 +329,7 @@ func TestBuildRoutingChains(t *testing.T) { }, }, { - RemoteIA: xtest.MustParseIA("1-ff00:0:110"), + RemoteIA: addr.MustParseIA("1-ff00:0:110"), Prefixes: xtest.MustParseCIDRs(t, "10.2.0.0/16"), TrafficMatchers: []control.TrafficMatcher{ { @@ -353,7 +354,7 @@ func TestBuildRoutingChains(t *testing.T) { { ID: 100, PolicyID: 1, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), TrafficMatcher: &pktcls.CondIPv4{Predicate: &pktcls.IPv4MatchDSCP{DSCP: 1}}, PerfPolicy: control.DefaultPerfPolicy, PathPolicy: control.DefaultPathPolicy, // via R1 and R1 @@ -366,7 +367,7 @@ func TestBuildRoutingChains(t *testing.T) { { ID: 101, PolicyID: 1, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), TrafficMatcher: &pktcls.CondIPv4{Predicate: &pktcls.IPv4MatchDSCP{DSCP: 1}}, PerfPolicy: control.DefaultPerfPolicy, PathPolicy: control.DefaultPathPolicy, // via R1 and R2 @@ -379,7 +380,7 @@ func TestBuildRoutingChains(t *testing.T) { { ID: 102, PolicyID: 0, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), TrafficMatcher: &pktcls.CondIPv4{Predicate: &pktcls.IPv4MatchDSCP{DSCP: 1}}, PerfPolicy: control.DefaultPerfPolicy, PathPolicy: control.DefaultPathPolicy, // via Any and R1 @@ -392,7 +393,7 @@ func TestBuildRoutingChains(t *testing.T) { { ID: 103, PolicyID: 0, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), TrafficMatcher: &pktcls.CondIPv4{Predicate: &pktcls.IPv4MatchDSCP{DSCP: 1}}, PerfPolicy: control.DefaultPerfPolicy, PathPolicy: control.DefaultPathPolicy, // via Any and R2 @@ -405,7 +406,7 @@ func TestBuildRoutingChains(t *testing.T) { }, Chains: []*control.RoutingChain{ { - RemoteIA: xtest.MustParseIA("1-ff00:0:110"), + RemoteIA: addr.MustParseIA("1-ff00:0:110"), Prefixes: xtest.MustParseCIDRs(t, "10.98.0.0/16", "10.99.0.0/16"), TrafficMatchers: []control.TrafficMatcher{ { @@ -415,7 +416,7 @@ func TestBuildRoutingChains(t *testing.T) { }, }, { - RemoteIA: xtest.MustParseIA("1-ff00:0:110"), + RemoteIA: addr.MustParseIA("1-ff00:0:110"), Prefixes: xtest.MustParseCIDRs(t, "10.1.0.0/16"), TrafficMatchers: []control.TrafficMatcher{ { @@ -425,7 +426,7 @@ func TestBuildRoutingChains(t *testing.T) { }, }, { - RemoteIA: xtest.MustParseIA("1-ff00:0:110"), + RemoteIA: addr.MustParseIA("1-ff00:0:110"), Prefixes: xtest.MustParseCIDRs(t, "10.2.0.0/16"), TrafficMatchers: []control.TrafficMatcher{ { @@ -446,7 +447,7 @@ func TestBuildRoutingChains(t *testing.T) { { ID: 100, PolicyID: 0, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), TrafficMatcher: pktcls.CondTrue, PerfPolicy: control.DefaultPerfPolicy, PathPolicy: control.DefaultPathPolicy, // via R1 and R2 @@ -458,7 +459,7 @@ func TestBuildRoutingChains(t *testing.T) { { ID: 101, PolicyID: 0, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), TrafficMatcher: pktcls.CondTrue, PerfPolicy: control.DefaultPerfPolicy, PathPolicy: control.DefaultPathPolicy, // via R1 @@ -470,7 +471,7 @@ func TestBuildRoutingChains(t *testing.T) { { ID: 102, PolicyID: 0, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), TrafficMatcher: pktcls.CondTrue, PerfPolicy: control.DefaultPerfPolicy, PathPolicy: control.DefaultPathPolicy, // via R2 @@ -482,12 +483,12 @@ func TestBuildRoutingChains(t *testing.T) { }, Chains: []*control.RoutingChain{ { - RemoteIA: xtest.MustParseIA("1-ff00:0:110"), + RemoteIA: addr.MustParseIA("1-ff00:0:110"), Prefixes: xtest.MustParseCIDRs(t, "10.1.0.0/16"), TrafficMatchers: []control.TrafficMatcher{{ID: 1, Matcher: pktcls.CondTrue}}, }, { - RemoteIA: xtest.MustParseIA("1-ff00:0:110"), + RemoteIA: addr.MustParseIA("1-ff00:0:110"), Prefixes: xtest.MustParseCIDRs(t, "10.2.0.0/16"), TrafficMatchers: []control.TrafficMatcher{{ID: 2, Matcher: pktcls.CondTrue}}, }, @@ -502,7 +503,7 @@ func TestBuildRoutingChains(t *testing.T) { { ID: 23, PolicyID: 0, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), TrafficMatcher: pktcls.CondTrue, PerfPolicy: control.DefaultPerfPolicy, PathPolicy: control.DefaultPathPolicy, @@ -514,7 +515,7 @@ func TestBuildRoutingChains(t *testing.T) { { ID: 42, PolicyID: 0, - IA: xtest.MustParseIA("1-ff00:0:111"), + IA: addr.MustParseIA("1-ff00:0:111"), TrafficMatcher: pktcls.CondTrue, PerfPolicy: control.DefaultPerfPolicy, PathPolicy: control.DefaultPathPolicy, @@ -526,12 +527,12 @@ func TestBuildRoutingChains(t *testing.T) { }, Chains: []*control.RoutingChain{ { - RemoteIA: xtest.MustParseIA("1-ff00:0:110"), + RemoteIA: addr.MustParseIA("1-ff00:0:110"), Prefixes: xtest.MustParseCIDRs(t, "10.98.0.0/16", "10.99.0.0/16"), TrafficMatchers: []control.TrafficMatcher{{ID: 1, Matcher: pktcls.CondTrue}}, }, { - RemoteIA: xtest.MustParseIA("1-ff00:0:111"), + RemoteIA: addr.MustParseIA("1-ff00:0:111"), Prefixes: xtest.MustParseCIDRs(t, "10.13.0.0/16", "10.14.0.0/16"), TrafficMatchers: []control.TrafficMatcher{{ID: 2, Matcher: pktcls.CondTrue}}, }, diff --git a/gateway/control/grpc/BUILD.bazel b/gateway/control/grpc/BUILD.bazel index 8e57b2c6a5..6032afc468 100644 --- a/gateway/control/grpc/BUILD.bazel +++ b/gateway/control/grpc/BUILD.bazel @@ -37,6 +37,7 @@ go_test( deps = [ ":go_default_library", "//gateway/control/grpc/mock_grpc:go_default_library", + "//pkg/addr:go_default_library", "//pkg/private/mocks/net/mock_net:go_default_library", "//pkg/private/serrors:go_default_library", "//pkg/private/xtest:go_default_library", diff --git a/gateway/control/grpc/prefix_server_test.go b/gateway/control/grpc/prefix_server_test.go index 2e7540f9ca..f04b538dc5 100644 --- a/gateway/control/grpc/prefix_server_test.go +++ b/gateway/control/grpc/prefix_server_test.go @@ -27,14 +27,15 @@ import ( "github.com/scionproto/scion/gateway/control/grpc" "github.com/scionproto/scion/gateway/control/grpc/mock_grpc" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/xtest" gpb "github.com/scionproto/scion/pkg/proto/gateway" "github.com/scionproto/scion/pkg/snet" ) func TestIPPrefixServerPrefixes(t *testing.T) { - local := xtest.MustParseIA("1-ff00:0:110") - remote := xtest.MustParseIA("1-ff00:0:111") + local := addr.MustParseIA("1-ff00:0:110") + remote := addr.MustParseIA("1-ff00:0:111") testCases := map[string]struct { Advertiser func(t *testing.T, ctrl *gomock.Controller) grpc.Advertiser diff --git a/gateway/control/grpc/probeserver_test.go b/gateway/control/grpc/probeserver_test.go index d460273192..d840f7bf78 100644 --- a/gateway/control/grpc/probeserver_test.go +++ b/gateway/control/grpc/probeserver_test.go @@ -26,9 +26,9 @@ import ( "google.golang.org/protobuf/proto" "github.com/scionproto/scion/gateway/control/grpc" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/mocks/net/mock_net" "github.com/scionproto/scion/pkg/private/serrors" - "github.com/scionproto/scion/pkg/private/xtest" gpb "github.com/scionproto/scion/pkg/proto/gateway" "github.com/scionproto/scion/pkg/snet" ) @@ -37,7 +37,7 @@ func TestControlDispatcher(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() - src := &snet.UDPAddr{IA: xtest.MustParseIA("1-ff00:0:110")} + src := &snet.UDPAddr{IA: addr.MustParseIA("1-ff00:0:110")} requests := make([][]byte, 3) for i := range requests { diff --git a/gateway/control/prefixesfilter_test.go b/gateway/control/prefixesfilter_test.go index bc160b8c42..bf3afec201 100644 --- a/gateway/control/prefixesfilter_test.go +++ b/gateway/control/prefixesfilter_test.go @@ -44,7 +44,7 @@ func TestPrefixesFilterPrefixes(t *testing.T) { provider := mock_control.NewMockRoutingPolicyProvider(ctrl) provider.EXPECT().RoutingPolicy().Times(2) f := control.PrefixesFilter{ - LocalIA: xtest.MustParseIA("1-ff00:0:110"), + LocalIA: addr.MustParseIA("1-ff00:0:110"), PolicyProvider: provider, Consumer: consumer, } @@ -52,12 +52,12 @@ func TestPrefixesFilterPrefixes(t *testing.T) { }, Inputs: []input{ { - IA: xtest.MustParseIA("1-ff00:0:111"), + IA: addr.MustParseIA("1-ff00:0:111"), Gateway: control.Gateway{}, Prefixes: xtest.MustParseCIDRs(t, "10.1.0.0/25"), }, { - IA: xtest.MustParseIA("1-ff00:0:112"), + IA: addr.MustParseIA("1-ff00:0:112"), Gateway: control.Gateway{}, Prefixes: xtest.MustParseCIDRs(t, "10.4.0.0/25"), }, @@ -66,15 +66,15 @@ func TestPrefixesFilterPrefixes(t *testing.T) { "deny all filters all": { CreateFilter: func(_ *testing.T, ctrl *gomock.Controller) control.PrefixesFilter { consumer := mock_control.NewMockPrefixConsumer(ctrl) - consumer.EXPECT().Prefixes(xtest.MustParseIA("1-ff00:0:111"), + consumer.EXPECT().Prefixes(addr.MustParseIA("1-ff00:0:111"), gomock.Any(), nil).Return(nil) - consumer.EXPECT().Prefixes(xtest.MustParseIA("1-ff00:0:112"), + consumer.EXPECT().Prefixes(addr.MustParseIA("1-ff00:0:112"), gomock.Any(), nil).Return(nil) provider := mock_control.NewMockRoutingPolicyProvider(ctrl) provider.EXPECT().RoutingPolicy(). Return(&routing.Policy{DefaultAction: routing.Reject}).Times(2) f := control.PrefixesFilter{ - LocalIA: xtest.MustParseIA("1-ff00:0:110"), + LocalIA: addr.MustParseIA("1-ff00:0:110"), PolicyProvider: provider, Consumer: consumer, } @@ -82,12 +82,12 @@ func TestPrefixesFilterPrefixes(t *testing.T) { }, Inputs: []input{ { - IA: xtest.MustParseIA("1-ff00:0:111"), + IA: addr.MustParseIA("1-ff00:0:111"), Gateway: control.Gateway{}, Prefixes: xtest.MustParseCIDRs(t, "10.1.0.0/25"), }, { - IA: xtest.MustParseIA("1-ff00:0:112"), + IA: addr.MustParseIA("1-ff00:0:112"), Gateway: control.Gateway{}, Prefixes: xtest.MustParseCIDRs(t, "10.4.0.0/25"), }, @@ -96,15 +96,15 @@ func TestPrefixesFilterPrefixes(t *testing.T) { "allow all filters none": { CreateFilter: func(_ *testing.T, ctrl *gomock.Controller) control.PrefixesFilter { consumer := mock_control.NewMockPrefixConsumer(ctrl) - consumer.EXPECT().Prefixes(xtest.MustParseIA("1-ff00:0:111"), + consumer.EXPECT().Prefixes(addr.MustParseIA("1-ff00:0:111"), gomock.Any(), xtest.MustParseCIDRs(t, "10.1.0.0/25")).Return(nil) - consumer.EXPECT().Prefixes(xtest.MustParseIA("1-ff00:0:112"), + consumer.EXPECT().Prefixes(addr.MustParseIA("1-ff00:0:112"), gomock.Any(), xtest.MustParseCIDRs(t, "10.4.0.0/25")).Return(nil) provider := mock_control.NewMockRoutingPolicyProvider(ctrl) provider.EXPECT().RoutingPolicy(). Return(&routing.Policy{DefaultAction: routing.Accept}).Times(2) f := control.PrefixesFilter{ - LocalIA: xtest.MustParseIA("1-ff00:0:110"), + LocalIA: addr.MustParseIA("1-ff00:0:110"), PolicyProvider: provider, Consumer: consumer, } @@ -112,12 +112,12 @@ func TestPrefixesFilterPrefixes(t *testing.T) { }, Inputs: []input{ { - IA: xtest.MustParseIA("1-ff00:0:111"), + IA: addr.MustParseIA("1-ff00:0:111"), Gateway: control.Gateway{}, Prefixes: xtest.MustParseCIDRs(t, "10.1.0.0/25"), }, { - IA: xtest.MustParseIA("1-ff00:0:112"), + IA: addr.MustParseIA("1-ff00:0:112"), Gateway: control.Gateway{}, Prefixes: xtest.MustParseCIDRs(t, "10.4.0.0/25"), }, @@ -126,11 +126,11 @@ func TestPrefixesFilterPrefixes(t *testing.T) { "routing policy filters correctly": { CreateFilter: func(t *testing.T, ctrl *gomock.Controller) control.PrefixesFilter { consumer := mock_control.NewMockPrefixConsumer(ctrl) - consumer.EXPECT().Prefixes(xtest.MustParseIA("1-ff00:0:111"), + consumer.EXPECT().Prefixes(addr.MustParseIA("1-ff00:0:111"), gomock.Any(), xtest.MustParseCIDRs(t, "10.1.0.0/25")).Return(nil) - consumer.EXPECT().Prefixes(xtest.MustParseIA("1-ff00:0:112"), + consumer.EXPECT().Prefixes(addr.MustParseIA("1-ff00:0:112"), gomock.Any(), xtest.MustParseCIDRs(t, "10.4.0.0/25")).Return(nil) - consumer.EXPECT().Prefixes(xtest.MustParseIA("1-ff00:0:113"), + consumer.EXPECT().Prefixes(addr.MustParseIA("1-ff00:0:113"), gomock.Any(), nil).Return(nil) pol := &routing.Policy{DefaultAction: routing.Reject} err := pol.UnmarshalText( @@ -142,7 +142,7 @@ accept 1-ff00:0:113 1-ff00:0:110 10.3.0.0/25`)) provider.EXPECT().RoutingPolicy(). Return(pol).Times(3) f := control.PrefixesFilter{ - LocalIA: xtest.MustParseIA("1-ff00:0:110"), + LocalIA: addr.MustParseIA("1-ff00:0:110"), PolicyProvider: provider, Consumer: consumer, } @@ -150,17 +150,17 @@ accept 1-ff00:0:113 1-ff00:0:110 10.3.0.0/25`)) }, Inputs: []input{ { - IA: xtest.MustParseIA("1-ff00:0:111"), + IA: addr.MustParseIA("1-ff00:0:111"), Gateway: control.Gateway{}, Prefixes: xtest.MustParseCIDRs(t, "10.1.0.0/25", "127.0.0.0/8", "172.0.0.0/8"), }, { - IA: xtest.MustParseIA("1-ff00:0:112"), + IA: addr.MustParseIA("1-ff00:0:112"), Gateway: control.Gateway{}, Prefixes: xtest.MustParseCIDRs(t, "10.4.0.0/25", "127.0.0.0/8", "172.0.0.0/8"), }, { - IA: xtest.MustParseIA("1-ff00:0:113"), + IA: addr.MustParseIA("1-ff00:0:113"), Gateway: control.Gateway{}, Prefixes: xtest.MustParseCIDRs(t, "127.0.0.0/8", "172.0.0.0/8"), }, diff --git a/gateway/control/remotemonitor_test.go b/gateway/control/remotemonitor_test.go index b1ec5c6137..c93660e2f7 100644 --- a/gateway/control/remotemonitor_test.go +++ b/gateway/control/remotemonitor_test.go @@ -30,8 +30,8 @@ import ( ) func TestRemoteMonitor(t *testing.T) { - ia1 := xtest.MustParseIA("1-ff00:0:110") - ia2 := xtest.MustParseIA("1-ff00:0:111") + ia1 := addr.MustParseIA("1-ff00:0:110") + ia2 := addr.MustParseIA("1-ff00:0:111") ctrl := gomock.NewController(t) defer ctrl.Finish() diff --git a/gateway/control/routemgr_test.go b/gateway/control/routemgr_test.go index 2aa93f8523..2b11cfe17e 100644 --- a/gateway/control/routemgr_test.go +++ b/gateway/control/routemgr_test.go @@ -21,6 +21,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/scionproto/scion/gateway/control" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/xtest" ) @@ -72,7 +73,7 @@ func TestRouteString(t *testing.T) { Prefix: xtest.MustParseCIDR(t, "192.168.0.0/24"), NextHop: net.ParseIP("192.168.0.1"), Source: net.ParseIP("192.168.0.2"), - IA: xtest.MustParseIA("1-ff00:0:1"), + IA: addr.MustParseIA("1-ff00:0:1"), }, String: "192.168.0.0/24 via 192.168.0.1 src 192.168.0.2 isd-as 1-ff00:0:1", }, @@ -80,7 +81,7 @@ func TestRouteString(t *testing.T) { Route: &control.Route{ Prefix: xtest.MustParseCIDR(t, "192.168.0.0/24"), NextHop: net.ParseIP("192.168.0.1"), - IA: xtest.MustParseIA("1-ff00:0:1"), + IA: addr.MustParseIA("1-ff00:0:1"), }, String: "192.168.0.0/24 via 192.168.0.1 isd-as 1-ff00:0:1", }, diff --git a/gateway/control/sessionconfigurator_test.go b/gateway/control/sessionconfigurator_test.go index 168cb61eaa..ec7ba781f8 100644 --- a/gateway/control/sessionconfigurator_test.go +++ b/gateway/control/sessionconfigurator_test.go @@ -95,7 +95,7 @@ func TestSessionConfigurator(t *testing.T) { routingUpdate := control.RemoteGateways{ Gateways: map[addr.IA][]control.RemoteGateway{ - xtest.MustParseIA("1-ff00:0:110"): { + addr.MustParseIA("1-ff00:0:110"): { { Gateway: control.Gateway{ Probe: mustParseUDPAddr(t, "10.0.1.1:25"), @@ -113,7 +113,7 @@ func TestSessionConfigurator(t *testing.T) { } sessionPolicies := control.SessionPolicies{ { - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), ID: 42, TrafficMatcher: pktcls.CondTrue, PerfPolicy: dummyPerfPolicy{}, @@ -126,7 +126,7 @@ func TestSessionConfigurator(t *testing.T) { { ID: 0, PolicyID: 42, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), TrafficMatcher: pktcls.CondTrue, PerfPolicy: dummyPerfPolicy{}, PathPolicy: control.DefaultPathPolicy, @@ -139,7 +139,7 @@ func TestSessionConfigurator(t *testing.T) { { ID: 1, PolicyID: 42, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), TrafficMatcher: pktcls.CondTrue, PerfPolicy: dummyPerfPolicy{}, PathPolicy: control.DefaultPathPolicy, @@ -208,7 +208,7 @@ func TestBuildSessionConfigs(t *testing.T) { SessionPolicies: nil, RoutingUpdate: control.RemoteGateways{ Gateways: map[addr.IA][]control.RemoteGateway{ - xtest.MustParseIA("1-ff00:0:110"): { + addr.MustParseIA("1-ff00:0:110"): { { Gateway: control.Gateway{ Probe: mustParseUDPAddr(t, "10.0.1.1:25"), @@ -229,7 +229,7 @@ func TestBuildSessionConfigs(t *testing.T) { "empty dynamic": { SessionPolicies: control.SessionPolicies{ { - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), ID: 42, TrafficMatcher: pktcls.CondTrue, PerfPolicy: dummyPerfPolicy{}, @@ -243,7 +243,7 @@ func TestBuildSessionConfigs(t *testing.T) { "simple": { SessionPolicies: control.SessionPolicies{ { - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), ID: 42, TrafficMatcher: pktcls.CondTrue, PerfPolicy: dummyPerfPolicy{}, @@ -254,7 +254,7 @@ func TestBuildSessionConfigs(t *testing.T) { }, RoutingUpdate: control.RemoteGateways{ Gateways: map[addr.IA][]control.RemoteGateway{ - xtest.MustParseIA("1-ff00:0:110"): { + addr.MustParseIA("1-ff00:0:110"): { { Gateway: control.Gateway{ Probe: mustParseUDPAddr(t, "10.0.1.1:25"), @@ -274,7 +274,7 @@ func TestBuildSessionConfigs(t *testing.T) { { ID: 0, PolicyID: 42, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), TrafficMatcher: pktcls.CondTrue, PerfPolicy: dummyPerfPolicy{}, PathPolicy: control.DefaultPathPolicy, @@ -287,7 +287,7 @@ func TestBuildSessionConfigs(t *testing.T) { { ID: 1, PolicyID: 42, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), TrafficMatcher: pktcls.CondTrue, PerfPolicy: dummyPerfPolicy{}, PathPolicy: control.DefaultPathPolicy, @@ -302,7 +302,7 @@ func TestBuildSessionConfigs(t *testing.T) { "complex": { SessionPolicies: control.SessionPolicies{ { - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), ID: 1, TrafficMatcher: pktcls.CondTrue, PerfPolicy: dummyPerfPolicy{}, @@ -311,7 +311,7 @@ func TestBuildSessionConfigs(t *testing.T) { Prefixes: []*net.IPNet{xtest.MustParseCIDR(t, "10.1.0.0/24")}, }, { - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), ID: 2, TrafficMatcher: pktcls.CondTrue, PerfPolicy: dummyPerfPolicy{}, @@ -320,7 +320,7 @@ func TestBuildSessionConfigs(t *testing.T) { Prefixes: []*net.IPNet{xtest.MustParseCIDR(t, "10.1.0.0/24")}, }, { - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), ID: 3, TrafficMatcher: pktcls.CondFalse, PerfPolicy: dummyPerfPolicy{}, @@ -329,7 +329,7 @@ func TestBuildSessionConfigs(t *testing.T) { Prefixes: []*net.IPNet{xtest.MustParseCIDR(t, "10.1.0.0/24")}, }, { - IA: xtest.MustParseIA("1-ff00:0:111"), + IA: addr.MustParseIA("1-ff00:0:111"), ID: 1, TrafficMatcher: pktcls.CondTrue, PerfPolicy: dummyPerfPolicy{}, @@ -341,7 +341,7 @@ func TestBuildSessionConfigs(t *testing.T) { RoutingUpdate: control.RemoteGateways{ Gateways: map[addr.IA][]control.RemoteGateway{ - xtest.MustParseIA("1-ff00:0:110"): { + addr.MustParseIA("1-ff00:0:110"): { { Gateway: control.Gateway{ Probe: mustParseUDPAddr(t, "10.0.1.1:25"), @@ -357,7 +357,7 @@ func TestBuildSessionConfigs(t *testing.T) { Prefixes: xtest.MustParseCIDRs(t, "10.13.0.0/24", "10.37.0.0/24"), }, }, - xtest.MustParseIA("1-ff00:0:111"): { + addr.MustParseIA("1-ff00:0:111"): { { Gateway: control.Gateway{ Probe: mustParseUDPAddr(t, "10.6.20.1:404"), @@ -372,10 +372,10 @@ func TestBuildSessionConfigs(t *testing.T) { { ID: 0, PolicyID: 1, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), TrafficMatcher: pktcls.CondTrue, PerfPolicy: dummyPerfPolicy{}, - PathPolicy: gatewayPolicy(xtest.MustParseIA("1-ff00:0:110"), + PathPolicy: gatewayPolicy(addr.MustParseIA("1-ff00:0:110"), []uint64{40, 4}), PathCount: control.DefaultPathCount, Prefixes: xtest.MustParseCIDRs(t, @@ -388,10 +388,10 @@ func TestBuildSessionConfigs(t *testing.T) { { ID: 1, PolicyID: 1, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), TrafficMatcher: pktcls.CondTrue, PerfPolicy: dummyPerfPolicy{}, - PathPolicy: gatewayPolicy(xtest.MustParseIA("1-ff00:0:110"), + PathPolicy: gatewayPolicy(addr.MustParseIA("1-ff00:0:110"), []uint64{13, 37}), PathCount: control.DefaultPathCount, Prefixes: xtest.MustParseCIDRs(t, @@ -404,12 +404,12 @@ func TestBuildSessionConfigs(t *testing.T) { { ID: 2, PolicyID: 2, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), TrafficMatcher: pktcls.CondTrue, PerfPolicy: dummyPerfPolicy{}, PathPolicy: control.ConjunctionPathPol{ Pol1: &pathpol.Policy{Name: "pol2"}, - Pol2: gatewayPolicy(xtest.MustParseIA("1-ff00:0:110"), + Pol2: gatewayPolicy(addr.MustParseIA("1-ff00:0:110"), []uint64{40, 4}), }, PathCount: control.DefaultPathCount, @@ -423,12 +423,12 @@ func TestBuildSessionConfigs(t *testing.T) { { ID: 3, PolicyID: 2, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), TrafficMatcher: pktcls.CondTrue, PerfPolicy: dummyPerfPolicy{}, PathPolicy: control.ConjunctionPathPol{ Pol1: &pathpol.Policy{Name: "pol2"}, - Pol2: gatewayPolicy(xtest.MustParseIA("1-ff00:0:110"), []uint64{13, 37}), + Pol2: gatewayPolicy(addr.MustParseIA("1-ff00:0:110"), []uint64{13, 37}), }, PathCount: control.DefaultPathCount, Prefixes: xtest.MustParseCIDRs(t, @@ -441,12 +441,12 @@ func TestBuildSessionConfigs(t *testing.T) { { ID: 4, PolicyID: 3, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), TrafficMatcher: pktcls.CondFalse, PerfPolicy: dummyPerfPolicy{}, PathPolicy: control.ConjunctionPathPol{ Pol1: &pathpol.Policy{Name: "pol2"}, - Pol2: gatewayPolicy(xtest.MustParseIA("1-ff00:0:110"), []uint64{40, 4}), + Pol2: gatewayPolicy(addr.MustParseIA("1-ff00:0:110"), []uint64{40, 4}), }, PathCount: control.DefaultPathCount, Prefixes: xtest.MustParseCIDRs(t, @@ -459,12 +459,12 @@ func TestBuildSessionConfigs(t *testing.T) { { ID: 5, PolicyID: 3, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), TrafficMatcher: pktcls.CondFalse, PerfPolicy: dummyPerfPolicy{}, PathPolicy: control.ConjunctionPathPol{ Pol1: &pathpol.Policy{Name: "pol2"}, - Pol2: gatewayPolicy(xtest.MustParseIA("1-ff00:0:110"), []uint64{13, 37}), + Pol2: gatewayPolicy(addr.MustParseIA("1-ff00:0:110"), []uint64{13, 37}), }, PathCount: control.DefaultPathCount, Prefixes: xtest.MustParseCIDRs(t, @@ -477,10 +477,10 @@ func TestBuildSessionConfigs(t *testing.T) { { ID: 6, PolicyID: 1, - IA: xtest.MustParseIA("1-ff00:0:111"), + IA: addr.MustParseIA("1-ff00:0:111"), TrafficMatcher: pktcls.CondTrue, PerfPolicy: dummyPerfPolicy{}, - PathPolicy: gatewayPolicy(xtest.MustParseIA("1-ff00:0:111"), []uint64{1}), + PathPolicy: gatewayPolicy(addr.MustParseIA("1-ff00:0:111"), []uint64{1}), PathCount: control.DefaultPathCount, Prefixes: xtest.MustParseCIDRs(t, "10.25.0.0/24", "10.21.0.0/24"), Gateway: control.Gateway{ @@ -522,8 +522,8 @@ func TestConjuctionPolicy(t *testing.T) { path.Path{ Meta: snet.PathMetadata{ Interfaces: []snet.PathInterface{ - {IA: xtest.MustParseIA("1-ff00:0:112"), ID: 2}, - {IA: xtest.MustParseIA("1-ff00:0:110"), ID: 1}, + {IA: addr.MustParseIA("1-ff00:0:112"), ID: 2}, + {IA: addr.MustParseIA("1-ff00:0:110"), ID: 1}, }, }, }, @@ -533,8 +533,8 @@ func TestConjuctionPolicy(t *testing.T) { path.Path{ Meta: snet.PathMetadata{ Interfaces: []snet.PathInterface{ - {IA: xtest.MustParseIA("1-ff00:0:112"), ID: 2}, - {IA: xtest.MustParseIA("1-ff00:0:110"), ID: 1}, + {IA: addr.MustParseIA("1-ff00:0:112"), ID: 2}, + {IA: addr.MustParseIA("1-ff00:0:110"), ID: 1}, }, }, }, @@ -547,8 +547,8 @@ func TestConjuctionPolicy(t *testing.T) { path.Path{ Meta: snet.PathMetadata{ Interfaces: []snet.PathInterface{ - {IA: xtest.MustParseIA("1-ff00:0:112"), ID: 2}, - {IA: xtest.MustParseIA("1-ff00:0:110"), ID: 1}, + {IA: addr.MustParseIA("1-ff00:0:112"), ID: 2}, + {IA: addr.MustParseIA("1-ff00:0:110"), ID: 1}, }, }, }, @@ -558,8 +558,8 @@ func TestConjuctionPolicy(t *testing.T) { path.Path{ Meta: snet.PathMetadata{ Interfaces: []snet.PathInterface{ - {IA: xtest.MustParseIA("1-ff00:0:112"), ID: 2}, - {IA: xtest.MustParseIA("1-ff00:0:110"), ID: 1}, + {IA: addr.MustParseIA("1-ff00:0:112"), ID: 2}, + {IA: addr.MustParseIA("1-ff00:0:110"), ID: 1}, }, }, }, @@ -572,8 +572,8 @@ func TestConjuctionPolicy(t *testing.T) { path.Path{ Meta: snet.PathMetadata{ Interfaces: []snet.PathInterface{ - {IA: xtest.MustParseIA("1-ff00:0:112"), ID: 2}, - {IA: xtest.MustParseIA("1-ff00:0:110"), ID: 1}, + {IA: addr.MustParseIA("1-ff00:0:112"), ID: 2}, + {IA: addr.MustParseIA("1-ff00:0:110"), ID: 1}, }, }, }, @@ -582,8 +582,8 @@ func TestConjuctionPolicy(t *testing.T) { path.Path{ Meta: snet.PathMetadata{ Interfaces: []snet.PathInterface{ - {IA: xtest.MustParseIA("1-ff00:0:112"), ID: 2}, - {IA: xtest.MustParseIA("1-ff00:0:110"), ID: 1}, + {IA: addr.MustParseIA("1-ff00:0:112"), ID: 2}, + {IA: addr.MustParseIA("1-ff00:0:110"), ID: 1}, }, }, }, @@ -597,24 +597,24 @@ func TestConjuctionPolicy(t *testing.T) { path.Path{ Meta: snet.PathMetadata{ Interfaces: []snet.PathInterface{ - {IA: xtest.MustParseIA("2-ff00:0:210"), ID: 2}, - {IA: xtest.MustParseIA("1-ff00:0:110"), ID: 1}, + {IA: addr.MustParseIA("2-ff00:0:210"), ID: 2}, + {IA: addr.MustParseIA("1-ff00:0:110"), ID: 1}, }, }, }, path.Path{ Meta: snet.PathMetadata{ Interfaces: []snet.PathInterface{ - {IA: xtest.MustParseIA("2-ff00:0:210"), ID: 2}, - {IA: xtest.MustParseIA("1-ff00:0:110"), ID: 2}, + {IA: addr.MustParseIA("2-ff00:0:210"), ID: 2}, + {IA: addr.MustParseIA("1-ff00:0:110"), ID: 2}, }, }, }, path.Path{ Meta: snet.PathMetadata{ Interfaces: []snet.PathInterface{ - {IA: xtest.MustParseIA("3-ff00:0:310"), ID: 1}, - {IA: xtest.MustParseIA("1-ff00:0:110"), ID: 1}, + {IA: addr.MustParseIA("3-ff00:0:310"), ID: 1}, + {IA: addr.MustParseIA("1-ff00:0:110"), ID: 1}, }, }, }, @@ -623,8 +623,8 @@ func TestConjuctionPolicy(t *testing.T) { path.Path{ Meta: snet.PathMetadata{ Interfaces: []snet.PathInterface{ - {IA: xtest.MustParseIA("2-ff00:0:210"), ID: 2}, - {IA: xtest.MustParseIA("1-ff00:0:110"), ID: 1}, + {IA: addr.MustParseIA("2-ff00:0:210"), ID: 2}, + {IA: addr.MustParseIA("1-ff00:0:110"), ID: 1}, }, }, }, @@ -633,16 +633,16 @@ func TestConjuctionPolicy(t *testing.T) { path.Path{ Meta: snet.PathMetadata{ Interfaces: []snet.PathInterface{ - {IA: xtest.MustParseIA("2-ff00:0:210"), ID: 2}, - {IA: xtest.MustParseIA("1-ff00:0:110"), ID: 2}, + {IA: addr.MustParseIA("2-ff00:0:210"), ID: 2}, + {IA: addr.MustParseIA("1-ff00:0:110"), ID: 2}, }, }, }, path.Path{ Meta: snet.PathMetadata{ Interfaces: []snet.PathInterface{ - {IA: xtest.MustParseIA("3-ff00:0:310"), ID: 1}, - {IA: xtest.MustParseIA("1-ff00:0:110"), ID: 1}, + {IA: addr.MustParseIA("3-ff00:0:310"), ID: 1}, + {IA: addr.MustParseIA("1-ff00:0:110"), ID: 1}, }, }, }, @@ -679,13 +679,13 @@ func TestNewPathPolForEnteringAS(t *testing.T) { }{ "empty interfaces": { Interfaces: []uint64{}, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), AcceptedPaths: []snet.Path{ path.Path{ Meta: snet.PathMetadata{ Interfaces: []snet.PathInterface{ - {IA: xtest.MustParseIA("1-ff00:0:112"), ID: 2}, - {IA: xtest.MustParseIA("1-ff00:0:110"), ID: 1}, + {IA: addr.MustParseIA("1-ff00:0:112"), ID: 2}, + {IA: addr.MustParseIA("1-ff00:0:110"), ID: 1}, }, }, }, @@ -693,13 +693,13 @@ func TestNewPathPolForEnteringAS(t *testing.T) { }, "single interface": { Interfaces: []uint64{1}, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), AcceptedPaths: []snet.Path{ path.Path{ Meta: snet.PathMetadata{ Interfaces: []snet.PathInterface{ - {IA: xtest.MustParseIA("1-ff00:0:112"), ID: 2}, - {IA: xtest.MustParseIA("1-ff00:0:110"), ID: 1}, + {IA: addr.MustParseIA("1-ff00:0:112"), ID: 2}, + {IA: addr.MustParseIA("1-ff00:0:110"), ID: 1}, }, }, }, @@ -708,17 +708,17 @@ func TestNewPathPolForEnteringAS(t *testing.T) { path.Path{ Meta: snet.PathMetadata{ Interfaces: []snet.PathInterface{ - {IA: xtest.MustParseIA("1-ff00:0:110"), ID: 1}, - {IA: xtest.MustParseIA("1-ff00:0:112"), ID: 2}, + {IA: addr.MustParseIA("1-ff00:0:110"), ID: 1}, + {IA: addr.MustParseIA("1-ff00:0:112"), ID: 2}, }, }, }, path.Path{ Meta: snet.PathMetadata{ Interfaces: []snet.PathInterface{ - {IA: xtest.MustParseIA("1-ff00:0:111"), ID: 25}, - {IA: xtest.MustParseIA("1-ff00:0:110"), ID: 1}, - {IA: xtest.MustParseIA("1-ff00:0:112"), ID: 2}, + {IA: addr.MustParseIA("1-ff00:0:111"), ID: 25}, + {IA: addr.MustParseIA("1-ff00:0:110"), ID: 1}, + {IA: addr.MustParseIA("1-ff00:0:112"), ID: 2}, }, }, }, @@ -726,8 +726,8 @@ func TestNewPathPolForEnteringAS(t *testing.T) { Meta: snet.PathMetadata{ Interfaces: []snet.PathInterface{ - {IA: xtest.MustParseIA("1-ff00:0:112"), ID: 2}, - {IA: xtest.MustParseIA("1-ff00:0:110"), ID: 2}, + {IA: addr.MustParseIA("1-ff00:0:112"), ID: 2}, + {IA: addr.MustParseIA("1-ff00:0:110"), ID: 2}, }, }, }, @@ -735,21 +735,21 @@ func TestNewPathPolForEnteringAS(t *testing.T) { }, "multi interface": { Interfaces: []uint64{1, 2, 3, 4}, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), AcceptedPaths: []snet.Path{ path.Path{ Meta: snet.PathMetadata{ Interfaces: []snet.PathInterface{ - {IA: xtest.MustParseIA("1-ff00:0:112"), ID: 2}, - {IA: xtest.MustParseIA("1-ff00:0:110"), ID: 1}, + {IA: addr.MustParseIA("1-ff00:0:112"), ID: 2}, + {IA: addr.MustParseIA("1-ff00:0:110"), ID: 1}, }, }, }, path.Path{ Meta: snet.PathMetadata{ Interfaces: []snet.PathInterface{ - {IA: xtest.MustParseIA("1-ff00:0:112"), ID: 2}, - {IA: xtest.MustParseIA("1-ff00:0:110"), ID: 2}, + {IA: addr.MustParseIA("1-ff00:0:112"), ID: 2}, + {IA: addr.MustParseIA("1-ff00:0:110"), ID: 2}, }, }, }, @@ -758,17 +758,17 @@ func TestNewPathPolForEnteringAS(t *testing.T) { path.Path{ Meta: snet.PathMetadata{ Interfaces: []snet.PathInterface{ - {IA: xtest.MustParseIA("1-ff00:0:110"), ID: 1}, - {IA: xtest.MustParseIA("1-ff00:0:112"), ID: 2}, + {IA: addr.MustParseIA("1-ff00:0:110"), ID: 1}, + {IA: addr.MustParseIA("1-ff00:0:112"), ID: 2}, }, }, }, path.Path{ Meta: snet.PathMetadata{ Interfaces: []snet.PathInterface{ - {IA: xtest.MustParseIA("1-ff00:0:111"), ID: 25}, - {IA: xtest.MustParseIA("1-ff00:0:110"), ID: 1}, - {IA: xtest.MustParseIA("1-ff00:0:112"), ID: 2}, + {IA: addr.MustParseIA("1-ff00:0:111"), ID: 25}, + {IA: addr.MustParseIA("1-ff00:0:110"), ID: 1}, + {IA: addr.MustParseIA("1-ff00:0:112"), ID: 2}, }, }, }, diff --git a/gateway/control/sessionmonitor_test.go b/gateway/control/sessionmonitor_test.go index b4f14c414f..b986823b2d 100644 --- a/gateway/control/sessionmonitor_test.go +++ b/gateway/control/sessionmonitor_test.go @@ -31,8 +31,8 @@ import ( "github.com/scionproto/scion/gateway/control" "github.com/scionproto/scion/gateway/control/mock_control" "github.com/scionproto/scion/gateway/pathhealth" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/mocks/net/mock_net" - "github.com/scionproto/scion/pkg/private/xtest" gatewaypb "github.com/scionproto/scion/pkg/proto/gateway" "github.com/scionproto/scion/pkg/snet" "github.com/scionproto/scion/pkg/snet/mock_snet" @@ -89,7 +89,7 @@ func TestSessionMonitorTestProbing(t *testing.T) { pathReg := mock_control.NewMockPathMonitorRegistration(ctrl) sessMon := control.SessionMonitor{ ID: 25, - RemoteIA: xtest.MustParseIA("1-ff00:0:110"), + RemoteIA: addr.MustParseIA("1-ff00:0:110"), ProbeAddr: &net.UDPAddr{IP: net.IP{10, 0, 01}, Port: 42}, Events: make(chan control.SessionEvent, 50), ProbeConn: conn, @@ -144,7 +144,7 @@ func TestSessionMonitorTestEvents(t *testing.T) { pathReg.EXPECT().Get().Return(pathhealth.Selection{}).AnyTimes() sessMon := control.SessionMonitor{ ID: 25, - RemoteIA: xtest.MustParseIA("1-ff00:0:110"), + RemoteIA: addr.MustParseIA("1-ff00:0:110"), ProbeAddr: &net.UDPAddr{IP: net.IP{10, 0, 01}, Port: 42}, Events: events, ProbeConn: conn, diff --git a/gateway/control/sessionpolicy_test.go b/gateway/control/sessionpolicy_test.go index 295ad6c92c..1926e8bca0 100644 --- a/gateway/control/sessionpolicy_test.go +++ b/gateway/control/sessionpolicy_test.go @@ -97,7 +97,7 @@ func TestLegacySessionPolicyAdapterParse(t *testing.T) { Expected: control.SessionPolicies{ control.SessionPolicy{ ID: 0, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), TrafficMatcher: pktcls.CondTrue, PerfPolicy: control.DefaultPerfPolicy, PathPolicy: control.DefaultPathPolicy, @@ -189,19 +189,19 @@ func TestSessionPoliciesRemoteIAs(t *testing.T) { }, "single entry": { Policies: control.SessionPolicies{ - control.SessionPolicy{IA: xtest.MustParseIA("1-ff00:0:110")}, + control.SessionPolicy{IA: addr.MustParseIA("1-ff00:0:110")}, }, - Expected: []addr.IA{xtest.MustParseIA("1-ff00:0:110")}, + Expected: []addr.IA{addr.MustParseIA("1-ff00:0:110")}, }, "multiple entries with duplicates": { Policies: control.SessionPolicies{ - control.SessionPolicy{IA: xtest.MustParseIA("1-ff00:0:110")}, - control.SessionPolicy{IA: xtest.MustParseIA("1-ff00:0:110")}, - control.SessionPolicy{IA: xtest.MustParseIA("1-ff00:0:111")}, + control.SessionPolicy{IA: addr.MustParseIA("1-ff00:0:110")}, + control.SessionPolicy{IA: addr.MustParseIA("1-ff00:0:110")}, + control.SessionPolicy{IA: addr.MustParseIA("1-ff00:0:111")}, }, Expected: []addr.IA{ - xtest.MustParseIA("1-ff00:0:110"), - xtest.MustParseIA("1-ff00:0:111"), + addr.MustParseIA("1-ff00:0:110"), + addr.MustParseIA("1-ff00:0:111"), }, }, } diff --git a/gateway/dataplane/BUILD.bazel b/gateway/dataplane/BUILD.bazel index a6e554f9e7..b6a3136e69 100644 --- a/gateway/dataplane/BUILD.bazel +++ b/gateway/dataplane/BUILD.bazel @@ -56,6 +56,7 @@ go_test( "//gateway/control:go_default_library", "//gateway/control/mock_control:go_default_library", "//gateway/pktcls:go_default_library", + "//pkg/addr:go_default_library", "//pkg/private/mocks/io/mock_io:go_default_library", "//pkg/private/mocks/net/mock_net:go_default_library", "//pkg/private/serrors:go_default_library", diff --git a/gateway/dataplane/session_test.go b/gateway/dataplane/session_test.go index 042ae7e231..e661e7584c 100644 --- a/gateway/dataplane/session_test.go +++ b/gateway/dataplane/session_test.go @@ -26,8 +26,8 @@ import ( "github.com/stretchr/testify/require" "go.uber.org/goleak" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/mocks/net/mock_net" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/snet" "github.com/scionproto/scion/pkg/snet/mock_snet" snetpath "github.com/scionproto/scion/pkg/snet/path" @@ -177,7 +177,7 @@ func createMockPath(ctrl *gomock.Controller, mtu uint16) snet.Path { MTU: mtu, } path := mock_snet.NewMockPath(ctrl) - path.EXPECT().Destination().Return(xtest.MustParseIA("1-ff00:0:300")).AnyTimes() + path.EXPECT().Destination().Return(addr.MustParseIA("1-ff00:0:300")).AnyTimes() path.EXPECT().Metadata().Return(meta).AnyTimes() path.EXPECT().Dataplane().Return(snetpath.SCION{Raw: []byte{}}).AnyTimes() path.EXPECT().UnderlayNextHop().Return(nil).AnyTimes() diff --git a/gateway/dataplane/worker_test.go b/gateway/dataplane/worker_test.go index 4d3c6e4451..7ce5c57b1e 100644 --- a/gateway/dataplane/worker_test.go +++ b/gateway/dataplane/worker_test.go @@ -21,7 +21,7 @@ import ( "github.com/stretchr/testify/assert" - "github.com/scionproto/scion/pkg/private/xtest" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/snet" "github.com/scionproto/scion/private/ringbuf" ) @@ -67,7 +67,7 @@ func SendFrame(t *testing.T, w *worker, data []byte) { func TestParsing(t *testing.T) { addr := &snet.UDPAddr{ - IA: xtest.MustParseIA("1-ff00:0:300"), + IA: addr.MustParseIA("1-ff00:0:300"), Host: &net.UDPAddr{ IP: net.IP{192, 168, 1, 1}, Port: 80, diff --git a/gateway/loader_test.go b/gateway/loader_test.go index 1e8aab931b..8185bd20fb 100644 --- a/gateway/loader_test.go +++ b/gateway/loader_test.go @@ -29,6 +29,7 @@ import ( "github.com/scionproto/scion/gateway/control/mock_control" "github.com/scionproto/scion/gateway/mock_gateway" "github.com/scionproto/scion/gateway/routing" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/serrors" "github.com/scionproto/scion/pkg/private/xtest" ) @@ -137,7 +138,7 @@ func TestLoaderRun(t *testing.T) { stopCh := make(chan struct{}) publisher := mock_gateway.NewMockPublisher(ctrl) - sessPols := control.SessionPolicies{{IA: xtest.MustParseIA("1-ff00:0:110")}} + sessPols := control.SessionPolicies{{IA: addr.MustParseIA("1-ff00:0:110")}} publisher.EXPECT().Publish(sessPols, &defaultPol).Do( func(control.SessionPolicies, *routing.Policy) { close(stopCh) }) parser := mock_control.NewMockSessionPolicyParser(ctrl) @@ -198,7 +199,7 @@ func TestLoaderRun(t *testing.T) { "load default routing policy": func(t *testing.T, ctrl *gomock.Controller) { stopCh := make(chan struct{}) publisher := mock_gateway.NewMockPublisher(ctrl) - sessPols := control.SessionPolicies{{IA: xtest.MustParseIA("1-ff00:0:110")}} + sessPols := control.SessionPolicies{{IA: addr.MustParseIA("1-ff00:0:110")}} defaultRP := &routing.Policy{DefaultAction: routing.Reject} publisher.EXPECT().Publish(sessPols, defaultRP).Do( func(control.SessionPolicies, *routing.Policy) { close(stopCh) }) diff --git a/gateway/routemgr/BUILD.bazel b/gateway/routemgr/BUILD.bazel index 5b53100710..e82353aa6e 100644 --- a/gateway/routemgr/BUILD.bazel +++ b/gateway/routemgr/BUILD.bazel @@ -30,6 +30,7 @@ go_test( deps = [ "//gateway/control:go_default_library", "//gateway/control/mock_control:go_default_library", + "//pkg/addr:go_default_library", "//pkg/log:go_default_library", "//pkg/private/serrors:go_default_library", "//pkg/private/xtest:go_default_library", diff --git a/gateway/routemgr/device_test.go b/gateway/routemgr/device_test.go index 86490f3e3b..107b191890 100644 --- a/gateway/routemgr/device_test.go +++ b/gateway/routemgr/device_test.go @@ -25,8 +25,8 @@ import ( "github.com/scionproto/scion/gateway/control" "github.com/scionproto/scion/gateway/control/mock_control" "github.com/scionproto/scion/gateway/routemgr" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/serrors" - "github.com/scionproto/scion/pkg/private/xtest" ) func TestSingleDeviceManager(t *testing.T) { @@ -34,7 +34,7 @@ func TestSingleDeviceManager(t *testing.T) { t.Parallel() m := routemgr.SingleDeviceManager{} - handle, err := m.Get(context.Background(), xtest.MustParseIA("1-ff00:0:1")) + handle, err := m.Get(context.Background(), addr.MustParseIA("1-ff00:0:1")) assert.Nil(t, handle) assert.NotNil(t, err) }) @@ -53,7 +53,7 @@ func TestSingleDeviceManager(t *testing.T) { DeviceOpener: mockDeviceOpener, } - handle, err := m.Get(context.Background(), xtest.MustParseIA("1-ff00:0:1")) + handle, err := m.Get(context.Background(), addr.MustParseIA("1-ff00:0:1")) assert.Nil(t, err) mockDeviceHandle.EXPECT().Close() @@ -74,9 +74,9 @@ func TestSingleDeviceManager(t *testing.T) { DeviceOpener: mockDeviceOpener, } - handle1, err := m.Get(context.Background(), xtest.MustParseIA("1-ff00:0:1")) + handle1, err := m.Get(context.Background(), addr.MustParseIA("1-ff00:0:1")) assert.Nil(t, err) - handle2, err := m.Get(context.Background(), xtest.MustParseIA("1-ff00:0:2")) + handle2, err := m.Get(context.Background(), addr.MustParseIA("1-ff00:0:2")) assert.Nil(t, err) mockDeviceHandle.EXPECT().Close() @@ -98,9 +98,9 @@ func TestSingleDeviceManager(t *testing.T) { DeviceOpener: mockDeviceOpener, } - handle1, err := m.Get(context.Background(), xtest.MustParseIA("1-ff00:0:1")) + handle1, err := m.Get(context.Background(), addr.MustParseIA("1-ff00:0:1")) assert.Nil(t, err) - handle2, err := m.Get(context.Background(), xtest.MustParseIA("1-ff00:0:1")) + handle2, err := m.Get(context.Background(), addr.MustParseIA("1-ff00:0:1")) assert.Nil(t, err) mockDeviceHandle.EXPECT().Close() @@ -122,7 +122,7 @@ func TestSingleDeviceManager(t *testing.T) { DeviceOpener: mockDeviceOpener, } - handle, err := m.Get(context.Background(), xtest.MustParseIA("1-ff00:0:1")) + handle, err := m.Get(context.Background(), addr.MustParseIA("1-ff00:0:1")) assert.Nil(t, handle) assert.NotNil(t, err) }) @@ -141,7 +141,7 @@ func TestSingleDeviceManager(t *testing.T) { DeviceOpener: mockDeviceOpener, } - handle, err := m.Get(context.Background(), xtest.MustParseIA("1-ff00:0:1")) + handle, err := m.Get(context.Background(), addr.MustParseIA("1-ff00:0:1")) assert.Nil(t, err) mockDeviceHandle.EXPECT().Close().Return(serrors.New("test error")) @@ -162,7 +162,7 @@ func TestSingleDeviceManager(t *testing.T) { DeviceOpener: mockDeviceOpener, } - handle, err := m.Get(context.Background(), xtest.MustParseIA("1-ff00:0:1")) + handle, err := m.Get(context.Background(), addr.MustParseIA("1-ff00:0:1")) assert.Nil(t, err) mockDeviceHandle.EXPECT().Close() @@ -184,7 +184,7 @@ func TestSingleDeviceManager(t *testing.T) { DeviceOpener: mockDeviceOpener, } - handle, err := m.Get(context.Background(), xtest.MustParseIA("1-ff00:0:1")) + handle, err := m.Get(context.Background(), addr.MustParseIA("1-ff00:0:1")) assert.Nil(t, err) t.Run("read", func(t *testing.T) { @@ -236,7 +236,7 @@ func TestSingleDeviceManager(t *testing.T) { DeviceOpener: mockDeviceOpener, } - handle, err := m.Get(context.Background(), xtest.MustParseIA("1-ff00:0:1")) + handle, err := m.Get(context.Background(), addr.MustParseIA("1-ff00:0:1")) assert.Nil(t, err) mockDeviceHandle.EXPECT().Close() @@ -269,7 +269,7 @@ func TestSingleDeviceManager(t *testing.T) { DeviceOpener: mockDeviceOpener, } - handle, err := m.Get(context.Background(), xtest.MustParseIA("1-ff00:0:1")) + handle, err := m.Get(context.Background(), addr.MustParseIA("1-ff00:0:1")) assert.Nil(t, err) mockDeviceHandle.EXPECT().Close() @@ -311,7 +311,7 @@ func TestSingleDeviceManager(t *testing.T) { DeviceOpener: mockDeviceOpener, } - handle, err := m.Get(context.Background(), xtest.MustParseIA("1-ff00:0:1")) + handle, err := m.Get(context.Background(), addr.MustParseIA("1-ff00:0:1")) assert.Nil(t, err) mockDeviceHandle.EXPECT().Close() @@ -352,7 +352,7 @@ func TestSingleDeviceManager(t *testing.T) { DeviceOpener: mockDeviceOpener, } - handle1, err := m.Get(context.Background(), xtest.MustParseIA("1-ff00:0:1")) + handle1, err := m.Get(context.Background(), addr.MustParseIA("1-ff00:0:1")) assert.Nil(t, err) mockDeviceHandle1.EXPECT().Close() @@ -361,7 +361,7 @@ func TestSingleDeviceManager(t *testing.T) { mockDeviceHandle2 := mock_control.NewMockDeviceHandle(ctrl) mockDeviceOpener.EXPECT().Open(gomock.Any(), gomock.Any()).Return(mockDeviceHandle2, nil) - handle2, err := m.Get(context.Background(), xtest.MustParseIA("1-ff00:0:1")) + handle2, err := m.Get(context.Background(), addr.MustParseIA("1-ff00:0:1")) assert.Nil(t, err) mockDeviceHandle2.EXPECT().Close() @@ -371,5 +371,5 @@ func TestSingleDeviceManager(t *testing.T) { func TestFixedTunnelName(t *testing.T) { namer := routemgr.FixedTunnelName("foo") - assert.Equal(t, "foo", namer(xtest.MustParseIA("1-ff00:0:1"))) + assert.Equal(t, "foo", namer(addr.MustParseIA("1-ff00:0:1"))) } diff --git a/gateway/routing/export_test.go b/gateway/routing/export_test.go index 9f54dbf9cc..c775e9d8d6 100644 --- a/gateway/routing/export_test.go +++ b/gateway/routing/export_test.go @@ -19,7 +19,7 @@ import ( "strings" "testing" - "github.com/scionproto/scion/pkg/private/xtest" + "github.com/scionproto/scion/pkg/addr" ) var ( @@ -33,12 +33,12 @@ func NewIAMatcher(t *testing.T, ia string) IAMatcher { if strings.HasPrefix(ia, "!") { return NegatedIAMatcher{ IAMatcher: SingleIAMatcher{ - IA: xtest.MustParseIA(strings.TrimPrefix(ia, "!")), + IA: addr.MustParseIA(strings.TrimPrefix(ia, "!")), }, } } return SingleIAMatcher{ - IA: xtest.MustParseIA(ia), + IA: addr.MustParseIA(ia), } } diff --git a/gateway/routing/matchers_test.go b/gateway/routing/matchers_test.go index 06fe942715..149488e8b1 100644 --- a/gateway/routing/matchers_test.go +++ b/gateway/routing/matchers_test.go @@ -20,7 +20,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/scionproto/scion/gateway/routing" - "github.com/scionproto/scion/pkg/private/xtest" + "github.com/scionproto/scion/pkg/addr" ) func TestSingleIAMatcher(t *testing.T) { @@ -73,10 +73,10 @@ func TestSingleIAMatcher(t *testing.T) { t.Run(name, func(t *testing.T) { t.Parallel() for _, matches := range tc.Matches { - assert.True(t, tc.Matcher.Match(xtest.MustParseIA(matches)), matches) + assert.True(t, tc.Matcher.Match(addr.MustParseIA(matches)), matches) } for _, notMatches := range tc.NotMatches { - assert.False(t, tc.Matcher.Match(xtest.MustParseIA(notMatches)), notMatches) + assert.False(t, tc.Matcher.Match(addr.MustParseIA(notMatches)), notMatches) } }) } diff --git a/gateway/routing/policy_test.go b/gateway/routing/policy_test.go index 3a4171b009..8a8c40574f 100644 --- a/gateway/routing/policy_test.go +++ b/gateway/routing/policy_test.go @@ -22,7 +22,7 @@ import ( "github.com/stretchr/testify/require" "github.com/scionproto/scion/gateway/routing" - "github.com/scionproto/scion/pkg/private/xtest" + "github.com/scionproto/scion/pkg/addr" ) func TestPolicyCopy(t *testing.T) { @@ -40,7 +40,7 @@ func TestPolicyCopy(t *testing.T) { }, "change rule custom": { action: func(p *routing.Policy) { - p.Rules[0].To = routing.SingleIAMatcher{IA: xtest.MustParseIA("1-ff00:0:113")} + p.Rules[0].To = routing.SingleIAMatcher{IA: addr.MustParseIA("1-ff00:0:113")} }, policy: &routing.Policy{ Rules: []routing.Rule{ @@ -191,7 +191,7 @@ func TestNetworkMatch(t *testing.T) { name, tc := name, tc t.Run(name, func(t *testing.T) { t.Parallel() - ia := xtest.MustParseIA("1-ff00:0:110") + ia := addr.MustParseIA("1-ff00:0:110") iaMatcher := routing.NewIAMatcher(t, "1-ff00:0:110") for i, r := range tc.policy.Rules { tc.policy.Rules[i] = routing.Rule{ diff --git a/pkg/addr/isdas.go b/pkg/addr/isdas.go index 64e9c50a8b..d4c42fb09c 100644 --- a/pkg/addr/isdas.go +++ b/pkg/addr/isdas.go @@ -54,6 +54,16 @@ func ParseISD(s string) (ISD, error) { return ISD(isd), nil } +// MustParseISD parses s and returns the corresponding addr.ISD object. It panics +// if s is not valid ISD representation. +func MustParseISD(s string) ISD { + isd, err := ParseISD(s) + if err != nil { + panic(err) + } + return isd +} + func (isd ISD) String() string { return strconv.FormatUint(uint64(isd), 10) } @@ -70,6 +80,16 @@ func ParseAS(as string) (AS, error) { return parseAS(as, ":") } +// MustParseAS parses s and returns the corresponding addr.AS object. It panics +// if s is not valid AS representation. +func MustParseAS(s string) AS { + as, err := ParseAS(s) + if err != nil { + panic(err) + } + return as +} + func parseAS(as string, sep string) (AS, error) { parts := strings.Split(as, sep) if len(parts) == 1 { @@ -173,6 +193,16 @@ func ParseIA(ia string) (IA, error) { return MustIAFrom(isd, as), nil } +// MustParseIA parses s and returns the corresponding addr.IA object. It +// panics if s is not a valid ISD-AS representation. +func MustParseIA(s string) IA { + ia, err := ParseIA(s) + if err != nil { + panic(err) + } + return ia +} + func (ia IA) ISD() ISD { return ISD(ia >> ASBits) } diff --git a/pkg/drkey/generic/BUILD.bazel b/pkg/drkey/generic/BUILD.bazel index afd06f2b2a..5b90513f59 100644 --- a/pkg/drkey/generic/BUILD.bazel +++ b/pkg/drkey/generic/BUILD.bazel @@ -18,6 +18,7 @@ go_test( srcs = ["generic_test.go"], data = glob(["testdata/**"]), deps = [ + "//pkg/addr:go_default_library", "//pkg/drkey:go_default_library", "//pkg/private/xtest:go_default_library", "//private/drkey/drkeytest:go_default_library", diff --git a/pkg/drkey/generic/generic_test.go b/pkg/drkey/generic/generic_test.go index 6a7b22b7d7..7851f78e92 100644 --- a/pkg/drkey/generic/generic_test.go +++ b/pkg/drkey/generic/generic_test.go @@ -22,6 +22,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/drkey" "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/private/drkey/drkeytest" @@ -31,8 +32,8 @@ var ( update = xtest.UpdateGoldenFiles() protoId = drkey.Generic epoch = drkey.NewEpoch(0, 1) - srcIA = xtest.MustParseIA("1-ff00:0:111") - dstIA = xtest.MustParseIA("1-ff00:0:112") + srcIA = addr.MustParseIA("1-ff00:0:111") + dstIA = addr.MustParseIA("1-ff00:0:112") srcHost = "127.0.0.2" dstHost = "127.0.0.1" ) diff --git a/pkg/drkey/specific/BUILD.bazel b/pkg/drkey/specific/BUILD.bazel index baad2183ac..761573fca7 100644 --- a/pkg/drkey/specific/BUILD.bazel +++ b/pkg/drkey/specific/BUILD.bazel @@ -19,6 +19,7 @@ go_test( data = glob(["testdata/**"]), deps = [ ":go_default_library", + "//pkg/addr:go_default_library", "//pkg/drkey:go_default_library", "//pkg/private/xtest:go_default_library", "//private/drkey/drkeytest:go_default_library", diff --git a/pkg/drkey/specific/specific_test.go b/pkg/drkey/specific/specific_test.go index 52aa8a893e..1a2b54abd3 100644 --- a/pkg/drkey/specific/specific_test.go +++ b/pkg/drkey/specific/specific_test.go @@ -22,6 +22,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/drkey" "github.com/scionproto/scion/pkg/drkey/specific" "github.com/scionproto/scion/pkg/private/xtest" @@ -32,8 +33,8 @@ var ( update = xtest.UpdateGoldenFiles() protoId = drkey.SCMP epoch = drkey.NewEpoch(0, 1) - srcIA = xtest.MustParseIA("1-ff00:0:111") - dstIA = xtest.MustParseIA("1-ff00:0:112") + srcIA = addr.MustParseIA("1-ff00:0:111") + dstIA = addr.MustParseIA("1-ff00:0:112") srcHost = "127.0.0.2" dstHost = "127.0.0.1" ) @@ -204,7 +205,7 @@ func TestDeriveLevel1(t *testing.T) { deriver := &specific.Deriver{} - dstIA := xtest.MustParseIA("1-ff00:0:112") + dstIA := addr.MustParseIA("1-ff00:0:112") level1Target := drkey.Key{0xa8, 0x23, 0xf5, 0xb9, 0x56, 0xde, 0x7c, 0xc, 0xbc, 0x5a, 0x69, 0x42, 0xf5, 0xb6, 0xfc, 0x10} diff --git a/pkg/experimental/epic/BUILD.bazel b/pkg/experimental/epic/BUILD.bazel index 15dc154e93..54ac3e65e6 100644 --- a/pkg/experimental/epic/BUILD.bazel +++ b/pkg/experimental/epic/BUILD.bazel @@ -25,7 +25,6 @@ go_test( embed = [":go_default_library"], deps = [ "//pkg/addr:go_default_library", - "//pkg/private/xtest:go_default_library", "//pkg/slayers:go_default_library", "//pkg/slayers/path/epic:go_default_library", "@com_github_stretchr_testify//assert:go_default_library", diff --git a/pkg/experimental/epic/epic_test.go b/pkg/experimental/epic/epic_test.go index 6d7bb32843..5f9d18e94e 100644 --- a/pkg/experimental/epic/epic_test.go +++ b/pkg/experimental/epic/epic_test.go @@ -23,7 +23,6 @@ import ( "github.com/scionproto/scion/pkg/addr" libepic "github.com/scionproto/scion/pkg/experimental/epic" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/slayers" "github.com/scionproto/scion/pkg/slayers/path/epic" ) @@ -381,7 +380,7 @@ func TestCoreFromPktCounter(t *testing.T) { func createScionCmnAddrHdr(t *testing.T) *slayers.SCION { t.Helper() spkt := &slayers.SCION{ - SrcIA: xtest.MustParseIA("2-ff00:0:222"), + SrcIA: addr.MustParseIA("2-ff00:0:222"), PayloadLen: 120, } _ = spkt.SetSrcAddr(addr.MustParseHost("10.0.0.100")) diff --git a/pkg/experimental/hiddenpath/authoritative_test.go b/pkg/experimental/hiddenpath/authoritative_test.go index abb6728163..569b8476e8 100644 --- a/pkg/experimental/hiddenpath/authoritative_test.go +++ b/pkg/experimental/hiddenpath/authoritative_test.go @@ -25,12 +25,11 @@ import ( "github.com/scionproto/scion/pkg/experimental/hiddenpath" "github.com/scionproto/scion/pkg/experimental/hiddenpath/mock_hiddenpath" "github.com/scionproto/scion/pkg/private/serrors" - "github.com/scionproto/scion/pkg/private/xtest" seg "github.com/scionproto/scion/pkg/segment" ) func TestAuthoritativeServerSegments(t *testing.T) { - local := xtest.MustParseIA("1-ff00:0:14") + local := addr.MustParseIA("1-ff00:0:14") testCases := map[string]struct { request hiddenpath.SegmentRequest local addr.IA @@ -42,17 +41,17 @@ func TestAuthoritativeServerSegments(t *testing.T) { "no groups in request": { request: hiddenpath.SegmentRequest{ GroupIDs: nil, - DstIA: xtest.MustParseIA("2-ff00:0:22"), - Peer: xtest.MustParseIA("1-ff00:0:13"), + DstIA: addr.MustParseIA("2-ff00:0:22"), + Peer: addr.MustParseIA("1-ff00:0:13"), }, db: func(ctrl *gomock.Controller) hiddenpath.Store { return nil }, groups: func() map[hiddenpath.GroupID]*hiddenpath.Group { return map[hiddenpath.GroupID]*hiddenpath.Group{ - {OwnerAS: xtest.MustParseAS("ff00:0:110")}: { - ID: hiddenpath.GroupID{OwnerAS: xtest.MustParseAS("ff00:0:110")}, - Readers: map[addr.IA]struct{}{xtest.MustParseIA("1-ff00:0:13"): {}}, + {OwnerAS: addr.MustParseAS("ff00:0:110")}: { + ID: hiddenpath.GroupID{OwnerAS: addr.MustParseAS("ff00:0:110")}, + Readers: map[addr.IA]struct{}{addr.MustParseIA("1-ff00:0:13"): {}}, Registries: map[addr.IA]struct{}{local: {}}, }, } @@ -63,20 +62,20 @@ func TestAuthoritativeServerSegments(t *testing.T) { "unknown group in request": { request: hiddenpath.SegmentRequest{ GroupIDs: []hiddenpath.GroupID{ - {OwnerAS: xtest.MustParseAS("ff00:0:110")}, - {OwnerAS: xtest.MustParseAS("ff00:0:404")}, + {OwnerAS: addr.MustParseAS("ff00:0:110")}, + {OwnerAS: addr.MustParseAS("ff00:0:404")}, }, - DstIA: xtest.MustParseIA("2-ff00:0:22"), - Peer: xtest.MustParseIA("1-ff00:0:13"), + DstIA: addr.MustParseIA("2-ff00:0:22"), + Peer: addr.MustParseIA("1-ff00:0:13"), }, db: func(ctrl *gomock.Controller) hiddenpath.Store { return nil }, groups: func() map[hiddenpath.GroupID]*hiddenpath.Group { return map[hiddenpath.GroupID]*hiddenpath.Group{ - {OwnerAS: xtest.MustParseAS("ff00:0:110")}: { - ID: hiddenpath.GroupID{OwnerAS: xtest.MustParseAS("ff00:0:110")}, - Readers: map[addr.IA]struct{}{xtest.MustParseIA("1-ff00:0:13"): {}}, + {OwnerAS: addr.MustParseAS("ff00:0:110")}: { + ID: hiddenpath.GroupID{OwnerAS: addr.MustParseAS("ff00:0:110")}, + Readers: map[addr.IA]struct{}{addr.MustParseIA("1-ff00:0:13"): {}}, Registries: map[addr.IA]struct{}{local: {}}, }, } @@ -87,25 +86,25 @@ func TestAuthoritativeServerSegments(t *testing.T) { "not reader in group": { request: hiddenpath.SegmentRequest{ GroupIDs: []hiddenpath.GroupID{ - {OwnerAS: xtest.MustParseAS("ff00:0:110")}, - {OwnerAS: xtest.MustParseAS("ff00:0:111")}, + {OwnerAS: addr.MustParseAS("ff00:0:110")}, + {OwnerAS: addr.MustParseAS("ff00:0:111")}, }, - DstIA: xtest.MustParseIA("2-ff00:0:22"), - Peer: xtest.MustParseIA("1-ff00:0:13"), + DstIA: addr.MustParseIA("2-ff00:0:22"), + Peer: addr.MustParseIA("1-ff00:0:13"), }, db: func(ctrl *gomock.Controller) hiddenpath.Store { return nil }, groups: func() map[hiddenpath.GroupID]*hiddenpath.Group { return map[hiddenpath.GroupID]*hiddenpath.Group{ - {OwnerAS: xtest.MustParseAS("ff00:0:110")}: { - ID: hiddenpath.GroupID{OwnerAS: xtest.MustParseAS("ff00:0:110")}, - Readers: map[addr.IA]struct{}{xtest.MustParseIA("1-ff00:0:13"): {}}, + {OwnerAS: addr.MustParseAS("ff00:0:110")}: { + ID: hiddenpath.GroupID{OwnerAS: addr.MustParseAS("ff00:0:110")}, + Readers: map[addr.IA]struct{}{addr.MustParseIA("1-ff00:0:13"): {}}, Registries: map[addr.IA]struct{}{local: {}}, }, - {OwnerAS: xtest.MustParseAS("ff00:0:111")}: { - ID: hiddenpath.GroupID{OwnerAS: xtest.MustParseAS("ff00:0:111")}, - Readers: map[addr.IA]struct{}{xtest.MustParseIA("1-ff00:0:25"): {}}, + {OwnerAS: addr.MustParseAS("ff00:0:111")}: { + ID: hiddenpath.GroupID{OwnerAS: addr.MustParseAS("ff00:0:111")}, + Readers: map[addr.IA]struct{}{addr.MustParseIA("1-ff00:0:25"): {}}, Registries: map[addr.IA]struct{}{local: {}}, }, } @@ -116,26 +115,26 @@ func TestAuthoritativeServerSegments(t *testing.T) { "non authoritative for group": { request: hiddenpath.SegmentRequest{ GroupIDs: []hiddenpath.GroupID{ - {OwnerAS: xtest.MustParseAS("ff00:0:110")}, - {OwnerAS: xtest.MustParseAS("ff00:0:111")}, + {OwnerAS: addr.MustParseAS("ff00:0:110")}, + {OwnerAS: addr.MustParseAS("ff00:0:111")}, }, - DstIA: xtest.MustParseIA("2-ff00:0:22"), - Peer: xtest.MustParseIA("1-ff00:0:13"), + DstIA: addr.MustParseIA("2-ff00:0:22"), + Peer: addr.MustParseIA("1-ff00:0:13"), }, db: func(ctrl *gomock.Controller) hiddenpath.Store { return nil }, groups: func() map[hiddenpath.GroupID]*hiddenpath.Group { return map[hiddenpath.GroupID]*hiddenpath.Group{ - {OwnerAS: xtest.MustParseAS("ff00:0:110")}: { - ID: hiddenpath.GroupID{OwnerAS: xtest.MustParseAS("ff00:0:110")}, - Readers: map[addr.IA]struct{}{xtest.MustParseIA("1-ff00:0:13"): {}}, + {OwnerAS: addr.MustParseAS("ff00:0:110")}: { + ID: hiddenpath.GroupID{OwnerAS: addr.MustParseAS("ff00:0:110")}, + Readers: map[addr.IA]struct{}{addr.MustParseIA("1-ff00:0:13"): {}}, Registries: map[addr.IA]struct{}{local: {}}, }, - {OwnerAS: xtest.MustParseAS("ff00:0:111")}: { - ID: hiddenpath.GroupID{OwnerAS: xtest.MustParseAS("ff00:0:111")}, - Readers: map[addr.IA]struct{}{xtest.MustParseIA("1-ff00:0:13"): {}}, - Registries: map[addr.IA]struct{}{xtest.MustParseIA("1-ff00:0:404"): {}}, + {OwnerAS: addr.MustParseAS("ff00:0:111")}: { + ID: hiddenpath.GroupID{OwnerAS: addr.MustParseAS("ff00:0:111")}, + Readers: map[addr.IA]struct{}{addr.MustParseIA("1-ff00:0:13"): {}}, + Registries: map[addr.IA]struct{}{addr.MustParseIA("1-ff00:0:404"): {}}, }, } }, @@ -145,31 +144,31 @@ func TestAuthoritativeServerSegments(t *testing.T) { "db error": { request: hiddenpath.SegmentRequest{ GroupIDs: []hiddenpath.GroupID{ - {OwnerAS: xtest.MustParseAS("ff00:0:110")}, - {OwnerAS: xtest.MustParseAS("ff00:0:111")}, + {OwnerAS: addr.MustParseAS("ff00:0:110")}, + {OwnerAS: addr.MustParseAS("ff00:0:111")}, }, - DstIA: xtest.MustParseIA("2-ff00:0:22"), - Peer: xtest.MustParseIA("1-ff00:0:13"), + DstIA: addr.MustParseIA("2-ff00:0:22"), + Peer: addr.MustParseIA("1-ff00:0:13"), }, db: func(ctrl *gomock.Controller) hiddenpath.Store { db := mock_hiddenpath.NewMockStore(ctrl) - db.EXPECT().Get(gomock.Any(), xtest.MustParseIA("2-ff00:0:22"), + db.EXPECT().Get(gomock.Any(), addr.MustParseIA("2-ff00:0:22"), []hiddenpath.GroupID{ - {OwnerAS: xtest.MustParseAS("ff00:0:110")}, - {OwnerAS: xtest.MustParseAS("ff00:0:111")}, + {OwnerAS: addr.MustParseAS("ff00:0:110")}, + {OwnerAS: addr.MustParseAS("ff00:0:111")}, }).Return(nil, serrors.New("test error")) return db }, groups: func() map[hiddenpath.GroupID]*hiddenpath.Group { return map[hiddenpath.GroupID]*hiddenpath.Group{ - {OwnerAS: xtest.MustParseAS("ff00:0:110")}: { - ID: hiddenpath.GroupID{OwnerAS: xtest.MustParseAS("ff00:0:110")}, - Readers: map[addr.IA]struct{}{xtest.MustParseIA("1-ff00:0:13"): {}}, + {OwnerAS: addr.MustParseAS("ff00:0:110")}: { + ID: hiddenpath.GroupID{OwnerAS: addr.MustParseAS("ff00:0:110")}, + Readers: map[addr.IA]struct{}{addr.MustParseIA("1-ff00:0:13"): {}}, Registries: map[addr.IA]struct{}{local: {}}, }, - {OwnerAS: xtest.MustParseAS("ff00:0:111")}: { - ID: hiddenpath.GroupID{OwnerAS: xtest.MustParseAS("ff00:0:111")}, - Readers: map[addr.IA]struct{}{xtest.MustParseIA("1-ff00:0:13"): {}}, + {OwnerAS: addr.MustParseAS("ff00:0:111")}: { + ID: hiddenpath.GroupID{OwnerAS: addr.MustParseAS("ff00:0:111")}, + Readers: map[addr.IA]struct{}{addr.MustParseIA("1-ff00:0:13"): {}}, Registries: map[addr.IA]struct{}{local: {}}, }, } @@ -180,31 +179,31 @@ func TestAuthoritativeServerSegments(t *testing.T) { "valid": { request: hiddenpath.SegmentRequest{ GroupIDs: []hiddenpath.GroupID{ - {OwnerAS: xtest.MustParseAS("ff00:0:110")}, - {OwnerAS: xtest.MustParseAS("ff00:0:111")}, + {OwnerAS: addr.MustParseAS("ff00:0:110")}, + {OwnerAS: addr.MustParseAS("ff00:0:111")}, }, - DstIA: xtest.MustParseIA("2-ff00:0:22"), - Peer: xtest.MustParseIA("1-ff00:0:13"), + DstIA: addr.MustParseIA("2-ff00:0:22"), + Peer: addr.MustParseIA("1-ff00:0:13"), }, db: func(ctrl *gomock.Controller) hiddenpath.Store { db := mock_hiddenpath.NewMockStore(ctrl) - db.EXPECT().Get(gomock.Any(), xtest.MustParseIA("2-ff00:0:22"), + db.EXPECT().Get(gomock.Any(), addr.MustParseIA("2-ff00:0:22"), []hiddenpath.GroupID{ - {OwnerAS: xtest.MustParseAS("ff00:0:110")}, - {OwnerAS: xtest.MustParseAS("ff00:0:111")}, + {OwnerAS: addr.MustParseAS("ff00:0:110")}, + {OwnerAS: addr.MustParseAS("ff00:0:111")}, }).Return([]*seg.Meta{{Type: seg.TypeDown}}, nil) return db }, groups: func() map[hiddenpath.GroupID]*hiddenpath.Group { return map[hiddenpath.GroupID]*hiddenpath.Group{ - {OwnerAS: xtest.MustParseAS("ff00:0:110")}: { - ID: hiddenpath.GroupID{OwnerAS: xtest.MustParseAS("ff00:0:110")}, - Readers: map[addr.IA]struct{}{xtest.MustParseIA("1-ff00:0:13"): {}}, + {OwnerAS: addr.MustParseAS("ff00:0:110")}: { + ID: hiddenpath.GroupID{OwnerAS: addr.MustParseAS("ff00:0:110")}, + Readers: map[addr.IA]struct{}{addr.MustParseIA("1-ff00:0:13"): {}}, Registries: map[addr.IA]struct{}{local: {}}, }, - {OwnerAS: xtest.MustParseAS("ff00:0:111")}: { - ID: hiddenpath.GroupID{OwnerAS: xtest.MustParseAS("ff00:0:111")}, - Readers: map[addr.IA]struct{}{xtest.MustParseIA("1-ff00:0:13"): {}}, + {OwnerAS: addr.MustParseAS("ff00:0:111")}: { + ID: hiddenpath.GroupID{OwnerAS: addr.MustParseAS("ff00:0:111")}, + Readers: map[addr.IA]struct{}{addr.MustParseIA("1-ff00:0:13"): {}}, Registries: map[addr.IA]struct{}{local: {}}, }, } diff --git a/pkg/experimental/hiddenpath/beaconwriter_test.go b/pkg/experimental/hiddenpath/beaconwriter_test.go index 8c217c60ab..5844b4c30e 100644 --- a/pkg/experimental/hiddenpath/beaconwriter_test.go +++ b/pkg/experimental/hiddenpath/beaconwriter_test.go @@ -147,7 +147,7 @@ func TestRemoteBeaconWriterWrite(t *testing.T) { rpc := mock_hiddenpath.NewMockRegister(ctrl) rpc.EXPECT().RegisterSegment(gomock.Any(), gomock.Any(), addrMatcher{udp: &snet.UDPAddr{ - IA: xtest.MustParseIA("1-ff00:0:114"), + IA: addr.MustParseIA("1-ff00:0:114"), Host: xtest.MustParseUDPAddr(t, "10.1.0.1:404"), }}).Times(2).DoAndReturn( func(_ context.Context, reg hiddenpath.SegmentRegistration, _ net.Addr) error { @@ -163,19 +163,19 @@ func TestRemoteBeaconWriterWrite(t *testing.T) { mustParseGroupID(t, "ff00:0:140-2"): { ID: mustParseGroupID(t, "ff00:0:140-2"), Registries: map[addr.IA]struct{}{ - xtest.MustParseIA("1-ff00:0:114"): {}, + addr.MustParseIA("1-ff00:0:114"): {}, }, - Writers: map[addr.IA]struct{}{xtest.MustParseIA("1-ff00:0:111"): {}}, + Writers: map[addr.IA]struct{}{addr.MustParseIA("1-ff00:0:111"): {}}, }, }, }, }, resolver: func(ctrl *gomock.Controller) hiddenpath.AddressResolver { resolver := mock_hiddenpath.NewMockAddressResolver(ctrl) - resolver.EXPECT().Resolve(gomock.Any(), xtest.MustParseIA("1-ff00:0:114")). + resolver.EXPECT().Resolve(gomock.Any(), addr.MustParseIA("1-ff00:0:114")). Times(2).Return( &snet.UDPAddr{ - IA: xtest.MustParseIA("1-ff00:0:114"), + IA: addr.MustParseIA("1-ff00:0:114"), Host: xtest.MustParseUDPAddr(t, "10.1.0.1:404"), }, nil) return resolver @@ -288,7 +288,7 @@ func sortedIntfs(intfs *ifstate.Interfaces, linkType topology.LinkType) []uint16 func matchSVCCS(ia string) gomock.Matcher { return addrMatcher{ svc: &snet.SVCAddr{ - IA: xtest.MustParseIA(ia), + IA: addr.MustParseIA(ia), SVC: addr.SvcCS, }, } diff --git a/pkg/experimental/hiddenpath/discovery_test.go b/pkg/experimental/hiddenpath/discovery_test.go index ee016680e4..117cc1b070 100644 --- a/pkg/experimental/hiddenpath/discovery_test.go +++ b/pkg/experimental/hiddenpath/discovery_test.go @@ -42,7 +42,7 @@ func TestRegistrationResolverResolve(t *testing.T) { "router error": { router: func(ctrl *gomock.Controller) snet.Router { router := mock_snet.NewMockRouter(ctrl) - router.EXPECT().Route(gomock.Any(), xtest.MustParseIA("1-ff00:0:110")). + router.EXPECT().Route(gomock.Any(), addr.MustParseIA("1-ff00:0:110")). Return(nil, serrors.New("test")) return router }, @@ -55,7 +55,7 @@ func TestRegistrationResolverResolve(t *testing.T) { "no paths found": { router: func(ctrl *gomock.Controller) snet.Router { router := mock_snet.NewMockRouter(ctrl) - router.EXPECT().Route(gomock.Any(), xtest.MustParseIA("1-ff00:0:110")). + router.EXPECT().Route(gomock.Any(), addr.MustParseIA("1-ff00:0:110")). Return(nil, nil) return router }, @@ -72,14 +72,14 @@ func TestRegistrationResolverResolve(t *testing.T) { path.EXPECT().Dataplane().Return(snetpath.SCION{Raw: []byte("path")}).AnyTimes() path.EXPECT().UnderlayNextHop().AnyTimes().Return( xtest.MustParseUDPAddr(t, "10.1.0.1:404")) - router.EXPECT().Route(gomock.Any(), xtest.MustParseIA("1-ff00:0:110")). + router.EXPECT().Route(gomock.Any(), addr.MustParseIA("1-ff00:0:110")). Return(path, nil) return router }, discoverer: func(ctrl *gomock.Controller) hiddenpath.Discoverer { d := mock_hiddenpath.NewMockDiscoverer(ctrl) d.EXPECT().Discover(gomock.Any(), addrMatcher{svc: &snet.SVCAddr{ - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), NextHop: xtest.MustParseUDPAddr(t, "10.1.0.1:404"), Path: snetpath.SCION{Raw: []byte("path")}, SVC: addr.SvcDS, @@ -96,14 +96,14 @@ func TestRegistrationResolverResolve(t *testing.T) { path.EXPECT().Dataplane().Return(snetpath.SCION{Raw: []byte("path")}).AnyTimes() path.EXPECT().UnderlayNextHop().AnyTimes().Return( xtest.MustParseUDPAddr(t, "10.1.0.1:404")) - router.EXPECT().Route(gomock.Any(), xtest.MustParseIA("1-ff00:0:110")). + router.EXPECT().Route(gomock.Any(), addr.MustParseIA("1-ff00:0:110")). Return(path, nil) return router }, discoverer: func(ctrl *gomock.Controller) hiddenpath.Discoverer { d := mock_hiddenpath.NewMockDiscoverer(ctrl) d.EXPECT().Discover(gomock.Any(), addrMatcher{svc: &snet.SVCAddr{ - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), NextHop: xtest.MustParseUDPAddr(t, "10.1.0.1:404"), Path: snetpath.SCION{Raw: []byte("path")}, SVC: addr.SvcDS, @@ -120,14 +120,14 @@ func TestRegistrationResolverResolve(t *testing.T) { path.EXPECT().Dataplane().Return(snetpath.SCION{Raw: []byte("path")}).AnyTimes() path.EXPECT().UnderlayNextHop().AnyTimes().Return( xtest.MustParseUDPAddr(t, "10.1.0.1:404")) - router.EXPECT().Route(gomock.Any(), xtest.MustParseIA("1-ff00:0:110")). + router.EXPECT().Route(gomock.Any(), addr.MustParseIA("1-ff00:0:110")). Return(path, nil) return router }, discoverer: func(ctrl *gomock.Controller) hiddenpath.Discoverer { d := mock_hiddenpath.NewMockDiscoverer(ctrl) d.EXPECT().Discover(gomock.Any(), addrMatcher{svc: &snet.SVCAddr{ - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), NextHop: xtest.MustParseUDPAddr(t, "10.1.0.1:404"), Path: snetpath.SCION{Raw: []byte("path")}, SVC: addr.SvcDS, @@ -140,7 +140,7 @@ func TestRegistrationResolverResolve(t *testing.T) { }, assertErr: assert.NoError, want: &snet.UDPAddr{ - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), Host: xtest.MustParseUDPAddr(t, "10.1.0.5:42"), NextHop: xtest.MustParseUDPAddr(t, "10.1.0.1:404"), Path: snetpath.SCION{Raw: []byte("path")}, @@ -159,7 +159,7 @@ func TestRegistrationResolverResolve(t *testing.T) { Router: tc.router(ctrl), Discoverer: tc.discoverer(ctrl), } - got, err := r.Resolve(context.Background(), xtest.MustParseIA("1-ff00:0:110")) + got, err := r.Resolve(context.Background(), addr.MustParseIA("1-ff00:0:110")) tc.assertErr(t, err) assert.Equal(t, tc.want, got) diff --git a/pkg/experimental/hiddenpath/forwarder_test.go b/pkg/experimental/hiddenpath/forwarder_test.go index 6d5d54a287..60317d8c9d 100644 --- a/pkg/experimental/hiddenpath/forwarder_test.go +++ b/pkg/experimental/hiddenpath/forwarder_test.go @@ -25,12 +25,11 @@ import ( "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/experimental/hiddenpath" "github.com/scionproto/scion/pkg/experimental/hiddenpath/mock_hiddenpath" - "github.com/scionproto/scion/pkg/private/xtest" seg "github.com/scionproto/scion/pkg/segment" ) func TestForwardServerSegments(t *testing.T) { - local := xtest.MustParseIA("1-ff00:0:110") + local := addr.MustParseIA("1-ff00:0:110") testCases := map[string]struct { request hiddenpath.SegmentRequest groups func() map[hiddenpath.GroupID]*hiddenpath.Group @@ -44,20 +43,20 @@ func TestForwardServerSegments(t *testing.T) { "valid": { request: hiddenpath.SegmentRequest{ GroupIDs: []hiddenpath.GroupID{ - {OwnerAS: xtest.MustParseAS("ff00:0:110")}, - {OwnerAS: xtest.MustParseAS("ff00:0:111")}, - {OwnerAS: xtest.MustParseAS("ff00:0:112")}, + {OwnerAS: addr.MustParseAS("ff00:0:110")}, + {OwnerAS: addr.MustParseAS("ff00:0:111")}, + {OwnerAS: addr.MustParseAS("ff00:0:112")}, }, - DstIA: xtest.MustParseIA("2-ff00:0:22"), + DstIA: addr.MustParseIA("2-ff00:0:22"), }, rpc: func(c *gomock.Controller) hiddenpath.RPC { ret := mock_hiddenpath.NewMockRPC(c) ret.EXPECT().HiddenSegments(gomock.Any(), hiddenpath.SegmentRequest{ GroupIDs: []hiddenpath.GroupID{ - {OwnerAS: xtest.MustParseAS("ff00:0:111")}, - {OwnerAS: xtest.MustParseAS("ff00:0:112")}, + {OwnerAS: addr.MustParseAS("ff00:0:111")}, + {OwnerAS: addr.MustParseAS("ff00:0:112")}, }, - DstIA: xtest.MustParseIA("2-ff00:0:22"), + DstIA: addr.MustParseIA("2-ff00:0:22"), }, gomock.Any()).Return([]*seg.Meta{{Type: seg.TypeDown}}, nil). Times(1) @@ -67,10 +66,10 @@ func TestForwardServerSegments(t *testing.T) { ret := mock_hiddenpath.NewMockLookuper(c) ret.EXPECT().Segments(gomock.Any(), hiddenpath.SegmentRequest{ GroupIDs: []hiddenpath.GroupID{ - {OwnerAS: xtest.MustParseAS("ff00:0:110")}, + {OwnerAS: addr.MustParseAS("ff00:0:110")}, }, - DstIA: xtest.MustParseIA("2-ff00:0:22"), - Peer: xtest.MustParseIA("1-ff00:0:110"), + DstIA: addr.MustParseIA("2-ff00:0:22"), + Peer: addr.MustParseIA("1-ff00:0:110"), }). Return([]*seg.Meta{{Type: seg.TypeDown}}, nil). Times(1) @@ -84,17 +83,17 @@ func TestForwardServerSegments(t *testing.T) { }, groups: func() map[hiddenpath.GroupID]*hiddenpath.Group { return map[hiddenpath.GroupID]*hiddenpath.Group{ - {OwnerAS: xtest.MustParseAS("ff00:0:110")}: { - ID: hiddenpath.GroupID{OwnerAS: xtest.MustParseAS("ff00:0:110")}, - Registries: map[addr.IA]struct{}{xtest.MustParseIA("1-ff00:0:110"): {}}, + {OwnerAS: addr.MustParseAS("ff00:0:110")}: { + ID: hiddenpath.GroupID{OwnerAS: addr.MustParseAS("ff00:0:110")}, + Registries: map[addr.IA]struct{}{addr.MustParseIA("1-ff00:0:110"): {}}, }, - {OwnerAS: xtest.MustParseAS("ff00:0:111")}: { - ID: hiddenpath.GroupID{OwnerAS: xtest.MustParseAS("ff00:0:111")}, - Registries: map[addr.IA]struct{}{xtest.MustParseIA("1-ff00:0:111"): {}}, + {OwnerAS: addr.MustParseAS("ff00:0:111")}: { + ID: hiddenpath.GroupID{OwnerAS: addr.MustParseAS("ff00:0:111")}, + Registries: map[addr.IA]struct{}{addr.MustParseIA("1-ff00:0:111"): {}}, }, - {OwnerAS: xtest.MustParseAS("ff00:0:112")}: { - ID: hiddenpath.GroupID{OwnerAS: xtest.MustParseAS("ff00:0:112")}, - Registries: map[addr.IA]struct{}{xtest.MustParseIA("1-ff00:0:111"): {}}, + {OwnerAS: addr.MustParseAS("ff00:0:112")}: { + ID: hiddenpath.GroupID{OwnerAS: addr.MustParseAS("ff00:0:112")}, + Registries: map[addr.IA]struct{}{addr.MustParseIA("1-ff00:0:111"): {}}, }, } }, diff --git a/pkg/experimental/hiddenpath/group_test.go b/pkg/experimental/hiddenpath/group_test.go index 4aa9fd0707..e10f6d12a1 100644 --- a/pkg/experimental/hiddenpath/group_test.go +++ b/pkg/experimental/hiddenpath/group_test.go @@ -32,8 +32,8 @@ var update = xtest.UpdateGoldenFiles() func TestGroupIDUint64Conversion(t *testing.T) { testCases := []hiddenpath.GroupID{ - {OwnerAS: xtest.MustParseAS("ff00:0:110"), Suffix: 24}, - {OwnerAS: xtest.MustParseAS("ff00:0:112"), Suffix: 0}, + {OwnerAS: addr.MustParseAS("ff00:0:110"), Suffix: 24}, + {OwnerAS: addr.MustParseAS("ff00:0:112"), Suffix: 0}, } for i, id := range testCases { i, id := i, id @@ -53,44 +53,44 @@ func TestNewGroup(t *testing.T) { input: "./testdata/groups.yml", want: hiddenpath.Groups{ hiddenpath.GroupID{ - OwnerAS: xtest.MustParseAS("ff00:0:110"), + OwnerAS: addr.MustParseAS("ff00:0:110"), Suffix: 0x69b5, }: { ID: hiddenpath.GroupID{ - OwnerAS: xtest.MustParseAS("ff00:0:110"), + OwnerAS: addr.MustParseAS("ff00:0:110"), Suffix: 0x69b5, }, - Owner: xtest.MustParseIA("1-ff00:0:110"), + Owner: addr.MustParseIA("1-ff00:0:110"), Writers: map[addr.IA]struct{}{ - xtest.MustParseIA("1-ff00:0:111"): {}, - xtest.MustParseIA("1-ff00:0:112"): {}, + addr.MustParseIA("1-ff00:0:111"): {}, + addr.MustParseIA("1-ff00:0:112"): {}, }, Readers: map[addr.IA]struct{}{ - xtest.MustParseIA("1-ff00:0:114"): {}, + addr.MustParseIA("1-ff00:0:114"): {}, }, Registries: map[addr.IA]struct{}{ - xtest.MustParseIA("1-ff00:0:111"): {}, - xtest.MustParseIA("1-ff00:0:113"): {}, + addr.MustParseIA("1-ff00:0:111"): {}, + addr.MustParseIA("1-ff00:0:113"): {}, }, }, hiddenpath.GroupID{ - OwnerAS: xtest.MustParseAS("ff00:0:222"), + OwnerAS: addr.MustParseAS("ff00:0:222"), Suffix: 0xabcd, }: { ID: hiddenpath.GroupID{ - OwnerAS: xtest.MustParseAS("ff00:0:222"), + OwnerAS: addr.MustParseAS("ff00:0:222"), Suffix: 0xabcd, }, - Owner: xtest.MustParseIA("1-ff00:0:222"), + Owner: addr.MustParseIA("1-ff00:0:222"), Writers: map[addr.IA]struct{}{ - xtest.MustParseIA("1-ff00:0:111"): {}, - xtest.MustParseIA("1-ff00:0:112"): {}, + addr.MustParseIA("1-ff00:0:111"): {}, + addr.MustParseIA("1-ff00:0:112"): {}, }, Readers: map[addr.IA]struct{}{ - xtest.MustParseIA("1-ff00:0:114"): {}, + addr.MustParseIA("1-ff00:0:114"): {}, }, Registries: map[addr.IA]struct{}{ - xtest.MustParseIA("1-ff00:0:115"): {}, + addr.MustParseIA("1-ff00:0:115"): {}, }, }, }, @@ -125,22 +125,22 @@ func TestGroupValidate(t *testing.T) { "valid": { input: &hiddenpath.Group{ ID: hiddenpath.GroupID{ - OwnerAS: xtest.MustParseAS("ff00:0:110"), + OwnerAS: addr.MustParseAS("ff00:0:110"), Suffix: 0x69b5, }, - Owner: xtest.MustParseIA("1-ff00:0:110"), + Owner: addr.MustParseIA("1-ff00:0:110"), Writers: map[addr.IA]struct{}{ - xtest.MustParseIA("1-ff00:0:111"): {}, - xtest.MustParseIA("1-ff00:0:112"): {}, + addr.MustParseIA("1-ff00:0:111"): {}, + addr.MustParseIA("1-ff00:0:112"): {}, }, Readers: map[addr.IA]struct{}{ - xtest.MustParseIA("1-ff00:0:113"): {}, - xtest.MustParseIA("1-ff00:0:114"): {}, + addr.MustParseIA("1-ff00:0:113"): {}, + addr.MustParseIA("1-ff00:0:114"): {}, }, Registries: map[addr.IA]struct{}{ - xtest.MustParseIA("1-ff00:0:110"): {}, - xtest.MustParseIA("1-ff00:0:111"): {}, - xtest.MustParseIA("1-ff00:0:115"): {}, + addr.MustParseIA("1-ff00:0:110"): {}, + addr.MustParseIA("1-ff00:0:111"): {}, + addr.MustParseIA("1-ff00:0:115"): {}, }, }, assertError: assert.NoError, @@ -154,7 +154,7 @@ func TestGroupValidate(t *testing.T) { "invalid owner": { input: &hiddenpath.Group{ ID: hiddenpath.GroupID{ - OwnerAS: xtest.MustParseAS("ff00:0:110"), + OwnerAS: addr.MustParseAS("ff00:0:110"), Suffix: 0x69b5, }, Owner: 0, @@ -164,20 +164,20 @@ func TestGroupValidate(t *testing.T) { "invalid owner and group id": { input: &hiddenpath.Group{ ID: hiddenpath.GroupID{ - OwnerAS: xtest.MustParseAS("ff00:0:110"), + OwnerAS: addr.MustParseAS("ff00:0:110"), Suffix: 0x69b5, }, - Owner: xtest.MustParseIA("1-ff00:0:111"), + Owner: addr.MustParseIA("1-ff00:0:111"), }, assertError: assert.Error, }, "invalid writers": { input: &hiddenpath.Group{ ID: hiddenpath.GroupID{ - OwnerAS: xtest.MustParseAS("ff00:0:110"), + OwnerAS: addr.MustParseAS("ff00:0:110"), Suffix: 0x69b5, }, - Owner: xtest.MustParseIA("1-ff00:0:110"), + Owner: addr.MustParseIA("1-ff00:0:110"), Writers: map[addr.IA]struct{}{}, Readers: map[addr.IA]struct{}{}, Registries: map[addr.IA]struct{}{}, diff --git a/pkg/experimental/hiddenpath/grpc/lookup_test.go b/pkg/experimental/hiddenpath/grpc/lookup_test.go index 6b7becdc83..f2742d0ab7 100644 --- a/pkg/experimental/hiddenpath/grpc/lookup_test.go +++ b/pkg/experimental/hiddenpath/grpc/lookup_test.go @@ -25,11 +25,11 @@ import ( "google.golang.org/grpc/peer" "google.golang.org/protobuf/proto" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/experimental/hiddenpath" "github.com/scionproto/scion/pkg/experimental/hiddenpath/grpc" "github.com/scionproto/scion/pkg/experimental/hiddenpath/mock_hiddenpath" "github.com/scionproto/scion/pkg/private/serrors" - "github.com/scionproto/scion/pkg/private/xtest" hspb "github.com/scionproto/scion/pkg/proto/hidden_segment" "github.com/scionproto/scion/pkg/scrypto/signed" seg "github.com/scionproto/scion/pkg/segment" @@ -55,7 +55,7 @@ func TestSegmentServerHiddenSegments(t *testing.T) { ret := mock_hiddenpath.NewMockLookuper(ctrl) ret.EXPECT().Segments(gomock.Any(), hiddenpath.SegmentRequest{ GroupIDs: mustParseGroupIDs(t, "ff00:0:22-1", "ff00:0:42-5"), - DstIA: xtest.MustParseIA("1-ff00:0:110"), + DstIA: addr.MustParseIA("1-ff00:0:110"), }).Return(nil, serrors.New("error")).Times(1) return ret }, @@ -72,7 +72,7 @@ func TestSegmentServerHiddenSegments(t *testing.T) { ret := mock_hiddenpath.NewMockLookuper(ctrl) ret.EXPECT().Segments(gomock.Any(), hiddenpath.SegmentRequest{ GroupIDs: mustParseGroupIDs(t, "ff00:0:22-1", "ff00:0:42-5"), - DstIA: xtest.MustParseIA("1-ff00:0:110"), + DstIA: addr.MustParseIA("1-ff00:0:110"), }).Return(segsMeta, nil).Times(1) return ret }, @@ -150,7 +150,7 @@ func TestAuthoritativeSegmentServerAuthoritativeHiddenSegments(t *testing.T) { "verification error": { createCtx: func(t *testing.T) context.Context { return peer.NewContext(context.Background(), &peer.Peer{Addr: &snet.UDPAddr{ - IA: xtest.MustParseIA("1-ff00:0:14"), + IA: addr.MustParseIA("1-ff00:0:14"), }}) }, lookuper: func(ctrl *gomock.Controller) hiddenpath.Lookuper { @@ -159,7 +159,7 @@ func TestAuthoritativeSegmentServerAuthoritativeHiddenSegments(t *testing.T) { verifier: func(ctrl *gomock.Controller) infra.Verifier { v := mock_infra.NewMockVerifier(ctrl) v.EXPECT().WithServer(gomock.Any()).Return(v) - v.EXPECT().WithIA(xtest.MustParseIA("1-ff00:0:14")).Return(v) + v.EXPECT().WithIA(addr.MustParseIA("1-ff00:0:14")).Return(v) v.EXPECT().Verify(gomock.Any(), gomock.Any(), gomock.Any()). Return(nil, serrors.New("verification error")) return v @@ -171,15 +171,15 @@ func TestAuthoritativeSegmentServerAuthoritativeHiddenSegments(t *testing.T) { "lookuper error": { createCtx: func(t *testing.T) context.Context { return peer.NewContext(context.Background(), &peer.Peer{Addr: &snet.UDPAddr{ - IA: xtest.MustParseIA("1-ff00:0:14"), + IA: addr.MustParseIA("1-ff00:0:14"), }}) }, lookuper: func(ctrl *gomock.Controller) hiddenpath.Lookuper { lookuper := mock_hiddenpath.NewMockLookuper(ctrl) lookuper.EXPECT().Segments(gomock.Any(), hiddenpath.SegmentRequest{ GroupIDs: mustParseGroupIDs(t, "ff00:0:22-1", "ff00:0:42-5"), - DstIA: xtest.MustParseIA("1-ff00:0:110"), - Peer: xtest.MustParseIA("1-ff00:0:14"), + DstIA: addr.MustParseIA("1-ff00:0:110"), + Peer: addr.MustParseIA("1-ff00:0:14"), }).Return(nil, serrors.New("test error")) return lookuper }, @@ -190,7 +190,7 @@ func TestAuthoritativeSegmentServerAuthoritativeHiddenSegments(t *testing.T) { }) v := mock_infra.NewMockVerifier(ctrl) v.EXPECT().WithServer(gomock.Any()).Return(v) - v.EXPECT().WithIA(xtest.MustParseIA("1-ff00:0:14")).Return(v) + v.EXPECT().WithIA(addr.MustParseIA("1-ff00:0:14")).Return(v) v.EXPECT().Verify(gomock.Any(), gomock.Any(), gomock.Any()).Return(&signed.Message{ Body: body, }, nil) @@ -203,15 +203,15 @@ func TestAuthoritativeSegmentServerAuthoritativeHiddenSegments(t *testing.T) { "valid": { createCtx: func(t *testing.T) context.Context { return peer.NewContext(context.Background(), &peer.Peer{Addr: &snet.UDPAddr{ - IA: xtest.MustParseIA("1-ff00:0:14"), + IA: addr.MustParseIA("1-ff00:0:14"), }}) }, lookuper: func(ctrl *gomock.Controller) hiddenpath.Lookuper { lookuper := mock_hiddenpath.NewMockLookuper(ctrl) lookuper.EXPECT().Segments(gomock.Any(), hiddenpath.SegmentRequest{ GroupIDs: mustParseGroupIDs(t, "ff00:0:22-1", "ff00:0:42-5"), - DstIA: xtest.MustParseIA("1-ff00:0:110"), - Peer: xtest.MustParseIA("1-ff00:0:14"), + DstIA: addr.MustParseIA("1-ff00:0:110"), + Peer: addr.MustParseIA("1-ff00:0:14"), }).Return(segsMeta, nil) return lookuper }, @@ -222,7 +222,7 @@ func TestAuthoritativeSegmentServerAuthoritativeHiddenSegments(t *testing.T) { }) v := mock_infra.NewMockVerifier(ctrl) v.EXPECT().WithServer(gomock.Any()).Return(v) - v.EXPECT().WithIA(xtest.MustParseIA("1-ff00:0:14")).Return(v) + v.EXPECT().WithIA(addr.MustParseIA("1-ff00:0:14")).Return(v) v.EXPECT().Verify(gomock.Any(), gomock.Any(), gomock.Any()).Return(&signed.Message{ Body: body, }, nil) @@ -256,7 +256,7 @@ func TestAuthoritativeSegmentServerAuthoritativeHiddenSegments(t *testing.T) { } func mustIA(s string) uint64 { - return uint64(xtest.MustParseIA(s)) + return uint64(addr.MustParseIA(s)) } func mustParseGroupIDs(t *testing.T, ids ...string) []hiddenpath.GroupID { diff --git a/pkg/experimental/hiddenpath/grpc/registerer_test.go b/pkg/experimental/hiddenpath/grpc/registerer_test.go index cfff599c5e..26a1820699 100644 --- a/pkg/experimental/hiddenpath/grpc/registerer_test.go +++ b/pkg/experimental/hiddenpath/grpc/registerer_test.go @@ -26,6 +26,7 @@ import ( "github.com/scionproto/scion/control/beaconing" "github.com/scionproto/scion/control/beaconing/mock_beaconing" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/experimental/hiddenpath" hpgrpc "github.com/scionproto/scion/pkg/experimental/hiddenpath/grpc" "github.com/scionproto/scion/pkg/experimental/hiddenpath/grpc/mock_grpc" @@ -122,7 +123,7 @@ func TestRegistererRegisterSegment(t *testing.T) { func createSeg(t *testing.T) seg.Meta { t.Helper() asEntry := seg.ASEntry{ - Local: xtest.MustParseIA("1-ff00:0:110"), + Local: addr.MustParseIA("1-ff00:0:110"), HopEntry: seg.HopEntry{ HopField: seg.HopField{MAC: [path.MacLen]byte{0x11, 0x11, 0x11, 0x11, 0x11, 0x11}}, }, diff --git a/pkg/experimental/hiddenpath/grpc/registry_test.go b/pkg/experimental/hiddenpath/grpc/registry_test.go index 6b7aad01ba..5da4504e10 100644 --- a/pkg/experimental/hiddenpath/grpc/registry_test.go +++ b/pkg/experimental/hiddenpath/grpc/registry_test.go @@ -25,11 +25,11 @@ import ( "google.golang.org/grpc/peer" "google.golang.org/protobuf/proto" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/experimental/hiddenpath" hpgrpc "github.com/scionproto/scion/pkg/experimental/hiddenpath/grpc" "github.com/scionproto/scion/pkg/experimental/hiddenpath/mock_hiddenpath" "github.com/scionproto/scion/pkg/private/serrors" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/private/xtest/graph" "github.com/scionproto/scion/pkg/proto/control_plane" hspb "github.com/scionproto/scion/pkg/proto/hidden_segment" @@ -78,7 +78,7 @@ func TestRegistrationServerHiddenSegmentRegistration(t *testing.T) { }, "invalid segment": { ctx: peer.NewContext(context.Background(), &peer.Peer{Addr: &snet.UDPAddr{ - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), }}), registry: func(ctrl *gomock.Controller) hiddenpath.Registry { return mock_hiddenpath.NewMockRegistry(ctrl) @@ -93,7 +93,7 @@ func TestRegistrationServerHiddenSegmentRegistration(t *testing.T) { }) v := mock_infra.NewMockVerifier(ctrl) v.EXPECT().WithServer(gomock.Any()).Return(v) - v.EXPECT().WithIA(xtest.MustParseIA("1-ff00:0:110")).Return(v) + v.EXPECT().WithIA(addr.MustParseIA("1-ff00:0:110")).Return(v) v.EXPECT().Verify(gomock.Any(), gomock.Any(), gomock.Any()).Return(&signed.Message{ Body: body, }, nil) @@ -104,7 +104,7 @@ func TestRegistrationServerHiddenSegmentRegistration(t *testing.T) { }, "signature verification error": { ctx: peer.NewContext(context.Background(), &peer.Peer{Addr: &snet.UDPAddr{ - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), }}), registry: func(ctrl *gomock.Controller) hiddenpath.Registry { return mock_hiddenpath.NewMockRegistry(ctrl) @@ -122,7 +122,7 @@ func TestRegistrationServerHiddenSegmentRegistration(t *testing.T) { }) v := mock_infra.NewMockVerifier(ctrl) v.EXPECT().WithServer(gomock.Any()).Return(v) - v.EXPECT().WithIA(xtest.MustParseIA("1-ff00:0:110")).Return(v) + v.EXPECT().WithIA(addr.MustParseIA("1-ff00:0:110")).Return(v) v.EXPECT().Verify(gomock.Any(), gomock.Any(), gomock.Any()).Return(&signed.Message{ Body: body, }, serrors.New("verification failed")) @@ -133,7 +133,7 @@ func TestRegistrationServerHiddenSegmentRegistration(t *testing.T) { }, "invalid body": { ctx: peer.NewContext(context.Background(), &peer.Peer{Addr: &snet.UDPAddr{ - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), }}), registry: func(ctrl *gomock.Controller) hiddenpath.Registry { return mock_hiddenpath.NewMockRegistry(ctrl) @@ -142,7 +142,7 @@ func TestRegistrationServerHiddenSegmentRegistration(t *testing.T) { body := []byte("garbage") v := mock_infra.NewMockVerifier(ctrl) v.EXPECT().WithServer(gomock.Any()).Return(v) - v.EXPECT().WithIA(xtest.MustParseIA("1-ff00:0:110")).Return(v) + v.EXPECT().WithIA(addr.MustParseIA("1-ff00:0:110")).Return(v) v.EXPECT().Verify(gomock.Any(), gomock.Any(), gomock.Any()).Return(&signed.Message{ Body: body, }, nil) @@ -153,7 +153,7 @@ func TestRegistrationServerHiddenSegmentRegistration(t *testing.T) { }, "registry error": { ctx: peer.NewContext(context.Background(), &peer.Peer{Addr: &snet.UDPAddr{ - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), }}), registry: func(ctrl *gomock.Controller) hiddenpath.Registry { registry := mock_hiddenpath.NewMockRegistry(ctrl) @@ -174,7 +174,7 @@ func TestRegistrationServerHiddenSegmentRegistration(t *testing.T) { }) v := mock_infra.NewMockVerifier(ctrl) v.EXPECT().WithServer(gomock.Any()).Return(v) - v.EXPECT().WithIA(xtest.MustParseIA("1-ff00:0:110")).Return(v) + v.EXPECT().WithIA(addr.MustParseIA("1-ff00:0:110")).Return(v) v.EXPECT().Verify(gomock.Any(), gomock.Any(), gomock.Any()).Return(&signed.Message{ Body: body, }, nil) @@ -185,7 +185,7 @@ func TestRegistrationServerHiddenSegmentRegistration(t *testing.T) { }, "valid": { ctx: peer.NewContext(context.Background(), &peer.Peer{Addr: &snet.UDPAddr{ - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), }}), registry: func(ctrl *gomock.Controller) hiddenpath.Registry { registry := mock_hiddenpath.NewMockRegistry(ctrl) @@ -205,7 +205,7 @@ func TestRegistrationServerHiddenSegmentRegistration(t *testing.T) { }) v := mock_infra.NewMockVerifier(ctrl) v.EXPECT().WithServer(gomock.Any()).Return(v) - v.EXPECT().WithIA(xtest.MustParseIA("1-ff00:0:110")).Return(v) + v.EXPECT().WithIA(addr.MustParseIA("1-ff00:0:110")).Return(v) v.EXPECT().Verify(gomock.Any(), gomock.Any(), gomock.Any()).Return(&signed.Message{ Body: body, }, nil) diff --git a/pkg/experimental/hiddenpath/grpc/requester_test.go b/pkg/experimental/hiddenpath/grpc/requester_test.go index 81bc77ffdc..8a27269655 100644 --- a/pkg/experimental/hiddenpath/grpc/requester_test.go +++ b/pkg/experimental/hiddenpath/grpc/requester_test.go @@ -40,14 +40,14 @@ import ( func TestRequesterSegments(t *testing.T) { testSeg := createSeg(t) hpID := hiddenpath.GroupID{ - OwnerAS: xtest.MustParseAS("ff00:0:2"), + OwnerAS: addr.MustParseAS("ff00:0:2"), Suffix: 15, } defaultGroups := hiddenpath.Groups{ hpID: { ID: hpID, Writers: map[addr.IA]struct{}{ - xtest.MustParseIA("1-ff00:0:3"): {}, + addr.MustParseIA("1-ff00:0:3"): {}, }, }, } @@ -69,7 +69,7 @@ func TestRequesterSegments(t *testing.T) { return ret }, input: segfetcher.Request{ - Dst: xtest.MustParseIA("1-ff00:0:3"), + Dst: addr.MustParseIA("1-ff00:0:3"), }, want: 1, assertError: assert.NoError, @@ -83,7 +83,7 @@ func TestRequesterSegments(t *testing.T) { return ret }, input: segfetcher.Request{ - Dst: xtest.MustParseIA("1-ff00:0:7"), + Dst: addr.MustParseIA("1-ff00:0:7"), }, want: 0, assertError: assert.NoError, @@ -97,7 +97,7 @@ func TestRequesterSegments(t *testing.T) { return ret }, input: segfetcher.Request{ - Dst: xtest.MustParseIA("1-ff00:0:3"), + Dst: addr.MustParseIA("1-ff00:0:3"), }, want: 0, assertError: assert.Error, @@ -149,7 +149,7 @@ func TestAuthoritativeRequesterHiddenSegments(t *testing.T) { "valid": { input: hiddenpath.SegmentRequest{ GroupIDs: []hiddenpath.GroupID{mustParseGroupID(t, "ff00:0:42-404")}, - DstIA: xtest.MustParseIA("1-ff00:0:3"), + DstIA: addr.MustParseIA("1-ff00:0:3"), }, signer: func(ctrl *gomock.Controller) hpgrpc.Signer { s := mock_grpc.NewMockSigner(ctrl) diff --git a/pkg/experimental/hiddenpath/registrationpolicy_test.go b/pkg/experimental/hiddenpath/registrationpolicy_test.go index 272502c6cb..f8fee4fc0d 100644 --- a/pkg/experimental/hiddenpath/registrationpolicy_test.go +++ b/pkg/experimental/hiddenpath/registrationpolicy_test.go @@ -24,7 +24,6 @@ import ( "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/experimental/hiddenpath" - "github.com/scionproto/scion/pkg/private/xtest" ) func TestRegistrationPolicyUnmarshalYAML(t *testing.T) { @@ -41,31 +40,31 @@ func TestRegistrationPolicyUnmarshalYAML(t *testing.T) { Groups: map[hiddenpath.GroupID]*hiddenpath.Group{ mustParseGroupID(t, "ff00:0:110-69b5"): { ID: mustParseGroupID(t, "ff00:0:110-69b5"), - Owner: xtest.MustParseIA("1-ff00:0:110"), + Owner: addr.MustParseIA("1-ff00:0:110"), Writers: map[addr.IA]struct{}{ - xtest.MustParseIA("1-ff00:0:111"): {}, - xtest.MustParseIA("1-ff00:0:112"): {}, + addr.MustParseIA("1-ff00:0:111"): {}, + addr.MustParseIA("1-ff00:0:112"): {}, }, Readers: map[addr.IA]struct{}{ - xtest.MustParseIA("1-ff00:0:114"): {}, + addr.MustParseIA("1-ff00:0:114"): {}, }, Registries: map[addr.IA]struct{}{ - xtest.MustParseIA("1-ff00:0:111"): {}, - xtest.MustParseIA("1-ff00:0:113"): {}, + addr.MustParseIA("1-ff00:0:111"): {}, + addr.MustParseIA("1-ff00:0:113"): {}, }, }, mustParseGroupID(t, "ff00:0:222-abcd"): { ID: mustParseGroupID(t, "ff00:0:222-abcd"), - Owner: xtest.MustParseIA("1-ff00:0:222"), + Owner: addr.MustParseIA("1-ff00:0:222"), Writers: map[addr.IA]struct{}{ - xtest.MustParseIA("1-ff00:0:111"): {}, - xtest.MustParseIA("1-ff00:0:112"): {}, + addr.MustParseIA("1-ff00:0:111"): {}, + addr.MustParseIA("1-ff00:0:112"): {}, }, Readers: map[addr.IA]struct{}{ - xtest.MustParseIA("1-ff00:0:114"): {}, + addr.MustParseIA("1-ff00:0:114"): {}, }, Registries: map[addr.IA]struct{}{ - xtest.MustParseIA("1-ff00:0:115"): {}, + addr.MustParseIA("1-ff00:0:115"): {}, }, }, }, diff --git a/pkg/experimental/hiddenpath/registry_test.go b/pkg/experimental/hiddenpath/registry_test.go index b33f703ff2..bba8cb9578 100644 --- a/pkg/experimental/hiddenpath/registry_test.go +++ b/pkg/experimental/hiddenpath/registry_test.go @@ -25,14 +25,13 @@ import ( "github.com/scionproto/scion/pkg/experimental/hiddenpath" "github.com/scionproto/scion/pkg/experimental/hiddenpath/mock_hiddenpath" "github.com/scionproto/scion/pkg/private/serrors" - "github.com/scionproto/scion/pkg/private/xtest" seg "github.com/scionproto/scion/pkg/segment" "github.com/scionproto/scion/pkg/snet" ) func TestRegistryRegister(t *testing.T) { - localIA := xtest.MustParseIA("1-ff00:0:114") - writer := xtest.MustParseIA("2-ff00:0:221") + localIA := addr.MustParseIA("1-ff00:0:114") + writer := addr.MustParseIA("2-ff00:0:221") groups := map[hiddenpath.GroupID]*hiddenpath.Group{ mustParseGroupID(t, "ff00:0:4-5"): { Writers: map[addr.IA]struct{}{writer: {}}, diff --git a/pkg/experimental/hiddenpath/store_test.go b/pkg/experimental/hiddenpath/store_test.go index a326aba80a..b50a6aba76 100644 --- a/pkg/experimental/hiddenpath/store_test.go +++ b/pkg/experimental/hiddenpath/store_test.go @@ -26,7 +26,6 @@ import ( "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/experimental/hiddenpath" "github.com/scionproto/scion/pkg/private/serrors" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/private/xtest/graph" seg "github.com/scionproto/scion/pkg/segment" "github.com/scionproto/scion/pkg/slayers/path" @@ -37,7 +36,7 @@ import ( func TestStorerGet(t *testing.T) { want, dbresult := createSegs(t) - groupID := hiddenpath.GroupID{OwnerAS: xtest.MustParseAS("ff00:0:111"), Suffix: 42} + groupID := hiddenpath.GroupID{OwnerAS: addr.MustParseAS("ff00:0:111"), Suffix: 42} testCases := map[string]struct { inputGroups []hiddenpath.GroupID inputIA addr.IA @@ -49,11 +48,11 @@ func TestStorerGet(t *testing.T) { inputGroups: []hiddenpath.GroupID{ groupID, }, - inputIA: xtest.MustParseIA("1-ff00:0:110"), + inputIA: addr.MustParseIA("1-ff00:0:110"), db: func(c *gomock.Controller) pathdb.DB { ret := mock_pathdb.NewMockDB(c) ret.EXPECT().Get(gomock.Any(), &query.Params{ - EndsAt: []addr.IA{xtest.MustParseIA("1-ff00:0:110")}, + EndsAt: []addr.IA{addr.MustParseIA("1-ff00:0:110")}, HPGroupIDs: []uint64{ groupID.ToUint64(), }, @@ -68,11 +67,11 @@ func TestStorerGet(t *testing.T) { inputGroups: []hiddenpath.GroupID{ groupID, }, - inputIA: xtest.MustParseIA("1-ff00:0:110"), + inputIA: addr.MustParseIA("1-ff00:0:110"), db: func(c *gomock.Controller) pathdb.DB { ret := mock_pathdb.NewMockDB(c) ret.EXPECT().Get(gomock.Any(), &query.Params{ - EndsAt: []addr.IA{xtest.MustParseIA("1-ff00:0:110")}, + EndsAt: []addr.IA{addr.MustParseIA("1-ff00:0:110")}, HPGroupIDs: []uint64{ groupID.ToUint64(), }, @@ -111,7 +110,7 @@ func TestStorerPut(t *testing.T) { }{ "valid": { inputGroup: hiddenpath.GroupID{ - OwnerAS: xtest.MustParseAS("ff00:0:111"), Suffix: 42, + OwnerAS: addr.MustParseAS("ff00:0:111"), Suffix: 42, }, inputSegs: want, db: func(c *gomock.Controller) pathdb.DB { @@ -124,7 +123,7 @@ func TestStorerPut(t *testing.T) { }, "db error": { inputGroup: hiddenpath.GroupID{ - OwnerAS: xtest.MustParseAS("ff00:0:111"), Suffix: 42, + OwnerAS: addr.MustParseAS("ff00:0:111"), Suffix: 42, }, inputSegs: want, db: func(c *gomock.Controller) pathdb.DB { @@ -156,7 +155,7 @@ func TestStorerPut(t *testing.T) { func createSegs(t *testing.T) ([]*seg.Meta, query.Results) { t.Helper() asEntry := seg.ASEntry{ - Local: xtest.MustParseIA("1-ff00:0:110"), + Local: addr.MustParseIA("1-ff00:0:110"), HopEntry: seg.HopEntry{ HopField: seg.HopField{MAC: [path.MacLen]byte{0x11, 0x11, 0x11, 0x11, 0x11, 0x11}}, }, diff --git a/pkg/private/xtest/helpers.go b/pkg/private/xtest/helpers.go index 7279cde632..6f4fb55732 100644 --- a/pkg/private/xtest/helpers.go +++ b/pkg/private/xtest/helpers.go @@ -30,8 +30,6 @@ import ( "time" "github.com/stretchr/testify/require" - - "github.com/scionproto/scion/pkg/addr" ) // Update registers the '-update' flag for the test. @@ -186,48 +184,6 @@ func ExpandPath(file string) string { return filepath.Join("testdata", file) } -// MustParseIA parses s and returns the corresponding addr.IA object. It -// panics if s is not a valid ISD-AS representation. -func MustParseIA(s string) addr.IA { - ia, err := addr.ParseIA(s) - if err != nil { - panic(err) - } - return ia -} - -// MustParseIAs parses a list of comma separated ISD-AS strings. It panics in case -// parsing fails. -func MustParseIAs(list string) []addr.IA { - l := strings.Split(list, ",") - var ias []addr.IA - for _, raw := range l { - ias = append(ias, MustParseIA(raw)) - } - return ias -} - -// MustParseAS parses s and returns the corresponding addr.AS object. It panics -// if s is not valid AS representation. -func MustParseAS(s string) addr.AS { - ia, err := addr.ParseAS(s) - if err != nil { - panic(err) - } - return ia -} - -// MustParseASes parses a list of comma separated AS strings. It panics in case -// parsing fails. -func MustParseASes(list string) []addr.AS { - l := strings.Split(list, ",") - var ases []addr.AS - for _, raw := range l { - ases = append(ases, MustParseAS(raw)) - } - return ases -} - // MustParseHexString parses s and returns the corresponding byte slice. // It panics if the decoding fails. func MustParseHexString(s string) []byte { diff --git a/pkg/scrypto/cppki/trc_asn1_test.go b/pkg/scrypto/cppki/trc_asn1_test.go index 58a71142af..30e7abc900 100644 --- a/pkg/scrypto/cppki/trc_asn1_test.go +++ b/pkg/scrypto/cppki/trc_asn1_test.go @@ -24,7 +24,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/scionproto/scion/pkg/private/xtest" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/scrypto/cppki" ) @@ -43,12 +43,15 @@ func TestDecodeEncodedTRC(t *testing.T) { NotBefore: regularCrt.NotBefore.Add(time.Hour), NotAfter: regularCrt.NotAfter.Add(-time.Hour), }, - GracePeriod: 10 * time.Hour, - NoTrustReset: false, - Votes: []int{1, 2, 4}, - Quorum: 1, - CoreASes: xtest.MustParseASes("ff00:0:110,ff00:0:120"), - AuthoritativeASes: xtest.MustParseASes("ff00:0:110"), + GracePeriod: 10 * time.Hour, + NoTrustReset: false, + Votes: []int{1, 2, 4}, + Quorum: 1, + CoreASes: []addr.AS{ + addr.MustParseAS("ff00:0:110"), + addr.MustParseAS("ff00:0:120"), + }, + AuthoritativeASes: []addr.AS{addr.MustParseAS("ff00:0:110")}, Description: "This is a testing ISD", Certificates: []*x509.Certificate{ loadCert(t, "./testdata/sensitive-voting.crt"), diff --git a/pkg/scrypto/cppki/trc_test.go b/pkg/scrypto/cppki/trc_test.go index 58485f7633..a799f07c7c 100644 --- a/pkg/scrypto/cppki/trc_test.go +++ b/pkg/scrypto/cppki/trc_test.go @@ -23,13 +23,12 @@ import ( "github.com/stretchr/testify/require" "github.com/scionproto/scion/pkg/addr" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/scrypto/cppki" ) var ( - a110 = xtest.MustParseAS("ff00:0:110") - a120 = xtest.MustParseAS("ff00:0:120") + a110 = addr.MustParseAS("ff00:0:110") + a120 = addr.MustParseAS("ff00:0:120") ) func TestTRCValidateInvariant(t *testing.T) { @@ -340,7 +339,7 @@ func TestTRCValidateUpdate(t *testing.T) { // Remove root succ.TRC.Certificates = succ.TRC.Certificates[:9] - succ.TRC.CoreASes = append(succ.TRC.CoreASes, xtest.MustParseAS("ff00:0:119")) + succ.TRC.CoreASes = append(succ.TRC.CoreASes, addr.MustParseAS("ff00:0:119")) succ.TRC.AuthoritativeASes = succ.TRC.CoreASes return &pred.TRC, &succ.TRC @@ -466,7 +465,7 @@ func TestTRCValidateUpdate(t *testing.T) { TRCs: func(t *testing.T) (*cppki.TRC, *cppki.TRC) { pred := loadTRC(t, "./testdata/ISD1-B1-S1.trc") succ := loadTRC(t, "./testdata/ISD1-B1-S2.trc") - succ.TRC.CoreASes = append(succ.TRC.CoreASes, xtest.MustParseAS("ff00:0:119")) + succ.TRC.CoreASes = append(succ.TRC.CoreASes, addr.MustParseAS("ff00:0:119")) return &pred.TRC, &succ.TRC }, Update: func(t *testing.T) cppki.Update { @@ -493,7 +492,7 @@ func TestTRCValidateUpdate(t *testing.T) { pred := loadTRC(t, "./testdata/ISD1-B1-S1.trc") succ := loadTRC(t, "./testdata/ISD1-B1-S2.trc") succ.TRC.AuthoritativeASes = append(succ.TRC.AuthoritativeASes, - xtest.MustParseAS("ff00:0:119")) + addr.MustParseAS("ff00:0:119")) return &pred.TRC, &succ.TRC }, Update: func(t *testing.T) cppki.Update { diff --git a/pkg/segment/BUILD.bazel b/pkg/segment/BUILD.bazel index c4185122dd..8a5f45b4f2 100644 --- a/pkg/segment/BUILD.bazel +++ b/pkg/segment/BUILD.bazel @@ -43,7 +43,6 @@ go_test( deps = [ "//pkg/addr:go_default_library", "//pkg/private/serrors:go_default_library", - "//pkg/private/xtest:go_default_library", "//pkg/proto/control_plane:go_default_library", "//pkg/proto/crypto:go_default_library", "//pkg/scrypto/signed:go_default_library", diff --git a/pkg/segment/seg_test.go b/pkg/segment/seg_test.go index 7c8dd9a09c..f2ece3bf69 100644 --- a/pkg/segment/seg_test.go +++ b/pkg/segment/seg_test.go @@ -27,20 +27,20 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/serrors" - "github.com/scionproto/scion/pkg/private/xtest" cryptopb "github.com/scionproto/scion/pkg/proto/crypto" "github.com/scionproto/scion/pkg/scrypto/signed" "github.com/scionproto/scion/pkg/slayers/path" ) var ( - as110 = xtest.MustParseIA("1-ff00:0:110") - as111 = xtest.MustParseIA("1-ff00:0:111") - as112 = xtest.MustParseIA("1-ff00:0:112") - as113 = xtest.MustParseIA("1-ff00:0:113") - as211 = xtest.MustParseIA("2-ff00:0:211") - as311 = xtest.MustParseIA("3-ff00:0:311") + as110 = addr.MustParseIA("1-ff00:0:110") + as111 = addr.MustParseIA("1-ff00:0:111") + as112 = addr.MustParseIA("1-ff00:0:112") + as113 = addr.MustParseIA("1-ff00:0:113") + as211 = addr.MustParseIA("2-ff00:0:211") + as311 = addr.MustParseIA("3-ff00:0:311") ) func TestPathSegmentAddASEntry(t *testing.T) { diff --git a/pkg/segment/segs_test.go b/pkg/segment/segs_test.go index 0dc31d024c..d9e9a30ed2 100644 --- a/pkg/segment/segs_test.go +++ b/pkg/segment/segs_test.go @@ -21,13 +21,12 @@ import ( "github.com/stretchr/testify/assert" "github.com/scionproto/scion/pkg/addr" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/slayers/path" ) var ( - core1_110 = xtest.MustParseIA("1-ff00:0:110") - core1_120 = xtest.MustParseIA("1-ff00:0:120") + core1_110 = addr.MustParseIA("1-ff00:0:110") + core1_120 = addr.MustParseIA("1-ff00:0:120") ) func allocPathSegment(ias []addr.IA) *PathSegment { diff --git a/pkg/slayers/scion_test.go b/pkg/slayers/scion_test.go index a794587614..f1821d221c 100644 --- a/pkg/slayers/scion_test.go +++ b/pkg/slayers/scion_test.go @@ -515,8 +515,8 @@ func prepPacket(t testing.TB, c slayers.L4ProtocolType) *slayers.SCION { PathType: scion.PathType, DstAddrType: slayers.T16Ip, SrcAddrType: slayers.T4Ip, - DstIA: xtest.MustParseIA("1-ff00:0:111"), - SrcIA: xtest.MustParseIA("2-ff00:0:222"), + DstIA: addr.MustParseIA("1-ff00:0:111"), + SrcIA: addr.MustParseIA("2-ff00:0:222"), Path: &scion.Raw{}, } require.NoError(t, spkt.SetDstAddr(ip6Addr)) @@ -543,8 +543,8 @@ func TestSCIONComputeChecksum(t *testing.T) { "IPv4/IPv4": { Header: func(t *testing.T) *slayers.SCION { s := &slayers.SCION{ - SrcIA: xtest.MustParseIA("1-ff00:0:110"), - DstIA: xtest.MustParseIA("1-ff00:0:112"), + SrcIA: addr.MustParseIA("1-ff00:0:110"), + DstIA: addr.MustParseIA("1-ff00:0:112"), } err := s.SetSrcAddr(addr.MustParseHost("174.16.4.1")) require.NoError(t, err) @@ -559,8 +559,8 @@ func TestSCIONComputeChecksum(t *testing.T) { "IPv4/IPv4 odd length": { Header: func(t *testing.T) *slayers.SCION { s := &slayers.SCION{ - SrcIA: xtest.MustParseIA("1-ff00:0:110"), - DstIA: xtest.MustParseIA("1-ff00:0:112"), + SrcIA: addr.MustParseIA("1-ff00:0:110"), + DstIA: addr.MustParseIA("1-ff00:0:112"), } err := s.SetSrcAddr(addr.MustParseHost("174.16.4.1")) require.NoError(t, err) @@ -575,8 +575,8 @@ func TestSCIONComputeChecksum(t *testing.T) { "IPv4/IPv6": { Header: func(t *testing.T) *slayers.SCION { s := &slayers.SCION{ - SrcIA: xtest.MustParseIA("1-ff00:0:110"), - DstIA: xtest.MustParseIA("1-ff00:0:112"), + SrcIA: addr.MustParseIA("1-ff00:0:110"), + DstIA: addr.MustParseIA("1-ff00:0:112"), } err := s.SetSrcAddr(addr.MustParseHost("174.16.4.1")) require.NoError(t, err) @@ -591,8 +591,8 @@ func TestSCIONComputeChecksum(t *testing.T) { "IPv4/SVC": { Header: func(t *testing.T) *slayers.SCION { s := &slayers.SCION{ - SrcIA: xtest.MustParseIA("1-ff00:0:110"), - DstIA: xtest.MustParseIA("1-ff00:0:112"), + SrcIA: addr.MustParseIA("1-ff00:0:110"), + DstIA: addr.MustParseIA("1-ff00:0:112"), } err := s.SetSrcAddr(addr.MustParseHost("174.16.4.1")) require.NoError(t, err) diff --git a/pkg/slayers/scmp_msg_test.go b/pkg/slayers/scmp_msg_test.go index db6807d966..5b7976e835 100644 --- a/pkg/slayers/scmp_msg_test.go +++ b/pkg/slayers/scmp_msg_test.go @@ -21,7 +21,7 @@ import ( "github.com/google/gopacket" "github.com/stretchr/testify/assert" - "github.com/scionproto/scion/pkg/private/xtest" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/slayers" ) @@ -39,7 +39,7 @@ func TestSCMPExternalInterfaceDownDecodeFromBytes(t *testing.T) { 0x0, 0x0, 0x0, 0x5, }, bytes.Repeat([]byte{0xff}, 10)...), decoded: &slayers.SCMPExternalInterfaceDown{ - IA: xtest.MustParseIA("1-ff00:0:111"), + IA: addr.MustParseIA("1-ff00:0:111"), IfID: uint64(5), }, assertFunc: assert.NoError, @@ -82,7 +82,7 @@ func TestSCMPExternalInterfaceDownSerializeTo(t *testing.T) { 0x0, 0x0, 0x0, 0x5, }, bytes.Repeat([]byte{0xff}, 10)...), decoded: &slayers.SCMPExternalInterfaceDown{ - IA: xtest.MustParseIA("1-ff00:0:111"), + IA: addr.MustParseIA("1-ff00:0:111"), IfID: uint64(5), }, assertFunc: assert.NoError, @@ -125,7 +125,7 @@ func TestSCMPInternalConnectivityDownDecodeFromBytes(t *testing.T) { 0x0, 0x0, 0x0, 0xf, }, bytes.Repeat([]byte{0xff}, 10)...), decoded: &slayers.SCMPInternalConnectivityDown{ - IA: xtest.MustParseIA("1-ff00:0:111"), + IA: addr.MustParseIA("1-ff00:0:111"), Ingress: 5, Egress: 15, }, @@ -171,7 +171,7 @@ func TestSCMPInternalConnectivityDownSerializeTo(t *testing.T) { 0x0, 0x0, 0x0, 0xf, }, bytes.Repeat([]byte{0xff}, 10)...), decoded: &slayers.SCMPInternalConnectivityDown{ - IA: xtest.MustParseIA("1-ff00:0:111"), + IA: addr.MustParseIA("1-ff00:0:111"), Ingress: 5, Egress: 15, }, @@ -364,7 +364,7 @@ func TestSCMPTracerouteDecodeFromBytes(t *testing.T) { decoded: &slayers.SCMPTraceroute{ Identifier: 42, Sequence: 9, - IA: xtest.MustParseIA("1-ff00:0:111"), + IA: addr.MustParseIA("1-ff00:0:111"), Interface: 5, }, assertFunc: assert.NoError, @@ -410,7 +410,7 @@ func TestSCMPTracerouteSerializeTo(t *testing.T) { decoded: &slayers.SCMPTraceroute{ Identifier: 42, Sequence: 9, - IA: xtest.MustParseIA("1-ff00:0:111"), + IA: addr.MustParseIA("1-ff00:0:111"), Interface: 5, }, assertFunc: assert.NoError, diff --git a/pkg/slayers/scmp_test.go b/pkg/slayers/scmp_test.go index dfeceb54ff..32638c831f 100644 --- a/pkg/slayers/scmp_test.go +++ b/pkg/slayers/scmp_test.go @@ -24,7 +24,6 @@ import ( "github.com/stretchr/testify/require" "github.com/scionproto/scion/pkg/addr" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/slayers" ) @@ -79,8 +78,8 @@ func TestSCMPDecodeFromBytes(t *testing.T) { func TestSCMPSerializeTo(t *testing.T) { // scion header over which the pseudo checksum header is calculated. scnL := &slayers.SCION{ - SrcIA: xtest.MustParseIA("1-ff00:0:1"), - DstIA: xtest.MustParseIA("1-ff00:0:4"), + SrcIA: addr.MustParseIA("1-ff00:0:1"), + DstIA: addr.MustParseIA("1-ff00:0:4"), } err := scnL.SetDstAddr(addr.MustParseHost("174.16.4.1")) require.NoError(t, err) @@ -272,7 +271,7 @@ func TestSCMP(t *testing.T) { }, Payload: bytes.Repeat([]byte{0xff}, 15), }, - IA: xtest.MustParseIA("1-ff00:0:111"), + IA: addr.MustParseIA("1-ff00:0:111"), Ingress: 5, Egress: 15, }, @@ -314,7 +313,7 @@ func TestSCMP(t *testing.T) { }, Payload: bytes.Repeat([]byte{0xff}, 15), }, - IA: xtest.MustParseIA("1-ff00:0:111"), + IA: addr.MustParseIA("1-ff00:0:111"), IfID: uint64(5), }, gopacket.Payload(bytes.Repeat([]byte{0xff}, 15)), @@ -424,7 +423,7 @@ func TestSCMP(t *testing.T) { }, Identifier: 42, Sequence: 9, - IA: xtest.MustParseIA("1-ff00:0:111"), + IA: addr.MustParseIA("1-ff00:0:111"), Interface: 5, }, gopacket.Payload(bytes.Repeat([]byte{0xff}, 15)), @@ -470,7 +469,7 @@ func TestSCMP(t *testing.T) { }, Identifier: 42, Sequence: 9, - IA: xtest.MustParseIA("1-ff00:0:111"), + IA: addr.MustParseIA("1-ff00:0:111"), Interface: 5, }, gopacket.Payload(bytes.Repeat([]byte{0xff}, 15)), @@ -510,8 +509,8 @@ func TestSCMP(t *testing.T) { t.Run("serialize", func(t *testing.T) { scnL := &slayers.SCION{ - SrcIA: xtest.MustParseIA("1-ff00:0:1"), - DstIA: xtest.MustParseIA("1-ff00:0:4"), + SrcIA: addr.MustParseIA("1-ff00:0:1"), + DstIA: addr.MustParseIA("1-ff00:0:4"), } err := scnL.SetDstAddr(addr.MustParseHost("174.16.4.1")) assert.NoError(t, err) diff --git a/pkg/slayers/slayers_test.go b/pkg/slayers/slayers_test.go index 5833e45fc8..34dcffc641 100644 --- a/pkg/slayers/slayers_test.go +++ b/pkg/slayers/slayers_test.go @@ -24,6 +24,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/slayers" "github.com/scionproto/scion/pkg/slayers/path/empty" @@ -66,7 +67,7 @@ func TestSCIONSCMP(t *testing.T) { TypeCode: slayers.CreateSCMPTypeCode(6, 0), }, &slayers.SCMPInternalConnectivityDown{ - IA: xtest.MustParseIA("1-ff00:0:111"), + IA: addr.MustParseIA("1-ff00:0:111"), Ingress: 5, Egress: 15, }, @@ -81,7 +82,7 @@ func TestSCIONSCMP(t *testing.T) { TypeCode: slayers.CreateSCMPTypeCode(5, 0), }, &slayers.SCMPExternalInterfaceDown{ - IA: xtest.MustParseIA("1-ff00:0:111"), + IA: addr.MustParseIA("1-ff00:0:111"), IfID: uint64(5), }, gopacket.Payload(bytes.Repeat([]byte{0xff}, 18)), @@ -195,8 +196,8 @@ func TestPaths(t *testing.T) { PathType: empty.PathType, DstAddrType: slayers.T16Ip, SrcAddrType: slayers.T4Ip, - DstIA: xtest.MustParseIA("1-ff00:0:111"), - SrcIA: xtest.MustParseIA("1-ff00:0:111"), + DstIA: addr.MustParseIA("1-ff00:0:111"), + SrcIA: addr.MustParseIA("1-ff00:0:111"), Path: empty.Path{}, } require.NoError(t, s.SetDstAddr(ip6Addr)) @@ -224,8 +225,8 @@ func TestPaths(t *testing.T) { PathType: scion.PathType, DstAddrType: slayers.T16Ip, SrcAddrType: slayers.T4Ip, - DstIA: xtest.MustParseIA("1-ff00:0:111"), - SrcIA: xtest.MustParseIA("2-ff00:0:222"), + DstIA: addr.MustParseIA("1-ff00:0:111"), + SrcIA: addr.MustParseIA("2-ff00:0:222"), Path: &scion.Raw{}, } require.NoError(t, s.SetDstAddr(ip6Addr)) diff --git a/pkg/snet/BUILD.bazel b/pkg/snet/BUILD.bazel index 568cc98d7c..0c07539843 100644 --- a/pkg/snet/BUILD.bazel +++ b/pkg/snet/BUILD.bazel @@ -52,7 +52,6 @@ go_test( deps = [ "//pkg/addr:go_default_library", "//pkg/private/serrors:go_default_library", - "//pkg/private/xtest:go_default_library", "//pkg/slayers:go_default_library", "//pkg/slayers/path:go_default_library", "//pkg/slayers/path/onehop:go_default_library", diff --git a/pkg/snet/packet_test.go b/pkg/snet/packet_test.go index ebaf1f55f9..17c8bcd368 100644 --- a/pkg/snet/packet_test.go +++ b/pkg/snet/packet_test.go @@ -22,7 +22,6 @@ import ( "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/serrors" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/slayers" "github.com/scionproto/scion/pkg/slayers/path" "github.com/scionproto/scion/pkg/slayers/path/onehop" @@ -53,11 +52,11 @@ func TestPacketSerializeDecodeLoop(t *testing.T) { "UDP OHP packet": { PacketInfo: snet.PacketInfo{ Destination: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), Host: addr.HostSVC(addr.SvcCS), }, Source: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:112"), + IA: addr.MustParseIA("1-ff00:0:112"), Host: addr.MustParseHost("127.0.0.1"), }, Path: snetpath.OneHop{}, @@ -71,11 +70,11 @@ func TestPacketSerializeDecodeLoop(t *testing.T) { "UDP packet": { PacketInfo: snet.PacketInfo{ Destination: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), Host: addr.HostSVC(addr.SvcCS), }, Source: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:112"), + IA: addr.MustParseIA("1-ff00:0:112"), Host: addr.MustParseHost("127.0.0.1"), }, Path: snetpath.SCION{ @@ -91,11 +90,11 @@ func TestPacketSerializeDecodeLoop(t *testing.T) { "SCMP EchoRequest": { PacketInfo: snet.PacketInfo{ Destination: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), Host: addr.HostSVC(addr.SvcCS), }, Source: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:112"), + IA: addr.MustParseIA("1-ff00:0:112"), Host: addr.MustParseHost("127.0.0.1"), }, Path: snetpath.SCION{ @@ -111,11 +110,11 @@ func TestPacketSerializeDecodeLoop(t *testing.T) { "SCMP EchoReply": { PacketInfo: snet.PacketInfo{ Destination: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), Host: addr.HostSVC(addr.SvcCS), }, Source: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:112"), + IA: addr.MustParseIA("1-ff00:0:112"), Host: addr.MustParseHost("127.0.0.1"), }, Path: snetpath.SCION{ @@ -131,18 +130,18 @@ func TestPacketSerializeDecodeLoop(t *testing.T) { "SCMP ExternalInterfaceDown": { PacketInfo: snet.PacketInfo{ Destination: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), Host: addr.HostSVC(addr.SvcCS), }, Source: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:112"), + IA: addr.MustParseIA("1-ff00:0:112"), Host: addr.MustParseHost("127.0.0.1"), }, Path: snetpath.SCION{ Raw: rawSP(), }, Payload: snet.SCMPExternalInterfaceDown{ - IA: xtest.MustParseIA("1-ff00:0:111"), + IA: addr.MustParseIA("1-ff00:0:111"), Interface: 13, Payload: []byte("scmp quote"), }, @@ -151,18 +150,18 @@ func TestPacketSerializeDecodeLoop(t *testing.T) { "SCMP InternalConnectivityDown": { PacketInfo: snet.PacketInfo{ Destination: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), Host: addr.HostSVC(addr.SvcCS), }, Source: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:112"), + IA: addr.MustParseIA("1-ff00:0:112"), Host: addr.MustParseHost("127.0.0.1"), }, Path: snetpath.SCION{ Raw: rawSP(), }, Payload: snet.SCMPInternalConnectivityDown{ - IA: xtest.MustParseIA("1-ff00:0:111"), + IA: addr.MustParseIA("1-ff00:0:111"), Ingress: 14, Egress: 25, Payload: []byte("scmp quote"), @@ -172,11 +171,11 @@ func TestPacketSerializeDecodeLoop(t *testing.T) { "SCMP ParameterProblem": { PacketInfo: snet.PacketInfo{ Destination: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), Host: addr.HostSVC(addr.SvcCS), }, Source: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:112"), + IA: addr.MustParseIA("1-ff00:0:112"), Host: addr.MustParseHost("127.0.0.1"), }, Path: snetpath.SCION{ @@ -194,11 +193,11 @@ func TestPacketSerializeDecodeLoop(t *testing.T) { "SCMP PacketTooBig": { PacketInfo: snet.PacketInfo{ Destination: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), Host: addr.HostSVC(addr.SvcCS), }, Source: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:112"), + IA: addr.MustParseIA("1-ff00:0:112"), Host: addr.MustParseHost("127.0.0.1"), }, Path: snetpath.SCION{ @@ -266,11 +265,11 @@ func TestPacketSerialize(t *testing.T) { input: snet.Packet{ PacketInfo: snet.PacketInfo{ Destination: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), Host: addr.HostSVC(addr.SvcCS), }, Source: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:112"), + IA: addr.MustParseIA("1-ff00:0:112"), Host: addr.MustParseHost("127.0.0.1"), }, Path: snetpath.OneHop{}, @@ -287,11 +286,11 @@ func TestPacketSerialize(t *testing.T) { input: snet.Packet{ PacketInfo: snet.PacketInfo{ Destination: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), Host: addr.HostSVC(addr.SvcCS), }, Source: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:112"), + IA: addr.MustParseIA("1-ff00:0:112"), Host: addr.MustParseHost("127.0.0.1"), }, Payload: snet.UDPPayload{ @@ -311,11 +310,11 @@ func TestPacketSerialize(t *testing.T) { input: snet.Packet{ PacketInfo: snet.PacketInfo{ Destination: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), Host: addr.HostSVC(addr.SvcCS), }, Source: snet.SCIONAddress{ - IA: xtest.MustParseIA("1-ff00:0:112"), + IA: addr.MustParseIA("1-ff00:0:112"), Host: addr.MustParseHost("127.0.0.1"), }, Path: snetpath.OneHop{}, diff --git a/pkg/snet/udpaddr_test.go b/pkg/snet/udpaddr_test.go index c03ace511e..490fba601f 100644 --- a/pkg/snet/udpaddr_test.go +++ b/pkg/snet/udpaddr_test.go @@ -20,7 +20,7 @@ import ( "github.com/stretchr/testify/assert" - "github.com/scionproto/scion/pkg/private/xtest" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/snet" ) @@ -45,21 +45,21 @@ func TestUDPAddrString(t *testing.T) { }, "ipv4": { input: &snet.UDPAddr{ - IA: xtest.MustParseIA("1-ff00:0:320"), + IA: addr.MustParseIA("1-ff00:0:320"), Host: &net.UDPAddr{IP: net.IPv4(1, 2, 3, 4), Port: 10000}, }, want: "1-ff00:0:320,1.2.3.4:10000", }, "ipv6": { input: &snet.UDPAddr{ - IA: xtest.MustParseIA("1-ff00:0:320"), + IA: addr.MustParseIA("1-ff00:0:320"), Host: &net.UDPAddr{IP: net.ParseIP("2001::1"), Port: 20000}, }, want: "1-ff00:0:320,[2001::1]:20000", }, "ipv6-zone": { input: &snet.UDPAddr{ - IA: xtest.MustParseIA("1-ff00:0:320"), + IA: addr.MustParseIA("1-ff00:0:320"), Host: &net.UDPAddr{IP: net.ParseIP("2001::1"), Port: 20000, Zone: "some-zone"}, }, want: "1-ff00:0:320,[2001::1%some-zone]:20000", @@ -103,7 +103,7 @@ func TestUDPAddrSet(t *testing.T) { Input: "1-ff00:0:1,192.168.1.1:80", Error: assert.NoError, Want: &snet.UDPAddr{ - IA: xtest.MustParseIA("1-ff00:0:1"), + IA: addr.MustParseIA("1-ff00:0:1"), Host: &net.UDPAddr{ IP: net.ParseIP("192.168.1.1"), Port: 80, @@ -114,7 +114,7 @@ func TestUDPAddrSet(t *testing.T) { Input: "1-ff00:0:1,[dead::beef%some-zone]:80", Error: assert.NoError, Want: &snet.UDPAddr{ - IA: xtest.MustParseIA("1-ff00:0:1"), + IA: addr.MustParseIA("1-ff00:0:1"), Host: &net.UDPAddr{ IP: net.ParseIP("dead::beef"), Port: 80, diff --git a/pkg/spao/BUILD.bazel b/pkg/spao/BUILD.bazel index 69eda0ed2a..265983600c 100644 --- a/pkg/spao/BUILD.bazel +++ b/pkg/spao/BUILD.bazel @@ -31,8 +31,8 @@ go_test( ], embed = [":go_default_library"], deps = [ + "//pkg/addr:go_default_library", "//pkg/drkey:go_default_library", - "//pkg/private/xtest:go_default_library", "//pkg/slayers:go_default_library", "//pkg/slayers/path:go_default_library", "//pkg/slayers/path/empty:go_default_library", diff --git a/pkg/spao/mac_test.go b/pkg/spao/mac_test.go index 3b74398ab7..bb66c02977 100644 --- a/pkg/spao/mac_test.go +++ b/pkg/spao/mac_test.go @@ -24,8 +24,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/drkey" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/slayers" "github.com/scionproto/scion/pkg/slayers/path" "github.com/scionproto/scion/pkg/slayers/path/empty" @@ -36,8 +36,8 @@ import ( ) func TestComputeAuthMac(t *testing.T) { - srcIA := xtest.MustParseIA("1-ff00:0:111") - dstIA := xtest.MustParseIA("1-ff00:0:112") + srcIA := addr.MustParseIA("1-ff00:0:111") + dstIA := addr.MustParseIA("1-ff00:0:112") authKey := drkey.Key{0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7} ts := uint32(0x030201) fooPayload := []byte("some payload") diff --git a/private/app/appnet/BUILD.bazel b/private/app/appnet/BUILD.bazel index ab84c7c0fa..68a82272dd 100644 --- a/private/app/appnet/BUILD.bazel +++ b/private/app/appnet/BUILD.bazel @@ -34,7 +34,6 @@ go_test( embed = [":go_default_library"], deps = [ "//pkg/addr:go_default_library", - "//pkg/private/xtest:go_default_library", "//pkg/snet:go_default_library", "//pkg/snet/mock_snet:go_default_library", "//pkg/snet/path:go_default_library", diff --git a/private/app/appnet/addr_test.go b/private/app/appnet/addr_test.go index b3f482830b..b4adc4f361 100644 --- a/private/app/appnet/addr_test.go +++ b/private/app/appnet/addr_test.go @@ -25,7 +25,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/scionproto/scion/pkg/addr" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/snet" "github.com/scionproto/scion/pkg/snet/mock_snet" snetpath "github.com/scionproto/scion/pkg/snet/path" @@ -35,7 +34,7 @@ import ( ) func TestRedirectQUIC(t *testing.T) { - dummyIA := xtest.MustParseIA("1-ff00:0:2") + dummyIA := addr.MustParseIA("1-ff00:0:2") testCases := map[string]struct { input net.Addr wantAddr net.Addr @@ -118,7 +117,7 @@ func TestBuildFullAddress(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() router := mock_snet.NewMockRouter(ctrl) - remoteIA := xtest.MustParseIA("1-ff00:0:2") + remoteIA := addr.MustParseIA("1-ff00:0:2") svcRouter := mock_infraenv.NewMockSVCResolver(ctrl) aw := infraenv.AddressRewriter{ Router: router, @@ -134,7 +133,7 @@ func TestBuildFullAddress(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() router := mock_snet.NewMockRouter(ctrl) - remoteIA := xtest.MustParseIA("1-ff00:0:2") + remoteIA := addr.MustParseIA("1-ff00:0:2") svcRouter := mock_infraenv.NewMockSVCResolver(ctrl) aw := infraenv.AddressRewriter{ Router: router, @@ -155,7 +154,7 @@ func TestBuildFullAddress(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() router := mock_snet.NewMockRouter(ctrl) - remoteIA := xtest.MustParseIA("1-ff00:0:2") + remoteIA := addr.MustParseIA("1-ff00:0:2") svcRouter := mock_infraenv.NewMockSVCResolver(ctrl) aw := infraenv.AddressRewriter{ Router: router, @@ -185,7 +184,7 @@ func TestBuildFullAddress(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() router := mock_snet.NewMockRouter(ctrl) - localIA := xtest.MustParseIA("1-ff00:0:1") + localIA := addr.MustParseIA("1-ff00:0:1") svcRouter := mock_infraenv.NewMockSVCResolver(ctrl) aw := infraenv.AddressRewriter{ Router: router, @@ -221,7 +220,7 @@ func TestBuildFullAddress(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() router := mock_snet.NewMockRouter(ctrl) - localIA := xtest.MustParseIA("1-ff00:0:1") + localIA := addr.MustParseIA("1-ff00:0:1") svcRouter := mock_infraenv.NewMockSVCResolver(ctrl) aw := infraenv.AddressRewriter{ Router: router, diff --git a/private/app/flag/BUILD.bazel b/private/app/flag/BUILD.bazel index fca4f76dcb..a2ce842208 100644 --- a/private/app/flag/BUILD.bazel +++ b/private/app/flag/BUILD.bazel @@ -29,7 +29,6 @@ go_test( deps = [ "//pkg/addr:go_default_library", "//pkg/daemon:go_default_library", - "//pkg/private/xtest:go_default_library", "//private/app/env:go_default_library", "@com_github_spf13_pflag//:go_default_library", "@com_github_stretchr_testify//assert:go_default_library", diff --git a/private/app/flag/env_test.go b/private/app/flag/env_test.go index 262f0efc33..4b0c395fd4 100644 --- a/private/app/flag/env_test.go +++ b/private/app/flag/env_test.go @@ -26,7 +26,6 @@ import ( "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/daemon" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/private/app/env" "github.com/scionproto/scion/private/app/flag" ) @@ -39,10 +38,10 @@ func TestSCIONEnvironment(t *testing.T) { t.Cleanup(func() { os.Remove(fName) }) e := env.SCION{ General: env.General{ - DefaultIA: xtest.MustParseIA("1-ff00:0:110"), + DefaultIA: addr.MustParseIA("1-ff00:0:110"), }, ASes: map[addr.IA]env.AS{ - xtest.MustParseIA("1-ff00:0:110"): { + addr.MustParseIA("1-ff00:0:110"): { DaemonAddress: "scion_file:1234", }, }, diff --git a/private/app/path/BUILD.bazel b/private/app/path/BUILD.bazel index d6df278e2a..021251dfff 100644 --- a/private/app/path/BUILD.bazel +++ b/private/app/path/BUILD.bazel @@ -22,7 +22,7 @@ go_test( srcs = ["path_test.go"], deps = [ ":go_default_library", - "//pkg/private/xtest:go_default_library", + "//pkg/addr:go_default_library", "//pkg/snet:go_default_library", "//pkg/snet/path:go_default_library", "@com_github_stretchr_testify//assert:go_default_library", diff --git a/private/app/path/path_test.go b/private/app/path/path_test.go index 921f139ee1..0e6fa45e3d 100644 --- a/private/app/path/path_test.go +++ b/private/app/path/path_test.go @@ -19,7 +19,7 @@ import ( "github.com/stretchr/testify/assert" - "github.com/scionproto/scion/pkg/private/xtest" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/snet" "github.com/scionproto/scion/pkg/snet/path" apppath "github.com/scionproto/scion/private/app/path" @@ -34,7 +34,7 @@ func TestFilter(t *testing.T) { "valid": { input: []snet.Path{ path.Path{ - Dst: xtest.MustParseIA("1-ff00:0:112"), + Dst: addr.MustParseIA("1-ff00:0:112"), Meta: snet.PathMetadata{ Interfaces: []snet.PathInterface{{ID: 1}}, }, diff --git a/private/ca/renewal/BUILD.bazel b/private/ca/renewal/BUILD.bazel index 36f8af0ff0..c24a754b24 100644 --- a/private/ca/renewal/BUILD.bazel +++ b/private/ca/renewal/BUILD.bazel @@ -31,6 +31,7 @@ go_test( data = glob(["testdata/**"]), deps = [ ":go_default_library", + "//pkg/addr:go_default_library", "//pkg/metrics:go_default_library", "//pkg/private/serrors:go_default_library", "//pkg/private/xtest:go_default_library", diff --git a/private/ca/renewal/ca_signer_gen_test.go b/private/ca/renewal/ca_signer_gen_test.go index cc2da78c4c..4f55a0907c 100644 --- a/private/ca/renewal/ca_signer_gen_test.go +++ b/private/ca/renewal/ca_signer_gen_test.go @@ -31,6 +31,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/metrics" "github.com/scionproto/scion/pkg/private/serrors" "github.com/scionproto/scion/pkg/private/xtest" @@ -390,7 +391,7 @@ func TestCACertLoaderCACerts(t *testing.T) { dir, cleanF, db := tc.prepare(t, ctrl) defer cleanF() loader := renewal.CACertLoader{ - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), Dir: dir, DB: db, } diff --git a/private/ca/renewal/grpc/BUILD.bazel b/private/ca/renewal/grpc/BUILD.bazel index 101a3cb928..801caa3c56 100644 --- a/private/ca/renewal/grpc/BUILD.bazel +++ b/private/ca/renewal/grpc/BUILD.bazel @@ -37,7 +37,6 @@ go_test( "//pkg/addr:go_default_library", "//pkg/metrics:go_default_library", "//pkg/private/serrors:go_default_library", - "//pkg/private/xtest:go_default_library", "//pkg/proto/control_plane:go_default_library", "//pkg/scrypto/cppki:go_default_library", "//pkg/scrypto/signed:go_default_library", diff --git a/private/ca/renewal/grpc/cms_test.go b/private/ca/renewal/grpc/cms_test.go index 42924eb1da..ddb71ed084 100644 --- a/private/ca/renewal/grpc/cms_test.go +++ b/private/ca/renewal/grpc/cms_test.go @@ -30,7 +30,6 @@ import ( "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/metrics" "github.com/scionproto/scion/pkg/private/serrors" - "github.com/scionproto/scion/pkg/private/xtest" cppb "github.com/scionproto/scion/pkg/proto/control_plane" "github.com/scionproto/scion/pkg/scrypto/cppki" "github.com/scionproto/scion/pkg/scrypto/signed" @@ -73,7 +72,7 @@ func TestCMSHandleCMSRequest(t *testing.T) { NotAfter: time.Now().Add(time.Hour), }, Expiration: time.Now().Add(time.Hour - time.Minute), - IA: xtest.MustParseIA("1-ff00:0:111"), + IA: addr.MustParseIA("1-ff00:0:111"), SubjectKeyID: chain[0].SubjectKeyId, Chain: chain, }, @@ -105,7 +104,7 @@ func TestCMSHandleCMSRequest(t *testing.T) { CMSSigner: func(ctrl *gomock.Controller) grpc.CMSSigner { return mock_grpc.NewMockCMSSigner(ctrl) }, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), Assertion: assert.Error, Code: codes.InvalidArgument, Metric: "err_parse", @@ -123,7 +122,7 @@ func TestCMSHandleCMSRequest(t *testing.T) { CMSSigner: func(ctrl *gomock.Controller) grpc.CMSSigner { return mock_grpc.NewMockCMSSigner(ctrl) }, - IA: xtest.MustParseIA("2-ff00:0:112"), + IA: addr.MustParseIA("2-ff00:0:112"), Assertion: assert.Error, Code: codes.PermissionDenied, Metric: "err_notfound", @@ -146,7 +145,7 @@ func TestCMSHandleCMSRequest(t *testing.T) { CMSSigner: func(ctrl *gomock.Controller) grpc.CMSSigner { return mock_grpc.NewMockCMSSigner(ctrl) }, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), Assertion: assert.Error, Code: codes.InvalidArgument, Metric: "err_verify", @@ -171,7 +170,7 @@ func TestCMSHandleCMSRequest(t *testing.T) { CMSSigner: func(ctrl *gomock.Controller) grpc.CMSSigner { return mock_grpc.NewMockCMSSigner(ctrl) }, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), Assertion: assert.Error, Code: codes.Unavailable, Metric: "err_internal", @@ -196,7 +195,7 @@ func TestCMSHandleCMSRequest(t *testing.T) { signer.EXPECT().SignCMS(gomock.Any(), gomock.Any()) return signer }, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), Assertion: assert.NoError, Code: codes.OK, Metric: "ok_success", diff --git a/private/ca/renewal/grpc/delegating_handler_test.go b/private/ca/renewal/grpc/delegating_handler_test.go index aaffdc85ad..b6a2854b31 100644 --- a/private/ca/renewal/grpc/delegating_handler_test.go +++ b/private/ca/renewal/grpc/delegating_handler_test.go @@ -33,9 +33,9 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/metrics" "github.com/scionproto/scion/pkg/private/serrors" - "github.com/scionproto/scion/pkg/private/xtest" cppb "github.com/scionproto/scion/pkg/proto/control_plane" "github.com/scionproto/scion/pkg/scrypto/cppki" "github.com/scionproto/scion/pkg/scrypto/signed" @@ -56,7 +56,7 @@ func TestDelegatingHandler(t *testing.T) { NotAfter: time.Now().Add(time.Hour), }, Expiration: time.Now().Add(time.Hour - time.Minute), - IA: xtest.MustParseIA("1-ff00:0:111"), + IA: addr.MustParseIA("1-ff00:0:111"), SubjectKeyID: chain[0].SubjectKeyId, Chain: chain, } diff --git a/private/ca/renewal/grpc/renewal_test.go b/private/ca/renewal/grpc/renewal_test.go index ec2d8c80db..f3c652d9c6 100644 --- a/private/ca/renewal/grpc/renewal_test.go +++ b/private/ca/renewal/grpc/renewal_test.go @@ -31,8 +31,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/metrics" - "github.com/scionproto/scion/pkg/private/xtest" cppb "github.com/scionproto/scion/pkg/proto/control_plane" "github.com/scionproto/scion/pkg/scrypto/cppki" "github.com/scionproto/scion/pkg/scrypto/signed" @@ -53,7 +53,7 @@ func TestRenewalServerChainRenewal(t *testing.T) { NotAfter: time.Now().Add(time.Hour), }, Expiration: time.Now().Add(time.Hour - time.Minute), - IA: xtest.MustParseIA("1-ff00:0:111"), + IA: addr.MustParseIA("1-ff00:0:111"), SubjectKeyID: chain[0].SubjectKeyId, Chain: chain, }, diff --git a/private/mgmtapi/cppki/api/api_test.go b/private/mgmtapi/cppki/api/api_test.go index ab678cb156..10a8d5bbc1 100644 --- a/private/mgmtapi/cppki/api/api_test.go +++ b/private/mgmtapi/cppki/api/api_test.go @@ -164,13 +164,13 @@ func TestAPI(t *testing.T) { cppki.SignedTRC{ TRC: cppki.TRC{ CoreASes: []addr.AS{ - xtest.MustParseIA("1-ff00:0:130").AS(), - xtest.MustParseIA("1-ff00:0:131").AS(), - xtest.MustParseIA("1-ff00:0:132").AS(), + addr.MustParseIA("1-ff00:0:130").AS(), + addr.MustParseIA("1-ff00:0:131").AS(), + addr.MustParseIA("1-ff00:0:132").AS(), }, AuthoritativeASes: []addr.AS{ - xtest.MustParseIA("1-ff00:0:131").AS(), - xtest.MustParseIA("1-ff00:0:132").AS(), + addr.MustParseIA("1-ff00:0:131").AS(), + addr.MustParseIA("1-ff00:0:132").AS(), }, Description: "trc description", ID: cppki.TRCID{ diff --git a/private/mgmtapi/segments/api/api_test.go b/private/mgmtapi/segments/api/api_test.go index 9977b33d99..052ad2b8ba 100644 --- a/private/mgmtapi/segments/api/api_test.go +++ b/private/mgmtapi/segments/api/api_test.go @@ -96,8 +96,8 @@ func TestAPI(t *testing.T) { } dbresult := createSegs(t, graph.NewSigner()) q := query.Params{ - StartsAt: []addr.IA{xtest.MustParseIA("1-ff00:0:110")}, - EndsAt: []addr.IA{xtest.MustParseIA("1-ff00:0:112")}, + StartsAt: []addr.IA{addr.MustParseIA("1-ff00:0:110")}, + EndsAt: []addr.IA{addr.MustParseIA("1-ff00:0:112")}, } seg.EXPECT().Get(gomock.Any(), &q).AnyTimes().Return( dbresult[:1], nil, @@ -260,7 +260,7 @@ func TestAPI(t *testing.T) { func createSegs(t *testing.T, signer seg.Signer) query.Results { asEntry1 := seg.ASEntry{ - Local: xtest.MustParseIA("1-ff00:0:110"), + Local: addr.MustParseIA("1-ff00:0:110"), HopEntry: seg.HopEntry{ HopField: seg.HopField{MAC: [path.MacLen]byte{0x11, 0x11, 0x11, 0x11, 0x11, 0x11}, ConsEgress: 1, @@ -268,7 +268,7 @@ func createSegs(t *testing.T, signer seg.Signer) query.Results { }, } asEntry2 := seg.ASEntry{ - Local: xtest.MustParseIA("1-ff00:0:111"), + Local: addr.MustParseIA("1-ff00:0:111"), HopEntry: seg.HopEntry{ HopField: seg.HopField{MAC: [path.MacLen]byte{0x12, 0x12, 0x12, 0x12, 0x12, 0x12}, ConsIngress: 1, @@ -276,7 +276,7 @@ func createSegs(t *testing.T, signer seg.Signer) query.Results { }, } asEntry3 := seg.ASEntry{ - Local: xtest.MustParseIA("1-ff00:0:113"), + Local: addr.MustParseIA("1-ff00:0:113"), HopEntry: seg.HopEntry{ HopField: seg.HopField{MAC: [path.MacLen]byte{0x13, 0x13, 0x13, 0x13, 0x13, 0x13}, ConsIngress: 2}, diff --git a/private/path/combinator/combinator_test.go b/private/path/combinator/combinator_test.go index 8f5e439602..c1a6495b50 100644 --- a/private/path/combinator/combinator_test.go +++ b/private/path/combinator/combinator_test.go @@ -67,8 +67,8 @@ func TestBadPeering(t *testing.T) { { Name: "broken peering", FileName: "00_bad_peering.txt", - SrcIA: xtest.MustParseIA("1-ff00:0:112"), - DstIA: xtest.MustParseIA("1-ff00:0:122"), + SrcIA: addr.MustParseIA("1-ff00:0:112"), + DstIA: addr.MustParseIA("1-ff00:0:122"), Ups: []*seg.PathSegment{ g.Beacon([]uint16{graph.If_130_B_111_A, graph.If_111_A_112_X}), }, @@ -113,8 +113,8 @@ func TestMultiPeering(t *testing.T) { { Name: "two peerings between same ases", FileName: "00_multi_peering.txt", - SrcIA: xtest.MustParseIA("1-ff00:0:112"), - DstIA: xtest.MustParseIA("2-ff00:0:212"), + SrcIA: addr.MustParseIA("1-ff00:0:112"), + DstIA: addr.MustParseIA("2-ff00:0:212"), Ups: []*seg.PathSegment{ g.Beacon([]uint16{graph.If_130_B_111_A, graph.If_111_A_112_X}), }, @@ -159,8 +159,8 @@ func TestSameCoreParent(t *testing.T) { { Name: "non-core ases share same core as direct upstream", FileName: "00_same_core_parent.txt", - SrcIA: xtest.MustParseIA("1-ff00:0:131"), - DstIA: xtest.MustParseIA("1-ff00:0:112"), + SrcIA: addr.MustParseIA("1-ff00:0:131"), + DstIA: addr.MustParseIA("1-ff00:0:112"), Ups: []*seg.PathSegment{ g.Beacon([]uint16{graph.If_130_A_131_X}), }, @@ -201,8 +201,8 @@ func TestLoops(t *testing.T) { { Name: "core segment create a loop", FileName: "00_loops.txt", - SrcIA: xtest.MustParseIA("1-ff00:0:111"), - DstIA: xtest.MustParseIA("1-ff00:0:112"), + SrcIA: addr.MustParseIA("1-ff00:0:111"), + DstIA: addr.MustParseIA("1-ff00:0:112"), Ups: []*seg.PathSegment{ g.Beacon([]uint16{graph.If_120_X_111_B}), g.Beacon([]uint16{graph.If_130_B_111_A}), @@ -253,8 +253,8 @@ func TestComputePath(t *testing.T) { { Name: "#0 simple up-core-down", FileName: "00_compute_path.txt", - SrcIA: xtest.MustParseIA("1-ff00:0:131"), - DstIA: xtest.MustParseIA("1-ff00:0:111"), + SrcIA: addr.MustParseIA("1-ff00:0:131"), + DstIA: addr.MustParseIA("1-ff00:0:111"), Ups: []*seg.PathSegment{ g.Beacon([]uint16{graph.If_130_A_131_X}), }, @@ -268,8 +268,8 @@ func TestComputePath(t *testing.T) { { Name: "#1 simple up-core", FileName: "01_compute_path.txt", - SrcIA: xtest.MustParseIA("1-ff00:0:131"), - DstIA: xtest.MustParseIA("1-ff00:0:110"), + SrcIA: addr.MustParseIA("1-ff00:0:131"), + DstIA: addr.MustParseIA("1-ff00:0:110"), Ups: []*seg.PathSegment{ g.Beacon([]uint16{graph.If_130_A_131_X}), }, @@ -280,8 +280,8 @@ func TestComputePath(t *testing.T) { { Name: "#2 simple up only", FileName: "02_compute_path.txt", - SrcIA: xtest.MustParseIA("1-ff00:0:131"), - DstIA: xtest.MustParseIA("1-ff00:0:130"), + SrcIA: addr.MustParseIA("1-ff00:0:131"), + DstIA: addr.MustParseIA("1-ff00:0:130"), Ups: []*seg.PathSegment{ g.Beacon([]uint16{graph.If_130_A_131_X}), }, @@ -289,8 +289,8 @@ func TestComputePath(t *testing.T) { { Name: "#3 simple core-down", FileName: "03_compute_path.txt", - SrcIA: xtest.MustParseIA("1-ff00:0:130"), - DstIA: xtest.MustParseIA("1-ff00:0:121"), + SrcIA: addr.MustParseIA("1-ff00:0:130"), + DstIA: addr.MustParseIA("1-ff00:0:121"), Cores: []*seg.PathSegment{ g.Beacon([]uint16{graph.If_120_A_130_B}), }, @@ -301,8 +301,8 @@ func TestComputePath(t *testing.T) { { Name: "#4 simple down only", FileName: "04_compute_path.txt", - SrcIA: xtest.MustParseIA("1-ff00:0:130"), - DstIA: xtest.MustParseIA("1-ff00:0:111"), + SrcIA: addr.MustParseIA("1-ff00:0:130"), + DstIA: addr.MustParseIA("1-ff00:0:111"), Downs: []*seg.PathSegment{ g.Beacon([]uint16{graph.If_130_B_111_A}), }, @@ -310,8 +310,8 @@ func TestComputePath(t *testing.T) { { Name: "#5 inverted core", FileName: "05_compute_path.txt", - SrcIA: xtest.MustParseIA("1-ff00:0:131"), - DstIA: xtest.MustParseIA("1-ff00:0:111"), + SrcIA: addr.MustParseIA("1-ff00:0:131"), + DstIA: addr.MustParseIA("1-ff00:0:111"), Ups: []*seg.PathSegment{ g.Beacon([]uint16{graph.If_130_A_131_X}), }, @@ -325,8 +325,8 @@ func TestComputePath(t *testing.T) { { Name: "#6 simple long up-core-down", FileName: "06_compute_path.txt", - SrcIA: xtest.MustParseIA("1-ff00:0:132"), - DstIA: xtest.MustParseIA("2-ff00:0:212"), + SrcIA: addr.MustParseIA("1-ff00:0:132"), + DstIA: addr.MustParseIA("2-ff00:0:212"), Ups: []*seg.PathSegment{ g.Beacon([]uint16{graph.If_130_A_131_X, graph.If_131_X_132_X}), }, @@ -340,8 +340,8 @@ func TestComputePath(t *testing.T) { { Name: "#7 missing up", FileName: "07_compute_path.txt", - SrcIA: xtest.MustParseIA("1-ff00:0:132"), - DstIA: xtest.MustParseIA("1-ff00:0:122"), + SrcIA: addr.MustParseIA("1-ff00:0:132"), + DstIA: addr.MustParseIA("1-ff00:0:122"), Cores: []*seg.PathSegment{ g.Beacon([]uint16{graph.If_120_A_110_X, graph.If_110_X_130_A}), }, @@ -352,8 +352,8 @@ func TestComputePath(t *testing.T) { { Name: "#8 missing core", FileName: "08_compute_path.txt", - SrcIA: xtest.MustParseIA("1-ff00:0:132"), - DstIA: xtest.MustParseIA("2-ff00:0:211"), + SrcIA: addr.MustParseIA("1-ff00:0:132"), + DstIA: addr.MustParseIA("2-ff00:0:211"), Ups: []*seg.PathSegment{ g.Beacon([]uint16{graph.If_130_A_131_X, graph.If_131_X_132_X}), }, @@ -364,8 +364,8 @@ func TestComputePath(t *testing.T) { { Name: "#9 missing down", FileName: "09_compute_path.txt", - SrcIA: xtest.MustParseIA("1-ff00:0:132"), - DstIA: xtest.MustParseIA("1-ff00:0:122"), + SrcIA: addr.MustParseIA("1-ff00:0:132"), + DstIA: addr.MustParseIA("1-ff00:0:122"), Ups: []*seg.PathSegment{ g.Beacon([]uint16{graph.If_130_A_131_X, graph.If_131_X_132_X}), }, @@ -376,8 +376,8 @@ func TestComputePath(t *testing.T) { { Name: "#10 simple up-core-down, multiple cores", FileName: "10_compute_path.txt", - SrcIA: xtest.MustParseIA("1-ff00:0:132"), - DstIA: xtest.MustParseIA("1-ff00:0:112"), + SrcIA: addr.MustParseIA("1-ff00:0:132"), + DstIA: addr.MustParseIA("1-ff00:0:112"), Ups: []*seg.PathSegment{ g.Beacon([]uint16{graph.If_130_A_131_X, graph.If_131_X_132_X}), }, @@ -392,8 +392,8 @@ func TestComputePath(t *testing.T) { { Name: "#11 shortcut, destination on path, going up, vonly hf is from core", FileName: "11_compute_path.txt", - SrcIA: xtest.MustParseIA("1-ff00:0:133"), - DstIA: xtest.MustParseIA("1-ff00:0:131"), + SrcIA: addr.MustParseIA("1-ff00:0:133"), + DstIA: addr.MustParseIA("1-ff00:0:131"), Ups: []*seg.PathSegment{ g.Beacon([]uint16{graph.If_130_A_131_X, graph.If_131_X_132_X, graph.If_132_X_133_X}), @@ -405,8 +405,8 @@ func TestComputePath(t *testing.T) { { Name: "#12 shortcut, destination on path, going up, vonly hf is non-core", FileName: "12_compute_path.txt", - SrcIA: xtest.MustParseIA("1-ff00:0:133"), - DstIA: xtest.MustParseIA("1-ff00:0:132"), + SrcIA: addr.MustParseIA("1-ff00:0:133"), + DstIA: addr.MustParseIA("1-ff00:0:132"), Ups: []*seg.PathSegment{ g.Beacon([]uint16{graph.If_130_A_131_X, graph.If_131_X_132_X, graph.If_132_X_133_X}), @@ -418,8 +418,8 @@ func TestComputePath(t *testing.T) { { Name: "#13 shortcut, destination on path, going down, verify hf is from core", FileName: "13_compute_path.txt", - SrcIA: xtest.MustParseIA("1-ff00:0:131"), - DstIA: xtest.MustParseIA("1-ff00:0:132"), + SrcIA: addr.MustParseIA("1-ff00:0:131"), + DstIA: addr.MustParseIA("1-ff00:0:132"), Ups: []*seg.PathSegment{ g.Beacon([]uint16{graph.If_130_A_131_X}), }, @@ -430,8 +430,8 @@ func TestComputePath(t *testing.T) { { Name: "#14 shortcut, common upstream", FileName: "14_compute_path.txt", - SrcIA: xtest.MustParseIA("2-ff00:0:212"), - DstIA: xtest.MustParseIA("2-ff00:0:222"), + SrcIA: addr.MustParseIA("2-ff00:0:212"), + DstIA: addr.MustParseIA("2-ff00:0:222"), Ups: []*seg.PathSegment{ g.Beacon([]uint16{graph.If_210_X1_211_A, graph.If_211_A1_212_X}), }, @@ -442,8 +442,8 @@ func TestComputePath(t *testing.T) { { Name: "#15 go through peer", FileName: "15_compute_path.txt", - SrcIA: xtest.MustParseIA("2-ff00:0:212"), - DstIA: xtest.MustParseIA("2-ff00:0:222"), + SrcIA: addr.MustParseIA("2-ff00:0:212"), + DstIA: addr.MustParseIA("2-ff00:0:222"), Ups: []*seg.PathSegment{ g.Beacon([]uint16{graph.If_210_X1_211_A, graph.If_211_A1_212_X}), }, @@ -457,8 +457,8 @@ func TestComputePath(t *testing.T) { { Name: "#16 start from peer", FileName: "16_compute_path.txt", - SrcIA: xtest.MustParseIA("1-ff00:0:131"), - DstIA: xtest.MustParseIA("1-ff00:0:122"), + SrcIA: addr.MustParseIA("1-ff00:0:131"), + DstIA: addr.MustParseIA("1-ff00:0:122"), Ups: []*seg.PathSegment{ g.Beacon([]uint16{graph.If_130_A_131_X}), }, @@ -472,8 +472,8 @@ func TestComputePath(t *testing.T) { { Name: "#17 start and end on peer", FileName: "17_compute_path.txt", - SrcIA: xtest.MustParseIA("1-ff00:0:131"), - DstIA: xtest.MustParseIA("1-ff00:0:121"), + SrcIA: addr.MustParseIA("1-ff00:0:131"), + DstIA: addr.MustParseIA("1-ff00:0:121"), Ups: []*seg.PathSegment{ g.Beacon([]uint16{graph.If_130_A_131_X}), }, @@ -487,8 +487,8 @@ func TestComputePath(t *testing.T) { { Name: "#18 only end on peer", FileName: "18_compute_path.txt", - SrcIA: xtest.MustParseIA("1-ff00:0:132"), - DstIA: xtest.MustParseIA("1-ff00:0:121"), + SrcIA: addr.MustParseIA("1-ff00:0:132"), + DstIA: addr.MustParseIA("1-ff00:0:121"), Ups: []*seg.PathSegment{ g.Beacon([]uint16{graph.If_130_A_131_X, graph.If_131_X_132_X}), }, @@ -502,8 +502,8 @@ func TestComputePath(t *testing.T) { { Name: "#19 don't use core shortcuts", FileName: "19_compute_path.txt", - SrcIA: xtest.MustParseIA("1-ff00:0:110"), - DstIA: xtest.MustParseIA("2-ff00:0:222"), + SrcIA: addr.MustParseIA("1-ff00:0:110"), + DstIA: addr.MustParseIA("2-ff00:0:222"), Cores: []*seg.PathSegment{ g.Beacon([]uint16{graph.If_210_X_110_X}), g.Beacon([]uint16{graph.If_220_X_210_X, graph.If_210_X_110_X}), @@ -516,8 +516,8 @@ func TestComputePath(t *testing.T) { { Name: "#20 core only", FileName: "20_compute_path.txt", - SrcIA: xtest.MustParseIA("1-ff00:0:130"), - DstIA: xtest.MustParseIA("2-ff00:0:210"), + SrcIA: addr.MustParseIA("1-ff00:0:130"), + DstIA: addr.MustParseIA("2-ff00:0:210"), Cores: []*seg.PathSegment{ g.Beacon([]uint16{graph.If_210_X_110_X, graph.If_110_X_130_A}), g.Beacon([]uint16{graph.If_210_X_110_X, graph.If_110_X_120_A, @@ -547,20 +547,20 @@ func TestFilterDuplicates(t *testing.T) { // These look somewhat valid, but that doesn't matter at all -- we only look // at the fingerprint anyway. path0 := []snet.PathInterface{ - {IA: xtest.MustParseIA("1-ff00:0:110"), ID: common.IFIDType(10)}, - {IA: xtest.MustParseIA("1-ff00:0:111"), ID: common.IFIDType(10)}, + {IA: addr.MustParseIA("1-ff00:0:110"), ID: common.IFIDType(10)}, + {IA: addr.MustParseIA("1-ff00:0:111"), ID: common.IFIDType(10)}, } path1 := []snet.PathInterface{ - {IA: xtest.MustParseIA("1-ff00:0:110"), ID: common.IFIDType(11)}, - {IA: xtest.MustParseIA("1-ff00:0:112"), ID: common.IFIDType(11)}, - {IA: xtest.MustParseIA("1-ff00:0:112"), ID: common.IFIDType(12)}, - {IA: xtest.MustParseIA("1-ff00:0:111"), ID: common.IFIDType(12)}, + {IA: addr.MustParseIA("1-ff00:0:110"), ID: common.IFIDType(11)}, + {IA: addr.MustParseIA("1-ff00:0:112"), ID: common.IFIDType(11)}, + {IA: addr.MustParseIA("1-ff00:0:112"), ID: common.IFIDType(12)}, + {IA: addr.MustParseIA("1-ff00:0:111"), ID: common.IFIDType(12)}, } path2 := []snet.PathInterface{ - {IA: xtest.MustParseIA("1-ff00:0:110"), ID: common.IFIDType(11)}, - {IA: xtest.MustParseIA("1-ff00:0:112"), ID: common.IFIDType(11)}, - {IA: xtest.MustParseIA("1-ff00:0:112"), ID: common.IFIDType(22)}, - {IA: xtest.MustParseIA("1-ff00:0:111"), ID: common.IFIDType(22)}, + {IA: addr.MustParseIA("1-ff00:0:110"), ID: common.IFIDType(11)}, + {IA: addr.MustParseIA("1-ff00:0:112"), ID: common.IFIDType(11)}, + {IA: addr.MustParseIA("1-ff00:0:112"), ID: common.IFIDType(22)}, + {IA: addr.MustParseIA("1-ff00:0:111"), ID: common.IFIDType(22)}, } // Define two expiry times for the paths: paths with latest expiry will be kept diff --git a/private/path/combinator/staticinfo_accumulator_test.go b/private/path/combinator/staticinfo_accumulator_test.go index 11966d8229..491ff6e0c3 100644 --- a/private/path/combinator/staticinfo_accumulator_test.go +++ b/private/path/combinator/staticinfo_accumulator_test.go @@ -24,7 +24,6 @@ import ( "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/common" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/private/xtest/graph" seg "github.com/scionproto/scion/pkg/segment" "github.com/scionproto/scion/pkg/snet" @@ -43,12 +42,12 @@ func TestStaticinfo(t *testing.T) { { Name: "#0 simple up-core-down", Path: []snet.PathInterface{ - {IA: xtest.MustParseIA("1-ff00:0:131"), ID: common.IFIDType(graph.If_131_X_130_A)}, - {IA: xtest.MustParseIA("1-ff00:0:130"), ID: common.IFIDType(graph.If_130_A_131_X)}, - {IA: xtest.MustParseIA("1-ff00:0:130"), ID: common.IFIDType(graph.If_130_B_120_A)}, - {IA: xtest.MustParseIA("1-ff00:0:120"), ID: common.IFIDType(graph.If_120_A_130_B)}, - {IA: xtest.MustParseIA("1-ff00:0:120"), ID: common.IFIDType(graph.If_120_X_111_B)}, - {IA: xtest.MustParseIA("1-ff00:0:111"), ID: common.IFIDType(graph.If_111_B_120_X)}, + {IA: addr.MustParseIA("1-ff00:0:131"), ID: common.IFIDType(graph.If_131_X_130_A)}, + {IA: addr.MustParseIA("1-ff00:0:130"), ID: common.IFIDType(graph.If_130_A_131_X)}, + {IA: addr.MustParseIA("1-ff00:0:130"), ID: common.IFIDType(graph.If_130_B_120_A)}, + {IA: addr.MustParseIA("1-ff00:0:120"), ID: common.IFIDType(graph.If_120_A_130_B)}, + {IA: addr.MustParseIA("1-ff00:0:120"), ID: common.IFIDType(graph.If_120_X_111_B)}, + {IA: addr.MustParseIA("1-ff00:0:111"), ID: common.IFIDType(graph.If_111_B_120_X)}, }, ASEntries: concatBeaconASEntries(g, []uint16{graph.If_130_A_131_X}, @@ -59,10 +58,10 @@ func TestStaticinfo(t *testing.T) { { Name: "#1 simple up-core", Path: []snet.PathInterface{ - {IA: xtest.MustParseIA("1-ff00:0:131"), ID: common.IFIDType(graph.If_131_X_130_A)}, - {IA: xtest.MustParseIA("1-ff00:0:130"), ID: common.IFIDType(graph.If_130_A_131_X)}, - {IA: xtest.MustParseIA("1-ff00:0:130"), ID: common.IFIDType(graph.If_130_A_110_X)}, - {IA: xtest.MustParseIA("1-ff00:0:110"), ID: common.IFIDType(graph.If_110_X_130_A)}, + {IA: addr.MustParseIA("1-ff00:0:131"), ID: common.IFIDType(graph.If_131_X_130_A)}, + {IA: addr.MustParseIA("1-ff00:0:130"), ID: common.IFIDType(graph.If_130_A_131_X)}, + {IA: addr.MustParseIA("1-ff00:0:130"), ID: common.IFIDType(graph.If_130_A_110_X)}, + {IA: addr.MustParseIA("1-ff00:0:110"), ID: common.IFIDType(graph.If_110_X_130_A)}, }, ASEntries: concatBeaconASEntries(g, []uint16{graph.If_130_A_131_X}, @@ -73,8 +72,8 @@ func TestStaticinfo(t *testing.T) { { Name: "#2 simple up only", Path: []snet.PathInterface{ - {IA: xtest.MustParseIA("1-ff00:0:131"), ID: common.IFIDType(graph.If_131_X_130_A)}, - {IA: xtest.MustParseIA("1-ff00:0:130"), ID: common.IFIDType(graph.If_130_A_131_X)}, + {IA: addr.MustParseIA("1-ff00:0:131"), ID: common.IFIDType(graph.If_131_X_130_A)}, + {IA: addr.MustParseIA("1-ff00:0:130"), ID: common.IFIDType(graph.If_130_A_131_X)}, }, ASEntries: concatBeaconASEntries(g, []uint16{graph.If_130_A_131_X}, @@ -85,10 +84,10 @@ func TestStaticinfo(t *testing.T) { { Name: "#14 shortcut, common upstream", Path: []snet.PathInterface{ - {IA: xtest.MustParseIA("2-ff00:0:212"), ID: common.IFIDType(graph.If_212_X_211_A1)}, - {IA: xtest.MustParseIA("2-ff00:0:211"), ID: common.IFIDType(graph.If_211_A1_212_X)}, - {IA: xtest.MustParseIA("2-ff00:0:211"), ID: common.IFIDType(graph.If_211_A_222_X)}, - {IA: xtest.MustParseIA("2-ff00:0:222"), ID: common.IFIDType(graph.If_222_X_211_A)}, + {IA: addr.MustParseIA("2-ff00:0:212"), ID: common.IFIDType(graph.If_212_X_211_A1)}, + {IA: addr.MustParseIA("2-ff00:0:211"), ID: common.IFIDType(graph.If_211_A1_212_X)}, + {IA: addr.MustParseIA("2-ff00:0:211"), ID: common.IFIDType(graph.If_211_A_222_X)}, + {IA: addr.MustParseIA("2-ff00:0:222"), ID: common.IFIDType(graph.If_222_X_211_A)}, }, ASEntries: concatBeaconASEntries(g, []uint16{graph.If_210_X1_211_A, graph.If_211_A1_212_X}, @@ -99,12 +98,12 @@ func TestStaticinfo(t *testing.T) { { Name: "#15 go through peer", Path: []snet.PathInterface{ - {IA: xtest.MustParseIA("2-ff00:0:212"), ID: common.IFIDType(graph.If_212_X_211_A1)}, - {IA: xtest.MustParseIA("2-ff00:0:211"), ID: common.IFIDType(graph.If_211_A1_212_X)}, - {IA: xtest.MustParseIA("2-ff00:0:211"), ID: common.IFIDType(graph.If_211_A_221_X)}, - {IA: xtest.MustParseIA("2-ff00:0:221"), ID: common.IFIDType(graph.If_221_X_211_A)}, - {IA: xtest.MustParseIA("2-ff00:0:221"), ID: common.IFIDType(graph.If_221_X_222_X)}, - {IA: xtest.MustParseIA("2-ff00:0:222"), ID: common.IFIDType(graph.If_222_X_221_X)}, + {IA: addr.MustParseIA("2-ff00:0:212"), ID: common.IFIDType(graph.If_212_X_211_A1)}, + {IA: addr.MustParseIA("2-ff00:0:211"), ID: common.IFIDType(graph.If_211_A1_212_X)}, + {IA: addr.MustParseIA("2-ff00:0:211"), ID: common.IFIDType(graph.If_211_A_221_X)}, + {IA: addr.MustParseIA("2-ff00:0:221"), ID: common.IFIDType(graph.If_221_X_211_A)}, + {IA: addr.MustParseIA("2-ff00:0:221"), ID: common.IFIDType(graph.If_221_X_222_X)}, + {IA: addr.MustParseIA("2-ff00:0:222"), ID: common.IFIDType(graph.If_222_X_221_X)}, }, ASEntries: concatBeaconASEntries(g, []uint16{graph.If_210_X1_211_A, graph.If_211_A1_212_X}, diff --git a/private/path/pathpol/BUILD.bazel b/private/path/pathpol/BUILD.bazel index b5c7b1d06d..a85b5f97a0 100644 --- a/private/path/pathpol/BUILD.bazel +++ b/private/path/pathpol/BUILD.bazel @@ -37,7 +37,6 @@ go_test( deps = [ "//pkg/addr:go_default_library", "//pkg/private/common:go_default_library", - "//pkg/private/xtest:go_default_library", "//pkg/private/xtest/graph:go_default_library", "//pkg/snet:go_default_library", "//pkg/snet/mock_snet:go_default_library", diff --git a/private/path/pathpol/acl_test.go b/private/path/pathpol/acl_test.go index 7842afe79e..1fe86cfb2b 100644 --- a/private/path/pathpol/acl_test.go +++ b/private/path/pathpol/acl_test.go @@ -24,7 +24,6 @@ import ( "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/common" - "github.com/scionproto/scion/pkg/private/xtest" ) func TestNewACL(t *testing.T) { @@ -183,8 +182,8 @@ func TestACLEval(t *testing.T) { denyEntry, }, }, - Src: xtest.MustParseIA("2-ff00:0:212"), - Dst: xtest.MustParseIA("2-ff00:0:211"), + Src: addr.MustParseIA("2-ff00:0:212"), + Dst: addr.MustParseIA("2-ff00:0:211"), ExpPathNum: 2, }, "allow 2-0#0, deny rest": { @@ -194,8 +193,8 @@ func TestACLEval(t *testing.T) { denyEntry, }, }, - Src: xtest.MustParseIA("2-ff00:0:212"), - Dst: xtest.MustParseIA("2-ff00:0:211"), + Src: addr.MustParseIA("2-ff00:0:212"), + Dst: addr.MustParseIA("2-ff00:0:211"), ExpPathNum: 2, }, "allow 2-ff00:0:212#0 and 2-ff00:0:211, deny rest": { @@ -206,8 +205,8 @@ func TestACLEval(t *testing.T) { denyEntry, }, }, - Src: xtest.MustParseIA("2-ff00:0:212"), - Dst: xtest.MustParseIA("2-ff00:0:211"), + Src: addr.MustParseIA("2-ff00:0:212"), + Dst: addr.MustParseIA("2-ff00:0:211"), ExpPathNum: 2, }, "allow 2-ff00:0:212#0, deny rest": { @@ -217,8 +216,8 @@ func TestACLEval(t *testing.T) { denyEntry, }, }, - Src: xtest.MustParseIA("2-ff00:0:212"), - Dst: xtest.MustParseIA("2-ff00:0:211"), + Src: addr.MustParseIA("2-ff00:0:212"), + Dst: addr.MustParseIA("2-ff00:0:211"), ExpPathNum: 0, }, "deny 1-ff00:0:110#0, 1-ff00:0:120#0, allow rest": { @@ -229,8 +228,8 @@ func TestACLEval(t *testing.T) { allowEntry, }, }, - Src: xtest.MustParseIA("1-ff00:0:133"), - Dst: xtest.MustParseIA("2-ff00:0:222"), + Src: addr.MustParseIA("1-ff00:0:133"), + Dst: addr.MustParseIA("2-ff00:0:222"), ExpPathNum: 2, }, "deny 1-ff00:0:110#0, 1-ff00:0:120#0 and 1-ff00:0:111#2823, allow rest": { @@ -242,8 +241,8 @@ func TestACLEval(t *testing.T) { allowEntry, }, }, - Src: xtest.MustParseIA("1-ff00:0:133"), - Dst: xtest.MustParseIA("2-ff00:0:222"), + Src: addr.MustParseIA("1-ff00:0:133"), + Dst: addr.MustParseIA("2-ff00:0:222"), ExpPathNum: 1, }, "deny ISD1, allow certain ASes": { @@ -255,8 +254,8 @@ func TestACLEval(t *testing.T) { allowEntry, }, }, - Src: xtest.MustParseIA("1-ff00:0:130"), - Dst: xtest.MustParseIA("2-ff00:0:220"), + Src: addr.MustParseIA("1-ff00:0:130"), + Dst: addr.MustParseIA("2-ff00:0:220"), ExpPathNum: 2, }, "deny ISD1, allow certain ASes - wrong oder": { @@ -268,8 +267,8 @@ func TestACLEval(t *testing.T) { allowEntry, }, }, - Src: xtest.MustParseIA("1-ff00:0:130"), - Dst: xtest.MustParseIA("2-ff00:0:220"), + Src: addr.MustParseIA("1-ff00:0:130"), + Dst: addr.MustParseIA("2-ff00:0:220"), ExpPathNum: 0, }, "nil rule should match all the paths": { @@ -279,8 +278,8 @@ func TestACLEval(t *testing.T) { allowEntry, }, }, - Src: xtest.MustParseIA("1-ff00:0:130"), - Dst: xtest.MustParseIA("2-ff00:0:220"), + Src: addr.MustParseIA("1-ff00:0:130"), + Dst: addr.MustParseIA("2-ff00:0:220"), ExpPathNum: 0, }, } @@ -306,6 +305,6 @@ func TestACLPanic(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() pp := NewPathProvider(ctrl) - paths := pp.GetPaths(xtest.MustParseIA("2-ff00:0:212"), xtest.MustParseIA("2-ff00:0:211")) + paths := pp.GetPaths(addr.MustParseIA("2-ff00:0:212"), addr.MustParseIA("2-ff00:0:211")) assert.Panics(t, func() { acl.Eval(paths) }) } diff --git a/private/path/pathpol/local_isdas_test.go b/private/path/pathpol/local_isdas_test.go index 671f2e7d91..52c03c0023 100644 --- a/private/path/pathpol/local_isdas_test.go +++ b/private/path/pathpol/local_isdas_test.go @@ -21,7 +21,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/scionproto/scion/pkg/addr" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/snet" "github.com/scionproto/scion/pkg/snet/mock_snet" ) @@ -30,39 +29,46 @@ func TestLocalISDASEval(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() pp := NewPathProvider(ctrl) - paths212 := pp.GetPaths(xtest.MustParseIA("2-ff00:0:212"), xtest.MustParseIA("2-ff00:0:220")) - paths220 := pp.GetPaths(xtest.MustParseIA("2-ff00:0:220"), xtest.MustParseIA("2-ff00:0:212")) + paths212 := pp.GetPaths(addr.MustParseIA("2-ff00:0:212"), addr.MustParseIA("2-ff00:0:220")) + paths220 := pp.GetPaths(addr.MustParseIA("2-ff00:0:220"), addr.MustParseIA("2-ff00:0:212")) inPaths := append(paths212, paths220...) localPath := mock_snet.NewMockPath(ctrl) - localPath.EXPECT().Source().Return(xtest.MustParseIA("2-ff00:0:220")) - localPath.EXPECT().Destination().Return(xtest.MustParseIA("2-ff00:0:220")) + localPath.EXPECT().Source().Return(addr.MustParseIA("2-ff00:0:220")) + localPath.EXPECT().Destination().Return(addr.MustParseIA("2-ff00:0:220")) tests := map[string]struct { AllowedIAs []addr.IA ExpPathNum int Paths []snet.Path }{ "first isdas": { - AllowedIAs: xtest.MustParseIAs("2-ff00:0:212"), + AllowedIAs: []addr.IA{addr.MustParseIA("2-ff00:0:212")}, ExpPathNum: 6, Paths: inPaths, }, "second isdas": { - AllowedIAs: xtest.MustParseIAs("2-ff00:0:220"), + AllowedIAs: []addr.IA{addr.MustParseIA("2-ff00:0:220")}, ExpPathNum: 6, Paths: inPaths, }, "both isdases": { - AllowedIAs: xtest.MustParseIAs("2-ff00:0:212,2-ff00:0:220"), + AllowedIAs: []addr.IA{ + addr.MustParseIA("2-ff00:0:212"), + addr.MustParseIA("2-ff00:0:220"), + }, ExpPathNum: 12, Paths: inPaths, }, "extra isdas": { - AllowedIAs: xtest.MustParseIAs("2-ff00:0:212,2-ff00:0:220,1-ff00:0:220"), + AllowedIAs: []addr.IA{ + addr.MustParseIA("2-ff00:0:212"), + addr.MustParseIA("2-ff00:0:220"), + addr.MustParseIA("1-ff00:0:220"), + }, ExpPathNum: 12, Paths: inPaths, }, "local paths are not counted": { - AllowedIAs: xtest.MustParseIAs("2-ff00:0:220"), + AllowedIAs: []addr.IA{addr.MustParseIA("2-ff00:0:220")}, ExpPathNum: 6, Paths: append(inPaths, localPath), }, diff --git a/private/path/pathpol/policy_test.go b/private/path/pathpol/policy_test.go index 76d336acd2..61f7392aad 100644 --- a/private/path/pathpol/policy_test.go +++ b/private/path/pathpol/policy_test.go @@ -25,7 +25,6 @@ import ( "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/common" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/private/xtest/graph" "github.com/scionproto/scion/pkg/snet" snetpath "github.com/scionproto/scion/pkg/snet/path" @@ -41,8 +40,8 @@ func TestBasicPolicy(t *testing.T) { }{ "Empty policy": { Policy: &Policy{}, - Src: xtest.MustParseIA("2-ff00:0:212"), - Dst: xtest.MustParseIA("2-ff00:0:211"), + Src: addr.MustParseIA("2-ff00:0:212"), + Dst: addr.MustParseIA("2-ff00:0:211"), ExpPathNum: 2, }, } @@ -81,8 +80,8 @@ func TestOptionsEval(t *testing.T) { Weight: 0, }, }), - Src: xtest.MustParseIA("2-ff00:0:212"), - Dst: xtest.MustParseIA("2-ff00:0:211"), + Src: addr.MustParseIA("2-ff00:0:212"), + Dst: addr.MustParseIA("2-ff00:0:211"), ExpPathNum: 2, }, "two options, deny everything": { @@ -114,8 +113,8 @@ func TestOptionsEval(t *testing.T) { Weight: 1, }, }), - Src: xtest.MustParseIA("2-ff00:0:212"), - Dst: xtest.MustParseIA("2-ff00:0:211"), + Src: addr.MustParseIA("2-ff00:0:212"), + Dst: addr.MustParseIA("2-ff00:0:211"), ExpPathNum: 2, }, "two options, first: allow everything, second: allow one path": { @@ -149,8 +148,8 @@ func TestOptionsEval(t *testing.T) { Weight: 1, }, }), - Src: xtest.MustParseIA("1-ff00:0:122"), - Dst: xtest.MustParseIA("2-ff00:0:222"), + Src: addr.MustParseIA("1-ff00:0:122"), + Dst: addr.MustParseIA("2-ff00:0:222"), ExpPathNum: 1, }, "two options, combined": { @@ -182,8 +181,8 @@ func TestOptionsEval(t *testing.T) { Weight: 0, }, }), - Src: xtest.MustParseIA("1-ff00:0:110"), - Dst: xtest.MustParseIA("2-ff00:0:220"), + Src: addr.MustParseIA("1-ff00:0:110"), + Dst: addr.MustParseIA("2-ff00:0:220"), ExpPathNum: 3, }, "two options, take first": { @@ -215,8 +214,8 @@ func TestOptionsEval(t *testing.T) { Weight: 0, }, }), - Src: xtest.MustParseIA("1-ff00:0:110"), - Dst: xtest.MustParseIA("2-ff00:0:220"), + Src: addr.MustParseIA("1-ff00:0:110"), + Dst: addr.MustParseIA("2-ff00:0:220"), ExpPathNum: 1, }, "two options, take second": { @@ -246,8 +245,8 @@ func TestOptionsEval(t *testing.T) { Weight: 10, }, }), - Src: xtest.MustParseIA("1-ff00:0:110"), - Dst: xtest.MustParseIA("2-ff00:0:220"), + Src: addr.MustParseIA("1-ff00:0:110"), + Dst: addr.MustParseIA("2-ff00:0:220"), ExpPathNum: 2, }, } @@ -574,8 +573,8 @@ func TestFilterOpt(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() pp := NewPathProvider(ctrl) - src := xtest.MustParseIA("1-ff00:0:110") - dst := xtest.MustParseIA("2-ff00:0:220") + src := addr.MustParseIA("1-ff00:0:110") + dst := addr.MustParseIA("2-ff00:0:220") paths := pp.GetPaths(src, dst) for name, test := range tests { t.Run(name, func(t *testing.T) { @@ -599,14 +598,14 @@ func TestPolicyJsonConversion(t *testing.T) { ACL: acl, LocalISDAS: &LocalISDAS{ AllowedIAs: []addr.IA{ - xtest.MustParseIA("64-123"), - xtest.MustParseIA("70-ff00:0102:0304"), + addr.MustParseIA("64-123"), + addr.MustParseIA("70-ff00:0102:0304"), }, }, RemoteISDAS: &RemoteISDAS{ Rules: []ISDASRule{ { - IA: xtest.MustParseIA("64-123"), + IA: addr.MustParseIA("64-123"), Reject: true, }, }, diff --git a/private/path/pathpol/remote_isdas_test.go b/private/path/pathpol/remote_isdas_test.go index 725d6aca3a..1113d12a92 100644 --- a/private/path/pathpol/remote_isdas_test.go +++ b/private/path/pathpol/remote_isdas_test.go @@ -20,7 +20,7 @@ import ( "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" - "github.com/scionproto/scion/pkg/private/xtest" + "github.com/scionproto/scion/pkg/addr" ) func TestRemoteISDASEval(t *testing.T) { @@ -38,33 +38,33 @@ func TestRemoteISDASEval(t *testing.T) { }, "accept all": { Rules: []ISDASRule{ - {IA: xtest.MustParseIA("0-0")}, + {IA: addr.MustParseIA("0-0")}, }, ExpPathNum: 6, }, "as wildcard": { Rules: []ISDASRule{ - {IA: xtest.MustParseIA("2-0")}, + {IA: addr.MustParseIA("2-0")}, }, ExpPathNum: 5, }, "isd wildcard": { Rules: []ISDASRule{ - {IA: xtest.MustParseIA("0-ff00:0:212")}, + {IA: addr.MustParseIA("0-ff00:0:212")}, }, ExpPathNum: 4, }, "two rules": { Rules: []ISDASRule{ - {IA: xtest.MustParseIA("1-0")}, - {IA: xtest.MustParseIA("2-ff00:0:220")}, + {IA: addr.MustParseIA("1-0")}, + {IA: addr.MustParseIA("2-ff00:0:220")}, }, ExpPathNum: 2, }, "two rules negated": { Rules: []ISDASRule{ - {IA: xtest.MustParseIA("1-0"), Reject: true}, - {IA: xtest.MustParseIA("0-0")}, + {IA: addr.MustParseIA("1-0"), Reject: true}, + {IA: addr.MustParseIA("0-0")}, }, ExpPathNum: 5, }, @@ -73,9 +73,9 @@ func TestRemoteISDASEval(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() pp := NewPathProvider(ctrl) - paths1_110 := pp.GetPaths(xtest.MustParseIA("2-ff00:0:210"), xtest.MustParseIA("1-ff00:0:110")) - paths2_212 := pp.GetPaths(xtest.MustParseIA("2-ff00:0:210"), xtest.MustParseIA("2-ff00:0:212")) - paths2_220 := pp.GetPaths(xtest.MustParseIA("2-ff00:0:210"), xtest.MustParseIA("2-ff00:0:220")) + paths1_110 := pp.GetPaths(addr.MustParseIA("2-ff00:0:210"), addr.MustParseIA("1-ff00:0:110")) + paths2_212 := pp.GetPaths(addr.MustParseIA("2-ff00:0:210"), addr.MustParseIA("2-ff00:0:212")) + paths2_220 := pp.GetPaths(addr.MustParseIA("2-ff00:0:210"), addr.MustParseIA("2-ff00:0:220")) inPaths := append(paths1_110, append(paths2_212, paths2_220...)...) for name, test := range tests { t.Run(name, func(t *testing.T) { diff --git a/private/path/pathpol/sequence_test.go b/private/path/pathpol/sequence_test.go index 88f9124f0d..aa9bb9bddf 100644 --- a/private/path/pathpol/sequence_test.go +++ b/private/path/pathpol/sequence_test.go @@ -22,7 +22,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/scionproto/scion/pkg/addr" - "github.com/scionproto/scion/pkg/private/xtest" ) func TestNewSequence(t *testing.T) { @@ -50,260 +49,260 @@ func TestSequenceEval(t *testing.T) { }{ "Empty path": { Seq: newSequence(t, "0-0#0"), - Src: xtest.MustParseIA("2-ff00:0:212"), - Dst: xtest.MustParseIA("2-ff00:0:212"), + Src: addr.MustParseIA("2-ff00:0:212"), + Dst: addr.MustParseIA("2-ff00:0:212"), ExpPathNum: 0, }, "Asterisk matches empty path": { Seq: newSequence(t, "0*"), - Src: xtest.MustParseIA("2-ff00:0:212"), - Dst: xtest.MustParseIA("2-ff00:0:212"), + Src: addr.MustParseIA("2-ff00:0:212"), + Dst: addr.MustParseIA("2-ff00:0:212"), ExpPathNum: 1, }, "Asterisk on non-wildcard matches empty path": { Seq: newSequence(t, "1-ff00:0:110#1,2*"), - Src: xtest.MustParseIA("2-ff00:0:212"), - Dst: xtest.MustParseIA("2-ff00:0:212"), + Src: addr.MustParseIA("2-ff00:0:212"), + Dst: addr.MustParseIA("2-ff00:0:212"), ExpPathNum: 1, }, "Double Asterisk matches empty path": { Seq: newSequence(t, "0* 0*"), - Src: xtest.MustParseIA("2-ff00:0:212"), - Dst: xtest.MustParseIA("2-ff00:0:212"), + Src: addr.MustParseIA("2-ff00:0:212"), + Dst: addr.MustParseIA("2-ff00:0:212"), ExpPathNum: 1, }, "QuestionMark matches empty path": { Seq: newSequence(t, "0*"), - Src: xtest.MustParseIA("2-ff00:0:212"), - Dst: xtest.MustParseIA("2-ff00:0:212"), + Src: addr.MustParseIA("2-ff00:0:212"), + Dst: addr.MustParseIA("2-ff00:0:212"), ExpPathNum: 1, }, "Asterisk and QuestionMark matches empty path": { Seq: newSequence(t, "0* 0?"), - Src: xtest.MustParseIA("2-ff00:0:212"), - Dst: xtest.MustParseIA("2-ff00:0:212"), + Src: addr.MustParseIA("2-ff00:0:212"), + Dst: addr.MustParseIA("2-ff00:0:212"), ExpPathNum: 1, }, "Plus does not match empty path": { Seq: newSequence(t, "0+"), - Src: xtest.MustParseIA("2-ff00:0:212"), - Dst: xtest.MustParseIA("2-ff00:0:212"), + Src: addr.MustParseIA("2-ff00:0:212"), + Dst: addr.MustParseIA("2-ff00:0:212"), ExpPathNum: 0, }, "Length not matching": { Seq: newSequence(t, "0-0#0"), - Src: xtest.MustParseIA("2-ff00:0:212"), - Dst: xtest.MustParseIA("2-ff00:0:211"), + Src: addr.MustParseIA("2-ff00:0:212"), + Dst: addr.MustParseIA("2-ff00:0:211"), ExpPathNum: 0, }, "Two Wildcard matching": { Seq: newSequence(t, "0-0#0 0-0#0"), - Src: xtest.MustParseIA("2-ff00:0:212"), - Dst: xtest.MustParseIA("2-ff00:0:211"), + Src: addr.MustParseIA("2-ff00:0:212"), + Dst: addr.MustParseIA("2-ff00:0:211"), ExpPathNum: 2, }, "Longer Wildcard matching": { Seq: newSequence(t, "0-0#0 0-0#0 0-0#0 0-0#0"), - Src: xtest.MustParseIA("1-ff00:0:122"), - Dst: xtest.MustParseIA("2-ff00:0:220"), + Src: addr.MustParseIA("1-ff00:0:122"), + Dst: addr.MustParseIA("2-ff00:0:220"), ExpPathNum: 2, }, "Two Explicit matching": { Seq: newSequence(t, "1-ff00:0:133#1019 1-ff00:0:132#1910"), - Src: xtest.MustParseIA("1-ff00:0:133"), - Dst: xtest.MustParseIA("1-ff00:0:132"), + Src: addr.MustParseIA("1-ff00:0:133"), + Dst: addr.MustParseIA("1-ff00:0:132"), ExpPathNum: 1, }, "AS double IF matching": { Seq: newSequence(t, "0 1-ff00:0:132#1910,1916 0"), - Src: xtest.MustParseIA("1-ff00:0:133"), - Dst: xtest.MustParseIA("1-ff00:0:131"), + Src: addr.MustParseIA("1-ff00:0:133"), + Dst: addr.MustParseIA("1-ff00:0:131"), ExpPathNum: 1, }, "AS IF matching, first wildcard": { Seq: newSequence(t, "0 1-ff00:0:132#0,1916 0"), - Src: xtest.MustParseIA("1-ff00:0:133"), - Dst: xtest.MustParseIA("1-ff00:0:131"), + Src: addr.MustParseIA("1-ff00:0:133"), + Dst: addr.MustParseIA("1-ff00:0:131"), ExpPathNum: 1, }, "Longer Explicit matching": { Seq: newSequence(t, "1-ff00:0:122#1815 1-ff00:0:121#1518,1530 "+ "1-ff00:0:120#3015,3122 2-ff00:0:220#2231,2224 2-ff00:0:221#2422"), - Src: xtest.MustParseIA("1-ff00:0:122"), - Dst: xtest.MustParseIA("2-ff00:0:221"), + Src: addr.MustParseIA("1-ff00:0:122"), + Dst: addr.MustParseIA("2-ff00:0:221"), ExpPathNum: 1, }, "Longer Explicit matching, single wildcard": { Seq: newSequence(t, "1-ff00:0:133#1018 1-ff00:0:122#1810,1815 "+ "1-ff00:0:121#0,1530 1-ff00:0:120#3015,2911 1-ff00:0:110#1129"), - Src: xtest.MustParseIA("1-ff00:0:133"), - Dst: xtest.MustParseIA("1-ff00:0:110"), + Src: addr.MustParseIA("1-ff00:0:133"), + Dst: addr.MustParseIA("1-ff00:0:110"), ExpPathNum: 1, }, "Longer Explicit matching, reverse single wildcard": { Seq: newSequence(t, "1-ff00:0:133#1018 1-ff00:0:122#1810,1815 "+ "1-ff00:0:121#1530,0 1-ff00:0:120#3015,2911 1-ff00:0:110#1129"), - Src: xtest.MustParseIA("1-ff00:0:133"), - Dst: xtest.MustParseIA("1-ff00:0:110"), + Src: addr.MustParseIA("1-ff00:0:133"), + Dst: addr.MustParseIA("1-ff00:0:110"), ExpPathNum: 0, }, "Longer Explicit matching, multiple wildcard": { Seq: newSequence(t, "1-ff00:0:133#1018 1-ff00:0:122#0,1815 "+ "1-ff00:0:121#0,1530 1-ff00:0:120#3015,0 1-ff00:0:110#1129"), - Src: xtest.MustParseIA("1-ff00:0:133"), - Dst: xtest.MustParseIA("1-ff00:0:110"), + Src: addr.MustParseIA("1-ff00:0:133"), + Dst: addr.MustParseIA("1-ff00:0:110"), ExpPathNum: 1, }, "Longer Explicit matching, mixed wildcard types": { Seq: newSequence(t, "1-ff00:0:133#0 1 "+ "0-0#0 1-ff00:0:120#0 1-ff00:0:110#1129"), - Src: xtest.MustParseIA("1-ff00:0:133"), - Dst: xtest.MustParseIA("1-ff00:0:110"), + Src: addr.MustParseIA("1-ff00:0:133"), + Dst: addr.MustParseIA("1-ff00:0:110"), ExpPathNum: 1, }, "Longer Explicit matching, mixed wildcard types, two paths": { Seq: newSequence(t, "1-ff00:0:133#0 1-0#0 "+ "0-0#0 1-0#0 1-ff00:0:110#0"), - Src: xtest.MustParseIA("1-ff00:0:133"), - Dst: xtest.MustParseIA("1-ff00:0:110"), + Src: addr.MustParseIA("1-ff00:0:133"), + Dst: addr.MustParseIA("1-ff00:0:110"), ExpPathNum: 2, }, "Nil sequence does not filter": { Seq: nil, - Src: xtest.MustParseIA("2-ff00:0:212"), - Dst: xtest.MustParseIA("2-ff00:0:211"), + Src: addr.MustParseIA("2-ff00:0:212"), + Dst: addr.MustParseIA("2-ff00:0:211"), ExpPathNum: 2, }, "Asterisk matches multiple hops": { Seq: newSequence(t, "0*"), - Src: xtest.MustParseIA("2-ff00:0:212"), - Dst: xtest.MustParseIA("2-ff00:0:211"), + Src: addr.MustParseIA("2-ff00:0:212"), + Dst: addr.MustParseIA("2-ff00:0:211"), ExpPathNum: 2, }, "Asterisk matches zero hops": { Seq: newSequence(t, "0 0 0*"), - Src: xtest.MustParseIA("2-ff00:0:212"), - Dst: xtest.MustParseIA("2-ff00:0:211"), + Src: addr.MustParseIA("2-ff00:0:212"), + Dst: addr.MustParseIA("2-ff00:0:211"), ExpPathNum: 2, }, "Plus matches multiple hops": { Seq: newSequence(t, "0+"), - Src: xtest.MustParseIA("2-ff00:0:212"), - Dst: xtest.MustParseIA("2-ff00:0:211"), + Src: addr.MustParseIA("2-ff00:0:212"), + Dst: addr.MustParseIA("2-ff00:0:211"), ExpPathNum: 2, }, "Plus doesn't match zero hops": { Seq: newSequence(t, "0 0 0+"), - Src: xtest.MustParseIA("2-ff00:0:212"), - Dst: xtest.MustParseIA("2-ff00:0:211"), + Src: addr.MustParseIA("2-ff00:0:212"), + Dst: addr.MustParseIA("2-ff00:0:211"), ExpPathNum: 0, }, "Question mark matches zero hops": { Seq: newSequence(t, "0 0 0?"), - Src: xtest.MustParseIA("2-ff00:0:212"), - Dst: xtest.MustParseIA("2-ff00:0:211"), + Src: addr.MustParseIA("2-ff00:0:212"), + Dst: addr.MustParseIA("2-ff00:0:211"), ExpPathNum: 2, }, "Question mark matches one hop": { Seq: newSequence(t, "0 0?"), - Src: xtest.MustParseIA("2-ff00:0:212"), - Dst: xtest.MustParseIA("2-ff00:0:211"), + Src: addr.MustParseIA("2-ff00:0:212"), + Dst: addr.MustParseIA("2-ff00:0:211"), ExpPathNum: 2, }, "Question mark doesn't match two hops": { Seq: newSequence(t, "0?"), - Src: xtest.MustParseIA("2-ff00:0:212"), - Dst: xtest.MustParseIA("2-ff00:0:211"), + Src: addr.MustParseIA("2-ff00:0:212"), + Dst: addr.MustParseIA("2-ff00:0:211"), ExpPathNum: 0, }, "Successful match on hop count": { Seq: newSequence(t, "0 0 0"), - Src: xtest.MustParseIA("2-ff00:0:211"), - Dst: xtest.MustParseIA("2-ff00:0:220"), + Src: addr.MustParseIA("2-ff00:0:211"), + Dst: addr.MustParseIA("2-ff00:0:220"), ExpPathNum: 3, }, "Failed match on hop count": { Seq: newSequence(t, "0 0"), - Src: xtest.MustParseIA("2-ff00:0:211"), - Dst: xtest.MustParseIA("2-ff00:0:220"), + Src: addr.MustParseIA("2-ff00:0:211"), + Dst: addr.MustParseIA("2-ff00:0:220"), ExpPathNum: 0, }, "Select one of the intermediate ASes": { Seq: newSequence(t, "0 2-ff00:0:221 0"), - Src: xtest.MustParseIA("2-ff00:0:211"), - Dst: xtest.MustParseIA("2-ff00:0:220"), + Src: addr.MustParseIA("2-ff00:0:211"), + Dst: addr.MustParseIA("2-ff00:0:220"), ExpPathNum: 1, }, "Select two alternative intermediate ASes": { Seq: newSequence(t, "0 (2-ff00:0:221 | 2-ff00:0:210) 0"), - Src: xtest.MustParseIA("2-ff00:0:211"), - Dst: xtest.MustParseIA("2-ff00:0:220"), + Src: addr.MustParseIA("2-ff00:0:211"), + Dst: addr.MustParseIA("2-ff00:0:220"), ExpPathNum: 3, }, "Alternative intermediate ASes, but one doesn't exist": { Seq: newSequence(t, "0 (2-ff00:0:221 |64-12345) 0"), - Src: xtest.MustParseIA("2-ff00:0:211"), - Dst: xtest.MustParseIA("2-ff00:0:220"), + Src: addr.MustParseIA("2-ff00:0:211"), + Dst: addr.MustParseIA("2-ff00:0:220"), ExpPathNum: 1, }, "Or has higher priority than concatenation": { Seq: newSequence(t, "0 2-ff00:0:221|64-12345 0"), - Src: xtest.MustParseIA("2-ff00:0:211"), - Dst: xtest.MustParseIA("2-ff00:0:220"), + Src: addr.MustParseIA("2-ff00:0:211"), + Dst: addr.MustParseIA("2-ff00:0:220"), ExpPathNum: 1, }, "Question mark has higher priority than concatenation": { Seq: newSequence(t, "0 0 0 ? "), - Src: xtest.MustParseIA("2-ff00:0:211"), - Dst: xtest.MustParseIA("2-ff00:0:220"), + Src: addr.MustParseIA("2-ff00:0:211"), + Dst: addr.MustParseIA("2-ff00:0:220"), ExpPathNum: 3, }, "Parentheses change priority": { Seq: newSequence(t, "(0 0)?"), - Src: xtest.MustParseIA("2-ff00:0:211"), - Dst: xtest.MustParseIA("2-ff00:0:220"), + Src: addr.MustParseIA("2-ff00:0:211"), + Dst: addr.MustParseIA("2-ff00:0:220"), ExpPathNum: 0, }, "Single interface matches inbound interface": { Seq: newSequence(t, "0 1-ff00:0:132#1910 0"), - Src: xtest.MustParseIA("1-ff00:0:133"), - Dst: xtest.MustParseIA("1-ff00:0:131"), + Src: addr.MustParseIA("1-ff00:0:133"), + Dst: addr.MustParseIA("1-ff00:0:131"), ExpPathNum: 1, }, "Single interface matches outbound interface": { Seq: newSequence(t, "0 1-ff00:0:132#1916 0"), - Src: xtest.MustParseIA("1-ff00:0:133"), - Dst: xtest.MustParseIA("1-ff00:0:131"), + Src: addr.MustParseIA("1-ff00:0:133"), + Dst: addr.MustParseIA("1-ff00:0:131"), ExpPathNum: 1, }, "Single non-matching interface": { Seq: newSequence(t, "0 1-ff00:0:132#1917 0"), - Src: xtest.MustParseIA("1-ff00:0:133"), - Dst: xtest.MustParseIA("1-ff00:0:131"), + Src: addr.MustParseIA("1-ff00:0:133"), + Dst: addr.MustParseIA("1-ff00:0:131"), ExpPathNum: 0, }, "Left interface matches inbound": { Seq: newSequence(t, "0 1-ff00:0:132#1910,0 0"), - Src: xtest.MustParseIA("1-ff00:0:133"), - Dst: xtest.MustParseIA("1-ff00:0:131"), + Src: addr.MustParseIA("1-ff00:0:133"), + Dst: addr.MustParseIA("1-ff00:0:131"), ExpPathNum: 1, }, "Left interface doesn't match outbound": { Seq: newSequence(t, "0 1-ff00:0:132#1916,0 0"), - Src: xtest.MustParseIA("1-ff00:0:133"), - Dst: xtest.MustParseIA("1-ff00:0:131"), + Src: addr.MustParseIA("1-ff00:0:133"), + Dst: addr.MustParseIA("1-ff00:0:131"), ExpPathNum: 0, }, "Right interface matches outbound": { Seq: newSequence(t, "0 1-ff00:0:132#0,1916 0"), - Src: xtest.MustParseIA("1-ff00:0:133"), - Dst: xtest.MustParseIA("1-ff00:0:131"), + Src: addr.MustParseIA("1-ff00:0:133"), + Dst: addr.MustParseIA("1-ff00:0:131"), ExpPathNum: 1, }, "Right interface doesn't match inbound": { Seq: newSequence(t, "0 1-ff00:0:132#0,1910 0"), - Src: xtest.MustParseIA("1-ff00:0:133"), - Dst: xtest.MustParseIA("1-ff00:0:131"), + Src: addr.MustParseIA("1-ff00:0:133"), + Dst: addr.MustParseIA("1-ff00:0:131"), ExpPathNum: 0, }, } diff --git a/private/revcache/BUILD.bazel b/private/revcache/BUILD.bazel index 252cbd3d20..2c1672930f 100644 --- a/private/revcache/BUILD.bazel +++ b/private/revcache/BUILD.bazel @@ -29,7 +29,6 @@ go_test( "//pkg/private/ctrl/path_mgmt/proto:go_default_library", "//pkg/private/serrors:go_default_library", "//pkg/private/util:go_default_library", - "//pkg/private/xtest:go_default_library", "//pkg/private/xtest/graph:go_default_library", "//pkg/segment:go_default_library", "//private/revcache/mock_revcache:go_default_library", diff --git a/private/revcache/revcachetest/BUILD.bazel b/private/revcache/revcachetest/BUILD.bazel index 709fba1325..6c10abce83 100644 --- a/private/revcache/revcachetest/BUILD.bazel +++ b/private/revcache/revcachetest/BUILD.bazel @@ -11,7 +11,6 @@ go_library( "//pkg/private/ctrl/path_mgmt:go_default_library", "//pkg/private/ctrl/path_mgmt/proto:go_default_library", "//pkg/private/util:go_default_library", - "//pkg/private/xtest:go_default_library", "//private/revcache:go_default_library", "@com_github_smartystreets_goconvey//convey:go_default_library", "@com_github_stretchr_testify//assert:go_default_library", diff --git a/private/revcache/revcachetest/revcachetest.go b/private/revcache/revcachetest/revcachetest.go index 96ba9f6386..64dedaf310 100644 --- a/private/revcache/revcachetest/revcachetest.go +++ b/private/revcache/revcachetest/revcachetest.go @@ -29,13 +29,12 @@ import ( "github.com/scionproto/scion/pkg/private/ctrl/path_mgmt" "github.com/scionproto/scion/pkg/private/ctrl/path_mgmt/proto" "github.com/scionproto/scion/pkg/private/util" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/private/revcache" ) var ( - ia110 = xtest.MustParseIA("1-ff00:0:110") - ia120 = xtest.MustParseIA("1-ff00:0:120") + ia110 = addr.MustParseIA("1-ff00:0:110") + ia120 = addr.MustParseIA("1-ff00:0:120") ifId15 = common.IFIDType(15) ifId19 = common.IFIDType(19) diff --git a/private/revcache/util_test.go b/private/revcache/util_test.go index 191dbec336..50cf650701 100644 --- a/private/revcache/util_test.go +++ b/private/revcache/util_test.go @@ -28,7 +28,6 @@ import ( "github.com/scionproto/scion/pkg/private/ctrl/path_mgmt/proto" "github.com/scionproto/scion/pkg/private/serrors" "github.com/scionproto/scion/pkg/private/util" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/private/xtest/graph" seg "github.com/scionproto/scion/pkg/segment" "github.com/scionproto/scion/private/revcache" @@ -36,8 +35,8 @@ import ( ) var ( - ia110 = xtest.MustParseIA("1-ff00:0:110") - ia211 = xtest.MustParseIA("2-ff00:0:211") + ia110 = addr.MustParseIA("1-ff00:0:110") + ia211 = addr.MustParseIA("2-ff00:0:211") ifid10 = uint16(10) ifid11 = uint16(11) @@ -116,7 +115,7 @@ func TestNoRevokedHopIntf(t *testing.T) { sRev := defaultRevInfo(ia211, graph.If_210_X_211_A, now) revCache.EXPECT().Get(gomock.Eq(ctx), gomock.Any()).Return( revcache.Revocations{ - revcache.Key{IA: xtest.MustParseIA("2-ff00:0:211"), + revcache.Key{IA: addr.MustParseIA("2-ff00:0:211"), IfId: common.IFIDType(graph.If_210_X_211_A)}: sRev, }, nil, ) diff --git a/private/segment/segfetcher/BUILD.bazel b/private/segment/segfetcher/BUILD.bazel index f7286b5dc4..faf6e1c34d 100644 --- a/private/segment/segfetcher/BUILD.bazel +++ b/private/segment/segfetcher/BUILD.bazel @@ -52,7 +52,6 @@ go_test( "//pkg/private/common:go_default_library", "//pkg/private/ctrl/path_mgmt:go_default_library", "//pkg/private/serrors:go_default_library", - "//pkg/private/xtest:go_default_library", "//pkg/private/xtest/graph:go_default_library", "//pkg/private/xtest/matchers:go_default_library", "//pkg/segment:go_default_library", diff --git a/private/segment/segfetcher/pather_test.go b/private/segment/segfetcher/pather_test.go index 1b5ba15c9f..3efc4f1624 100644 --- a/private/segment/segfetcher/pather_test.go +++ b/private/segment/segfetcher/pather_test.go @@ -19,7 +19,7 @@ import ( "github.com/stretchr/testify/assert" - "github.com/scionproto/scion/pkg/private/xtest" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/snet" "github.com/scionproto/scion/private/segment/segfetcher" ) @@ -39,14 +39,14 @@ func TestRevocationsString(t *testing.T) { }, "one element": { Input: map[snet.PathInterface]struct{}{ - {IA: xtest.MustParseIA("1-ff00:0:1"), ID: 1}: {}, + {IA: addr.MustParseIA("1-ff00:0:1"), ID: 1}: {}, }, Output: "[1-ff00:0:1#1]", }, "two elements": { Input: map[snet.PathInterface]struct{}{ - {IA: xtest.MustParseIA("1-ff00:0:1"), ID: 1}: {}, - {IA: xtest.MustParseIA("1-ff00:0:2"), ID: 2}: {}, + {IA: addr.MustParseIA("1-ff00:0:1"), ID: 1}: {}, + {IA: addr.MustParseIA("1-ff00:0:2"), ID: 2}: {}, }, Output: "[1-ff00:0:1#1 1-ff00:0:2#2]", }, diff --git a/private/segment/segfetcher/requester_test.go b/private/segment/segfetcher/requester_test.go index 01a38c871d..ed458fa2aa 100644 --- a/private/segment/segfetcher/requester_test.go +++ b/private/segment/segfetcher/requester_test.go @@ -25,8 +25,8 @@ import ( "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/serrors" - "github.com/scionproto/scion/pkg/private/xtest" seg "github.com/scionproto/scion/pkg/segment" "github.com/scionproto/scion/private/segment/segfetcher" "github.com/scionproto/scion/private/segment/segfetcher/mock_segfetcher" @@ -39,18 +39,18 @@ const ( ) var ( - isd1 = xtest.MustParseIA("1-0") - isd2 = xtest.MustParseIA("2-0") + isd1 = addr.MustParseIA("1-0") + isd2 = addr.MustParseIA("2-0") - core_110 = xtest.MustParseIA("1-ff00:0:110") - core_120 = xtest.MustParseIA("1-ff00:0:120") - core_130 = xtest.MustParseIA("1-ff00:0:130") - core_210 = xtest.MustParseIA("2-ff00:0:210") + core_110 = addr.MustParseIA("1-ff00:0:110") + core_120 = addr.MustParseIA("1-ff00:0:120") + core_130 = addr.MustParseIA("1-ff00:0:130") + core_210 = addr.MustParseIA("2-ff00:0:210") - non_core_111 = xtest.MustParseIA("1-ff00:0:111") - non_core_112 = xtest.MustParseIA("1-ff00:0:112") - non_core_211 = xtest.MustParseIA("2-ff00:0:211") - non_core_212 = xtest.MustParseIA("2-ff00:0:212") + non_core_111 = addr.MustParseIA("1-ff00:0:111") + non_core_112 = addr.MustParseIA("1-ff00:0:112") + non_core_211 = addr.MustParseIA("2-ff00:0:211") + non_core_212 = addr.MustParseIA("2-ff00:0:212") req_111_1 = segfetcher.Request{SegType: Up, Src: non_core_111, Dst: isd1} req_1_111 = segfetcher.Request{SegType: Down, Src: isd1, Dst: non_core_111} diff --git a/private/storage/beacon/metrics/BUILD.bazel b/private/storage/beacon/metrics/BUILD.bazel index 895ba4de4c..62c2ca1ae3 100644 --- a/private/storage/beacon/metrics/BUILD.bazel +++ b/private/storage/beacon/metrics/BUILD.bazel @@ -23,8 +23,8 @@ go_test( srcs = ["metrics_test.go"], deps = [ ":go_default_library", + "//pkg/addr:go_default_library", "//pkg/metrics:go_default_library", - "//pkg/private/xtest:go_default_library", "//private/storage:go_default_library", "//private/storage/beacon:go_default_library", "//private/storage/beacon/dbtest:go_default_library", diff --git a/private/storage/beacon/metrics/metrics_test.go b/private/storage/beacon/metrics/metrics_test.go index af9e358aa6..113dcd0ed8 100644 --- a/private/storage/beacon/metrics/metrics_test.go +++ b/private/storage/beacon/metrics/metrics_test.go @@ -20,8 +20,8 @@ import ( "github.com/stretchr/testify/require" + "github.com/scionproto/scion/pkg/addr" libmetrics "github.com/scionproto/scion/pkg/metrics" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/private/storage" "github.com/scionproto/scion/private/storage/beacon" "github.com/scionproto/scion/private/storage/beacon/dbtest" @@ -29,7 +29,7 @@ import ( "github.com/scionproto/scion/private/storage/beacon/sqlite" ) -var testIA = xtest.MustParseIA("1-ff00:0:333") +var testIA = addr.MustParseIA("1-ff00:0:333") type TestBackend struct { storage.BeaconDB diff --git a/private/storage/beacon/sqlite/BUILD.bazel b/private/storage/beacon/sqlite/BUILD.bazel index fb536c3032..eaf01f3a92 100644 --- a/private/storage/beacon/sqlite/BUILD.bazel +++ b/private/storage/beacon/sqlite/BUILD.bazel @@ -29,7 +29,7 @@ go_test( deps = [ "//control/beacon:go_default_library", "//control/beacon/beacondbtest:go_default_library", - "//pkg/private/xtest:go_default_library", + "//pkg/addr:go_default_library", "//private/storage/beacon/dbtest:go_default_library", "@com_github_stretchr_testify//assert:go_default_library", "@com_github_stretchr_testify//require:go_default_library", diff --git a/private/storage/beacon/sqlite/db_test.go b/private/storage/beacon/sqlite/db_test.go index dcc990e7cf..3cb030429a 100644 --- a/private/storage/beacon/sqlite/db_test.go +++ b/private/storage/beacon/sqlite/db_test.go @@ -28,12 +28,12 @@ import ( "github.com/scionproto/scion/control/beacon" "github.com/scionproto/scion/control/beacon/beacondbtest" - "github.com/scionproto/scion/pkg/private/xtest" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/private/storage/beacon/dbtest" "github.com/scionproto/scion/private/storage/beacon/sqlite" ) -var testIA = xtest.MustParseIA("1-ff00:0:333") +var testIA = addr.MustParseIA("1-ff00:0:333") type TestBackend struct { *sqlite.Backend diff --git a/private/storage/drkey/level1/dbtest/BUILD.bazel b/private/storage/drkey/level1/dbtest/BUILD.bazel index 2d8fa4a96d..9c0e892365 100644 --- a/private/storage/drkey/level1/dbtest/BUILD.bazel +++ b/private/storage/drkey/level1/dbtest/BUILD.bazel @@ -6,8 +6,8 @@ go_library( importpath = "github.com/scionproto/scion/private/storage/drkey/level1/dbtest", visibility = ["//visibility:public"], deps = [ + "//pkg/addr:go_default_library", "//pkg/drkey:go_default_library", - "//pkg/private/xtest:go_default_library", "//pkg/scrypto/cppki:go_default_library", "//private/drkey/drkeytest:go_default_library", "@com_github_stretchr_testify//assert:go_default_library", diff --git a/private/storage/drkey/level1/dbtest/dbtest.go b/private/storage/drkey/level1/dbtest/dbtest.go index 170a4707d3..8ecd3efe43 100644 --- a/private/storage/drkey/level1/dbtest/dbtest.go +++ b/private/storage/drkey/level1/dbtest/dbtest.go @@ -21,8 +21,8 @@ import ( "github.com/stretchr/testify/assert" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/drkey" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/scrypto/cppki" "github.com/scionproto/scion/private/drkey/drkeytest" ) @@ -33,8 +33,8 @@ const ( ) var ( - srcIA = xtest.MustParseIA("1-ff00:0:111") - dstIA = xtest.MustParseIA("1-ff00:0:112") + srcIA = addr.MustParseIA("1-ff00:0:111") + dstIA = addr.MustParseIA("1-ff00:0:112") ) type TestableDB interface { diff --git a/private/storage/drkey/level2/dbtest/BUILD.bazel b/private/storage/drkey/level2/dbtest/BUILD.bazel index 65a475aa49..e98fb9459d 100644 --- a/private/storage/drkey/level2/dbtest/BUILD.bazel +++ b/private/storage/drkey/level2/dbtest/BUILD.bazel @@ -6,8 +6,8 @@ go_library( importpath = "github.com/scionproto/scion/private/storage/drkey/level2/dbtest", visibility = ["//visibility:public"], deps = [ + "//pkg/addr:go_default_library", "//pkg/drkey:go_default_library", - "//pkg/private/xtest:go_default_library", "//pkg/scrypto/cppki:go_default_library", "//private/drkey/drkeytest:go_default_library", "@com_github_stretchr_testify//assert:go_default_library", diff --git a/private/storage/drkey/level2/dbtest/dbtest.go b/private/storage/drkey/level2/dbtest/dbtest.go index e5c6f4cf3e..cfaac344ca 100644 --- a/private/storage/drkey/level2/dbtest/dbtest.go +++ b/private/storage/drkey/level2/dbtest/dbtest.go @@ -22,8 +22,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/drkey" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/scrypto/cppki" "github.com/scionproto/scion/private/drkey/drkeytest" ) @@ -34,8 +34,8 @@ const ( ) var ( - srcIA = xtest.MustParseIA("1-ff00:0:111") - dstIA = xtest.MustParseIA("1-ff00:0:112") + srcIA = addr.MustParseIA("1-ff00:0:111") + dstIA = addr.MustParseIA("1-ff00:0:112") srcHost = "192.168.1.37" dstHost = "192.168.1.38" ) diff --git a/private/storage/drkey/secret/dbtest/BUILD.bazel b/private/storage/drkey/secret/dbtest/BUILD.bazel index 2ae245a00b..60b43d8d8c 100644 --- a/private/storage/drkey/secret/dbtest/BUILD.bazel +++ b/private/storage/drkey/secret/dbtest/BUILD.bazel @@ -6,8 +6,8 @@ go_library( importpath = "github.com/scionproto/scion/private/storage/drkey/secret/dbtest", visibility = ["//visibility:public"], deps = [ + "//pkg/addr:go_default_library", "//pkg/drkey:go_default_library", - "//pkg/private/xtest:go_default_library", "//pkg/scrypto/cppki:go_default_library", "@com_github_stretchr_testify//assert:go_default_library", "@com_github_stretchr_testify//require:go_default_library", diff --git a/private/storage/drkey/secret/dbtest/dbtest.go b/private/storage/drkey/secret/dbtest/dbtest.go index 9ab2532ed9..33ba0d7e04 100644 --- a/private/storage/drkey/secret/dbtest/dbtest.go +++ b/private/storage/drkey/secret/dbtest/dbtest.go @@ -22,8 +22,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/drkey" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/scrypto/cppki" ) @@ -33,7 +33,7 @@ const ( ) var ( - srcIA = xtest.MustParseIA("1-ff00:0:111") + srcIA = addr.MustParseIA("1-ff00:0:111") ) type TestableDB interface { diff --git a/private/storage/path/dbtest/BUILD.bazel b/private/storage/path/dbtest/BUILD.bazel index 46dd75ae17..dd03cd363a 100644 --- a/private/storage/path/dbtest/BUILD.bazel +++ b/private/storage/path/dbtest/BUILD.bazel @@ -8,7 +8,6 @@ go_library( deps = [ "//pkg/addr:go_default_library", "//pkg/private/common:go_default_library", - "//pkg/private/xtest:go_default_library", "//pkg/private/xtest/graph:go_default_library", "//pkg/segment:go_default_library", "//pkg/slayers/path:go_default_library", diff --git a/private/storage/path/dbtest/dbtest.go b/private/storage/path/dbtest/dbtest.go index 8554de6c06..631f94d754 100644 --- a/private/storage/path/dbtest/dbtest.go +++ b/private/storage/path/dbtest/dbtest.go @@ -28,7 +28,6 @@ import ( "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/common" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/private/xtest/graph" seg "github.com/scionproto/scion/pkg/segment" "github.com/scionproto/scion/pkg/slayers/path" @@ -418,8 +417,8 @@ func testGetWithHPGroupIDs(t *testing.T, pathDB pathdb.ReadWrite) { func testNextQuery(t *testing.T, pathDB pathdb.ReadWrite) { ctx, cancelF := context.WithTimeout(context.Background(), time.Second) defer cancelF() - src := xtest.MustParseIA("1-ff00:0:111") - dst := xtest.MustParseIA("1-ff00:0:133") + src := addr.MustParseIA("1-ff00:0:111") + dst := addr.MustParseIA("1-ff00:0:133") oldT := time.Now().Add(-10 * time.Second) updated, err := pathDB.InsertNextQuery(ctx, src, dst, oldT) require.NoError(t, err) @@ -441,15 +440,15 @@ func testNextQuery(t *testing.T, pathDB pathdb.ReadWrite) { require.NoError(t, err) assert.Equal(t, newT.Unix(), dbT.Unix(), "Should return updated time") // other dst - dbT, err = pathDB.GetNextQuery(ctx, src, xtest.MustParseIA("1-ff00:0:122")) + dbT, err = pathDB.GetNextQuery(ctx, src, addr.MustParseIA("1-ff00:0:122")) require.NoError(t, err) assert.Zero(t, dbT) - dbT, err = pathDB.GetNextQuery(ctx, xtest.MustParseIA("1-ff00:0:122"), dst) + dbT, err = pathDB.GetNextQuery(ctx, addr.MustParseIA("1-ff00:0:122"), dst) require.NoError(t, err) assert.Zero(t, dbT) ctx, cancelF = context.WithDeadline(context.Background(), time.Now().Add(-3*time.Second)) defer cancelF() - _, err = pathDB.GetNextQuery(ctx, src, xtest.MustParseIA("1-ff00:0:122")) + _, err = pathDB.GetNextQuery(ctx, src, addr.MustParseIA("1-ff00:0:122")) assert.Error(t, err) } diff --git a/private/storage/trust/dbtest/dbtest.go b/private/storage/trust/dbtest/dbtest.go index 0a2a865f35..754d0676df 100644 --- a/private/storage/trust/dbtest/dbtest.go +++ b/private/storage/trust/dbtest/dbtest.go @@ -141,7 +141,7 @@ func run(t *testing.T, db TestableDB, cfg Config) { }) t.Run("Get chain with covered validity", func(t *testing.T) { chains, err := db.Chains(ctx, trust.ChainQuery{ - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), Validity: cppki.Validity{ NotBefore: xtest.MustParseTime(t, "2020-06-24T14:00:00Z"), NotAfter: xtest.MustParseTime(t, "2020-06-27T00:00:00Z"), @@ -152,7 +152,7 @@ func run(t *testing.T, db TestableDB, cfg Config) { }) t.Run("Get chain with not covered validity", func(t *testing.T) { chains, err := db.Chains(ctx, trust.ChainQuery{ - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), Validity: cppki.Validity{ NotBefore: xtest.MustParseTime(t, "2020-06-24T14:00:00Z"), NotAfter: xtest.MustParseTime(t, "2020-06-27T14:00:00Z"), diff --git a/private/svc/resolver_test.go b/private/svc/resolver_test.go index f8b26d2d89..41de6c71c6 100644 --- a/private/svc/resolver_test.go +++ b/private/svc/resolver_test.go @@ -40,8 +40,8 @@ func TestResolver(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() - srcIA := xtest.MustParseIA("1-ff00:0:1") - dstIA := xtest.MustParseIA("1-ff00:0:2") + srcIA := addr.MustParseIA("1-ff00:0:1") + dstIA := addr.MustParseIA("1-ff00:0:2") mockPath := mock_snet.NewMockPath(ctrl) mockPath.EXPECT().Dataplane().Return(path.SCION{}).AnyTimes() mockPath.EXPECT().UnderlayNextHop().Return(nil).AnyTimes() diff --git a/private/topology/reload_test.go b/private/topology/reload_test.go index 0827217376..e801ea2e05 100644 --- a/private/topology/reload_test.go +++ b/private/topology/reload_test.go @@ -27,6 +27,7 @@ import ( "golang.org/x/net/context" "golang.org/x/sync/errgroup" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/metrics/mock_metrics" "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/private/topology" @@ -38,7 +39,7 @@ func TestLoader(t *testing.T) { testBasicTopo := func(t *testing.T, l *topology.Loader) { t.Helper() - assert.Equal(t, xtest.MustParseIA("1-ff00:0:311"), l.IA()) + assert.Equal(t, addr.MustParseIA("1-ff00:0:311"), l.IA()) assert.Equal(t, uint16(1472), l.MTU()) assert.Equal(t, false, l.Core()) assert.ElementsMatch(t, []uint16{1, 3, 8, 11}, l.InterfaceIDs()) diff --git a/private/topology/topology_test.go b/private/topology/topology_test.go index 68ac7a682a..c54e283b95 100644 --- a/private/topology/topology_test.go +++ b/private/topology/topology_test.go @@ -26,7 +26,6 @@ import ( "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/common" - "github.com/scionproto/scion/pkg/private/xtest" jsontopo "github.com/scionproto/scion/private/topology/json" ) @@ -198,7 +197,7 @@ func TestIFInfoMap(t *testing.T) { InternalAddr: netip.MustParseAddrPort("10.1.0.1:0"), Local: netip.MustParseAddrPort("192.0.2.1:44997"), Remote: netip.MustParseAddrPort("192.0.2.2:44998"), - IA: xtest.MustParseIA("1-ff00:0:312"), + IA: addr.MustParseIA("1-ff00:0:312"), LinkType: Parent, MTU: 1472, BFD: BFD{ @@ -213,7 +212,7 @@ func TestIFInfoMap(t *testing.T) { InternalAddr: netip.MustParseAddrPort("10.1.0.1:0"), Local: netip.MustParseAddrPort("[2001:db8:a0b:12f0::1]:44997"), Remote: netip.MustParseAddrPort("[2001:db8:a0b:12f0::2]:44998"), - IA: xtest.MustParseIA("1-ff00:0:314"), + IA: addr.MustParseIA("1-ff00:0:314"), LinkType: Child, MTU: 4430, }, @@ -223,7 +222,7 @@ func TestIFInfoMap(t *testing.T) { InternalAddr: netip.MustParseAddrPort("10.1.0.1:0"), Local: netip.AddrPortFrom(netip.Addr{}, 44997), Remote: netip.MustParseAddrPort("192.0.2.3:44998"), - IA: xtest.MustParseIA("1-ff00:0:313"), + IA: addr.MustParseIA("1-ff00:0:313"), LinkType: Peer, MTU: 1480, }, @@ -233,7 +232,7 @@ func TestIFInfoMap(t *testing.T) { InternalAddr: netip.MustParseAddrPort(`[2001:db8:a0b:12f0::1%some-internal-zone]:0`), Local: netip.MustParseAddrPort(`[2001:db8:a0b:12f0::1%some-local-zone]:44897`), Remote: netip.MustParseAddrPort(`[2001:db8:a0b:12f0::2%some-remote-zone]:44898`), - IA: xtest.MustParseIA("1-ff00:0:314"), + IA: addr.MustParseIA("1-ff00:0:314"), LinkType: Child, MTU: 4430, }, @@ -251,7 +250,7 @@ func TestIFInfoMapDeprecatedPublicBind(t *testing.T) { InternalAddr: netip.MustParseAddrPort("10.1.0.1:0"), Local: netip.MustParseAddrPort("10.0.0.1:44997"), Remote: netip.MustParseAddrPort("192.0.2.2:44998"), - IA: xtest.MustParseIA("1-ff00:0:312"), + IA: addr.MustParseIA("1-ff00:0:312"), LinkType: Parent, MTU: 1472, }, @@ -262,7 +261,7 @@ func TestIFInfoMapDeprecatedPublicBind(t *testing.T) { InternalAddr: netip.MustParseAddrPort("10.1.0.1:0"), Local: netip.MustParseAddrPort("[2001:db8:a0b:12f0::8]:44997"), Remote: netip.MustParseAddrPort("[2001:db8:a0b:12f0::2]:44998"), - IA: xtest.MustParseIA("1-ff00:0:314"), + IA: addr.MustParseIA("1-ff00:0:314"), LinkType: Child, MTU: 4430, }, @@ -273,7 +272,7 @@ func TestIFInfoMapDeprecatedPublicBind(t *testing.T) { InternalAddr: netip.MustParseAddrPort("10.1.0.1:0"), Local: netip.MustParseAddrPort("192.0.2.2:44997"), Remote: netip.MustParseAddrPort("192.0.2.3:44998"), - IA: xtest.MustParseIA("1-ff00:0:313"), + IA: addr.MustParseIA("1-ff00:0:313"), LinkType: Peer, MTU: 1480, }, @@ -291,7 +290,7 @@ func TestIFInfoMapCoreAS(t *testing.T) { InternalAddr: netip.MustParseAddrPort("10.1.0.1:0"), Local: netip.MustParseAddrPort("192.0.2.1:4997"), Remote: netip.MustParseAddrPort("192.0.2.2:4998"), - IA: xtest.MustParseIA("6-ff00:0:363"), + IA: addr.MustParseIA("6-ff00:0:363"), LinkType: Core, MTU: 1472, }, @@ -301,7 +300,7 @@ func TestIFInfoMapCoreAS(t *testing.T) { InternalAddr: netip.MustParseAddrPort("[2001:db8:a0b:12f0::2]:0"), Local: netip.MustParseAddrPort("[2001:db8:a0b:12f0::1]:4997"), Remote: netip.MustParseAddrPort("[2001:db8:a0b:12f0::2]:4998"), - IA: xtest.MustParseIA("6-ff00:0:364"), + IA: addr.MustParseIA("6-ff00:0:364"), LinkType: Child, MTU: 4430, }, diff --git a/private/trust/db_inspector_test.go b/private/trust/db_inspector_test.go index 6e67dd5bf1..29a72b725c 100644 --- a/private/trust/db_inspector_test.go +++ b/private/trust/db_inspector_test.go @@ -42,18 +42,18 @@ func (i isdInfo) any() []addr.IA { var attributes = isdInfo{ authoritatives: []addr.IA{ - xtest.MustParseIA("1-ff00:0:110"), - xtest.MustParseIA("1-ff00:0:130"), - xtest.MustParseIA("1-ff00:0:111"), + addr.MustParseIA("1-ff00:0:110"), + addr.MustParseIA("1-ff00:0:130"), + addr.MustParseIA("1-ff00:0:111"), }, cores: []addr.IA{ - xtest.MustParseIA("1-ff00:0:110"), - xtest.MustParseIA("1-ff00:0:120"), - xtest.MustParseIA("1-ff00:0:130"), + addr.MustParseIA("1-ff00:0:110"), + addr.MustParseIA("1-ff00:0:120"), + addr.MustParseIA("1-ff00:0:130"), }, rootCAs: []addr.IA{ - xtest.MustParseIA("1-ff00:0:110"), - xtest.MustParseIA("1-ff00:0:111"), + addr.MustParseIA("1-ff00:0:110"), + addr.MustParseIA("1-ff00:0:111"), }, } @@ -167,7 +167,7 @@ func TestDBInspectorHasAttributes(t *testing.T) { }, "valid non-primary": { db: trcDB(trc1), - query: hasAttrQuery{IA: xtest.MustParseIA("1-ff00:0:112"), Attrs: trust.Any}, + query: hasAttrQuery{IA: addr.MustParseIA("1-ff00:0:112"), Attrs: trust.Any}, expected: false, assertErr: assert.NoError, }, @@ -178,7 +178,7 @@ func TestDBInspectorHasAttributes(t *testing.T) { }, "trc not found": { db: trcDB(trc1), - query: hasAttrQuery{IA: xtest.MustParseIA("2-ff00:0:210"), Attrs: trust.Any}, + query: hasAttrQuery{IA: addr.MustParseIA("2-ff00:0:210"), Attrs: trust.Any}, assertErr: assert.Error, }, } diff --git a/private/trust/dbtest/BUILD.bazel b/private/trust/dbtest/BUILD.bazel index 7afaa36b4e..3a56cf4ca4 100644 --- a/private/trust/dbtest/BUILD.bazel +++ b/private/trust/dbtest/BUILD.bazel @@ -7,6 +7,7 @@ go_library( importpath = "github.com/scionproto/scion/private/trust/dbtest", visibility = ["//visibility:public"], deps = [ + "//pkg/addr:go_default_library", "//pkg/private/xtest:go_default_library", "//pkg/scrypto:go_default_library", "//pkg/scrypto/cppki:go_default_library", diff --git a/private/trust/dbtest/dbtest.go b/private/trust/dbtest/dbtest.go index 319cf8c709..6006cfcf9e 100644 --- a/private/trust/dbtest/dbtest.go +++ b/private/trust/dbtest/dbtest.go @@ -25,6 +25,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/scrypto" "github.com/scionproto/scion/pkg/scrypto/cppki" @@ -223,7 +224,7 @@ func testChain(t *testing.T, db trust.DB, cfg Config) { t.Run("Chain", func(t *testing.T) { t.Run("Non existing chain", func(t *testing.T) { chains, err := db.Chains(ctx, trust.ChainQuery{ - IA: xtest.MustParseIA("1-ff00:0:111"), + IA: addr.MustParseIA("1-ff00:0:111"), SubjectKeyID: []byte("non-existing"), Validity: cppki.Validity{ NotBefore: time.Now(), @@ -235,7 +236,7 @@ func testChain(t *testing.T, db trust.DB, cfg Config) { }) t.Run("Existing chain no overlap", func(t *testing.T) { chains, err := db.Chains(ctx, trust.ChainQuery{ - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), SubjectKeyID: bern1Chain[0].SubjectKeyId, Validity: cppki.Validity{ NotBefore: time.Date(2020, 6, 25, 14, 0, 0, 0, time.UTC), @@ -250,7 +251,7 @@ func testChain(t *testing.T, db trust.DB, cfg Config) { _, err = db.InsertChain(ctx, bern2Chain) require.NoError(t, err) chains, err := db.Chains(ctx, trust.ChainQuery{ - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), SubjectKeyID: bern1Chain[0].SubjectKeyId, Validity: cppki.Validity{ NotBefore: time.Date(2020, 6, 27, 12, 0, 1, 0, time.UTC), @@ -260,7 +261,7 @@ func testChain(t *testing.T, db trust.DB, cfg Config) { assert.NoError(t, err) assert.Empty(t, chains) chains, err = db.Chains(ctx, trust.ChainQuery{ - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), SubjectKeyID: bern1Chain[0].SubjectKeyId, Validity: cppki.Validity{ NotBefore: time.Date(2020, 6, 24, 11, 59, 59, 0, time.UTC), @@ -287,7 +288,7 @@ func testChain(t *testing.T, db trust.DB, cfg Config) { }) t.Run("certificate chain for a given ISD-AS", func(t *testing.T) { chains, err := db.Chains(ctx, trust.ChainQuery{ - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), }) assert.NoError(t, err) assert.Equal(t, [][]*x509.Certificate{bern1Chain, bern2Chain}, chains) @@ -296,7 +297,7 @@ func testChain(t *testing.T, db trust.DB, cfg Config) { _, err := db.InsertChain(ctx, bern2Chain) require.NoError(t, err) chains, err := db.Chains(ctx, trust.ChainQuery{ - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), SubjectKeyID: bern1Chain[0].SubjectKeyId, Validity: cppki.Validity{ NotBefore: time.Date(2020, 6, 26, 13, 0, 0, 0, time.UTC), @@ -306,7 +307,7 @@ func testChain(t *testing.T, db trust.DB, cfg Config) { assert.NoError(t, err) assert.Equal(t, [][]*x509.Certificate{bern1Chain}, chains) chains, err = db.Chains(ctx, trust.ChainQuery{ - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), SubjectKeyID: bern2Chain[0].SubjectKeyId, Validity: cppki.Validity{ NotBefore: time.Date(2020, 6, 26, 13, 0, 0, 0, time.UTC), @@ -320,7 +321,7 @@ func testChain(t *testing.T, db trust.DB, cfg Config) { _, err := db.InsertChain(ctx, bern3Chain) require.NoError(t, err) chains, err := db.Chains(ctx, trust.ChainQuery{ - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), SubjectKeyID: bern3Chain[0].SubjectKeyId, Validity: cppki.Validity{ NotBefore: time.Date(2020, 6, 28, 13, 0, 0, 0, time.UTC), diff --git a/private/trust/fetching_provider_test.go b/private/trust/fetching_provider_test.go index e4c3922a34..3ed1fb26eb 100644 --- a/private/trust/fetching_provider_test.go +++ b/private/trust/fetching_provider_test.go @@ -44,7 +44,7 @@ func TestFetchingProviderGetChains(t *testing.T) { now := time.Now() query := trust.ChainQuery{ - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), Validity: cppki.Validity{NotBefore: now, NotAfter: now}, SubjectKeyID: valid[0].SubjectKeyId, } @@ -73,7 +73,7 @@ func TestFetchingProviderGetChains(t *testing.T) { return mock_trust.NewMockFetcher(ctrl) }, Query: trust.ChainQuery{ - IA: xtest.MustParseIA("1-0"), + IA: addr.MustParseIA("1-0"), Validity: query.Validity, SubjectKeyID: query.SubjectKeyID, }, diff --git a/private/trust/grpc/BUILD.bazel b/private/trust/grpc/BUILD.bazel index 1307812756..9214748926 100644 --- a/private/trust/grpc/BUILD.bazel +++ b/private/trust/grpc/BUILD.bazel @@ -36,6 +36,7 @@ go_test( data = glob(["testdata/**"]), embed = [":go_default_library"], deps = [ + "//pkg/addr:go_default_library", "//pkg/private/serrors:go_default_library", "//pkg/private/xtest:go_default_library", "//pkg/proto/control_plane:go_default_library", diff --git a/private/trust/grpc/fetcher_test.go b/private/trust/grpc/fetcher_test.go index 0628e265da..0cd77ea50f 100644 --- a/private/trust/grpc/fetcher_test.go +++ b/private/trust/grpc/fetcher_test.go @@ -27,6 +27,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/serrors" "github.com/scionproto/scion/pkg/private/xtest" cppb "github.com/scionproto/scion/pkg/proto/control_plane" @@ -40,7 +41,7 @@ func TestFetcherChains(t *testing.T) { dir := genCrypto(t) chain110 := xtest.LoadChain(t, filepath.Join(dir, "/certs/ISD1-ASff00_0_110.pem")) chain112 := xtest.LoadChain(t, filepath.Join(dir, "/certs/ISD1-ASff00_0_112.pem")) - ia110 := xtest.MustParseIA("1-ff00:0:110") + ia110 := addr.MustParseIA("1-ff00:0:110") queryDate := chain110[0].NotBefore.Add(time.Hour) internal := serrors.New("internal") diff --git a/private/trust/grpc/proto_test.go b/private/trust/grpc/proto_test.go index c259434b84..3106755085 100644 --- a/private/trust/grpc/proto_test.go +++ b/private/trust/grpc/proto_test.go @@ -23,6 +23,7 @@ import ( "github.com/golang/protobuf/ptypes" "github.com/stretchr/testify/assert" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/xtest" cppb "github.com/scionproto/scion/pkg/proto/control_plane" "github.com/scionproto/scion/pkg/scrypto/cppki" @@ -33,7 +34,7 @@ import ( func TestChainQueryToReq(t *testing.T) { query := trust.ChainQuery{ - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), Validity: cppki.Validity{ NotBefore: time.Now().UTC().Truncate(time.Second), NotAfter: time.Now().UTC().Truncate(time.Second), diff --git a/private/trust/recurser_test.go b/private/trust/recurser_test.go index 8acab10831..611ffd05f5 100644 --- a/private/trust/recurser_test.go +++ b/private/trust/recurser_test.go @@ -20,14 +20,14 @@ import ( "github.com/stretchr/testify/assert" - "github.com/scionproto/scion/pkg/private/xtest" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/snet" "github.com/scionproto/scion/private/trust" ) func TestASLocalRecurserAllowRecursion(t *testing.T) { - ia110 := xtest.MustParseIA("1-ff00:0:110") - ia120 := xtest.MustParseIA("1-ff00:0:120") + ia110 := addr.MustParseIA("1-ff00:0:110") + ia120 := addr.MustParseIA("1-ff00:0:120") tests := map[string]struct { Addr net.Addr @@ -63,8 +63,8 @@ func TestASLocalRecurserAllowRecursion(t *testing.T) { } func TestLocalOnlyRecurserAllowRecursion(t *testing.T) { - ia110 := xtest.MustParseIA("1-ff00:0:110") - ia120 := xtest.MustParseIA("1-ff00:0:120") + ia110 := addr.MustParseIA("1-ff00:0:110") + ia120 := addr.MustParseIA("1-ff00:0:120") tests := map[string]struct { Addr net.Addr diff --git a/private/trust/router_test.go b/private/trust/router_test.go index 2f2f80eaf9..8bff766a8c 100644 --- a/private/trust/router_test.go +++ b/private/trust/router_test.go @@ -25,7 +25,6 @@ import ( "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/serrors" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/scrypto/cppki" "github.com/scionproto/scion/pkg/snet" "github.com/scionproto/scion/pkg/snet/mock_snet" @@ -35,7 +34,7 @@ import ( ) func TestLocalRouterChooseServer(t *testing.T) { - ia122 := xtest.MustParseIA("1-ff00:0:122") + ia122 := addr.MustParseIA("1-ff00:0:122") tests := map[string]addr.ISD{ "ISD local": 1, @@ -55,8 +54,8 @@ func TestLocalRouterChooseServer(t *testing.T) { } func TestCSRouterChooseServer(t *testing.T) { - ia110 := xtest.MustParseIA("1-ff00:0:110") - ia210 := xtest.MustParseIA("2-ff00:0:210") + ia110 := addr.MustParseIA("1-ff00:0:110") + ia210 := addr.MustParseIA("2-ff00:0:210") dbErr := serrors.New("DB error") routeErr := serrors.New("unable to route") diff --git a/private/trust/signer_gen_test.go b/private/trust/signer_gen_test.go index 7be97c99ad..1bb80b224d 100644 --- a/private/trust/signer_gen_test.go +++ b/private/trust/signer_gen_test.go @@ -34,6 +34,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/serrors" "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/scrypto/cppki" @@ -106,7 +107,7 @@ func TestSignerGenGenerate(t *testing.T) { cert := chain[0] db := mock_trust.NewMockDB(mctrl) matcher := chainQueryMatcher{ - ia: xtest.MustParseIA("1-ff00:0:110"), + ia: addr.MustParseIA("1-ff00:0:110"), skid: cert.SubjectKeyId, } db.EXPECT().SignedTRC(ctxMatcher{}, cppki.TRCID{ISD: 1}). @@ -120,7 +121,7 @@ func TestSignerGenGenerate(t *testing.T) { expected: []trust.Signer{{ PrivateKey: key, Algorithm: signed.ECDSAWithSHA256, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), TRCID: cppki.TRCID{ ISD: 1, Base: 1, @@ -148,7 +149,7 @@ func TestSignerGenGenerate(t *testing.T) { cert := chain[0] db := mock_trust.NewMockDB(mctrl) matcher := chainQueryMatcher{ - ia: xtest.MustParseIA("1-ff00:0:110"), + ia: addr.MustParseIA("1-ff00:0:110"), skid: cert.SubjectKeyId, } db.EXPECT().SignedTRC(ctxMatcher{}, cppki.TRCID{ISD: 1}). @@ -157,7 +158,7 @@ func TestSignerGenGenerate(t *testing.T) { [][]*x509.Certificate{chain}, nil, ) db.EXPECT().Chains(ctxMatcher{}, chainQueryMatcher{ - ia: xtest.MustParseIA("1-ff00:0:110"), + ia: addr.MustParseIA("1-ff00:0:110"), skid: chain2[0].SubjectKeyId, }).Return( [][]*x509.Certificate{chain2}, nil, @@ -169,7 +170,7 @@ func TestSignerGenGenerate(t *testing.T) { { PrivateKey: key, Algorithm: signed.ECDSAWithSHA256, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), TRCID: cppki.TRCID{ ISD: 1, Base: 1, @@ -187,7 +188,7 @@ func TestSignerGenGenerate(t *testing.T) { { PrivateKey: key2, Algorithm: signed.ECDSAWithSHA256, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), TRCID: cppki.TRCID{ ISD: 1, Base: 1, @@ -216,7 +217,7 @@ func TestSignerGenGenerate(t *testing.T) { cert := chain[0] db := mock_trust.NewMockDB(mctrl) matcher := chainQueryMatcher{ - ia: xtest.MustParseIA("1-ff00:0:110"), + ia: addr.MustParseIA("1-ff00:0:110"), skid: cert.SubjectKeyId, } @@ -231,7 +232,7 @@ func TestSignerGenGenerate(t *testing.T) { expected: []trust.Signer{{ PrivateKey: key, Algorithm: signed.ECDSAWithSHA256, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), TRCID: cppki.TRCID{ ISD: 1, Base: 1, @@ -259,7 +260,7 @@ func TestSignerGenGenerate(t *testing.T) { cert := chain[0] db := mock_trust.NewMockDB(mctrl) matcher := chainQueryMatcher{ - ia: xtest.MustParseIA("1-ff00:0:110"), + ia: addr.MustParseIA("1-ff00:0:110"), skid: cert.SubjectKeyId, } @@ -288,7 +289,7 @@ func TestSignerGenGenerate(t *testing.T) { expected: []trust.Signer{{ PrivateKey: key, Algorithm: signed.ECDSAWithSHA256, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), TRCID: cppki.TRCID{ ISD: 1, Base: 1, @@ -349,7 +350,7 @@ func TestSignerGenGenerate(t *testing.T) { db := mock_trust.NewMockDB(mctrl) cert := chain[0] matcher := chainQueryMatcher{ - ia: xtest.MustParseIA("1-ff00:0:110"), + ia: addr.MustParseIA("1-ff00:0:110"), skid: cert.SubjectKeyId, } db.EXPECT().SignedTRC(ctxMatcher{}, cppki.TRCID{ISD: 1}).Return(trc, nil) @@ -402,7 +403,7 @@ func TestSignerGenGenerate(t *testing.T) { db := mock_trust.NewMockDB(mctrl) cert := chain[0] matcher := chainQueryMatcher{ - ia: xtest.MustParseIA("1-ff00:0:110"), + ia: addr.MustParseIA("1-ff00:0:110"), skid: cert.SubjectKeyId, } db.EXPECT().SignedTRC(ctxMatcher{}, cppki.TRCID{ISD: 1}).Return(trc, nil) @@ -425,7 +426,7 @@ func TestSignerGenGenerate(t *testing.T) { defer mctrl.Finish() gen := trust.SignerGen{ - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), DB: tc.db(mctrl), KeyRing: tc.keyRing(mctrl), } @@ -447,7 +448,7 @@ func TestSignerGenGenerate(t *testing.T) { [][]*x509.Certificate{chain}, nil, ) _, err := trust.SignerGen{ - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), DB: db, KeyRing: ring, }.Generate(context.Background()) diff --git a/private/trust/signer_test.go b/private/trust/signer_test.go index 014ee2bbf4..8507a51173 100644 --- a/private/trust/signer_test.go +++ b/private/trust/signer_test.go @@ -31,7 +31,6 @@ import ( "github.com/stretchr/testify/require" "github.com/scionproto/scion/pkg/addr" - "github.com/scionproto/scion/pkg/private/xtest" cppb "github.com/scionproto/scion/pkg/proto/control_plane" "github.com/scionproto/scion/pkg/scrypto/cppki" "github.com/scionproto/scion/pkg/scrypto/signed" @@ -68,7 +67,7 @@ func TestSignerSign(t *testing.T) { signer := trust.Signer{ PrivateKey: priv, Algorithm: signed.ECDSAWithSHA512, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), TRCID: cppki.TRCID{ ISD: 1, Base: 1, @@ -87,7 +86,7 @@ func TestSignerSign(t *testing.T) { var keyID cppb.VerificationKeyID require.NoError(t, proto.Unmarshal(hdr.VerificationKeyID, &keyID)) - assert.Equal(t, xtest.MustParseIA("1-ff00:0:110"), addr.IA(keyID.IsdAs)) + assert.Equal(t, addr.MustParseIA("1-ff00:0:110"), addr.IA(keyID.IsdAs)) assert.Equal(t, []byte{0, 1, 2, 3, 4, 5, 6, 7}, keyID.SubjectKeyId) _, err = signed.Verify(signedMsg, signer.PrivateKey.Public()) @@ -113,7 +112,7 @@ func TestSignerSign(t *testing.T) { signer := trust.Signer{ PrivateKey: priv, Algorithm: signed.ECDSAWithSHA512, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), TRCID: cppki.TRCID{ ISD: 1, Base: 1, diff --git a/private/trust/verifier_bench_test.go b/private/trust/verifier_bench_test.go index 6a3befa982..bc59d802d9 100644 --- a/private/trust/verifier_bench_test.go +++ b/private/trust/verifier_bench_test.go @@ -28,7 +28,7 @@ import ( "github.com/patrickmn/go-cache" "github.com/stretchr/testify/require" - "github.com/scionproto/scion/pkg/private/xtest" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/scrypto/cppki" "github.com/scionproto/scion/pkg/scrypto/signed" "github.com/scionproto/scion/private/storage/trust/sqlite" @@ -145,7 +145,7 @@ func loadTrustSigner(b *testing.B, dir string, db trust.DB) trust.Signer { NotAfter: chain[0].NotAfter, }, Expiration: chain[0].NotAfter, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), SubjectKeyID: chain[0].SubjectKeyId, TRCID: cppki.TRCID{ ISD: 1, diff --git a/private/trust/verifier_test.go b/private/trust/verifier_test.go index d010d66b17..3bd67117ea 100644 --- a/private/trust/verifier_test.go +++ b/private/trust/verifier_test.go @@ -67,7 +67,7 @@ func TestVerify(t *testing.T) { p.EXPECT().GetChains(ctxMatcher{}, chainQueryMatcher{ - ia: xtest.MustParseIA("1-ff00:0:110"), + ia: addr.MustParseIA("1-ff00:0:110"), skid: []byte("subject-key-id"), }, trust.OptionsMatcher{}, @@ -89,7 +89,7 @@ func TestVerify(t *testing.T) { p.EXPECT().GetChains(ctxMatcher{}, chainQueryMatcher{ - ia: xtest.MustParseIA("1-ff00:0:110"), + ia: addr.MustParseIA("1-ff00:0:110"), skid: []byte("subject-key-id"), }, opts, @@ -108,7 +108,7 @@ func TestVerify(t *testing.T) { "invalid boundIA missmatch": { provider: func(mctrl *gomock.Controller) trust.Provider { return nil }, sign: sign, - boundIA: xtest.MustParseIA("1-ff00:0:210"), + boundIA: addr.MustParseIA("1-ff00:0:210"), assertFunc: assert.Error, }, "invalid provider nil": { @@ -166,7 +166,7 @@ func TestVerify(t *testing.T) { p.EXPECT().GetChains(ctxMatcher{}, chainQueryMatcher{ - ia: xtest.MustParseIA("1-ff00:0:110"), + ia: addr.MustParseIA("1-ff00:0:110"), skid: []byte("subject-key-id"), }, trust.OptionsMatcher{}, diff --git a/router/BUILD.bazel b/router/BUILD.bazel index a2343f0f4e..332a12f3b5 100644 --- a/router/BUILD.bazel +++ b/router/BUILD.bazel @@ -56,7 +56,6 @@ go_test( "//pkg/private/ptr:go_default_library", "//pkg/private/serrors:go_default_library", "//pkg/private/util:go_default_library", - "//pkg/private/xtest:go_default_library", "//pkg/scrypto:go_default_library", "//pkg/slayers:go_default_library", "//pkg/slayers/path:go_default_library", diff --git a/router/dataplane_internal_test.go b/router/dataplane_internal_test.go index 1a6e0fa1fa..6c96b149bb 100644 --- a/router/dataplane_internal_test.go +++ b/router/dataplane_internal_test.go @@ -33,7 +33,6 @@ import ( "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/serrors" "github.com/scionproto/scion/pkg/private/util" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/scrypto" "github.com/scionproto/scion/pkg/slayers" "github.com/scionproto/scion/pkg/slayers/path" @@ -450,13 +449,13 @@ func TestSlowPathProcessing(t *testing.T) { nil, mock_router.NewMockBatchConn(ctrl), fakeInternalNextHops, fakeServices, - xtest.MustParseIA("1-ff00:0:110"), + addr.MustParseIA("1-ff00:0:110"), nil, testKey) }, mockMsg: func() []byte { spkt := prepBaseMsg(t, payload, 0) _ = spkt.SetDstAddr(addr.MustParseHost("CS")) - spkt.DstIA = xtest.MustParseIA("1-ff00:0:110") + spkt.DstIA = addr.MustParseIA("1-ff00:0:110") ret := toMsg(t, spkt) return ret }, @@ -474,12 +473,12 @@ func TestSlowPathProcessing(t *testing.T) { nil, mock_router.NewMockBatchConn(ctrl), fakeInternalNextHops, fakeServices, - xtest.MustParseIA("1-ff00:0:110"), nil, testKey) + addr.MustParseIA("1-ff00:0:110"), nil, testKey) }, mockMsg: func() []byte { spkt := prepBaseMsg(t, payload, 0) _ = spkt.SetDstAddr(addr.MustParseHost("CS")) - spkt.DstIA = xtest.MustParseIA("1-ff00:0:110") + spkt.DstIA = addr.MustParseIA("1-ff00:0:110") ret := toMsg(t, spkt) return ret }, @@ -497,11 +496,11 @@ func TestSlowPathProcessing(t *testing.T) { nil, mock_router.NewMockBatchConn(ctrl), fakeInternalNextHops, fakeServices, - xtest.MustParseIA("1-ff00:0:110"), nil, testKey) + addr.MustParseIA("1-ff00:0:110"), nil, testKey) }, mockMsg: func() []byte { spkt := prepBaseMsg(t, payload, 0) - spkt.DstIA = xtest.MustParseIA("1-ff00:0:f1") + spkt.DstIA = addr.MustParseIA("1-ff00:0:f1") ret := toMsg(t, spkt) return ret }, @@ -520,7 +519,7 @@ func TestSlowPathProcessing(t *testing.T) { nil, mock_router.NewMockBatchConn(ctrl), fakeInternalNextHops, fakeServices, - xtest.MustParseIA("1-ff00:0:110"), nil, testKey) + addr.MustParseIA("1-ff00:0:110"), nil, testKey) }, mockMsg: func() []byte { spkt := prepBaseMsg(t, payload, 0) @@ -611,8 +610,8 @@ func prepBaseMsg(t *testing.T, payload []byte, flowId uint32) *slayers.SCION { FlowID: flowId, NextHdr: slayers.L4UDP, PathType: scion.PathType, - DstIA: xtest.MustParseIA("1-ff00:0:110"), - SrcIA: xtest.MustParseIA("1-ff00:0:111"), + DstIA: addr.MustParseIA("1-ff00:0:110"), + SrcIA: addr.MustParseIA("1-ff00:0:111"), Path: &scion.Raw{}, PayloadLen: 18, } diff --git a/router/dataplane_test.go b/router/dataplane_test.go index 0a324c0dab..67eef3d483 100644 --- a/router/dataplane_test.go +++ b/router/dataplane_test.go @@ -35,7 +35,6 @@ import ( libepic "github.com/scionproto/scion/pkg/experimental/epic" "github.com/scionproto/scion/pkg/private/ptr" "github.com/scionproto/scion/pkg/private/util" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/scrypto" "github.com/scionproto/scion/pkg/slayers" "github.com/scionproto/scion/pkg/slayers/path" @@ -114,11 +113,11 @@ func TestDataPlaneSetKey(t *testing.T) { func TestDataPlaneAddExternalInterface(t *testing.T) { l := control.LinkEnd{ - IA: xtest.MustParseIA("1-ff00:0:1"), + IA: addr.MustParseIA("1-ff00:0:1"), Addr: netip.MustParseAddrPort("10.0.0.100:0"), } r := control.LinkEnd{ - IA: xtest.MustParseIA("1-ff00:0:3"), + IA: addr.MustParseIA("1-ff00:0:3"), Addr: netip.MustParseAddrPort("10.0.0.200:0"), } nobfd := control.BFD{Disable: ptr.To(true)} @@ -241,7 +240,7 @@ func TestDataPlaneRun(t *testing.T) { prepareDP: func(ctrl *gomock.Controller, done chan<- struct{}) *router.DataPlane { ret := &router.DataPlane{Metrics: metrics} key := []byte("testkey_xxxxxxxx") - local := xtest.MustParseIA("1-ff00:0:110") + local := addr.MustParseIA("1-ff00:0:110") totalCount := 10 mInternal := mock_router.NewMockBatchConn(ctrl) @@ -308,11 +307,11 @@ func TestDataPlaneRun(t *testing.T) { mExternal.EXPECT().ReadBatch(gomock.Any()).Return(0, nil).AnyTimes() mExternal.EXPECT().WriteTo(gomock.Any(), gomock.Any()).Return(0, nil).AnyTimes() l := control.LinkEnd{ - IA: xtest.MustParseIA("1-ff00:0:1"), + IA: addr.MustParseIA("1-ff00:0:1"), Addr: netip.MustParseAddrPort("10.0.0.100:0"), } r := control.LinkEnd{ - IA: xtest.MustParseIA("1-ff00:0:3"), + IA: addr.MustParseIA("1-ff00:0:3"), Addr: netip.MustParseAddrPort("10.0.0.200:0"), } nobfd := control.BFD{Disable: ptr.To(true)} @@ -494,11 +493,11 @@ func TestDataPlaneRun(t *testing.T) { mExternal.EXPECT().WriteTo(gomock.Any(), gomock.Any()).Return(0, nil).AnyTimes() local := control.LinkEnd{ - IA: xtest.MustParseIA("1-ff00:0:1"), + IA: addr.MustParseIA("1-ff00:0:1"), Addr: netip.MustParseAddrPort("10.0.0.100:0"), } remote := control.LinkEnd{ - IA: xtest.MustParseIA("1-ff00:0:3"), + IA: addr.MustParseIA("1-ff00:0:3"), Addr: netip.MustParseAddrPort("10.0.0.200:0"), } _ = ret.SetKey([]byte("randomkeyformacs")) @@ -572,11 +571,11 @@ func TestDataPlaneRun(t *testing.T) { mExternal.EXPECT().WriteTo(gomock.Any(), gomock.Any()).Return(0, nil).AnyTimes() local := control.LinkEnd{ - IA: xtest.MustParseIA("1-ff00:0:1"), + IA: addr.MustParseIA("1-ff00:0:1"), Addr: netip.MustParseAddrPort("10.0.0.100:0"), } remote := control.LinkEnd{ - IA: xtest.MustParseIA("1-ff00:0:3"), + IA: addr.MustParseIA("1-ff00:0:3"), Addr: netip.MustParseAddrPort("10.0.0.200:0"), } _ = ret.SetKey([]byte("randomkeyformacs")) @@ -657,11 +656,11 @@ func TestProcessPkt(t *testing.T) { return router.NewDP(fakeExternalInterfaces, nil, mock_router.NewMockBatchConn(ctrl), fakeInternalNextHops, nil, - xtest.MustParseIA("1-ff00:0:110"), nil, key) + addr.MustParseIA("1-ff00:0:110"), nil, key) }, mockMsg: func(afterProcessing bool) *router.Packet { spkt, dpath := prepBaseMsg(now) - spkt.DstIA = xtest.MustParseIA("1-ff00:0:110") + spkt.DstIA = addr.MustParseIA("1-ff00:0:110") dst := addr.MustParseHost("10.0.100.100") _ = spkt.SetDstAddr(dst) dpath.HopFields = []path.HopField{ @@ -687,11 +686,11 @@ func TestProcessPkt(t *testing.T) { return router.NewDP(fakeExternalInterfaces, nil, mock_router.NewMockBatchConn(ctrl), fakeInternalNextHops, nil, - xtest.MustParseIA("1-ff00:0:110"), nil, key) + addr.MustParseIA("1-ff00:0:110"), nil, key) }, mockMsg: func(afterProcessing bool) *router.Packet { spkt, dpath := prepBaseMsg(now) - spkt.DstIA = xtest.MustParseIA("1-ff00:0:110") + spkt.DstIA = addr.MustParseIA("1-ff00:0:110") dst := addr.MustParseHost("10.0.100.100") _ = spkt.SetDstAddr(dst) dpath.HopFields = []path.HopField{ @@ -734,11 +733,11 @@ func TestProcessPkt(t *testing.T) { }, nil, fakeInternalNextHops, nil, - xtest.MustParseIA("1-ff00:0:110"), nil, key) + addr.MustParseIA("1-ff00:0:110"), nil, key) }, mockMsg: func(afterProcessing bool) *router.Packet { spkt, dpath := prepBaseMsg(now) - spkt.SrcIA = xtest.MustParseIA("1-ff00:0:110") + spkt.SrcIA = addr.MustParseIA("1-ff00:0:110") dpath.HopFields = []path.HopField{ {ConsIngress: 0, ConsEgress: 1}, {ConsIngress: 31, ConsEgress: 30}, @@ -770,7 +769,7 @@ func TestProcessPkt(t *testing.T) { }, nil, fakeInternalNextHops, nil, - xtest.MustParseIA("1-ff00:0:110"), nil, key) + addr.MustParseIA("1-ff00:0:110"), nil, key) }, mockMsg: func(afterProcessing bool) *router.Packet { spkt, dpath := prepBaseMsg(now) @@ -804,7 +803,7 @@ func TestProcessPkt(t *testing.T) { 1: topology.Child, }, nil, fakeInternalNextHops, nil, - xtest.MustParseIA("1-ff00:0:110"), nil, key) + addr.MustParseIA("1-ff00:0:110"), nil, key) }, mockMsg: func(afterProcessing bool) *router.Packet { spkt, dpath := prepBaseMsg(now) @@ -841,7 +840,7 @@ func TestProcessPkt(t *testing.T) { }, nil, fakeInternalNextHops, nil, - xtest.MustParseIA("1-ff00:0:110"), nil, key) + addr.MustParseIA("1-ff00:0:110"), nil, key) }, mockMsg: func(afterProcessing bool) *router.Packet { // Story: the packet just left segment 0 which ends at @@ -911,7 +910,7 @@ func TestProcessPkt(t *testing.T) { }, nil, fakeInternalNextHops, nil, - xtest.MustParseIA("1-ff00:0:110"), nil, key) + addr.MustParseIA("1-ff00:0:110"), nil, key) }, mockMsg: func(afterProcessing bool) *router.Packet { // Story: the packet lands on the last (peering) hop of @@ -988,7 +987,7 @@ func TestProcessPkt(t *testing.T) { }, nil, fakeInternalNextHops, nil, - xtest.MustParseIA("1-ff00:0:110"), nil, key) + addr.MustParseIA("1-ff00:0:110"), nil, key) }, mockMsg: func(afterProcessing bool) *router.Packet { // Story: the packet just left hop 1 (the first hop @@ -1062,7 +1061,7 @@ func TestProcessPkt(t *testing.T) { }, nil, fakeInternalNextHops, nil, - xtest.MustParseIA("1-ff00:0:110"), nil, key) + addr.MustParseIA("1-ff00:0:110"), nil, key) }, mockMsg: func(afterProcessing bool) *router.Packet { // Story: the packet lands on the second (non-peering) hop of @@ -1146,7 +1145,7 @@ func TestProcessPkt(t *testing.T) { mock_router.NewMockBatchConn(ctrl), map[uint16]netip.AddrPort{ uint16(3): netip.MustParseAddrPort("10.0.200.200:30043"), - }, nil, xtest.MustParseIA("1-ff00:0:110"), nil, key) + }, nil, addr.MustParseIA("1-ff00:0:110"), nil, key) }, mockMsg: func(afterProcessing bool) *router.Packet { spkt, dpath := prepBaseMsg(now) @@ -1179,7 +1178,7 @@ func TestProcessPkt(t *testing.T) { mock_router.NewMockBatchConn(ctrl), map[uint16]netip.AddrPort{ uint16(3): netip.MustParseAddrPort("10.0.200.200:30043"), - }, nil, xtest.MustParseIA("1-ff00:0:110"), nil, key) + }, nil, addr.MustParseIA("1-ff00:0:110"), nil, key) }, mockMsg: func(afterProcessing bool) *router.Packet { spkt, _ := prepBaseMsg(now) @@ -1234,12 +1233,12 @@ func TestProcessPkt(t *testing.T) { ), }, }, - xtest.MustParseIA("1-ff00:0:110"), nil, key) + addr.MustParseIA("1-ff00:0:110"), nil, key) }, mockMsg: func(afterProcessing bool) *router.Packet { spkt, dpath := prepBaseMsg(now) _ = spkt.SetDstAddr(addr.MustParseHost("CS")) - spkt.DstIA = xtest.MustParseIA("1-ff00:0:110") + spkt.DstIA = addr.MustParseIA("1-ff00:0:110") dpath.HopFields = []path.HopField{ {ConsIngress: 41, ConsEgress: 40}, {ConsIngress: 31, ConsEgress: 30}, @@ -1272,16 +1271,16 @@ func TestProcessPkt(t *testing.T) { ), }, }, - xtest.MustParseIA("1-ff00:0:110"), + addr.MustParseIA("1-ff00:0:110"), map[uint16]addr.IA{ - uint16(1): xtest.MustParseIA("1-ff00:0:111"), + uint16(1): addr.MustParseIA("1-ff00:0:111"), }, key) }, mockMsg: func(afterProcessing bool) *router.Packet { spkt, _ := prepBaseMsg(now) spkt.PathType = onehop.PathType - spkt.SrcIA = xtest.MustParseIA("1-ff00:0:111") - spkt.DstIA = xtest.MustParseIA("1-ff00:0:110") + spkt.SrcIA = addr.MustParseIA("1-ff00:0:111") + spkt.DstIA = addr.MustParseIA("1-ff00:0:110") err := spkt.SetDstAddr(addr.HostSVC(addr.SvcCS.Multicast())) require.NoError(t, err) dpath := &onehop.Path{ @@ -1327,16 +1326,16 @@ func TestProcessPkt(t *testing.T) { fakeExternalInterfaces, nil, nil, fakeInternalNextHops, nil, - xtest.MustParseIA("1-ff00:0:110"), + addr.MustParseIA("1-ff00:0:110"), map[uint16]addr.IA{ - uint16(1): xtest.MustParseIA("1-ff00:0:111"), + uint16(1): addr.MustParseIA("1-ff00:0:111"), }, key) }, mockMsg: func(afterProcessing bool) *router.Packet { spkt, _ := prepBaseMsg(now) spkt.PathType = onehop.PathType - spkt.SrcIA = xtest.MustParseIA("1-ff00:0:110") // sneaky - spkt.DstIA = xtest.MustParseIA("1-ff00:0:111") + spkt.SrcIA = addr.MustParseIA("1-ff00:0:110") // sneaky + spkt.DstIA = addr.MustParseIA("1-ff00:0:111") err := spkt.SetDstAddr(addr.HostSVC(addr.SvcCS.Multicast())) require.NoError(t, err) dpath := &onehop.Path{ @@ -1377,12 +1376,12 @@ func TestProcessPkt(t *testing.T) { ), }, }, - xtest.MustParseIA("1-ff00:0:110"), nil, key) + addr.MustParseIA("1-ff00:0:110"), nil, key) }, mockMsg: func(afterProcessing bool) *router.Packet { spkt, _ := prepBaseMsg(now) spkt.PathType = scion.PathType - spkt.SrcIA = xtest.MustParseIA("1-ff00:0:110") + spkt.SrcIA = addr.MustParseIA("1-ff00:0:110") err := spkt.SetDstAddr(addr.HostSVC(addr.SvcCS.Multicast())) require.NoError(t, err) dpath := &onehop.Path{ @@ -1429,16 +1428,16 @@ func TestProcessPkt(t *testing.T) { nil, mock_router.NewMockBatchConn(ctrl), fakeInternalNextHops, nil, - xtest.MustParseIA("1-ff00:0:110"), + addr.MustParseIA("1-ff00:0:110"), map[uint16]addr.IA{ - uint16(2): xtest.MustParseIA("1-ff00:0:111"), + uint16(2): addr.MustParseIA("1-ff00:0:111"), }, key) }, mockMsg: func(afterProcessing bool) *router.Packet { spkt, _ := prepBaseMsg(now) spkt.PathType = onehop.PathType - spkt.SrcIA = xtest.MustParseIA("1-ff00:0:110") - spkt.DstIA = xtest.MustParseIA("1-ff00:0:111") + spkt.SrcIA = addr.MustParseIA("1-ff00:0:110") + spkt.DstIA = addr.MustParseIA("1-ff00:0:111") err := spkt.SetDstAddr(addr.HostSVC(addr.SvcCS.Multicast())) require.NoError(t, err) dpath := &onehop.Path{ @@ -1470,7 +1469,7 @@ func TestProcessPkt(t *testing.T) { return router.NewDP(fakeExternalInterfaces, nil, mock_router.NewMockBatchConn(ctrl), fakeInternalNextHops, nil, - xtest.MustParseIA("1-ff00:0:110"), nil, key) + addr.MustParseIA("1-ff00:0:110"), nil, key) }, mockMsg: func(afterProcessing bool) *router.Packet { spkt, epicpath, dpath := prepEpicMsg(t, @@ -1486,7 +1485,7 @@ func TestProcessPkt(t *testing.T) { return router.NewDP(fakeExternalInterfaces, nil, mock_router.NewMockBatchConn(ctrl), fakeInternalNextHops, nil, - xtest.MustParseIA("1-ff00:0:110"), nil, key) + addr.MustParseIA("1-ff00:0:110"), nil, key) }, mockMsg: func(afterProcessing bool) *router.Packet { spkt, epicpath, dpath := prepEpicMsg(t, @@ -1503,7 +1502,7 @@ func TestProcessPkt(t *testing.T) { return router.NewDP(fakeExternalInterfaces, nil, mock_router.NewMockBatchConn(ctrl), fakeInternalNextHops, nil, - xtest.MustParseIA("1-ff00:0:110"), nil, key) + addr.MustParseIA("1-ff00:0:110"), nil, key) }, mockMsg: func(afterProcessing bool) *router.Packet { spkt, epicpath, dpath := prepEpicMsg(t, @@ -1522,7 +1521,7 @@ func TestProcessPkt(t *testing.T) { return router.NewDP(fakeExternalInterfaces, nil, mock_router.NewMockBatchConn(ctrl), fakeInternalNextHops, nil, - xtest.MustParseIA("1-ff00:0:110"), nil, key) + addr.MustParseIA("1-ff00:0:110"), nil, key) }, mockMsg: func(afterProcessing bool) *router.Packet { spkt, epicpath, dpath := prepEpicMsg(t, @@ -1576,8 +1575,8 @@ func prepBaseMsg(now time.Time) (*slayers.SCION, *scion.Decoded) { FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - DstIA: xtest.MustParseIA("4-ff00:0:411"), - SrcIA: xtest.MustParseIA("2-ff00:0:222"), + DstIA: addr.MustParseIA("4-ff00:0:411"), + SrcIA: addr.MustParseIA("2-ff00:0:222"), Path: &scion.Raw{}, PayloadLen: 26, // scionudpLayer + len("actualpayloadbytes") } @@ -1606,7 +1605,7 @@ func prepEpicMsg(t *testing.T, afterProcessing bool, key []byte, spkt, dpath := prepBaseMsg(now) spkt.PathType = epic.PathType - spkt.DstIA = xtest.MustParseIA("1-ff00:0:110") + spkt.DstIA = addr.MustParseIA("1-ff00:0:110") dpath.HopFields = []path.HopField{ {ConsIngress: 41, ConsEgress: 40}, {ConsIngress: 31, ConsEgress: 30}, diff --git a/router/mgmtapi/BUILD.bazel b/router/mgmtapi/BUILD.bazel index 42d4c85503..c1ea052b62 100644 --- a/router/mgmtapi/BUILD.bazel +++ b/router/mgmtapi/BUILD.bazel @@ -44,6 +44,7 @@ go_test( data = glob(["testdata/**"]), embed = [":go_default_library"], deps = [ + "//pkg/addr:go_default_library", "//pkg/private/ptr:go_default_library", "//pkg/private/serrors:go_default_library", "//pkg/private/xtest:go_default_library", diff --git a/router/mgmtapi/api_test.go b/router/mgmtapi/api_test.go index d4d5d49a65..c6e01412e3 100644 --- a/router/mgmtapi/api_test.go +++ b/router/mgmtapi/api_test.go @@ -26,6 +26,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/ptr" "github.com/scionproto/scion/pkg/private/serrors" "github.com/scionproto/scion/pkg/private/xtest" @@ -156,11 +157,11 @@ func createExternalIntfs(t *testing.T) []control.ExternalInterface { InterfaceID: 1, Link: control.LinkInfo{ Local: control.LinkEnd{ - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), Addr: netip.MustParseAddrPort("172.20.0.3:50000"), }, Remote: control.LinkEnd{ - IA: xtest.MustParseIA("1-ff00:0:111"), + IA: addr.MustParseIA("1-ff00:0:111"), Addr: netip.MustParseAddrPort("172.20.0.2:50000"), }, Instance: "br1-ff00_0_110-1", @@ -179,11 +180,11 @@ func createExternalIntfs(t *testing.T) []control.ExternalInterface { InterfaceID: 2, Link: control.LinkInfo{ Local: control.LinkEnd{ - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), Addr: netip.MustParseAddrPort("172.20.0.3:50000"), }, Remote: control.LinkEnd{ - IA: xtest.MustParseIA("1-ff00:0:112"), + IA: addr.MustParseIA("1-ff00:0:112"), Addr: netip.MustParseAddrPort("172.20.0.2:50000"), }, Instance: "br1-ff00_0_110-1", @@ -202,11 +203,11 @@ func createExternalIntfs(t *testing.T) []control.ExternalInterface { InterfaceID: 5, Link: control.LinkInfo{ Local: control.LinkEnd{ - IA: xtest.MustParseIA("1-ff00:0:111"), + IA: addr.MustParseIA("1-ff00:0:111"), Addr: netip.MustParseAddrPort("172.20.0.7:50000"), }, Remote: control.LinkEnd{ - IA: xtest.MustParseIA("1-ff00:0:113"), + IA: addr.MustParseIA("1-ff00:0:113"), Addr: netip.MustParseAddrPort("172.20.0.6:50000"), }, Instance: "br1-ff00_0_111-1", @@ -225,11 +226,11 @@ func createExternalIntfs(t *testing.T) []control.ExternalInterface { InterfaceID: 6, Link: control.LinkInfo{ Local: control.LinkEnd{ - IA: xtest.MustParseIA("1-ff00:0:112"), + IA: addr.MustParseIA("1-ff00:0:112"), Addr: netip.MustParseAddrPort("172.20.0.78:50000"), }, Remote: control.LinkEnd{ - IA: xtest.MustParseIA("1-ff00:0:113"), + IA: addr.MustParseIA("1-ff00:0:113"), Addr: netip.MustParseAddrPort("172.20.0.10:50000"), }, Instance: "br1-ff00_0_112-1", @@ -250,11 +251,11 @@ func createExternalIntfs(t *testing.T) []control.ExternalInterface { func createInternalIntfs(t *testing.T) []control.InternalInterface { return []control.InternalInterface{ { - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), Addr: netip.MustParseAddrPort("172.20.0.3:50000"), }, { - IA: xtest.MustParseIA("1-ff00:0:111"), + IA: addr.MustParseIA("1-ff00:0:111"), Addr: netip.MustParseAddrPort("172.20.0.5:50000"), }, } @@ -267,7 +268,7 @@ func createSiblingIntfs(t *testing.T) []control.SiblingInterface { InternalInterface: netip.MustParseAddrPort("172.20.0.20:30042"), Relationship: topology.Parent, MTU: 1280, - NeighborIA: xtest.MustParseIA("1-ff00:0:112"), + NeighborIA: addr.MustParseIA("1-ff00:0:112"), State: control.InterfaceUp, }, } diff --git a/scion-pki/certs/BUILD.bazel b/scion-pki/certs/BUILD.bazel index 82aaab42ac..85a32f4d7b 100644 --- a/scion-pki/certs/BUILD.bazel +++ b/scion-pki/certs/BUILD.bazel @@ -67,6 +67,7 @@ go_test( data = glob(["testdata/**"]), embed = [":go_default_library"], deps = [ + "//pkg/addr:go_default_library", "//pkg/private/xtest:go_default_library", "//pkg/proto/control_plane:go_default_library", "//pkg/scrypto:go_default_library", diff --git a/scion-pki/certs/renew_test.go b/scion-pki/certs/renew_test.go index d62c22fecf..d6b52229b2 100644 --- a/scion-pki/certs/renew_test.go +++ b/scion-pki/certs/renew_test.go @@ -26,6 +26,7 @@ import ( "github.com/stretchr/testify/require" "google.golang.org/protobuf/proto" + "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/xtest" cppb "github.com/scionproto/scion/pkg/proto/control_plane" "github.com/scionproto/scion/pkg/scrypto" @@ -111,7 +112,7 @@ func TestExtractChain(t *testing.T) { caSigner := trust.Signer{ PrivateKey: key, Algorithm: signed.ECDSAWithSHA256, - IA: xtest.MustParseIA("1-ff00:0:110"), + IA: addr.MustParseIA("1-ff00:0:110"), SubjectKeyID: caChain[0].SubjectKeyId, Expiration: time.Now().Add(20 * time.Hour), Chain: caChain, diff --git a/scion-pki/testcrypto/testcrypto_test.go b/scion-pki/testcrypto/testcrypto_test.go index ffaeeff018..1a8cbfdbd3 100644 --- a/scion-pki/testcrypto/testcrypto_test.go +++ b/scion-pki/testcrypto/testcrypto_test.go @@ -44,31 +44,31 @@ func TestCmd(t *testing.T) { require.NoError(t, err, buf.String()) allASes := []addr.IA{ - xtest.MustParseIA("1-ff00:0:110"), - xtest.MustParseIA("1-ff00:0:120"), - xtest.MustParseIA("1-ff00:0:130"), - xtest.MustParseIA("1-ff00:0:111"), - xtest.MustParseIA("1-ff00:0:131"), - xtest.MustParseIA("2-ff00:0:210"), - xtest.MustParseIA("2-ff00:0:220"), + addr.MustParseIA("1-ff00:0:110"), + addr.MustParseIA("1-ff00:0:120"), + addr.MustParseIA("1-ff00:0:130"), + addr.MustParseIA("1-ff00:0:111"), + addr.MustParseIA("1-ff00:0:131"), + addr.MustParseIA("2-ff00:0:210"), + addr.MustParseIA("2-ff00:0:220"), } for _, as := range allASes { checkAS(t, outDir, as) } issuers := []addr.IA{ - xtest.MustParseIA("1-ff00:0:110"), - xtest.MustParseIA("1-ff00:0:111"), - xtest.MustParseIA("2-ff00:0:210"), + addr.MustParseIA("1-ff00:0:110"), + addr.MustParseIA("1-ff00:0:111"), + addr.MustParseIA("2-ff00:0:210"), } for _, issuer := range issuers { checkIssuer(t, outDir, issuer) } voters := []addr.IA{ - xtest.MustParseIA("1-ff00:0:120"), - xtest.MustParseIA("1-ff00:0:111"), - xtest.MustParseIA("1-ff00:0:131"), - xtest.MustParseIA("2-ff00:0:210"), - xtest.MustParseIA("2-ff00:0:220"), + addr.MustParseIA("1-ff00:0:120"), + addr.MustParseIA("1-ff00:0:111"), + addr.MustParseIA("1-ff00:0:131"), + addr.MustParseIA("2-ff00:0:210"), + addr.MustParseIA("2-ff00:0:220"), } for _, voter := range voters { checkVoter(t, outDir, voter) diff --git a/scion-pki/testcrypto/update_test.go b/scion-pki/testcrypto/update_test.go index f44a200ced..54218424ec 100644 --- a/scion-pki/testcrypto/update_test.go +++ b/scion-pki/testcrypto/update_test.go @@ -53,13 +53,13 @@ func TestUpdateExtend(t *testing.T) { require.NoError(t, err) allASes := []addr.IA{ - xtest.MustParseIA("1-ff00:0:110"), - xtest.MustParseIA("1-ff00:0:120"), - xtest.MustParseIA("1-ff00:0:130"), - xtest.MustParseIA("1-ff00:0:111"), - xtest.MustParseIA("1-ff00:0:131"), - xtest.MustParseIA("2-ff00:0:210"), - xtest.MustParseIA("2-ff00:0:220"), + addr.MustParseIA("1-ff00:0:110"), + addr.MustParseIA("1-ff00:0:120"), + addr.MustParseIA("1-ff00:0:130"), + addr.MustParseIA("1-ff00:0:111"), + addr.MustParseIA("1-ff00:0:131"), + addr.MustParseIA("2-ff00:0:210"), + addr.MustParseIA("2-ff00:0:220"), } loadTRC := func(t *testing.T, isd addr.ISD, s uint64) cppki.SignedTRC { @@ -127,13 +127,13 @@ func TestUpdateReSign(t *testing.T) { require.NoError(t, err) allASes := []addr.IA{ - xtest.MustParseIA("1-ff00:0:110"), - xtest.MustParseIA("1-ff00:0:120"), - xtest.MustParseIA("1-ff00:0:130"), - xtest.MustParseIA("1-ff00:0:111"), - xtest.MustParseIA("1-ff00:0:131"), - xtest.MustParseIA("2-ff00:0:210"), - xtest.MustParseIA("2-ff00:0:220"), + addr.MustParseIA("1-ff00:0:110"), + addr.MustParseIA("1-ff00:0:120"), + addr.MustParseIA("1-ff00:0:130"), + addr.MustParseIA("1-ff00:0:111"), + addr.MustParseIA("1-ff00:0:131"), + addr.MustParseIA("2-ff00:0:210"), + addr.MustParseIA("2-ff00:0:220"), } loadTRC := func(t *testing.T, isd addr.ISD, s uint64) cppki.SignedTRC { @@ -197,13 +197,13 @@ func TestUpdateReGen(t *testing.T) { require.NoError(t, err) allASes := []addr.IA{ - xtest.MustParseIA("1-ff00:0:110"), - xtest.MustParseIA("1-ff00:0:120"), - xtest.MustParseIA("1-ff00:0:130"), - xtest.MustParseIA("1-ff00:0:111"), - xtest.MustParseIA("1-ff00:0:131"), - xtest.MustParseIA("2-ff00:0:210"), - xtest.MustParseIA("2-ff00:0:220"), + addr.MustParseIA("1-ff00:0:110"), + addr.MustParseIA("1-ff00:0:120"), + addr.MustParseIA("1-ff00:0:130"), + addr.MustParseIA("1-ff00:0:111"), + addr.MustParseIA("1-ff00:0:131"), + addr.MustParseIA("2-ff00:0:210"), + addr.MustParseIA("2-ff00:0:220"), } loadTRC := func(t *testing.T, isd addr.ISD, s uint64) cppki.SignedTRC { diff --git a/scion-pki/trcs/decoded_test.go b/scion-pki/trcs/decoded_test.go index 31eb614672..203781d4c9 100644 --- a/scion-pki/trcs/decoded_test.go +++ b/scion-pki/trcs/decoded_test.go @@ -21,7 +21,6 @@ import ( "github.com/stretchr/testify/require" "github.com/scionproto/scion/pkg/addr" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/scrypto" ) @@ -41,10 +40,16 @@ func TestDecode(t *testing.T) { assert.False(t, signed.TRC.NoTrustReset) assert.Empty(t, signed.TRC.Votes) assert.Equal(t, 2, signed.TRC.Quorum) - assert.ElementsMatch(t, xtest.MustParseASes("ff00:0:110,ff00:0:111"), - signed.TRC.CoreASes) - assert.ElementsMatch(t, xtest.MustParseASes("ff00:0:110,ff00:0:111"), - signed.TRC.AuthoritativeASes) + expectedCoreASes := []addr.AS{ + addr.MustParseAS("ff00:0:110"), + addr.MustParseAS("ff00:0:111"), + } + assert.ElementsMatch(t, expectedCoreASes, signed.TRC.CoreASes) + expectedAuthoritativeASes := []addr.AS{ + addr.MustParseAS("ff00:0:110"), + addr.MustParseAS("ff00:0:111"), + } + assert.ElementsMatch(t, expectedAuthoritativeASes, signed.TRC.AuthoritativeASes) assert.Equal(t, "Test ISD", signed.TRC.Description) assert.Len(t, signed.TRC.Certificates, 9) assert.Len(t, signed.SignerInfos, 6) diff --git a/tools/braccept/cases/BUILD.bazel b/tools/braccept/cases/BUILD.bazel index c856fe21d2..e5276c9a29 100644 --- a/tools/braccept/cases/BUILD.bazel +++ b/tools/braccept/cases/BUILD.bazel @@ -34,7 +34,6 @@ go_library( "//pkg/addr:go_default_library", "//pkg/drkey:go_default_library", "//pkg/private/util:go_default_library", - "//pkg/private/xtest:go_default_library", "//pkg/scrypto:go_default_library", "//pkg/slayers:go_default_library", "//pkg/slayers/path:go_default_library", diff --git a/tools/braccept/cases/child_to_child_xover.go b/tools/braccept/cases/child_to_child_xover.go index 74ec549e90..81f4c85b88 100644 --- a/tools/braccept/cases/child_to_child_xover.go +++ b/tools/braccept/cases/child_to_child_xover.go @@ -25,7 +25,6 @@ import ( "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/util" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/slayers" "github.com/scionproto/scion/pkg/slayers/path" "github.com/scionproto/scion/pkg/slayers/path/scion" @@ -103,8 +102,8 @@ func ChildToChildXover(artifactsDir string, mac hash.Hash) runner.Case { FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:5"), - DstIA: xtest.MustParseIA("1-ff00:0:4"), + SrcIA: addr.MustParseIA("1-ff00:0:5"), + DstIA: addr.MustParseIA("1-ff00:0:4"), Path: sp, } diff --git a/tools/braccept/cases/child_to_internal.go b/tools/braccept/cases/child_to_internal.go index 58b5c1c0c2..9e3ba10a36 100644 --- a/tools/braccept/cases/child_to_internal.go +++ b/tools/braccept/cases/child_to_internal.go @@ -25,7 +25,6 @@ import ( "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/util" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/slayers" "github.com/scionproto/scion/pkg/slayers/path" "github.com/scionproto/scion/pkg/slayers/path/scion" @@ -97,8 +96,8 @@ func ChildToInternalHost( FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:4"), - DstIA: xtest.MustParseIA("1-ff00:0:1"), + SrcIA: addr.MustParseIA("1-ff00:0:4"), + DstIA: addr.MustParseIA("1-ff00:0:1"), Path: sp, } if err := scionL.SetSrcAddr(addr.MustParseHost("172.16.4.1")); err != nil { @@ -207,8 +206,8 @@ func ChildToInternalHostShortcut( FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:4"), - DstIA: xtest.MustParseIA("1-ff00:0:1"), + SrcIA: addr.MustParseIA("1-ff00:0:4"), + DstIA: addr.MustParseIA("1-ff00:0:1"), Path: sp, } if err := scionL.SetSrcAddr(addr.MustParseHost("172.16.4.1")); err != nil { @@ -324,8 +323,8 @@ func ChildToInternalParent(artifactsDir string, mac hash.Hash) runner.Case { FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:4"), - DstIA: xtest.MustParseIA("1-ff00:0:9"), + SrcIA: addr.MustParseIA("1-ff00:0:4"), + DstIA: addr.MustParseIA("1-ff00:0:9"), Path: sp, } if err := scionL.SetSrcAddr(addr.MustParseHost("172.16.4.1")); err != nil { diff --git a/tools/braccept/cases/child_to_parent.go b/tools/braccept/cases/child_to_parent.go index fb6f24092f..aa049a547c 100644 --- a/tools/braccept/cases/child_to_parent.go +++ b/tools/braccept/cases/child_to_parent.go @@ -25,7 +25,6 @@ import ( "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/util" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/slayers" "github.com/scionproto/scion/pkg/slayers/path" "github.com/scionproto/scion/pkg/slayers/path/scion" @@ -101,8 +100,8 @@ func ChildToParent(artifactsDir string, mac hash.Hash) runner.Case { FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:4"), - DstIA: xtest.MustParseIA("1-ff00:0:3"), + SrcIA: addr.MustParseIA("1-ff00:0:4"), + DstIA: addr.MustParseIA("1-ff00:0:3"), Path: sp, } if err := scionL.SetSrcAddr(addr.MustParseHost("172.16.4.1")); err != nil { diff --git a/tools/braccept/cases/child_to_peer.go b/tools/braccept/cases/child_to_peer.go index 5d0d1081e9..1a705d1059 100644 --- a/tools/braccept/cases/child_to_peer.go +++ b/tools/braccept/cases/child_to_peer.go @@ -25,7 +25,6 @@ import ( "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/util" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/scrypto" "github.com/scionproto/scion/pkg/slayers" "github.com/scionproto/scion/pkg/slayers/path" @@ -136,8 +135,8 @@ func ChildToPeer(artifactsDir string, mac hash.Hash) runner.Case { FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:5"), - DstIA: xtest.MustParseIA("1-ff00:0:2"), + SrcIA: addr.MustParseIA("1-ff00:0:5"), + DstIA: addr.MustParseIA("1-ff00:0:2"), Path: sp, } if err := scionL.SetSrcAddr(addr.MustParseHost("172.16.5.1")); err != nil { diff --git a/tools/braccept/cases/internal_to_child.go b/tools/braccept/cases/internal_to_child.go index 5587e6141b..b668a5c448 100644 --- a/tools/braccept/cases/internal_to_child.go +++ b/tools/braccept/cases/internal_to_child.go @@ -25,7 +25,6 @@ import ( "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/util" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/slayers" "github.com/scionproto/scion/pkg/slayers/path" "github.com/scionproto/scion/pkg/slayers/path/scion" @@ -97,8 +96,8 @@ func InternalHostToChild(artifactsDir string, mac hash.Hash) runner.Case { FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:1"), - DstIA: xtest.MustParseIA("1-ff00:0:4"), + SrcIA: addr.MustParseIA("1-ff00:0:1"), + DstIA: addr.MustParseIA("1-ff00:0:4"), Path: sp, } if err := scionL.SetSrcAddr(addr.MustParseHost("192.168.0.51")); err != nil { @@ -223,8 +222,8 @@ func InternalParentToChild(artifactsDir string, mac hash.Hash) runner.Case { FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:9"), - DstIA: xtest.MustParseIA("1-ff00:0:4"), + SrcIA: addr.MustParseIA("1-ff00:0:9"), + DstIA: addr.MustParseIA("1-ff00:0:4"), Path: sp, } if err := scionL.SetSrcAddr(addr.MustParseHost("174.16.9.1")); err != nil { @@ -350,8 +349,8 @@ func InvalidSrcInternalParentToChild(artifactsDir string, mac hash.Hash) runner. FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:9"), - DstIA: xtest.MustParseIA("1-ff00:0:4"), + SrcIA: addr.MustParseIA("1-ff00:0:9"), + DstIA: addr.MustParseIA("1-ff00:0:4"), Path: sp, } if err := scionL.SetSrcAddr(addr.MustParseHost("174.16.9.1")); err != nil { diff --git a/tools/braccept/cases/jumbo.go b/tools/braccept/cases/jumbo.go index b2695264c1..1d3b80675e 100644 --- a/tools/braccept/cases/jumbo.go +++ b/tools/braccept/cases/jumbo.go @@ -25,7 +25,6 @@ import ( "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/util" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/slayers" "github.com/scionproto/scion/pkg/slayers/path" "github.com/scionproto/scion/pkg/slayers/path/scion" @@ -101,8 +100,8 @@ func JumboPacket(artifactsDir string, mac hash.Hash) runner.Case { FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:3"), - DstIA: xtest.MustParseIA("1-ff00:0:4"), + SrcIA: addr.MustParseIA("1-ff00:0:3"), + DstIA: addr.MustParseIA("1-ff00:0:4"), Path: sp, } if err := scionL.SetSrcAddr(addr.MustParseHost("172.16.3.1")); err != nil { diff --git a/tools/braccept/cases/onehop.go b/tools/braccept/cases/onehop.go index be28bb0f3b..47df9fdde0 100644 --- a/tools/braccept/cases/onehop.go +++ b/tools/braccept/cases/onehop.go @@ -26,7 +26,6 @@ import ( "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/util" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/slayers" "github.com/scionproto/scion/pkg/slayers/path" "github.com/scionproto/scion/pkg/slayers/path/onehop" @@ -79,8 +78,8 @@ func IncomingOneHop( FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: onehop.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:3"), - DstIA: xtest.MustParseIA("1-ff00:0:1"), + SrcIA: addr.MustParseIA("1-ff00:0:3"), + DstIA: addr.MustParseIA("1-ff00:0:1"), Path: ohp, } if err := scionL.SetSrcAddr(addr.MustParseHost("172.16.4.1")); err != nil { @@ -174,8 +173,8 @@ func OutgoingOneHop(artifactsDir string, mac hash.Hash) runner.Case { FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: onehop.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:1"), - DstIA: xtest.MustParseIA("1-ff00:0:4"), + SrcIA: addr.MustParseIA("1-ff00:0:1"), + DstIA: addr.MustParseIA("1-ff00:0:4"), Path: ohp, } if err := scionL.SetSrcAddr(addr.MustParseHost("192.168.0.71")); err != nil { diff --git a/tools/braccept/cases/parent_to_child.go b/tools/braccept/cases/parent_to_child.go index 39615aa10a..25ce70ced3 100644 --- a/tools/braccept/cases/parent_to_child.go +++ b/tools/braccept/cases/parent_to_child.go @@ -25,7 +25,6 @@ import ( "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/util" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/slayers" "github.com/scionproto/scion/pkg/slayers/path" "github.com/scionproto/scion/pkg/slayers/path/scion" @@ -101,8 +100,8 @@ func ParentToChild(artifactsDir string, mac hash.Hash) runner.Case { FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:3"), - DstIA: xtest.MustParseIA("1-ff00:0:4"), + SrcIA: addr.MustParseIA("1-ff00:0:3"), + DstIA: addr.MustParseIA("1-ff00:0:4"), Path: sp, } if err := scionL.SetSrcAddr(addr.MustParseHost("172.16.3.1")); err != nil { diff --git a/tools/braccept/cases/parent_to_internal.go b/tools/braccept/cases/parent_to_internal.go index 2892915dc9..80f3527a8f 100644 --- a/tools/braccept/cases/parent_to_internal.go +++ b/tools/braccept/cases/parent_to_internal.go @@ -25,7 +25,6 @@ import ( "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/util" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/slayers" "github.com/scionproto/scion/pkg/slayers/path" "github.com/scionproto/scion/pkg/slayers/path/scion" @@ -92,8 +91,8 @@ func ParentToInternalHost( FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:3"), - DstIA: xtest.MustParseIA("1-ff00:0:1"), + SrcIA: addr.MustParseIA("1-ff00:0:3"), + DstIA: addr.MustParseIA("1-ff00:0:1"), Path: sp, } if err := scionL.SetSrcAddr(addr.MustParseHost("172.16.3.1")); err != nil { @@ -210,8 +209,8 @@ func ParentToInternalHostMultiSegment( FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("2-ff00:0:42"), - DstIA: xtest.MustParseIA("1-ff00:0:1"), + SrcIA: addr.MustParseIA("2-ff00:0:42"), + DstIA: addr.MustParseIA("1-ff00:0:1"), Path: sp, } if err := scionL.SetSrcAddr(addr.MustParseHost("172.16.3.1")); err != nil { diff --git a/tools/braccept/cases/peer_to_child.go b/tools/braccept/cases/peer_to_child.go index 8c9d561fe9..1590dddd91 100644 --- a/tools/braccept/cases/peer_to_child.go +++ b/tools/braccept/cases/peer_to_child.go @@ -25,7 +25,6 @@ import ( "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/util" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/scrypto" "github.com/scionproto/scion/pkg/slayers" "github.com/scionproto/scion/pkg/slayers/path" @@ -135,8 +134,8 @@ func PeerToChild(artifactsDir string, mac hash.Hash) runner.Case { FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:2"), - DstIA: xtest.MustParseIA("1-ff00:0:5"), + SrcIA: addr.MustParseIA("1-ff00:0:2"), + DstIA: addr.MustParseIA("1-ff00:0:5"), Path: sp, } if err := scionL.SetSrcAddr(addr.MustParseHost("172.16.2.1")); err != nil { diff --git a/tools/braccept/cases/scmp_dest_unreachable.go b/tools/braccept/cases/scmp_dest_unreachable.go index 6af4ff1eb3..c9a9a71654 100644 --- a/tools/braccept/cases/scmp_dest_unreachable.go +++ b/tools/braccept/cases/scmp_dest_unreachable.go @@ -25,7 +25,6 @@ import ( "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/util" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/slayers" "github.com/scionproto/scion/pkg/slayers/path" "github.com/scionproto/scion/pkg/slayers/path/scion" @@ -91,8 +90,8 @@ func SCMPDestinationUnreachable(artifactsDir string, mac hash.Hash) runner.Case FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:3"), - DstIA: xtest.MustParseIA("1-ff00:0:1"), + SrcIA: addr.MustParseIA("1-ff00:0:3"), + DstIA: addr.MustParseIA("1-ff00:0:1"), Path: sp, } srcA := addr.MustParseHost("172.16.3.1") @@ -131,7 +130,7 @@ func SCMPDestinationUnreachable(artifactsDir string, mac hash.Hash) runner.Case udp.SrcPort, udp.DstPort = udp.DstPort, udp.SrcPort scionL.DstIA = scionL.SrcIA - scionL.SrcIA = xtest.MustParseIA("1-ff00:0:1") + scionL.SrcIA = addr.MustParseIA("1-ff00:0:1") if err := scionL.SetDstAddr(srcA); err != nil { panic(err) } diff --git a/tools/braccept/cases/scmp_expired_hop.go b/tools/braccept/cases/scmp_expired_hop.go index d8b645cffe..919ef92d39 100644 --- a/tools/braccept/cases/scmp_expired_hop.go +++ b/tools/braccept/cases/scmp_expired_hop.go @@ -25,7 +25,6 @@ import ( "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/util" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/slayers" "github.com/scionproto/scion/pkg/slayers/path" "github.com/scionproto/scion/pkg/slayers/path/scion" @@ -102,8 +101,8 @@ func SCMPExpiredHop(artifactsDir string, mac hash.Hash) runner.Case { FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:3"), - DstIA: xtest.MustParseIA("1-ff00:0:4"), + SrcIA: addr.MustParseIA("1-ff00:0:3"), + DstIA: addr.MustParseIA("1-ff00:0:4"), Path: sp, } srcA := addr.MustParseHost("172.16.3.1") @@ -143,7 +142,7 @@ func SCMPExpiredHop(artifactsDir string, mac hash.Hash) runner.Case { udp.SrcPort, udp.DstPort = udp.DstPort, udp.SrcPort scionL.DstIA = scionL.SrcIA - scionL.SrcIA = xtest.MustParseIA("1-ff00:0:1") + scionL.SrcIA = addr.MustParseIA("1-ff00:0:1") if err := scionL.SetDstAddr(srcA); err != nil { panic(err) } @@ -267,8 +266,8 @@ func SCMPExpiredHopAfterXover(artifactsDir string, mac hash.Hash) runner.Case { FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:5"), - DstIA: xtest.MustParseIA("1-ff00:0:4"), + SrcIA: addr.MustParseIA("1-ff00:0:5"), + DstIA: addr.MustParseIA("1-ff00:0:4"), Path: sp, } @@ -319,7 +318,7 @@ func SCMPExpiredHopAfterXover(artifactsDir string, mac hash.Hash) runner.Case { udp.SrcPort, udp.DstPort = udp.DstPort, udp.SrcPort scionL.DstIA = scionL.SrcIA - scionL.SrcIA = xtest.MustParseIA("1-ff00:0:1") + scionL.SrcIA = addr.MustParseIA("1-ff00:0:1") if err := scionL.SetDstAddr(srcA); err != nil { panic(err) } @@ -443,8 +442,8 @@ func SCMPExpiredHopAfterXoverConsDir(artifactsDir string, mac hash.Hash) runner. FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:5"), - DstIA: xtest.MustParseIA("1-ff00:0:4"), + SrcIA: addr.MustParseIA("1-ff00:0:5"), + DstIA: addr.MustParseIA("1-ff00:0:4"), Path: sp, } @@ -495,7 +494,7 @@ func SCMPExpiredHopAfterXoverConsDir(artifactsDir string, mac hash.Hash) runner. udp.SrcPort, udp.DstPort = udp.DstPort, udp.SrcPort scionL.DstIA = scionL.SrcIA - scionL.SrcIA = xtest.MustParseIA("1-ff00:0:1") + scionL.SrcIA = addr.MustParseIA("1-ff00:0:1") if err := scionL.SetDstAddr(srcA); err != nil { panic(err) } @@ -623,8 +622,8 @@ func SCMPExpiredHopAfterXoverInternal(artifactsDir string, mac hash.Hash) runner FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:8"), - DstIA: xtest.MustParseIA("1-ff00:0:4"), + SrcIA: addr.MustParseIA("1-ff00:0:8"), + DstIA: addr.MustParseIA("1-ff00:0:4"), Path: sp, } @@ -669,7 +668,7 @@ func SCMPExpiredHopAfterXoverInternal(artifactsDir string, mac hash.Hash) runner udp.SrcPort, udp.DstPort = udp.DstPort, udp.SrcPort scionL.DstIA = scionL.SrcIA - scionL.SrcIA = xtest.MustParseIA("1-ff00:0:1") + scionL.SrcIA = addr.MustParseIA("1-ff00:0:1") if err := scionL.SetDstAddr(srcA); err != nil { panic(err) } @@ -794,8 +793,8 @@ func SCMPExpiredHopAfterXoverInternalConsDir( FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:8"), - DstIA: xtest.MustParseIA("1-ff00:0:4"), + SrcIA: addr.MustParseIA("1-ff00:0:8"), + DstIA: addr.MustParseIA("1-ff00:0:4"), Path: sp, } @@ -840,7 +839,7 @@ func SCMPExpiredHopAfterXoverInternalConsDir( udp.SrcPort, udp.DstPort = udp.DstPort, udp.SrcPort scionL.DstIA = scionL.SrcIA - scionL.SrcIA = xtest.MustParseIA("1-ff00:0:1") + scionL.SrcIA = addr.MustParseIA("1-ff00:0:1") if err := scionL.SetDstAddr(srcA); err != nil { panic(err) } diff --git a/tools/braccept/cases/scmp_invalid_hop.go b/tools/braccept/cases/scmp_invalid_hop.go index c458e12622..cdf21b185d 100644 --- a/tools/braccept/cases/scmp_invalid_hop.go +++ b/tools/braccept/cases/scmp_invalid_hop.go @@ -25,7 +25,6 @@ import ( "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/util" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/slayers" "github.com/scionproto/scion/pkg/slayers/path" "github.com/scionproto/scion/pkg/slayers/path/scion" @@ -94,8 +93,8 @@ func SCMPInvalidHopParentToParent(artifactsDir string, mac hash.Hash) runner.Cas FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:3"), - DstIA: xtest.MustParseIA("1-ff00:0:9"), + SrcIA: addr.MustParseIA("1-ff00:0:3"), + DstIA: addr.MustParseIA("1-ff00:0:9"), Path: sp, } srcA := addr.MustParseHost("172.16.5.1") @@ -143,7 +142,7 @@ func SCMPInvalidHopParentToParent(artifactsDir string, mac hash.Hash) runner.Cas udp.SrcPort, udp.DstPort = udp.DstPort, udp.SrcPort scionL.DstIA = scionL.SrcIA - scionL.SrcIA = xtest.MustParseIA("1-ff00:0:1") + scionL.SrcIA = addr.MustParseIA("1-ff00:0:1") if err := scionL.SetDstAddr(srcA); err != nil { panic(err) } @@ -255,8 +254,8 @@ func SCMPInvalidHopChildToChild(artifactsDir string, mac hash.Hash) runner.Case FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:4"), - DstIA: xtest.MustParseIA("1-ff00:0:5"), + SrcIA: addr.MustParseIA("1-ff00:0:4"), + DstIA: addr.MustParseIA("1-ff00:0:5"), Path: sp, } srcA := addr.MustParseHost("172.16.5.1") @@ -304,7 +303,7 @@ func SCMPInvalidHopChildToChild(artifactsDir string, mac hash.Hash) runner.Case udp.SrcPort, udp.DstPort = udp.DstPort, udp.SrcPort scionL.DstIA = scionL.SrcIA - scionL.SrcIA = xtest.MustParseIA("1-ff00:0:1") + scionL.SrcIA = addr.MustParseIA("1-ff00:0:1") if err := scionL.SetDstAddr(srcA); err != nil { panic(err) } diff --git a/tools/braccept/cases/scmp_invalid_ia.go b/tools/braccept/cases/scmp_invalid_ia.go index f501ff308d..73540869b5 100644 --- a/tools/braccept/cases/scmp_invalid_ia.go +++ b/tools/braccept/cases/scmp_invalid_ia.go @@ -25,7 +25,6 @@ import ( "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/util" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/slayers" "github.com/scionproto/scion/pkg/slayers/path" "github.com/scionproto/scion/pkg/slayers/path/scion" @@ -96,8 +95,8 @@ func SCMPInvalidSrcIAInternalHostToChild(artifactsDir string, mac hash.Hash) run FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:2"), // != local IA, invalid Src IA - DstIA: xtest.MustParseIA("1-ff00:0:4"), + SrcIA: addr.MustParseIA("1-ff00:0:2"), // != local IA, invalid Src IA + DstIA: addr.MustParseIA("1-ff00:0:4"), Path: sp, } srcA := addr.MustParseHost("192.168.0.51") @@ -133,7 +132,7 @@ func SCMPInvalidSrcIAInternalHostToChild(artifactsDir string, mac hash.Hash) run udp.SrcPort, udp.DstPort = udp.DstPort, udp.SrcPort scionL.DstIA = scionL.SrcIA // This is bogus, correct is local IA. - scionL.SrcIA = xtest.MustParseIA("1-ff00:0:1") + scionL.SrcIA = addr.MustParseIA("1-ff00:0:1") if err := scionL.SetDstAddr(srcA); err != nil { panic(err) } @@ -243,8 +242,8 @@ func SCMPInvalidDstIAInternalHostToChild(artifactsDir string, mac hash.Hash) run FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:1"), - DstIA: xtest.MustParseIA("1-ff00:0:1"), // == local IA, invalid Dst IA + SrcIA: addr.MustParseIA("1-ff00:0:1"), + DstIA: addr.MustParseIA("1-ff00:0:1"), // == local IA, invalid Dst IA Path: sp, } srcA := addr.MustParseHost("192.168.0.51") @@ -280,7 +279,7 @@ func SCMPInvalidDstIAInternalHostToChild(artifactsDir string, mac hash.Hash) run udp.SrcPort, udp.DstPort = udp.DstPort, udp.SrcPort scionL.DstIA = scionL.SrcIA - scionL.SrcIA = xtest.MustParseIA("1-ff00:0:1") + scionL.SrcIA = addr.MustParseIA("1-ff00:0:1") if err := scionL.SetDstAddr(srcA); err != nil { panic(err) } @@ -394,8 +393,8 @@ func SCMPInvalidSrcIAChildToParent(artifactsDir string, mac hash.Hash) runner.Ca FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:1"), // == local IA, invalid Src IA - DstIA: xtest.MustParseIA("1-ff00:0:3"), + SrcIA: addr.MustParseIA("1-ff00:0:1"), // == local IA, invalid Src IA + DstIA: addr.MustParseIA("1-ff00:0:3"), Path: sp, } srcA := addr.MustParseHost("172.16.4.1") @@ -431,7 +430,7 @@ func SCMPInvalidSrcIAChildToParent(artifactsDir string, mac hash.Hash) runner.Ca udp.SrcPort, udp.DstPort = udp.DstPort, udp.SrcPort scionL.DstIA = scionL.SrcIA // This is bogus, but we don't know the correct IA. - scionL.SrcIA = xtest.MustParseIA("1-ff00:0:1") + scionL.SrcIA = addr.MustParseIA("1-ff00:0:1") if err := scionL.SetDstAddr(srcA); err != nil { panic(err) } @@ -550,8 +549,8 @@ func SCMPInvalidDstIAChildToParent(artifactsDir string, mac hash.Hash) runner.Ca FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:9"), - DstIA: xtest.MustParseIA("1-ff00:0:1"), // == local IA, invalid Dst IA + SrcIA: addr.MustParseIA("1-ff00:0:9"), + DstIA: addr.MustParseIA("1-ff00:0:1"), // == local IA, invalid Dst IA Path: sp, } srcA := addr.MustParseHost("172.16.4.1") @@ -587,7 +586,7 @@ func SCMPInvalidDstIAChildToParent(artifactsDir string, mac hash.Hash) runner.Ca udp.SrcPort, udp.DstPort = udp.DstPort, udp.SrcPort scionL.DstIA = scionL.SrcIA - scionL.SrcIA = xtest.MustParseIA("1-ff00:0:1") + scionL.SrcIA = addr.MustParseIA("1-ff00:0:1") if err := scionL.SetDstAddr(srcA); err != nil { panic(err) } diff --git a/tools/braccept/cases/scmp_invalid_mac.go b/tools/braccept/cases/scmp_invalid_mac.go index 3a5fbd7f56..f65231f4b3 100644 --- a/tools/braccept/cases/scmp_invalid_mac.go +++ b/tools/braccept/cases/scmp_invalid_mac.go @@ -25,7 +25,6 @@ import ( "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/util" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/slayers" "github.com/scionproto/scion/pkg/slayers/path" "github.com/scionproto/scion/pkg/slayers/path/scion" @@ -100,8 +99,8 @@ func SCMPBadMAC(artifactsDir string, mac hash.Hash) runner.Case { FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:3"), - DstIA: xtest.MustParseIA("1-ff00:0:4"), + SrcIA: addr.MustParseIA("1-ff00:0:3"), + DstIA: addr.MustParseIA("1-ff00:0:4"), Path: sp, } srcA := addr.MustParseHost("172.16.3.1") @@ -141,7 +140,7 @@ func SCMPBadMAC(artifactsDir string, mac hash.Hash) runner.Case { udp.SrcPort, udp.DstPort = udp.DstPort, udp.SrcPort scionL.DstIA = scionL.SrcIA - scionL.SrcIA = xtest.MustParseIA("1-ff00:0:1") + scionL.SrcIA = addr.MustParseIA("1-ff00:0:1") if err := scionL.SetDstAddr(srcA); err != nil { panic(err) } @@ -256,8 +255,8 @@ func SCMPBadMACInternal(artifactsDir string, mac hash.Hash) runner.Case { FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:9"), - DstIA: xtest.MustParseIA("1-ff00:0:4"), + SrcIA: addr.MustParseIA("1-ff00:0:9"), + DstIA: addr.MustParseIA("1-ff00:0:4"), Path: sp, } srcA := addr.MustParseHost("172.16.3.1") @@ -297,7 +296,7 @@ func SCMPBadMACInternal(artifactsDir string, mac hash.Hash) runner.Case { udp.SrcPort, udp.DstPort = udp.DstPort, udp.SrcPort scionL.DstIA = scionL.SrcIA - scionL.SrcIA = xtest.MustParseIA("1-ff00:0:1") + scionL.SrcIA = addr.MustParseIA("1-ff00:0:1") if err := scionL.SetDstAddr(srcA); err != nil { panic(err) } diff --git a/tools/braccept/cases/scmp_invalid_pkt.go b/tools/braccept/cases/scmp_invalid_pkt.go index bf61dcd9cc..7879f80c49 100644 --- a/tools/braccept/cases/scmp_invalid_pkt.go +++ b/tools/braccept/cases/scmp_invalid_pkt.go @@ -25,7 +25,6 @@ import ( "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/util" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/slayers" "github.com/scionproto/scion/pkg/slayers/path" "github.com/scionproto/scion/pkg/slayers/path/scion" @@ -89,8 +88,8 @@ func SCMPBadPktLen(artifactsDir string, mac hash.Hash) runner.Case { FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:3"), - DstIA: xtest.MustParseIA("1-ff00:0:4"), + SrcIA: addr.MustParseIA("1-ff00:0:3"), + DstIA: addr.MustParseIA("1-ff00:0:4"), Path: sp, } srcA := addr.MustParseHost("172.16.3.1") @@ -135,7 +134,7 @@ func SCMPBadPktLen(artifactsDir string, mac hash.Hash) runner.Case { udp.SrcPort, udp.DstPort = udp.DstPort, udp.SrcPort scionL.DstIA = scionL.SrcIA - scionL.SrcIA = xtest.MustParseIA("1-ff00:0:1") + scionL.SrcIA = addr.MustParseIA("1-ff00:0:1") if err := scionL.SetDstAddr(srcA); err != nil { panic(err) } @@ -243,8 +242,8 @@ func SCMPQuoteCut(artifactsDir string, mac hash.Hash) runner.Case { FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:3"), - DstIA: xtest.MustParseIA("1-ff00:0:4"), + SrcIA: addr.MustParseIA("1-ff00:0:3"), + DstIA: addr.MustParseIA("1-ff00:0:4"), Path: sp, } srcA := addr.MustParseHost("172.16.3.1") @@ -293,7 +292,7 @@ func SCMPQuoteCut(artifactsDir string, mac hash.Hash) runner.Case { udp.SrcPort, udp.DstPort = udp.DstPort, udp.SrcPort scionL.DstIA = scionL.SrcIA - scionL.SrcIA = xtest.MustParseIA("1-ff00:0:1") + scionL.SrcIA = addr.MustParseIA("1-ff00:0:1") if err := scionL.SetDstAddr(srcA); err != nil { panic(err) } @@ -404,8 +403,8 @@ func NoSCMPReplyForSCMPError(artifactsDir string, mac hash.Hash) runner.Case { FlowID: 0xdead, NextHdr: slayers.L4SCMP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:3"), - DstIA: xtest.MustParseIA("1-ff00:0:4"), + SrcIA: addr.MustParseIA("1-ff00:0:3"), + DstIA: addr.MustParseIA("1-ff00:0:4"), Path: sp, } srcA := addr.MustParseHost("172.16.3.1") diff --git a/tools/braccept/cases/scmp_invalid_segment_change.go b/tools/braccept/cases/scmp_invalid_segment_change.go index 20d52c2e6b..1568923189 100644 --- a/tools/braccept/cases/scmp_invalid_segment_change.go +++ b/tools/braccept/cases/scmp_invalid_segment_change.go @@ -25,7 +25,6 @@ import ( "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/util" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/slayers" "github.com/scionproto/scion/pkg/slayers/path" "github.com/scionproto/scion/pkg/slayers/path/scion" @@ -103,8 +102,8 @@ func SCMPParentToParentXover(artifactsDir string, mac hash.Hash) runner.Case { FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:3"), - DstIA: xtest.MustParseIA("1-ff00:0:9"), + SrcIA: addr.MustParseIA("1-ff00:0:3"), + DstIA: addr.MustParseIA("1-ff00:0:9"), Path: sp, } srcA := addr.MustParseHost("172.16.5.1") @@ -152,7 +151,7 @@ func SCMPParentToParentXover(artifactsDir string, mac hash.Hash) runner.Case { udp.SrcPort, udp.DstPort = udp.DstPort, udp.SrcPort scionL.DstIA = scionL.SrcIA - scionL.SrcIA = xtest.MustParseIA("1-ff00:0:1") + scionL.SrcIA = addr.MustParseIA("1-ff00:0:1") if err := scionL.SetDstAddr(srcA); err != nil { panic(err) } @@ -278,8 +277,8 @@ func SCMPParentToChildXover(artifactsDir string, mac hash.Hash) runner.Case { FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:3"), - DstIA: xtest.MustParseIA("1-ff00:0:8"), + SrcIA: addr.MustParseIA("1-ff00:0:3"), + DstIA: addr.MustParseIA("1-ff00:0:8"), Path: sp, } srcA := addr.MustParseHost("172.16.5.1") @@ -327,7 +326,7 @@ func SCMPParentToChildXover(artifactsDir string, mac hash.Hash) runner.Case { udp.SrcPort, udp.DstPort = udp.DstPort, udp.SrcPort scionL.DstIA = scionL.SrcIA - scionL.SrcIA = xtest.MustParseIA("1-ff00:0:1") + scionL.SrcIA = addr.MustParseIA("1-ff00:0:1") if err := scionL.SetDstAddr(srcA); err != nil { panic(err) } @@ -455,8 +454,8 @@ func SCMPChildToParentXover(artifactsDir string, mac hash.Hash) runner.Case { FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:4"), - DstIA: xtest.MustParseIA("1-ff00:0:9"), + SrcIA: addr.MustParseIA("1-ff00:0:4"), + DstIA: addr.MustParseIA("1-ff00:0:9"), Path: sp, } srcA := addr.MustParseHost("172.16.5.1") @@ -505,7 +504,7 @@ func SCMPChildToParentXover(artifactsDir string, mac hash.Hash) runner.Case { udp.SrcPort, udp.DstPort = udp.DstPort, udp.SrcPort scionL.DstIA = scionL.SrcIA - scionL.SrcIA = xtest.MustParseIA("1-ff00:0:1") + scionL.SrcIA = addr.MustParseIA("1-ff00:0:1") if err := scionL.SetDstAddr(srcA); err != nil { panic(err) } @@ -632,8 +631,8 @@ func SCMPInternalXover(artifactsDir string, mac hash.Hash) runner.Case { FlowID: 0xdead, NextHdr: slayers.L4SCMP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:8"), - DstIA: xtest.MustParseIA("1-ff00:0:4"), + SrcIA: addr.MustParseIA("1-ff00:0:8"), + DstIA: addr.MustParseIA("1-ff00:0:4"), Path: sp, } @@ -684,7 +683,7 @@ func SCMPInternalXover(artifactsDir string, mac hash.Hash) runner.Case { udp.SrcPort, udp.DstPort = udp.DstPort, udp.SrcPort scionL.DstIA = scionL.SrcIA - scionL.SrcIA = xtest.MustParseIA("1-ff00:0:1") + scionL.SrcIA = addr.MustParseIA("1-ff00:0:1") if err := scionL.SetDstAddr(srcA); err != nil { panic(err) } diff --git a/tools/braccept/cases/scmp_invalid_segment_change_local.go b/tools/braccept/cases/scmp_invalid_segment_change_local.go index e0198c686d..2b91e088d2 100644 --- a/tools/braccept/cases/scmp_invalid_segment_change_local.go +++ b/tools/braccept/cases/scmp_invalid_segment_change_local.go @@ -25,7 +25,6 @@ import ( "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/util" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/slayers" "github.com/scionproto/scion/pkg/slayers/path" "github.com/scionproto/scion/pkg/slayers/path/scion" @@ -103,8 +102,8 @@ func SCMPParentToParentLocalXover(artifactsDir string, mac hash.Hash) runner.Cas FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:3"), - DstIA: xtest.MustParseIA("1-ff00:0:3"), + SrcIA: addr.MustParseIA("1-ff00:0:3"), + DstIA: addr.MustParseIA("1-ff00:0:3"), Path: sp, } srcA := addr.MustParseHost("172.16.5.1") @@ -152,7 +151,7 @@ func SCMPParentToParentLocalXover(artifactsDir string, mac hash.Hash) runner.Cas udp.SrcPort, udp.DstPort = udp.DstPort, udp.SrcPort scionL.DstIA = scionL.SrcIA - scionL.SrcIA = xtest.MustParseIA("1-ff00:0:1") + scionL.SrcIA = addr.MustParseIA("1-ff00:0:1") if err := scionL.SetDstAddr(srcA); err != nil { panic(err) } @@ -278,8 +277,8 @@ func SCMPParentToChildLocalXover(artifactsDir string, mac hash.Hash) runner.Case FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:2"), - DstIA: xtest.MustParseIA("1-ff00:0:4"), + SrcIA: addr.MustParseIA("1-ff00:0:2"), + DstIA: addr.MustParseIA("1-ff00:0:4"), Path: sp, } srcA := addr.MustParseHost("172.16.5.1") @@ -327,7 +326,7 @@ func SCMPParentToChildLocalXover(artifactsDir string, mac hash.Hash) runner.Case udp.SrcPort, udp.DstPort = udp.DstPort, udp.SrcPort scionL.DstIA = scionL.SrcIA - scionL.SrcIA = xtest.MustParseIA("1-ff00:0:1") + scionL.SrcIA = addr.MustParseIA("1-ff00:0:1") if err := scionL.SetDstAddr(srcA); err != nil { panic(err) } @@ -455,8 +454,8 @@ func SCMPChildToParentLocalXover(artifactsDir string, mac hash.Hash) runner.Case FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:4"), - DstIA: xtest.MustParseIA("1-ff00:0:3"), + SrcIA: addr.MustParseIA("1-ff00:0:4"), + DstIA: addr.MustParseIA("1-ff00:0:3"), Path: sp, } srcA := addr.MustParseHost("172.16.5.1") @@ -505,7 +504,7 @@ func SCMPChildToParentLocalXover(artifactsDir string, mac hash.Hash) runner.Case udp.SrcPort, udp.DstPort = udp.DstPort, udp.SrcPort scionL.DstIA = scionL.SrcIA - scionL.SrcIA = xtest.MustParseIA("1-ff00:0:1") + scionL.SrcIA = addr.MustParseIA("1-ff00:0:1") if err := scionL.SetDstAddr(srcA); err != nil { panic(err) } diff --git a/tools/braccept/cases/scmp_traceroute.go b/tools/braccept/cases/scmp_traceroute.go index b405ce04ca..9f9493fac7 100644 --- a/tools/braccept/cases/scmp_traceroute.go +++ b/tools/braccept/cases/scmp_traceroute.go @@ -26,7 +26,6 @@ import ( "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/drkey" "github.com/scionproto/scion/pkg/private/util" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/slayers" "github.com/scionproto/scion/pkg/slayers/path" "github.com/scionproto/scion/pkg/slayers/path/scion" @@ -93,8 +92,8 @@ func SCMPTracerouteIngress(artifactsDir string, mac hash.Hash) runner.Case { FlowID: 0xdead, NextHdr: slayers.L4SCMP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:4"), - DstIA: xtest.MustParseIA("1-ff00:0:2"), + SrcIA: addr.MustParseIA("1-ff00:0:4"), + DstIA: addr.MustParseIA("1-ff00:0:2"), Path: sp, } srcA := addr.MustParseHost("172.16.4.1") @@ -129,7 +128,7 @@ func SCMPTracerouteIngress(artifactsDir string, mac hash.Hash) runner.Case { udp.SrcPort, udp.DstPort = udp.DstPort, udp.SrcPort scionL.DstIA = scionL.SrcIA - scionL.SrcIA = xtest.MustParseIA("1-ff00:0:1") + scionL.SrcIA = addr.MustParseIA("1-ff00:0:1") if err := scionL.SetDstAddr(srcA); err != nil { panic(err) } @@ -235,8 +234,8 @@ func SCMPTracerouteIngressWithSPAO(artifactsDir string, mac hash.Hash) runner.Ca HdrLen: 0x15, PayloadLen: 0x18, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:4"), - DstIA: xtest.MustParseIA("1-ff00:0:2"), + SrcIA: addr.MustParseIA("1-ff00:0:4"), + DstIA: addr.MustParseIA("1-ff00:0:2"), Path: sp, } srcA := addr.MustParseHost("172.16.4.1") @@ -262,7 +261,7 @@ func SCMPTracerouteIngressWithSPAO(artifactsDir string, mac hash.Hash) runner.Ca key, err := (&drkeyutil.FakeProvider{ EpochDuration: drkeyutil.LoadEpochDuration(), AcceptanceWindow: drkeyutil.LoadAcceptanceWindow(), - }).GetASHostKey(sendTime, xtest.MustParseIA("1-ff00:0:4"), srcA) + }).GetASHostKey(sendTime, addr.MustParseIA("1-ff00:0:4"), srcA) if err != nil { panic(err) } @@ -323,7 +322,7 @@ func SCMPTracerouteIngressWithSPAO(artifactsDir string, mac hash.Hash) runner.Ca udp.SrcPort, udp.DstPort = udp.DstPort, udp.SrcPort scionL.DstIA = scionL.SrcIA - scionL.SrcIA = xtest.MustParseIA("1-ff00:0:1") + scionL.SrcIA = addr.MustParseIA("1-ff00:0:1") if err := scionL.SetDstAddr(srcA); err != nil { panic(err) } @@ -450,8 +449,8 @@ func SCMPTracerouteIngressConsDir(artifactsDir string, mac hash.Hash) runner.Cas FlowID: 0xdead, NextHdr: slayers.L4SCMP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:3"), - DstIA: xtest.MustParseIA("1-ff00:0:4"), + SrcIA: addr.MustParseIA("1-ff00:0:3"), + DstIA: addr.MustParseIA("1-ff00:0:4"), Path: sp, } srcA := addr.MustParseHost("172.16.3.1") @@ -491,7 +490,7 @@ func SCMPTracerouteIngressConsDir(artifactsDir string, mac hash.Hash) runner.Cas udp.SrcPort, udp.DstPort = udp.DstPort, udp.SrcPort scionL.DstIA = scionL.SrcIA - scionL.SrcIA = xtest.MustParseIA("1-ff00:0:1") + scionL.SrcIA = addr.MustParseIA("1-ff00:0:1") if err := scionL.SetDstAddr(srcA); err != nil { panic(err) } @@ -595,8 +594,8 @@ func SCMPTracerouteEgress(artifactsDir string, mac hash.Hash) runner.Case { FlowID: 0xdead, NextHdr: slayers.L4SCMP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:4"), - DstIA: xtest.MustParseIA("1-ff00:0:3"), + SrcIA: addr.MustParseIA("1-ff00:0:4"), + DstIA: addr.MustParseIA("1-ff00:0:3"), Path: sp, } srcA := addr.MustParseHost("172.16.4.1") @@ -631,7 +630,7 @@ func SCMPTracerouteEgress(artifactsDir string, mac hash.Hash) runner.Case { udp.SrcPort, udp.DstPort = udp.DstPort, udp.SrcPort scionL.DstIA = scionL.SrcIA - scionL.SrcIA = xtest.MustParseIA("1-ff00:0:1") + scionL.SrcIA = addr.MustParseIA("1-ff00:0:1") if err := scionL.SetDstAddr(srcA); err != nil { panic(err) } @@ -734,8 +733,8 @@ func SCMPTracerouteEgressConsDir(artifactsDir string, mac hash.Hash) runner.Case FlowID: 0xdead, NextHdr: slayers.L4SCMP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:3"), - DstIA: xtest.MustParseIA("1-ff00:0:4"), + SrcIA: addr.MustParseIA("1-ff00:0:3"), + DstIA: addr.MustParseIA("1-ff00:0:4"), Path: sp, } srcA := addr.MustParseHost("172.16.3.1") @@ -775,7 +774,7 @@ func SCMPTracerouteEgressConsDir(artifactsDir string, mac hash.Hash) runner.Case udp.SrcPort, udp.DstPort = udp.DstPort, udp.SrcPort scionL.DstIA = scionL.SrcIA - scionL.SrcIA = xtest.MustParseIA("1-ff00:0:1") + scionL.SrcIA = addr.MustParseIA("1-ff00:0:1") if err := scionL.SetDstAddr(srcA); err != nil { panic(err) } @@ -893,8 +892,8 @@ func SCMPTracerouteEgressAfterXover(artifactsDir string, mac hash.Hash) runner.C FlowID: 0xdead, NextHdr: slayers.L4SCMP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:8"), - DstIA: xtest.MustParseIA("1-ff00:0:4"), + SrcIA: addr.MustParseIA("1-ff00:0:8"), + DstIA: addr.MustParseIA("1-ff00:0:4"), Path: sp, } @@ -932,7 +931,7 @@ func SCMPTracerouteEgressAfterXover(artifactsDir string, mac hash.Hash) runner.C udp.SrcPort, udp.DstPort = udp.DstPort, udp.SrcPort scionL.DstIA = scionL.SrcIA - scionL.SrcIA = xtest.MustParseIA("1-ff00:0:1") + scionL.SrcIA = addr.MustParseIA("1-ff00:0:1") if err := scionL.SetDstAddr(srcA); err != nil { panic(err) } @@ -1034,8 +1033,8 @@ func SCMPTracerouteInternal(artifactsDir string, mac hash.Hash) runner.Case { FlowID: 0xdead, NextHdr: slayers.L4SCMP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:1"), - DstIA: xtest.MustParseIA("1-ff00:0:4"), + SrcIA: addr.MustParseIA("1-ff00:0:1"), + DstIA: addr.MustParseIA("1-ff00:0:4"), Path: sp, } srcA := addr.MustParseHost("192.168.0.51") @@ -1071,7 +1070,7 @@ func SCMPTracerouteInternal(artifactsDir string, mac hash.Hash) runner.Case { udp.SrcPort, udp.DstPort = udp.DstPort, udp.SrcPort scionL.DstIA = scionL.SrcIA - scionL.SrcIA = xtest.MustParseIA("1-ff00:0:1") + scionL.SrcIA = addr.MustParseIA("1-ff00:0:1") if err := scionL.SetDstAddr(srcA); err != nil { panic(err) } diff --git a/tools/braccept/cases/scmp_unknown_hop.go b/tools/braccept/cases/scmp_unknown_hop.go index 1890a3ecc7..855a159738 100644 --- a/tools/braccept/cases/scmp_unknown_hop.go +++ b/tools/braccept/cases/scmp_unknown_hop.go @@ -25,7 +25,6 @@ import ( "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/util" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/slayers" "github.com/scionproto/scion/pkg/slayers/path" "github.com/scionproto/scion/pkg/slayers/path/scion" @@ -101,8 +100,8 @@ func SCMPUnknownHop(artifactsDir string, mac hash.Hash) runner.Case { FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:3"), - DstIA: xtest.MustParseIA("1-ff00:0:4"), + SrcIA: addr.MustParseIA("1-ff00:0:3"), + DstIA: addr.MustParseIA("1-ff00:0:4"), Path: sp, } srcA := addr.MustParseHost("172.16.3.1") @@ -142,7 +141,7 @@ func SCMPUnknownHop(artifactsDir string, mac hash.Hash) runner.Case { udp.SrcPort, udp.DstPort = udp.DstPort, udp.SrcPort scionL.DstIA = scionL.SrcIA - scionL.SrcIA = xtest.MustParseIA("1-ff00:0:1") + scionL.SrcIA = addr.MustParseIA("1-ff00:0:1") if err := scionL.SetDstAddr(srcA); err != nil { panic(err) } @@ -259,8 +258,8 @@ func SCMPUnknownHopEgress(artifactsDir string, mac hash.Hash) runner.Case { FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:3"), - DstIA: xtest.MustParseIA("1-ff00:0:f1"), + SrcIA: addr.MustParseIA("1-ff00:0:3"), + DstIA: addr.MustParseIA("1-ff00:0:f1"), Path: sp, } srcA := addr.MustParseHost("172.16.3.1") @@ -301,7 +300,7 @@ func SCMPUnknownHopEgress(artifactsDir string, mac hash.Hash) runner.Case { udp.SrcPort, udp.DstPort = udp.DstPort, udp.SrcPort scionL.DstIA = scionL.SrcIA - scionL.SrcIA = xtest.MustParseIA("1-ff00:0:1") + scionL.SrcIA = addr.MustParseIA("1-ff00:0:1") if err := scionL.SetDstAddr(srcA); err != nil { panic(err) } @@ -407,8 +406,8 @@ func SCMPUnknownHopWrongRouter(artifactsDir string, mac hash.Hash) runner.Case { FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:1"), - DstIA: xtest.MustParseIA("1-ff00:0:8"), + SrcIA: addr.MustParseIA("1-ff00:0:1"), + DstIA: addr.MustParseIA("1-ff00:0:8"), Path: sp, } srcA := addr.MustParseHost("192.168.0.51") @@ -454,7 +453,7 @@ func SCMPUnknownHopWrongRouter(artifactsDir string, mac hash.Hash) runner.Case { udp.SrcPort, udp.DstPort = udp.DstPort, udp.SrcPort scionL.DstIA = scionL.SrcIA - scionL.SrcIA = xtest.MustParseIA("1-ff00:0:1") + scionL.SrcIA = addr.MustParseIA("1-ff00:0:1") if err := scionL.SetDstAddr(srcA); err != nil { panic(err) } diff --git a/tools/braccept/cases/svc.go b/tools/braccept/cases/svc.go index b3adfea429..d77eafe960 100644 --- a/tools/braccept/cases/svc.go +++ b/tools/braccept/cases/svc.go @@ -25,7 +25,6 @@ import ( "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/util" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/slayers" "github.com/scionproto/scion/pkg/slayers/path" "github.com/scionproto/scion/pkg/slayers/path/scion" @@ -92,8 +91,8 @@ func SVC(artifactsDir string, mac hash.Hash) runner.Case { FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:4"), - DstIA: xtest.MustParseIA("1-ff00:0:1"), + SrcIA: addr.MustParseIA("1-ff00:0:4"), + DstIA: addr.MustParseIA("1-ff00:0:1"), Path: sp, } if err := scionL.SetSrcAddr(addr.MustParseHost("172.16.4.1")); err != nil { diff --git a/tools/braccept/runner/BUILD.bazel b/tools/braccept/runner/BUILD.bazel index 4c66b4c9ad..c3026c717f 100644 --- a/tools/braccept/runner/BUILD.bazel +++ b/tools/braccept/runner/BUILD.bazel @@ -29,7 +29,6 @@ go_test( deps = [ "//pkg/addr:go_default_library", "//pkg/private/util:go_default_library", - "//pkg/private/xtest:go_default_library", "//pkg/scrypto:go_default_library", "//pkg/slayers:go_default_library", "//pkg/slayers/path:go_default_library", diff --git a/tools/braccept/runner/compare_test.go b/tools/braccept/runner/compare_test.go index d2f8b327db..088ca33f75 100644 --- a/tools/braccept/runner/compare_test.go +++ b/tools/braccept/runner/compare_test.go @@ -23,7 +23,6 @@ import ( "github.com/scionproto/scion/pkg/addr" "github.com/scionproto/scion/pkg/private/util" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/pkg/scrypto" "github.com/scionproto/scion/pkg/slayers" "github.com/scionproto/scion/pkg/slayers/path" @@ -89,8 +88,8 @@ func prepareSCION(t *testing.T, diff string) gopacket.Packet { FlowID: 0xdead, NextHdr: slayers.L4UDP, PathType: scion.PathType, - SrcIA: xtest.MustParseIA("1-ff00:0:4"), - DstIA: xtest.MustParseIA("1-ff00:0:3"), + SrcIA: addr.MustParseIA("1-ff00:0:4"), + DstIA: addr.MustParseIA("1-ff00:0:3"), Path: sp, } if err := scionL.SetSrcAddr(addr.MustParseHost(diff)); err != nil { diff --git a/tools/integration/BUILD.bazel b/tools/integration/BUILD.bazel index cfe67524a7..989cd9ce74 100644 --- a/tools/integration/BUILD.bazel +++ b/tools/integration/BUILD.bazel @@ -35,7 +35,6 @@ go_test( deps = [ ":go_default_library", "//pkg/addr:go_default_library", - "//pkg/private/xtest:go_default_library", "@com_github_stretchr_testify//assert:go_default_library", ], ) diff --git a/tools/integration/aslist_test.go b/tools/integration/aslist_test.go index 17bef426ed..c08e1716ed 100644 --- a/tools/integration/aslist_test.go +++ b/tools/integration/aslist_test.go @@ -20,7 +20,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/scionproto/scion/pkg/addr" - "github.com/scionproto/scion/pkg/private/xtest" "github.com/scionproto/scion/tools/integration" ) @@ -42,10 +41,10 @@ func TestLoadASList(t *testing.T) { File: "testdata/aslist_valid.yml", Error: assert.NoError, Expected: &integration.ASList{ - Core: []addr.IA{xtest.MustParseIA("1-ff00:0:110")}, + Core: []addr.IA{addr.MustParseIA("1-ff00:0:110")}, NonCore: []addr.IA{ - xtest.MustParseIA("1-ff00:0:111"), - xtest.MustParseIA("1-ff00:0:112"), + addr.MustParseIA("1-ff00:0:111"), + addr.MustParseIA("1-ff00:0:112"), }, }, },