Skip to content

Commit

Permalink
Merge pull request #13 from hawkv6/poc
Browse files Browse the repository at this point in the history
WIP: Proof of concept
  • Loading branch information
severindellsperger committed Aug 22, 2024
2 parents 5dd15e7 + 68a64b6 commit 60c42b4
Show file tree
Hide file tree
Showing 288 changed files with 30,499 additions and 6 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/golangci-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Go Checks

on:
pull_request: {}
push:
branches:
- main

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.21'
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.54
44 changes: 44 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Release hawkeye

on:
push:
tags:
- v[0-9]+.*

permissions:
contents: write
packages: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true

- name: Load Go Modules
run: go mod tidy

- name: Log into Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

# Test binary, built with `go test -c`
*.test
!uml/test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out
Expand All @@ -26,13 +27,12 @@ bin/
# png folder
png/

#
test/uml
# no UML files
*.uml


## VS Code
.vscode/


## Debug
__debug*
__debug*
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "proto"]
path = proto
url = https://github.com/hawkv6/proto
32 changes: 32 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
project_name: hawkeye

before:
hooks:
- go mod tidy

builds:
- main: ./hawkeye/
binary: hawkeye
ldflags:
- -s -w -X main.build={{.Version}}
goos:
- linux
goarch:
- amd64
env:
- CGO_ENABLED=0

dockers:
- use: buildx
dockerfile: ./build/package/Dockerfile
image_templates:
- "ghcr.io/hawkv6/hawkeye:latest"
- "ghcr.io/hawkv6/hawkeye:{{ .Tag }}"

nfpms:
- maintainer: Severin Dellsperger <severin.dellsperger@ost.ch>
description: Controller for Enabling Intent-Based Networking in SRv6
homepage: https://github.com/hawkv6/hawkeye
license: Apache 2.0
formats:
- deb
128 changes: 128 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
severin.dellsperger@ost.ch.
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series
of actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
the community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.

Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
31 changes: 31 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
.PHONY: proto

GREEN := $(shell tput -Txterm setaf 2)
YELLOW := $(shell tput -Txterm setaf 3)
WHITE := $(shell tput -Txterm setaf 7)
CYAN := $(shell tput -Txterm setaf 6)
RESET := $(shell tput -Txterm sgr0)

help:
@echo ''
@echo 'Usage:'
@echo ' ${YELLOW}make${RESET} ${GREEN}<target>${RESET}'
@echo ''
@echo 'Targets:'
@awk 'BEGIN {FS = ":.*?## "} { \
if (/^[a-zA-Z_0-9-]+:.*?##.*$$/) {printf " ${YELLOW}%-20s${GREEN}%s${RESET}\n", $$1, $$2} \
else if (/^## .*$$/) {printf " ${CYAN}%s${RESET}\n", substr($$1,4)} \
}' $(MAKEFILE_LIST)

update-submodules: ## Update submodules (sync proto)
git submodule update --remote --merge

binary: ## Build binary bin/hawkeye
mkdir -p bin
go build -o bin/hawkeye hawkeye/main.go

clean: ## Clean bin directory
rm -rf bin

proto: ## Generate Go code from proto files
protoc --go_out=. --go_opt=Mproto/intent.proto=pkg/api --go-grpc_out=. --go-grpc_opt=Mproto/intent.proto=pkg/api proto/*.proto --experimental_allow_proto3_optional
98 changes: 96 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,96 @@
# hawkeye
Controller for Enabling Intent-Driven End-to-End SRv6 Networking
<h1 align="center">HawkEye</h1>
<p align="center">
<br>
<img alt="GitHub Release" src="https://img.shields.io/github/v/release/hawkv6/hawkeye?display_name=release&style=flat-square">
<img src="https://img.shields.io/badge/go%20report-A+-brightgreen.svg?style=flat-square">
<img src="https://img.shields.io/github/actions/workflow/status/hawkv6/hawkeye/testing.yaml?style=flat-square&label=tests">
<img src="https://img.shields.io/codecov/c/github/hawkv6/hawkeye?style=flat-square">
<img src="https://img.shields.io/github/actions/workflow/status/hawkv6/hawkeye/golangci-lint.yaml?style=flat-square&label=checks">
</p>

<p align="center">
</p>


## Overview
HawkEye is an advanced controller designed to facilitate Intent-Based Networking (IBN) and Segment Routing over IPv6 (SRv6). It integrates with open-source projects like [Jalapeno](https://github.com/cisco-open/jalapeno) and the [Jalapeno API Gateway](https://github.com/jalapeno-api-gateway), and utilizes standardized protocols such as [BMP](https://datatracker.ietf.org/doc/rfc7854/) and [YANG-Push](https://datatracker.ietf.org/doc/rfc8641/). Additionally, HawkEye leverages [Consul](https://www.consul.io/) as a service registry to gather critical information about network services and perform health checks.

When receiving path requests from clients via gRPC, HawkEye calculates optimal paths based on the specified intents and maps these paths to segment lists, which are then returned to the clients for packet encapsulation. The application continuously monitors the network, adjusting paths as network conditions evolve. If a change is necessary to maintain the intent, an updated segment list is automatically provided to the client, ensuring that the network meets the desired requirements.

![HawkEye Architecture](docs/images/Hawkv6-High-Level-Architecture.drawio.svg)

## Key Features

- **Intent Fulfillment**: HawkEye processes user-defined intents, such as ensuring low latency, high bandwidth, or specific service function chaining, and calculates optimal paths in the SRv6 network to meet these requirements. It returns the segment list that must be applied to the packet to achieve the desired behavior.

- **Real-Time Network Monitoring**: HawkEye continuously monitors network performance metrics, including latency, jitter, and packet loss. It responds to network changes such as link removals or performance metric variations, ensuring that the network adheres to the specified intents. This task leverages components like [Jalapeno](https://github.com/cisco-open/jalapeno), [JAGW](https://github.com/jalapeno-api-gateway), [Consul](https://www.consul.io/), the [generic-processor](https://github.com/hawkv6/generic-processor), and the [clab-telemetry-linker](https://github.com/hawkv6/clab-telemetry-linker).

- **Event-Driven Architecture**: HawkEye operates in an event-driven manner, automatically recalculating paths and updating segment lists when network conditions change or when service health checks indicate issues. Operators can define thresholds that determine when a path should be switched, preventing unnecessary path flapping. This feature ensures that the network remains responsive and reliable.

- **Service Registry Integration**: HawkEye integrates with [Consul](https://www.consul.io/) to monitor service availability and health. This integration ensures that service function chaining remains intact and that paths are adjusted if a service instance becomes unavailable.

- **Session Management**: HawkEye tracks ongoing sessions for each client, maintaining a record of path requests and updates. This session management capability allows for seamless adjustments to paths as network conditions change, ensuring continuous intent compliance.

- **Interoperability**: HawkEye leverages standardized technologies like YANG-Push for telemetry and BMP for performance measurement, ensuring compatibility with existing network hardware and software.

## Design Considerations

The design principles and detailed information about the HawkEye implementation are available in the [design documentation](docs/design.md).


## Intent Overview
An overview about the intents and examples can be found in the [intent documentation](docs/intents/overview.md).


## Usage
```
hawkeye [command]
```
### Commands
- Start the controller: [`start`](docs/commands/start.md)
- Check Version: `version`

## Installation

### Using Package Manager
For Debian-based systems, install the package using apt:
```
sudo apt install ./hawkeye_{version}_amd64.deb
```

### Using Docker
```
docker run --rm -e HAWKEYE_JAGW_SERVICE_ADDRESS=10.8.39.69 -e HAWKEYE_JAGW_REQUEST_PORT=9903 -e HAWKEYE_JAGW_SUBSCRIPTION_PORT=9902 -e HAWKEYE_GRPC_PORT=10000 -e HAWKEYE_CONSUL_SERVER_ADDRESS=consul-hawkv6.stud.network.garden -e HAWKEYE_SKIP_TLS_VERIFICATION=TRUE ghcr.io/hawkv6/hawkeye:latest start
```

### Using Binary
```
git clone https://github.com/hawkv6/hawkeye
cd hawkeye && make binary
sudo ./bin/hawkeye
```

## Getting Started

1. Deploy all necessary Kubernetes resources.
- For more details, refer to the [hawkv6 deployment documentation](https://github.com/hawkv6/deployment).

2. Ensure the network is properly configured and operational.
- Additional information can be found in the [hawkv6 testnetwork documentation](https://github.com/hawkv6/network).

3. Confirm that `clab-telemetry-linker` is active and running.
- Detailed instructions are available in the [clab-telemetry-linker documentation](https://github.com/hawkv6/clab-telemetry-linker).

4. Confirm that the `generic-processor` is active and running.
- Detailed instructions are available in the [generic processor documentation](https://github.com/hawkv6/generic-processor).

5. Install the HawkEye controller using one of the methods described above.

5. Start the HawkEye controller.
- For more information, refer to the [start command documentation](docs/commands/start.md).

## Additional Information
- Environment variables are documented in the [env documentation](docs/env.md).
- The proto/API definiton is included via submodule and can be found [here](https://github.com/hawkv6/proto/blob/main/intent.proto).
- Limitations are documented in the [limitations documentation](docs/limitations.md).
- Unit tests are documented in the [unit tests documentation](docs/unit-tests.md).
Loading

0 comments on commit 60c42b4

Please sign in to comment.