-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from DanSheps/develop
Add tests, upgrade to pyproject.toml
- Loading branch information
Showing
20 changed files
with
488 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
name: 🏡 Housekeeping | ||
description: A change pertaining to the codebase itself (developers only) | ||
labels: ["type: housekeeping"] | ||
body: | ||
- type: markdown | ||
attributes: | ||
value: > | ||
**NOTE:** This template is for use by maintainers only. Please do not submit | ||
an issue using this template unless you have been specifically asked to do so. | ||
- type: textarea | ||
attributes: | ||
label: Proposed Changes | ||
description: > | ||
Describe in detail the new feature or behavior you'd like to propose. | ||
Include any specific changes to work flows, data models, or the user interface. | ||
validations: | ||
required: true | ||
- type: textarea | ||
attributes: | ||
label: Justification | ||
description: Please provide justification for the proposed change(s). | ||
validations: | ||
required: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
} | ||
|
||
PLUGINS = [ | ||
'netbox_plugin_extensions', | ||
'netbox_routing', | ||
] | ||
|
||
REDIS = { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Build Test | ||
on: [push, pull_request] | ||
jobs: | ||
build: | ||
name: Build Distribution | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: build | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
- name: Set up Python 3.12 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.12 | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install --upgrade setuptools wheel | ||
python -m pip install build --user | ||
- name: Build a binary wheel and a source tarball | ||
run: python -m build | ||
- name: Store the distribution packages | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: CI | ||
on: [push, pull_request] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
env: | ||
NETBOX_CONFIGURATION: netbox.configuration_testing | ||
strategy: | ||
matrix: | ||
python-version: ['3.10', '3.11', '3.12'] | ||
services: | ||
redis: | ||
image: redis | ||
ports: | ||
- 6379:6379 | ||
postgres: | ||
image: postgres | ||
env: | ||
POSTGRES_USER: netbox | ||
POSTGRES_PASSWORD: netbox | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
ports: | ||
- 5432:5432 | ||
|
||
steps: | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Check out NetBox | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: netbox-community/netbox | ||
ref: master | ||
path: netbox | ||
|
||
- name: Check out repo | ||
uses: actions/checkout@v4 | ||
with: | ||
path: netbox-routing | ||
|
||
- name: Install dependencies & set up configuration | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r netbox/requirements.txt | ||
pip install pycodestyle coverage tblib | ||
pip install -e netbox-routing | ||
cp -f netbox-routing/.github/configuration.testing.py netbox/netbox/netbox/configuration_testing.py | ||
- name: Run tests | ||
run: coverage run --source="netbox-routing/netbox_routing" netbox/netbox/manage.py test netbox-routing/netbox_routing --parallel | ||
|
||
- name: Show coverage report | ||
run: coverage report --skip-covered --omit '*/migrations/*,*/tests/*' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from netaddr.ip import IPAddress | ||
|
||
|
||
class IPAddressFieldMixin: | ||
def model_to_dict(self, instance, fields, api=False): | ||
model_dict = super().model_to_dict(instance, fields, api) | ||
for key, value in list(model_dict.items()): | ||
if api: | ||
if type(value) is IPAddress: | ||
model_dict[key] = str(value) | ||
return model_dict |
Oops, something went wrong.