Skip to content

Commit

Permalink
Add FORWARD node type and implementation (#552)
Browse files Browse the repository at this point in the history
* Add intf read/writer

* add fwd node type definition

* fix fwd proto

* add forward container

* add license

* fix test

* lint

* lint
  • Loading branch information
alexmasi authored Jul 26, 2024
1 parent d98b538 commit 9dcbf29
Show file tree
Hide file tree
Showing 24 changed files with 1,493 additions and 15 deletions.
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@ kne_cli/kne_cli
kne_cli/kne
controller/server/server
x/webhook/webhook
x/wire/client/client
x/wire/server/server
x/wire/file/client/client
x/wire/file/server/server
x/wire/intf/client/client
x/wire/intf/server/server
x/wire/forward/forward
109 changes: 109 additions & 0 deletions examples/forward/topology.textproto
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: "forward-basic"
nodes: {
name: "r1"
vendor: OPENCONFIG
model: "LEMMING"
}
nodes: {
name: "r2"
vendor: OPENCONFIG
model: "LEMMING"
}
nodes: {
name: "fwd1"
vendor: FORWARD
config: {
image: "forward:latest"
vendor_data {
[type.googleapis.com/forward.ForwardConfig] {
wires: {
a: {
interface: {
name: "eth1"
}
}
z: {
local_node: {
name: "fwd2"
interface: "eth1"
}
}
}
wires: {
a: {
local_node: {
name: "fw2"
interface: "eth2"
}
}
z: {
interface: {
name: "eth2"
}
}
}
}
}
}
}
nodes: {
name: "fwd2"
vendor: FORWARD
config: {
image: "forward:latest"
vendor_data {
[type.googleapis.com/forward.ForwardConfig] {
wires: {
a: {
interface: {
name: "eth2"
}
}
z: {
local_node: {
name: "fwd1"
interface: "eth2"
}
}
}
wires: {
a: {
local_node: {
name: "fw1"
interface: "eth1"
}
}
z: {
interface: {
name: "eth1"
}
}
}
}
}
}
}
links: {
a_node: "r1"
a_int: "eth1"
z_node: "fwd1"
z_int: "eth1"
}
links: {
a_node: "fwd2"
a_int: "eth1"
z_node: "r2"
z_int: "eth1"
}
links: {
a_node: "r2"
a_int: "eth2"
z_node: "fwd2"
z_int: "eth2"
}
links: {
a_node: "fwd1"
a_int: "eth2"
z_node: "r1"
z_int: "eth2"
}
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ require (
github.com/golang/glog v1.2.0
github.com/golang/mock v1.6.0
github.com/google/go-cmp v0.6.0
github.com/google/gopacket v1.1.19
github.com/kr/pretty v0.3.1
github.com/networkop/meshnet-cni v0.3.1-0.20230525201116-d7c306c635cf
github.com/open-traffic-generator/keng-operator v0.3.28
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1028,6 +1028,8 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/gopacket v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8=
github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
Expand Down
59 changes: 59 additions & 0 deletions proto/forward.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Copyright 2024 Google LLC
//
// 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 forward;

option go_package = "github.com/openconfig/kne/proto/forward";

// Forward specific config data for KNE
message ForwardConfig {
repeated Wire wires = 1;
}

// Wire is a connection between two endpoints intended to forward
// data bidirectionally between them. One of the endpoints must be
// of type Interface.
message Wire {
// The a endpoint serves as the client endpoint in the bidirectional stream.
Endpoint a = 1;
// The z endpoint serves as the server endpoint in the bidirectional stream.
Endpoint z = 2;
}

message Endpoint {
oneof endpoint {
// Interface is a local interface (ex. eth0) on the node.
Interface interface = 1;
// LocalNode is a node in the same cluster.
LocalNode local_node = 2;
// RemoteNode is a node in a different cluster.
RemoteNode remote_node = 3;
}
}

message Interface {
string name = 1;
// TODO: Add MTU and other configurable fields.
}

message LocalNode {
string name = 1;
string interface = 2;
}

message RemoteNode {
string addr = 1;
string interface = 2;
}
Loading

0 comments on commit 9dcbf29

Please sign in to comment.