Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

braccept: more br_parent tests #3285

Merged
merged 6 commits into from
Nov 27, 2019

Conversation

sgmonroy
Copy link
Contributor

@sgmonroy sgmonroy commented Oct 28, 2019

Add test for the following cases:

  • revoked parent interface
  • svc tests
  • revoked child (not owned) interface
  • one-hop-path parent interface tests

Also fix some braccept issues when cloning packets.


This change is Reviewable

@sgmonroy sgmonroy self-assigned this Oct 28, 2019
@sgmonroy sgmonroy force-pushed the braccept-multi-tests branch from ad48c92 to 1fc7089 Compare October 28, 2019 14:27
@sgmonroy sgmonroy force-pushed the braccept-multi-tests branch 2 times, most recently from 4b9e31d to b5ab62c Compare November 25, 2019 16:08
@lukedirtwalker lukedirtwalker self-requested a review November 26, 2019 14:35
Copy link
Collaborator

@lukedirtwalker lukedirtwalker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 16 of 16 files at r1.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @sgmonroy)


go/border/braccept/svc_tests.go, line 1 at r1 (raw file):

// Copyright 2018 ETH Zurich

2019?


go/border/braccept/svc_tests.go, line 17 at r1 (raw file):

package main

func svc_anycast_parent_to_internal_host() int {

In general it's not really go style to use underlines for names. But I guess all tests are already this way so we can also leave it.
svcAnycastParentToInternalHost would be the go way.


go/border/braccept/svc_tests.go, line 18 at r1 (raw file):

func svc_anycast_parent_to_internal_host() int {
	pkt0 := AllocatePacket()

General note. All tests do pktX := AllocatePacket(); pktX.ParsePacket why isn't there a single ParsePacket function that returns the parsed packet?


go/border/braccept/layers/scnpath.go, line 30 at r1 (raw file):

}

func (p *ScnPath) Clone() ScnPath {

this isn't used anywhere? why is it needed?
Also why doesn't it return a pointer object, since the receiver is pointer?


go/border/braccept/parser/scion.go, line 350 at r1 (raw file):

}

func newScionTags() scionTags {

I don't see why the slice is needed wouldn't a map[string]interface{} provide everything you need?

And at this point you could simply use type scionTags map[string]interface{}


go/border/braccept/parser/scion.go, line 354 at r1 (raw file):

	tags.fields = []interface{}{}
	tags.toIndex = make(map[string]int)
	return tags

could be simpler:

return scionTags{
    fields: []interface{}{},
    toIndex: make(map[string]int),
}

@sgmonroy sgmonroy force-pushed the braccept-multi-tests branch from b5ab62c to e1ee57e Compare November 27, 2019 13:54
Copy link
Contributor Author

@sgmonroy sgmonroy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @lukedirtwalker)


go/border/braccept/svc_tests.go, line 1 at r1 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

2019?

Done.


go/border/braccept/svc_tests.go, line 17 at r1 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

In general it's not really go style to use underlines for names. But I guess all tests are already this way so we can also leave it.
svcAnycastParentToInternalHost would be the go way.

yeah, it should be a different PR anyway.


go/border/braccept/svc_tests.go, line 18 at r1 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

General note. All tests do pktX := AllocatePacket(); pktX.ParsePacket why isn't there a single ParsePacket function that returns the parsed packet?

No special reason, it could be done, but it wasn't done.


go/border/braccept/layers/scnpath.go, line 30 at r1 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

this isn't used anywhere? why is it needed?
Also why doesn't it return a pointer object, since the receiver is pointer?

It is used in go/border/braccept/parser/scion.go .
done.


go/border/braccept/parser/scion.go, line 350 at r1 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

I don't see why the slice is needed wouldn't a map[string]interface{} provide everything you need?

And at this point you could simply use type scionTags map[string]interface{}

Reworked to something IMO more straight forward. Single map as you suggested but providing a reverse lookup to retrieve a tag from a pointer to an object.


go/border/braccept/parser/scion.go, line 354 at r1 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

could be simpler:

return scionTags{
    fields: []interface{}{},
    toIndex: make(map[string]int),
}

Done.

Copy link
Collaborator

@lukedirtwalker lukedirtwalker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 3 of 3 files at r2.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

Add test for the following cases:
- revoked parent interface
- svc tests
- revoked child (not owned) interface
- one-hop-path parent interface tests

Also fix some braccept issues when cloning packets.
@sgmonroy sgmonroy force-pushed the braccept-multi-tests branch from e1ee57e to 0795f16 Compare November 27, 2019 14:58
@sgmonroy sgmonroy merged commit c462656 into scionproto:master Nov 27, 2019
@sgmonroy sgmonroy deleted the braccept-multi-tests branch November 27, 2019 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants