Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 28 additions & 28 deletions proto/metalstack/admin/v2/switch.proto
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ service SwitchService {

// SwitchServiceGetRequest is the request payload for getting a switch.
message SwitchServiceGetRequest {
// Id of the switch to get
// Id of the switch to get.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

maybe better to have a dedicated punctuation fix pr.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, I pushed this by mistake.

string id = 1 [(buf.validate.field).string = {
hostname: true
[metalstack.api.v2.is_name]: true
Expand All @@ -62,81 +62,81 @@ message SwitchServiceGetRequest {

// SwitchServiceGetResponse is the response payload for getting a switch.
message SwitchServiceGetResponse {
// Switch contains the requested switch
// Switch contains the requested switch.
metalstack.api.v2.Switch switch = 1;
}

// SwitchServiceListRequest is the request payload for listing switches.
message SwitchServiceListRequest {
// Query to filter the results
// Query to filter the results.
metalstack.api.v2.SwitchQuery query = 1;
}

// SwitchServiceListResponse is the response payload for listing switches.
message SwitchServiceListResponse {
// Switches that match the request query
// Switches that match the request query.
repeated metalstack.api.v2.Switch switches = 1;
}

// SwitchServiceUpdateRequest is the request payload for updating a switch.
message SwitchServiceUpdateRequest {
// ID of the switch
// ID of the switch.
string id = 1 [(buf.validate.field).string = {
hostname: true
[metalstack.api.v2.is_name]: true
}];
// UpdateMeta contains the timestamp and strategy to be used in this update request
// UpdateMeta contains the timestamp and strategy to be used in this update request.
metalstack.api.v2.UpdateMeta update_meta = 2 [(buf.validate.field).required = true];
// UpdatedAt is the date when this entity was updated
// Must be part of the update request to ensure optimistic locking
// UpdatedAt is the date when this entity was updated.
// Must be part of the update request to ensure optimistic locking.
google.protobuf.Timestamp updated_at = 3;
// Description of the switch
// Description of the switch.
optional string description = 4 [(buf.validate.field).string.(metalstack.api.v2.is_description) = true];
// ReplaceMode is used to mark a switch ready for replacement
// ReplaceMode is used to mark a switch ready for replacement.
optional metalstack.api.v2.SwitchReplaceMode replace_mode = 5 [(buf.validate.field).enum.defined_only = true];
// ManagementIp is the switch's IP for management access
optional string management_ip = 6 [(buf.validate.field).string.ip = true];
// ManagementUser is the user name to use for management access
// ManagementUser is the user name to use for management access.
optional string management_user = 7 [(buf.validate.field).string.(metalstack.api.v2.is_name) = true];
// ConsoleCommand is the command for accessing the switch's console
// ConsoleCommand is the command for accessing the switch's console.
optional string console_command = 8 [(buf.validate.field).string.(metalstack.api.v2.is_description) = true];
// Nics are the front panel ports of the switch
// Nics are the front panel ports of the switch.
repeated metalstack.api.v2.SwitchNic nics = 9;
// SwitchOs is the OS running on the switch
// SwitchOs is the OS running on the switch.
optional metalstack.api.v2.SwitchOS os = 10;
}

// SwitchServiceUpdateResponse is the response payload for updating a switch.
message SwitchServiceUpdateResponse {
// Switch contains the updated switch
// Switch contains the updated switch.
metalstack.api.v2.Switch switch = 1;
}

// SwitchServiceDeleteRequest is the request payload for deleting a switch.
message SwitchServiceDeleteRequest {
// Id of the switch
// Id of the switch.
string id = 1 [(buf.validate.field).string = {
hostname: true
[metalstack.api.v2.is_name]: true
}];
// Force will allow switch deletion despite existing machine connections
// Force will allow switch deletion despite existing machine connections.
bool force = 2;
}

// SwitchServiceDeleteResponse is the response payload for deleting a switch.
message SwitchServiceDeleteResponse {
// Switch contains the deleted switch
// Switch contains the deleted switch.
metalstack.api.v2.Switch switch = 1;
}

// SwitchServiceMigrateRequest is the request payload for migrating a switch.
message SwitchServiceMigrateRequest {
// OldSwitch is the switch to migrate away from
// OldSwitch is the switch to migrate away from.
string old_switch = 1 [(buf.validate.field).string = {
hostname: true
[metalstack.api.v2.is_name]: true
}];
// NewSwitch is the switch to migrate to
// NewSwitch is the switch to migrate to.
string new_switch = 2 [(buf.validate.field).string = {
hostname: true
[metalstack.api.v2.is_name]: true
Expand All @@ -145,39 +145,39 @@ message SwitchServiceMigrateRequest {

// SwitchServiceMigrateResponse is the response payload for migrating a switch.
message SwitchServiceMigrateResponse {
// Switch contains the switch that was migrated to
// Switch contains the switch that was migrated to.
metalstack.api.v2.Switch switch = 1;
}

// SwitchServicePortRequest is the request payload for setting the port status of a switch port.
message SwitchServicePortRequest {
// Id of the switch
// Id of the switch.
string id = 1 [(buf.validate.field).string = {
hostname: true
[metalstack.api.v2.is_name]: true
}];
// NicName of the port whose status should be changed
// NicName of the port whose status should be changed.
string nic_name = 2 [(buf.validate.field).string.(metalstack.api.v2.is_name) = true];
// Status that the port should have
// Status that the port should have.
metalstack.api.v2.SwitchPortStatus status = 3 [(buf.validate.field).enum.defined_only = true];
}

// SwitchServicePortResponse is the response payload for setting the port status of a switch port.
message SwitchServicePortResponse {
// Switch after the port status toggle
// Switch after the port status toggle.
metalstack.api.v2.Switch switch = 1;
}

// SwitchServiceConnectedMachinesRequest is the request payload for listing switches with machine connections.
message SwitchServiceConnectedMachinesRequest {
// Query to filter the switch results
// Query to filter the switch results.
metalstack.api.v2.SwitchQuery query = 1;
// MachineQuery to filter the machine results
// MachineQuery to filter the machine results.
metalstack.api.v2.MachineQuery machine_query = 2;
}

// SwitchServiceConnectedMachinesResponse is the response payload for listing switches with machine connections.
message SwitchServiceConnectedMachinesResponse {
// SwitchesWithMachines contains all switches with their machine connections
// SwitchesWithMachines contains all switches with their machine connections.
repeated metalstack.api.v2.SwitchWithMachines switches_with_machines = 1;
}
77 changes: 77 additions & 0 deletions proto/metalstack/admin/v2/vrf.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
syntax = "proto3";

package metalstack.admin.v2;

import "buf/validate/validate.proto";
import "google/protobuf/timestamp.proto";
import "metalstack/api/v2/common.proto";
import "metalstack/api/v2/machine.proto";
import "metalstack/api/v2/predefined_rules.proto";
import "metalstack/api/v2/vrf.proto";

// VRFService provides endpoints for managing VRFs connecting to machines outside of metal-stack.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Guess this needs to be discussed, i thought a network must be created, which creates a vrf and then we can add a administrative endpoint to expose the vrf of this network on additional switchports which do not have a machine connected.

@iljarotar iljarotar Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This makes a lot more sense. What do you think the endpoint should look like?

service NetworkService {
  rpc AddSwitchPorts(NetworkServiceAddSwitchPortRequest) returns (NetworkServiceAddSwitchPortResponse) {
    option (metalstack.api.v2.admin_roles) = ADMIN_ROLE_EDITOR;
    option (metalstack.api.v2.auditing) = AUDITING_INCLUDED;
  }
}

message NetworkServiceAddSwitchPortRequest {
  // VrfPorts maps switch IDs to the respective switch's ports that should be bound by this VRF.
  map<string, VRFPorts> vrf_ports = 1;
}

message VRFPorts {
  repeated metalstack.api.v2.SwitchNic nics = 1;
}

Something like this?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yes, but the request must contain the network for which these ports should be bound

service VRFService {
// Creates a new VRF.
rpc Create(VRFServiceCreateRequest) returns (VRFServiceCreateResponse) {
option (metalstack.api.v2.admin_roles) = ADMIN_ROLE_EDITOR;
option (metalstack.api.v2.auditing) = AUDITING_INCLUDED;
}
// Returns the VRF by ID.
rpc Get(VRFServiceGetRequest) returns (VRFServiceGetResponse) {
option (metalstack.api.v2.admin_roles) = ADMIN_ROLE_EDITOR;
option (metalstack.api.v2.admin_roles) = ADMIN_ROLE_VIEWER;
option (metalstack.api.v2.auditing) = AUDITING_EXCLUDED;
}
// Returns all queried VRFs.
rpc List(VRFServiceListRequest) returns (VRFServiceListResponse) {
option (metalstack.api.v2.admin_roles) = ADMIN_ROLE_EDITOR;
option (metalstack.api.v2.admin_roles) = ADMIN_ROLE_VIEWER;
option (metalstack.api.v2.auditing) = AUDITING_EXCLUDED;
}
// Updates a VRF.
rpc Update(VRFServiceUpdateRequest) returns (VRFServiceUpdateResponse) {
option (metalstack.api.v2.admin_roles) = ADMIN_ROLE_EDITOR;
option (metalstack.api.v2.auditing) = AUDITING_INCLUDED;
}
// Deletes a VRF.
rpc Delete(VRFServiceDeleteRequest) returns (VRFServiceDeleteResponse) {
option (metalstack.api.v2.admin_roles) = ADMIN_ROLE_EDITOR;
option (metalstack.api.v2.auditing) = AUDITING_INCLUDED;
}
}

// VRFServiceCreateRequest
message VRFServiceCreateRequest {}

// VRFServiceCreateResponse
message VRFServiceCreateResponse {}

// VRFServiceGetRequest
message VRFServiceGetRequest {
// Name of the VRF.
string name = 1 [(buf.validate.field).string.(metalstack.api.v2.is_name) = true];
}

// VRFServiceGetResponse
message VRFServiceGetResponse {
// Vrf is the requested VRF.
metalstack.api.v2.VRF vrf = 1;
}

// VRFServiceListRequest
message VRFServiceListRequest {}

// VRFServiceListResponse
message VRFServiceListResponse {}

// VRFServiceUpdateRequest
message VRFServiceUpdateRequest {}

// VRFServiceUpdateResponse
message VRFServiceUpdateResponse {}

// VRFServiceDeleteRequest
message VRFServiceDeleteRequest {}

// VRFServiceDeleteResponse
message VRFServiceDeleteResponse {}
28 changes: 28 additions & 0 deletions proto/metalstack/api/v2/vrf.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
syntax = "proto3";

package metalstack.api.v2;

import "buf/validate/validate.proto";
import "metalstack/api/v2/predefined_rules.proto";
import "metalstack/api/v2/switch.proto";

// VRF represents a VRF that is connected to machines which are not managed by metal-stack.
message VRF {
// Name of the VRF.
string name = 1 [(buf.validate.field).string.(metalstack.api.v2.is_name) = true];
// Vni of the VRF.
uint32 vni = 2 [(buf.validate.field).uint32 = {
gt: 0
lte: 16777216
}];
// VrfPorts maps switch IDs to the respective switch's ports that are bound to this VRF.
map<string, VRFPorts> vrf_ports = 3;
// Cidrs that are permitted in this VRF.
repeated string cidrs = 4 [(buf.validate.field).repeated.(metalstack.api.v2.prefixes) = true];
}

// VRFPorts is a collection of ports bound to a VRF.
message VRFPorts {
// Nics in the VRF.
repeated metalstack.api.v2.SwitchNic nics = 1;
}
24 changes: 12 additions & 12 deletions proto/metalstack/infra/v2/switch.proto
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ service SwitchService {

// SwitchServiceGetRequest is the request payload for getting a switch.
message SwitchServiceGetRequest {
// Id of the switch
// Id of the switch.
string id = 1 [(buf.validate.field).string = {
hostname: true
[metalstack.api.v2.is_name]: true
Expand All @@ -39,45 +39,45 @@ message SwitchServiceGetRequest {

// SwitchServiceGetResponse is the response payload for getting a switch.
message SwitchServiceGetResponse {
// Switch contains the requested switch
// Switch contains the requested switch.
metalstack.api.v2.Switch switch = 1;
}

// SwitchServiceRegisterRequest is the request payload for registering a switch.
message SwitchServiceRegisterRequest {
// Switch to register
// Switch to register.
metalstack.api.v2.Switch switch = 1;
}

// SwitchServiceRegisterResponse is the response payload for registering a switch.
message SwitchServiceRegisterResponse {
// Switch contains the registered switch
// Switch contains the registered switch.
metalstack.api.v2.Switch switch = 1;
}

// SwitchServiceHeartbeatRequest is the request payload for sending a switch heartbeat.
message SwitchServiceHeartbeatRequest {
// Id of the switch
// Id of the switch.
string id = 1 [(buf.validate.field).string = {
hostname: true
[metalstack.api.v2.is_name]: true
}];
// Duration of the sync
// Duration of the sync.
google.protobuf.Duration duration = 2;
// Error if any occurred during the sync
// Error if any occurred during the sync.
optional string error = 3;
// PortStates maps port identifiers to the respective port's operational state
// PortStates maps port identifiers to the respective port's operational state.
map<string, metalstack.api.v2.SwitchPortStatus> port_states = 4;
// BgpPortStates maps port identifiers to the respective port's BGP state
// BgpPortStates maps port identifiers to the respective port's BGP state.
map<string, metalstack.api.v2.SwitchBGPPortState> bgp_port_states = 5;
}

// SwitchServiceHeartbeatResponse is the response payload for sending a switch heartbeat.
message SwitchServiceHeartbeatResponse {
// Id of the switch
// Id of the switch.
string id = 1;
// LastSync holds information about the last sync
// LastSync holds information about the last sync.
metalstack.api.v2.SwitchSync last_sync = 2;
// LastSyncError holds information about the last erroneous sync
// LastSyncError holds information about the last erroneous sync.
metalstack.api.v2.SwitchSync last_sync_error = 3;
}
Loading