Skip to content

Commit

Permalink
Merge pull request #21 from wolsen/cleanup
Browse files Browse the repository at this point in the history
chore: cleanup of some files
  • Loading branch information
wolsen authored May 7, 2024
2 parents bd16543 + 726495e commit eea8613
Show file tree
Hide file tree
Showing 5 changed files with 132 additions and 66 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/cla.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Commits
on:
- pull_request

permissions:
contents: read

jobs:
cla-check:
permissions:
pull-requests: read
name: Canonical CLA signed
runs-on: ubuntu-latest
steps:
- name: Check if CLA signed
uses: canonical/has-signed-canonical-cla@v1

dco-check:
permissions:
pull-requests: read # for tim-actions/get-pr-commits to get list of commits from the PR
name: Signed-off-by (DCO)
runs-on: ubuntu-latest
steps:
- name: Get PR Commits
id: 'get-pr-commits'
uses: tim-actions/get-pr-commits@master
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Check that all commits are signed-off
uses: tim-actions/dco@master
with:
commits: ${{ steps.get-pr-commits.outputs.commits }}
75 changes: 54 additions & 21 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,67 @@
# lldpd
# Contributing to the lldpd charm

## Overview

This document explains the processes and practices recommended for contributing enhancements to
this charm.

- Generally, before developing enhancements to this charm you should consider [opening an issue](
https://github.com/canonical/charm-lldp/issues) explaining your bug or use case.
- Familiarising yourself with the [Charmed Operator Framework](https://juju.is/docs/sdk)
library will help you when working on new features or bug fixes.
- All enhancements and code changes require review before being merged. Code review typically
examines:
- code quality
- test coverage
- user experience for administrators deploying and operating this charm
- Please help us out by ensuring easy to review branches by rebasing your pull request branch
onto the `main` branch. This also avoids merge commits and creates a linear Git commit
history. Please do *not* merge the main branch into your PR.

## Developing

Create and activate a virtualenv with the development requirements:
Install `tox`, `charmcraft` and `juju`.

virtualenv -p python3 venv
source venv/bin/activate
pip install -r requirements-dev.txt
```bash
sudo apt-get install tox
sudo snap install charmcraft --classic
sudo snap install juju
```

## Code overview
## Testing

TEMPLATE-TODO:
One of the most important things a consumer of your charm (or library)
needs to know is what set of functionality it provides. Which categories
does it fit into? Which events do you listen to? Which libraries do you
consume? Which ones do you export and how are they used?
To test the charm, there are several tox targets which can be used

## Intended use case
```commandline
tox run -e format # update your code according to linting rules
tox run -e lint # code style tests
tox run -e static-charm # runs static analysis on the charm
tox run -e unit # unit tests
tox # runs lint, static analysis and unit tests
```

TEMPLATE-TODO:
Why were these decisions made? What's the scope of your charm?
## Building

## Roadmap
Build the charm in the local repository using the `charmcraft` tool.

If this Charm doesn't fulfill all of the initial functionality you were
hoping for or planning on, please add a Roadmap or TODO here
```commandline
charmcraft pack
```

## Testing
## Deploy

```commandline
# Create a model
juju add-model test
# Enable debug logging (optional)
juju model-config logging-config="<root>=INFO;unit=DEBUG"
The Python operator framework includes a very nice harness for testing
operator behaviour without full deployment. Just `run_tests`:
# Deploy the charm
juju deploy --base [email protected] ./lldpd_ubuntu-22.04-amd64.charm
```

./run_tests
## Canonical Contributor Agreement
Canonical welcomes contributions to the lldpd charm. Please check out our [contributor
agreement](https://ubuntu.com/legal/contributors) if you are interested in contributing to this
code base.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,28 @@ switches and routers.

# Usage

Start by installing the lldpd charm and relating it to another application:
Start by installing the lldpd charm and relating it to another application, e.g.

juju deploy ubuntu
juju deploy lldpd

juju add-relation lldpd application-on-physical-machine
juju integrate lldpd ubuntu

Being a subordinate charm it needs to be related to an application running
on physical machine. It doesn't make much sense to install LLDP on a VM
or LXD container, because Linux bridge will terminate LLDP traffic.
on physical machine, in the above case the Ubuntu charm.

## Scale out Usage

By scaling your application, subordinate charm will get installed automatically.

## Known Limitations and Issues

LLDP is not very useful on containers and virtual machines and therefore it's
use on those is not recommended.
Deploying LLDP to an LXD container or virtual machine may not work as expected
due to network bridges for virtual infrastructure not passing through LLDP frames.

# Configuration

By default LLDPd will listen on all interfaces and pick, more or less, a random
By default, LLDPd will listen on all interfaces and pick, more or less, a random
systemid. Two given configuration options allow user to specify which interfaces
will be used to broadcast LLDP data and which will be used for systemid.

Expand Down
73 changes: 38 additions & 35 deletions config.yaml
Original file line number Diff line number Diff line change
@@ -1,42 +1,45 @@
"options":
"i40e-lldp-stop":
"type": "boolean"
"default": !!bool "True"
"description": |
"This allows control over Intel's i40e NIC driver. By default
i40e blocks userspace LLDP and does it on its own. Setting this
option to 'True' means charm will disable this functionality in
the NIC and do it within userspace."
"interfaces-regex":
"type": "string"
"default": ""
"description": |
"Which interfaces should lldpd announce details. If you want lldpd
to listen on multiple interfaces, set it here. Examples:
options:
i40e-lldp-stop:
type: boolean
default: True
description: |
This allows control over Intel's i40e NIC driver. By default
i40e blocks userspace LLDP and does it on its own. Setting this
option to 'True' means charm will disable this functionality in
the NIC and do it within userspace.
interfaces-regex:
type: string
default: ""
description: |
Which interfaces should lldpd announce details. If you want lldpd
to listen on multiple interfaces, set it here. Examples:
seth*,meth*
seth*,meth*
You can also use exclamation mark to exclude an interface:
You can also use exclamation mark to exclude an interface:
eth*,!eth1
eth*,!eth1
This way lldpd will listen on all eth* interfaces with an
exception of eth1.
This way lldpd will listen on all eth* interfaces with an
exception of eth1.
By default this is set to None, which puts lldpd in listening
mode only."
"systemid-from-interface":
"type": "string"
"default": ""
"description": "Pull systemID from this interface"
"enable-snmp":
"type": "boolean"
"default": False
"description": "Enable the SNMP agent for LLDPD"
"short-name":
"type": "boolean"
"default": !!bool "False"
"description": "Set short name in SysName instead of FQDN"
By default this is set to None, which puts lldpd in listening
mode only.
systemid-from-interface:
type: string
default: ""
description: |
Pull systemID from this interface
enable-snmp:
type: boolean
default: False
description: |
Enable the SNMP agent for LLDPD
short-name:
type: boolean
default: False
description: |
Set short name in SysName instead of FQDN
nagios_context:
default: "juju"
type: string
Expand All @@ -50,4 +53,4 @@
default: "juju"
type: string
description: |
Comma separated list of nagios servicegroups for the check
Comma separated list of nagios service groups for the check
3 changes: 0 additions & 3 deletions requirements-dev.txt

This file was deleted.

0 comments on commit eea8613

Please sign in to comment.