Skip to content

Instantly share code, notes, and snippets.

@LionelJouin
Last active September 27, 2021 14:26
Show Gist options
  • Save LionelJouin/4e679467222d5e16c6d07c9fe8c8367f to your computer and use it in GitHub Desktop.
Save LionelJouin/4e679467222d5e16c6d07c9fe8c8367f to your computer and use it in GitHub Desktop.
New Meridio API
/*
Copyright (c) 2021 Nordix Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
syntax = "proto3";
package target;
option go_package = "github.com/nordix/meridio/api/target";
import "google/protobuf/empty.proto";
import "api/nsp/model.proto";
service Ambassador {
// Connect to a conduit, so a new interface will be created.
// The Ambassador will also connect to the trench the
// conduit belongs to. And, the VIPs will be added to
// the loopback interface.
rpc Connect(nsp.Conduit) returns (google.protobuf.Empty) {}
// Disconnect from a conduit, so the interface will be removed.
// The Ambassador will also close the streams which are opened
// in the conduit. It will disconnect the target from the trench.
// And, the VIPs will be removed from the loopback interface.
rpc Disconnect(nsp.Conduit) returns (google.protobuf.Empty) {}
// WatchConduit will return a list of conduits containing the same
// properties as the one in parameter (nil properties will be
// ignored). On any event (any conduit created/deleted/updated)
// the list will be sent again.
rpc WatchConduit(nsp.Conduit) returns (stream nsp.ConduitResponse) {}
// Open a stream, so the identifier will be registered
// in the NSP service, the LBs will start load-balancing the
// traffic to the target.
rpc Open(nsp.Stream) returns (google.protobuf.Empty) {}
// Close a stream, so the identifier will be unregistered
// in the NSP service, the LBs will stop load-balancing the
// traffic to the target.
rpc Close(nsp.Stream) returns (google.protobuf.Empty) {}
// WatchStream will return a list of streams containing the same
// properties as the one in parameter (nil properties will be
// ignored). On any event (any stream created/deleted/updated)
// the list will be sent again.
rpc WatchStream(nsp.Stream) returns (stream nsp.StreamResponse) {}
}
/*
Copyright (c) 1011 Nordix Foundation
Licensed under the Apache License, Version 1.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-1.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
syntax = "proto3";
package nsp;
option go_package = "github.com/nordix/meridio/api/nsp";
import "api/nsp/model.proto";
// ConfigurationManager provides multiple functions to
// watch the Meridio resources. Each function will return a
// list of resources containing the same properties as the
// one in parameter (nil properties will be ignored). On any
// event (any resource created/deleted/updated) the list will
// be sent again.
service ConfigurationManager {
rpc WatchTrench(Trench) returns (stream nsp.TrenchResponse) {}
rpc WatchConduit(Conduit) returns (stream nsp.ConduitResponse) {}
rpc WatchStream(Stream) returns (stream nsp.StreamResponse) {}
rpc WatchFlow(Flow) returns (stream nsp.FlowResponse) {}
rpc WatchVip(Vip) returns (stream nsp.VipResponse) {}
rpc WatchAttractor(Attractor) returns (stream nsp.AttractorResponse) {}
rpc WatchGateway(Gateway) returns (stream nsp.GatewayResponse) {}
}
/*
Copyright (c) 2021 Nordix Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
syntax = "proto3";
package nsp;
option go_package = "github.com/nordix/meridio/api/nsp";
message Trench {
// Name of the trench
string name = 1;
}
message Conduit {
// Name of the conduit
string name = 1;
// Trench the conduit belongs to
Trench trench = 2;
}
message Stream {
// Name of the stream
string name = 1;
// Conduit the stream belongs to
Conduit conduit = 2;
}
message Flow {
// Name of the flow
string name = 1;
// Source subnets allowed in the flow
// e.g.: ["124.0.0.0/24", "2001::/32"]
repeated string sourceSubnets = 2;
// Destination port ranges allowed in the flow
// e.g.: ["80", "90-95"]
repeated string destinationPortRanges = 3;
// Source port ranges allowed in the flow
// e.g.: ["35000-35500", "40000"]
repeated string sourcePortRanges = 4;
// Protocols allowed
// e.g.: ["tcp", "udp"]
repeated string protocols = 5;
// Stream the flow belongs to
Stream stream = 6;
repeated Vip vips = 7;
}
message Vip {
// Name of the vip
string name = 1;
// vip address
// e.g.: 124.0.0.0/24 or 2001::/32
string address = 2;
// Trench the vip belongs to
Trench trench = 3;
}
message Attractor {
// Name of the attractor
string name = 1;
// Trench the attractor belongs to
Trench trench = 3;
repeated Vip vips = 7;
}
message Gateway {
// Name of the vip
string name = 1;
// address of the gateway
// e.g.: 124.0.0.0/24 or 2001::/32
string address = 2;
uint32 remoteASN = 3;
uint32 localASN = 4;
uint32 remotePort = 5;
uint32 localPort = 6;
string ipFamily = 7;
bool bfd = 8;
string protocol = 9;
uint32 holdTime = 10;
// Attractor the gateway belongs to
Attractor attractor = 11;
}
message TrenchResponse {
repeated Trench trenches = 1;
}
message ConduitResponse {
repeated Conduit conduits = 1;
}
message StreamResponse {
repeated Stream streams = 1;
}
message FlowResponse {
repeated Flow flows = 1;
}
message VipResponse {
repeated Vip vips = 1;
}
message AttractorResponse {
repeated Attractor attractors = 1;
}
message GatewayResponse {
repeated Gateway gateways = 1;
}
/*
Copyright (c) 2021 Nordix Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
syntax = "proto3";
package nsp;
option go_package = "github.com/nordix/meridio/api/nsp";
import "google/protobuf/empty.proto";
import "api/nsp/model.proto";
service TargetRegistry {
rpc Register(Target) returns (google.protobuf.Empty) {}
rpc Unregister(Target) returns (google.protobuf.Empty) {}
rpc Update(Target) returns (google.protobuf.Empty) {}
rpc Watch(Target) returns (stream TargetResponse) {}
}
message TargetResponse {
repeated Target targets = 1;
}
message Target {
enum Status {
Enabled = 0;
Disabled = 1;
}
enum Type {
DEFAULT = 0;
FRONTEND = 1;
}
repeated string ips = 1;
map<string, string> context = 2;
Status status = 3;
Type type = 4;
Stream stream = 5;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment