# Path: sdn/models/base_model.py
# class BaseModel(models.Model):
#     class Meta:
#         # Makes django recognize model in split modules
#         app_label = 'sdn'
#         # Turns this into an abstract model (does not create table for it)
#         abstract = True
# 
#     # Default exception for models in manager
#     class ModelException(Exception):
#         # Get an instance of a logger
#         logger = logging.getLogger(__name__)
# 
#         def __init__(self, msg):
#             self.msg = msg
#             self.logger.warning(msg)
# 
#         def __str__(self):
#             return repr(self.msg)


from django.db import models
from sdn.models.base_model import BaseModel

CONTROLLER_CHOICE = (
    ('b', 'Beacon'),
    ('f', 'Floodlight'),
    ('j', 'Jaxon'),
    ('n', 'NOX'),
    ('p', 'POX')
)


# Create your models here.
class Controller(BaseModel):
    # Ip address
    ip_address = models.CharField(max_length=50)

    # Port
    listen_port = models.CharField(max_length=10)

    # Name
    name = models.CharField(max_length=50)

    # Description
    description = models.CharField(max_length=100)

    # Controller type
    controller_type = models.CharField(max_length=1, choices=CONTROLLER_CHOICE)

    def __unicode__(self):

# Path: sdn/models/base_model.py
# class BaseModel(models.Model):
#     class Meta:
#         # Makes django recognize model in split modules
#         app_label = 'sdn'
#         # Turns this into an abstract model (does not create table for it)
#         abstract = True
# 
#     # Default exception for models in manager
#     class ModelException(Exception):
#         # Get an instance of a logger
#         logger = logging.getLogger(__name__)
# 
#         def __init__(self, msg):
#             self.msg = msg
#             self.logger.warning(msg)
# 
#         def __str__(self):
#             return repr(self.msg)


# Path: sdn/models/controller.py
from django.db import models
from sdn.models.base_model import BaseModel


CONTROLLER_CHOICE = (
    ('b', 'Beacon'),
    ('f', 'Floodlight'),
    ('j', 'Jaxon'),
    ('n', 'NOX'),
    ('p', 'POX')
)


# Create your models here.
class Controller(BaseModel):
    # Ip address
    ip_address = models.CharField(max_length=50)

    # Port
    listen_port = models.CharField(max_length=10)

    # Name
    name = models.CharField(max_length=50)

    # Description
    description = models.CharField(max_length=100)

    # Controller type
    controller_type = models.CharField(max_length=1, choices=CONTROLLER_CHOICE)

    def __unicode__(self):

        return self.name + " - " + self.description