Skip to content

Commit

Permalink
Add OUI model
Browse files Browse the repository at this point in the history
  • Loading branch information
stveit committed May 2, 2024
1 parent a2be786 commit c70b45f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
19 changes: 19 additions & 0 deletions python/nav/models/oui.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from django.db import models
from django.core.validators import MinLengthValidator

from nav.models.fields import VarcharField


class OUI(models.Model):
"""Defines an OUI and the name of the vendor the OUI belongs to"""

vendor = VarcharField()
oui = models.CharField(
max_length=6, unique=True, validators=[MinLengthValidator(6)]
)

def __str__(self):
return self.oui

class Meta(object):
db_table = 'oui'
5 changes: 5 additions & 0 deletions python/nav/models/sql/changes/sc.05.08.0001.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CREATE TABLE oui (
id SERIAL PRIMARY KEY,
vendor VARCHAR NOT NULL,
oui CHAR(6) NOT NULL UNIQUE
);

0 comments on commit c70b45f

Please sign in to comment.