Skip to content

Commit

Permalink
Lower the bar on building Bio-Routing (#459)
Browse files Browse the repository at this point in the history
* Add Makefile to build cmds and exmaples

  This Makefile provides some useful targets:
   * build (default)
   * clean
   * test
   * tets-coverage (test + write coverage)
   * all (clean build test)

Signed-off-by: Maximilian Wilhelm <[email protected]>

* Add cmd/ris-lg/ris-lg to .gitignore and remove bazel

Signed-off-by: Maximilian Wilhelm <[email protected]>

* Use make targets in GitHub workflow

  Remove build_examples.sh script replaced by Makefile

Signed-off-by: Maximilian Wilhelm <[email protected]>

* Update README

Signed-off-by: Maximilian Wilhelm <[email protected]>

* Remove -IS config from bio-rd example config

Signed-off-by: Maximilian Wilhelm <[email protected]>

---------

Signed-off-by: Maximilian Wilhelm <[email protected]>
  • Loading branch information
BarbarossaTM authored Jan 7, 2024
1 parent c567987 commit a330f47
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 33 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
run: .github/check-gofmt.sh

- name: Test
run: go test -v -cover -coverprofile=coverage.txt ./...
run: make test-coverage

# Upload Coverage Report
- name: Upload coverage to Codecov
Expand All @@ -31,5 +31,5 @@ jobs:
name: codecov-${{ matrix.platform }}-${{ matrix.go-version }}
fail_ci_if_error: true

- name: Build examples
run: scripts/build_examples.sh
- name: Build commands and examples
run: make build
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ coverage.txt
/cmd/bio-rdc/bio-rdc
/cmd/ris-mirror/ris-mirror
/cmd/ris/ris
/cmd/ris-lg/ris-lg
/cmd/riscli/riscli
/examples/bgp/bgp
/examples/bmp/bmp
/examples/kernel

# bazel directories
/bazel-*
34 changes: 34 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/make
#
# Bio-Routing Makefile
#
# Maximilian Wilhelm <[email protected]>
# -- Tue 02 Jan 2024 08:21:17 PM CET
#

expand_binary = $(dir)/$(notdir $(dir))

CMD_DIRS := $(wildcard cmd/*)
CMDS := $(foreach dir, $(CMD_DIRS), $(expand_binary))
EXAMPLE_DIRS = $(wildcard examples/*)
EXAMPLES := $(foreach dir, $(EXAMPLE_DIRS), $(expand_binary))

%:
cd $(dir $(@)) && go build


build: $(CMDS) $(EXAMPLES)

all: clean build test

clean:
rm -f -- $(CMDS) $(EXMAPLES)

test:
@echo "Running tests..."
go test ./...

test-coverage:
go test -v -cover -coverprofile=coverage.txt ./...

.PHONY: all build clean test test-coverage
49 changes: 40 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# bio-rd
# Bio-Routing

A re-implementation of BGP, IS-IS and OSPF in go. We value respect and robustness!

Expand All @@ -9,18 +9,28 @@ A re-implementation of BGP, IS-IS and OSPF in go. We value respect and robustnes

## Building

### Build the examples

#### BGP
To build Bio-Routing binares and/or examples you need Go installed and in your `$PATH`.
Currently the minimum supported Go version is v1.20.

To build all commands and examples, you can leverage the `Makefile`, if you have `make` installed, and run
```bash
cd examples/bgp/ && go build
make build
```

#### BMP
If you're only interested in one particular command/service or example, found in the `cmd/` or `examples/` sub-directories within this repository,
enter the respective directory on a shell and run `go build`.
You should get a binary named like the current directory, which you can run.

To build the BGP examples, this would look like
```bash
cd exmaples/bgp
go build
```

To build the `bio-rd` service binary, this would look like
```bash
cd examples/bmp/ && go build
cd cmd/bio-rd
go build
```

### Run Tests
Expand All @@ -29,10 +39,31 @@ cd examples/bmp/ && go build
go test -v -cover ./...
```

### Update modules
## Running bio-rd

`bio-rd` is the main binary which provides a configurable BGP speaker.
It supports the following command-line parameters:

Usage of ./bio-rd:
-bgp.listen-addr-ipv4 string
BGP listen address for IPv4 AFI (default "0.0.0.0:179")
-bgp.listen-addr-ipv6 string
BGP listen address for IPv6 AFI (default "[::]:179")
-config.file string
bio-rd config file (default "bio-rd.yml")
-grpc_keepalive_min_time uint
Minimum time (seconds) for a client to wait between GRPC keepalive pings (default 1)
-grpc_port uint
GRPC API server port (default 5566)
-metrics_port uint
Metrics HTTP server port (default 55667)

You can find an [example configuration file](cmd/bio-rd/bio-rd.yml) within in `cmd/bio-rd` directory.

As `bio-rd` needs to listen on the priviledged TCP port 179 for BGP connections, you either need to start the service as `root` or using `sudo`, e.g.

```bash
go mod tidy
$ sudo ./bio-rd -config.file bio-rd.yml
```

## Benchmarks
Expand Down
12 changes: 0 additions & 12 deletions cmd/bio-rd/bio-rd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,3 @@ protocols:
peer_as: 65300
import: ["PeerB-In"]
export: ["ACCEPT_ALL"]
isis:
NETs: ["49.0001.0100.0000.0002.00"]
level1:
disable: true
interfaces:
- name: "tap0"
level2:
metric: 10
- name: "lo"
passive: true
level2:
metric: 0
6 changes: 0 additions & 6 deletions scripts/build_examples.sh

This file was deleted.

0 comments on commit a330f47

Please sign in to comment.