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

allow the API to toggle switch ports #506

Merged
merged 26 commits into from
May 6, 2024
Merged

allow the API to toggle switch ports #506

merged 26 commits into from
May 6, 2024

Conversation

ulrichSchreiner
Copy link
Contributor

@ulrichSchreiner ulrichSchreiner commented Feb 26, 2024

This API enables the user to toggle a port of a switch. The endpoint is /switch/{id}/port and the post body contains

type SwitchPortToggleRequest struct {
	NicName string           `json:"nic" description:"the nic of the switch you want to change"`
	Status  SwitchPortStatus `json:"status" description:"sets the port status" enum:"UP|DOWN"`
}

When this endpoint is invoked, the system stores the status as the new desired state (if it differs from the current state). The switch uses metal-core to regularly fetch the switch state. If it finds a desired state which differs from the current state, it will change the switch configuration to reflect this state and send a notification to /switch/{id}/notify and report the new state. If the new state is equal to the desired state, metal-api will store this new state and remove the desired state from the persistence layer.

Dependencies:

@ulrichSchreiner ulrichSchreiner force-pushed the toggle-switch-port branch 4 times, most recently from f26a3d6 to 7c8d310 Compare February 26, 2024 14:24
@ulrichSchreiner ulrichSchreiner marked this pull request as ready for review April 4, 2024 09:04
@ulrichSchreiner ulrichSchreiner requested a review from a team as a code owner April 4, 2024 09:04
.golangci.yaml Show resolved Hide resolved
@majst01
Copy link
Contributor

majst01 commented Apr 8, 2024

We should run the small integration test suite with this deployed in test, then merge

@Gerrit91 Gerrit91 self-requested a review May 6, 2024 08:35
@Gerrit91 Gerrit91 merged commit d81ecca into master May 6, 2024
2 checks passed
@Gerrit91 Gerrit91 deleted the toggle-switch-port branch May 6, 2024 08:58
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.

3 participants