# Path: netdevice/models.py
# class router(models.Model):
#     """
#     Router - A network device that moves packets around.
#     routing_id:         An IP address the router will use as identification and routing decisions.    [203.0.113.1]
#     hostname:           The (DNS) hostname of the router, domain included.                            [Router1.isp]
#     ibgp:               Boolean value to build an iBGP mesh with every router in the database.        [True]
#     network_os:         The network operating system and subsequent template this router is tied too.
#     service_ssh:        Boolean value to enable SSHv2 on the router.                                  [True]
#     service_netconf:    Boolean value to enable NETCONF on the router.                                [True]
#     local_aut_num:      Local autonomous system number for the router.
#     Example string: Router1
#     """
# 
#     routing_id         = models.GenericIPAddressField(unpack_ipv4=True)
#     hostname           = models.CharField(max_length=255)
#     ibgp               = models.BooleanField()
#     network_os         = models.ForeignKey('network_os', on_delete=models.CASCADE)
#     service_ssh        = models.BooleanField(default=True)
#     service_netconf    = models.BooleanField(default=True)
#     local_aut_num      = models.ForeignKey('bgp.aut_num', on_delete=models.CASCADE)
# 
#     def ldp_exists(self):
#         return self.interface_set.filter(logical_interface__ldp=True).exists()
# 
#     def __str__(self):
#         return self.hostname


from django.shortcuts import get_object_or_404, render
from netdevice.models import router
# file: config_gen/views.py



def index(request):
    context     = {}
    return render(request, 'config_gen/index.html', context)

def router_config(request, router_id):
    router_obj  = get_object_or_404(router, pk=router_id)

# Path: netdevice/models.py
# class router(models.Model):
#     """
#     Router - A network device that moves packets around.
#     routing_id:         An IP address the router will use as identification and routing decisions.    [203.0.113.1]
#     hostname:           The (DNS) hostname of the router, domain included.                            [Router1.isp]
#     ibgp:               Boolean value to build an iBGP mesh with every router in the database.        [True]
#     network_os:         The network operating system and subsequent template this router is tied too.
#     service_ssh:        Boolean value to enable SSHv2 on the router.                                  [True]
#     service_netconf:    Boolean value to enable NETCONF on the router.                                [True]
#     local_aut_num:      Local autonomous system number for the router.
#     Example string: Router1
#     """
# 
#     routing_id         = models.GenericIPAddressField(unpack_ipv4=True)
#     hostname           = models.CharField(max_length=255)
#     ibgp               = models.BooleanField()
#     network_os         = models.ForeignKey('network_os', on_delete=models.CASCADE)
#     service_ssh        = models.BooleanField(default=True)
#     service_netconf    = models.BooleanField(default=True)
#     local_aut_num      = models.ForeignKey('bgp.aut_num', on_delete=models.CASCADE)
# 
#     def ldp_exists(self):
#         return self.interface_set.filter(logical_interface__ldp=True).exists()
# 
#     def __str__(self):
#         return self.hostname


# Path: config_gen/views.py
from django.shortcuts import get_object_or_404, render
from netdevice.models import router

# file: config_gen/views.py



def index(request):
    context     = {}
    return render(request, 'config_gen/index.html', context)

def router_config(request, router_id):
    router_obj  = get_object_or_404(router, pk=router_id)

    router_list = router.objects.exclude(id=router_id)