MCPcopy
hub / github.com/osrg/gobgp / TestAddBogusPath

Function TestAddBogusPath

pkg/server/server_test.go:2984–3019  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2982}
2983
2984func TestAddBogusPath(t *testing.T) {
2985 s := runNewServer(t, 1, "1.1.1.1", 10179)
2986 defer s.StopBgp(context.Background(), &api.StopBgpRequest{})
2987
2988 nlri := &api.NLRI{Nlri: &api.NLRI_Prefix{Prefix: &api.IPAddressPrefix{}}}
2989
2990 a := &api.Attribute{Attr: &api.Attribute_MpReach{MpReach: &api.MpReachNLRIAttribute{}}}
2991
2992 p := &api.Path{
2993 Family: &api.Family{Afi: api.Family_AFI_IP, Safi: api.Family_SAFI_UNICAST},
2994 Nlri: nlri,
2995 Pattrs: []*api.Attribute{a},
2996 }
2997 ap, err := api2apiutilPath(p)
2998 assert.Error(t, err)
2999 _, err = s.AddPath(apiutil.AddPathRequest{Paths: []*apiutil.Path{ap}})
3000 assert.Error(t, err)
3001 _, err = s.AddPath(apiutil.AddPathRequest{VRFID: "", Paths: []*apiutil.Path{ap}})
3002 assert.Error(t, err)
3003
3004 nlri = &api.NLRI{Nlri: &api.NLRI_Prefix{Prefix: &api.IPAddressPrefix{}}}
3005 a = &api.Attribute{Attr: &api.Attribute_MpReach{MpReach: &api.MpReachNLRIAttribute{
3006 Family: &api.Family{Afi: api.Family_AFI_IP, Safi: api.Family_SAFI_FLOW_SPEC_UNICAST},
3007 }}}
3008 p = &api.Path{
3009 Family: &api.Family{Afi: api.Family_AFI_IP, Safi: api.Family_SAFI_UNICAST},
3010 Nlri: nlri,
3011 Pattrs: []*api.Attribute{a},
3012 }
3013 ap, err = api2apiutilPath(p)
3014 assert.Error(t, err)
3015 _, err = s.AddPath(apiutil.AddPathRequest{Paths: []*apiutil.Path{ap}})
3016 assert.Error(t, err)
3017 _, err = s.AddPath(apiutil.AddPathRequest{VRFID: "45", Paths: []*apiutil.Path{ap}})
3018 assert.Error(t, err)
3019}
3020
3021// TestListPathWithIdentifiers confirms whether ListPath properly returns the
3022// identifier information for paths for the Global RIB and for VRF RIBs.

Callers

nothing calls this directly

Calls 5

runNewServerFunction · 0.85
api2apiutilPathFunction · 0.85
ErrorMethod · 0.80
StopBgpMethod · 0.65
AddPathMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…