-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* mtu, vlan id and prefixes * make prefix unique * prefix form cleanup * linting * expose prefix to service bridge * expose ix field * netbox sync * linting * docs * docs * fix tests * Update to federation * relock --------- Co-authored-by: Matt Griswold <grizz@20c.com>
- Loading branch information
Showing
25 changed files
with
841 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
3.2.0 | ||
3.3.0-federation.0 |
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,19 @@ | ||
## Usage | ||
|
||
Once the organization has set up service federation for their NetBox instance | ||
the following command can be used to run the netbox sync job. | ||
|
||
```python | ||
Ctl/dev/run.sh ixctl_netbox_sync $ORG_SLUG $IX_SLUG | ||
``` | ||
|
||
- `$ORG_SLUG` is the organization slug | ||
- `$IX_SLUG` is the IXP slug (optional, if not provided all IXPs will be synced) | ||
|
||
## Data pushed to NetBox | ||
|
||
IxCtl Source of Truth: | ||
|
||
- mac addresses | ||
- MTU | ||
- Prefixes (will also remove prefixes that are no longer in ixctl) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,29 @@ | ||
from fullctl.django.management.commands.base import CommandInterface | ||
from fullctl.django.models.concrete import Organization | ||
from fullctl.service_bridge.context import ServiceBridgeContext | ||
|
||
import django_ixctl.sync.netbox as netbox | ||
|
||
|
||
class Command(CommandInterface): | ||
help = "Pull netbox data for specified organization" | ||
|
||
def add_arguments(self, parser): | ||
super().add_arguments(parser) | ||
|
||
parser.add_argument("org_slug", nargs="?") | ||
# optional ix_slug argument | ||
parser.add_argument("ix_slug", nargs="?") | ||
|
||
def run(self, *args, **kwargs): | ||
org_slug = kwargs.get("org_slug") | ||
ix_slug = kwargs.get("ix_slug") | ||
org = Organization.objects.get(slug=org_slug) | ||
with ServiceBridgeContext(org): | ||
self.log_info(f"Pushing updates to netbox for {org_slug}") | ||
|
||
netbox.push(org, ix_slug=ix_slug) | ||
|
||
# self.log_info(f"Pulling netbox data for {org_slug}") | ||
# netbox.pull(org) | ||
# self.log_info(f"Pulled netbox data for {org_slug}") |
80 changes: 80 additions & 0 deletions
80
src/django_ixctl/migrations/0018_internetexchange_mtu_internetexchange_vlan_id_and_more.py
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,80 @@ | ||
# Generated by Django 4.2.9 on 2024-03-14 11:17 | ||
|
||
import django.db.models.deletion | ||
import django.db.models.manager | ||
import django_handleref.models | ||
import netfields.fields | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("django_ixctl", "0017_internetexchangemember_port"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="internetexchange", | ||
name="mtu", | ||
field=models.PositiveSmallIntegerField( | ||
blank=True, help_text="MTU for the exchange", null=True | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="internetexchange", | ||
name="vlan_id", | ||
field=models.PositiveIntegerField( | ||
blank=True, help_text="VLAN ID for the exchange", null=True | ||
), | ||
), | ||
migrations.CreateModel( | ||
name="InternetExchangePrefix", | ||
fields=[ | ||
("id", models.AutoField(primary_key=True, serialize=False)), | ||
( | ||
"created", | ||
django_handleref.models.CreatedDateTimeField( | ||
auto_now_add=True, verbose_name="Created" | ||
), | ||
), | ||
( | ||
"updated", | ||
django_handleref.models.UpdatedDateTimeField( | ||
auto_now=True, verbose_name="Updated" | ||
), | ||
), | ||
("version", models.IntegerField(default=0)), | ||
( | ||
"status", | ||
models.CharField( | ||
choices=[ | ||
("ok", "Ok"), | ||
("pending", "Pending"), | ||
("deactivated", "Deactivated"), | ||
("failed", "Failed"), | ||
("expired", "Expired"), | ||
], | ||
default="ok", | ||
max_length=12, | ||
), | ||
), | ||
("prefix", netfields.fields.CidrAddressField(max_length=43)), | ||
( | ||
"ix", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="prefixes", | ||
to="django_ixctl.internetexchange", | ||
), | ||
), | ||
], | ||
options={ | ||
"verbose_name": "Internet Exchange Prefix", | ||
"verbose_name_plural": "Internet Exchange Prefixes", | ||
"db_table": "ixctl_prefix", | ||
}, | ||
managers=[ | ||
("handleref", django.db.models.manager.Manager()), | ||
], | ||
), | ||
] |
16 changes: 16 additions & 0 deletions
16
src/django_ixctl/migrations/0019_alter_internetexchangeprefix_unique_together.py
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,16 @@ | ||
# Generated by Django 4.2.9 on 2024-03-14 12:46 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("django_ixctl", "0018_internetexchange_mtu_internetexchange_vlan_id_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterUniqueTogether( | ||
name="internetexchangeprefix", | ||
unique_together={("prefix", "ix")}, | ||
), | ||
] |
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
Oops, something went wrong.