-
Notifications
You must be signed in to change notification settings - Fork 18
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
Update methods NewGroup, DeleteGroup and GetGroup of OFSwitch #46
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some errors happen with go-lint check, could you check?
3f1b729
to
b791ab7
Compare
Done |
Maybe you can split this one into 2 patches: one is for yout group operation changes, and the other is for golangci change; as I see other patches also have been impacted by it. |
Add #48 for this. |
b791ab7
to
88fd066
Compare
88fd066
to
2df2a11
Compare
ofctrl/fgraphSwitch.go
Outdated
if self.groupDb[groupId] != nil { | ||
return nil, errors.New("group already exists") | ||
// NewGroup creates a new group; when using cache, returns an error if the group ID already exists, otherwise returns the | ||
// group object; when not using cache, returns the new group object, and the caller should ensure the groupID is not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// group object; when not using cache, returns the new group object, and the caller should ensure the groupID is not | |
// group object; when useCache is false, a new group object is returned and the caller should ensure the groupID is not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
Not related to this PR: you could select multiple lines when reviewing code on time.
ofctrl/fgraphSwitch.go
Outdated
// duplicated. | ||
func (self *OFSwitch) NewGroup(groupID uint32, groupType GroupType, useCache bool) (*Group, error) { | ||
// Check if the group already exists. | ||
if useCache { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use this format?
if !useCache {
return newGroup(groupID, groupType, self), nil
}
if self.groupDb[groupID] != nil {
return nil, errors.New("group already exists")
}
return newGroup(groupID, groupType, self), nil
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
Signed-off-by: Hongliang Liu <[email protected]>
2df2a11
to
1be1913
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@hongliangl Could you resolve the conflicts on version changes? |
Add parameter
NewGroup
to decide whether to use cache in OFSwitch when create a group.Signed-off-by: Hongliang Liu [email protected]