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

ofnet_test.go: write some loops as functions #86

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

unclejack
Copy link
Contributor

This PR rewrites some loops as functions. This makes it easier to update this code in the future.

This PR doesn't fix any bugs. It can be reviewed and merged when there's time.

Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
@rhim rhim requested review from abhi and dseevr September 12, 2017 17:39
@rhim
Copy link

rhim commented Sep 12, 2017

This increases the readability of the code, so I am fine with it. What do you guys say?

Copy link
Contributor

@dseevr dseevr left a comment

Choose a reason for hiding this comment

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

Changes look fine to me, just some minor pedantry

vxlanAgents[i] = agent
case "vrtr":
vrtrAgents[i] = agent
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd add a default case here which panics/logs a fatal error just to be pedantic

j := ovsDriversOffset + i
ovsDrivers[j] = ovsdbDriver.NewOvsDriver(brName)
err := ovsDrivers[j].AddController("127.0.0.1", ovsPort)
if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Error check can be inline

brName := fmt.Sprintf("%vBridge%v", brPrefix, i)
log.Infof("deleting OVS bridge: %s", brName)
err := ovsDrivers[ovsDriversOffset+i].DeleteBridge(brName)
if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Error check can be inline

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.

None yet

3 participants