# Path: netdevice/tests.py
# def create_router(network_os_name):
#     nos               = network_os.objects.get(name=network_os_name)
#     local_aut_num     = aut_num.objects.create(asn=65000, name='Test ASN')
#     test_router       = router.objects.create(routing_id='1.1.1.1',
#                                               hostname='test-router',
#                                               ibgp=True,
#                                               network_os=nos,
#                                               local_aut_num=local_aut_num,
#                                              )
# 
#     return test_router
# 
# def create_interface(test_router):
#     test_interface          = interface.objects.create(router=test_router,
#                                                        name='ge-0/0/0',
#                                                        description="A test description.",
#                                                        mtu=9000,
#                                                        dot1q=True,
#                                                       )
# 
#     test_logical_interface  = logical_interface.objects.create(interface=test_interface,
#                                                                name='10',
#                                                                description="A logical test description.",
#                                                                mtu=4170,
#                                                                vlan=10,
#                                                                physical_interface=False,
#                                                                ldp=True,
#                                                                inet_dhcp_client=False,
#                                                                inet6_dhcp_client=False,
#                                                               )
# 
#     return test_logical_interface
# 
# Path: bgp/models.py
# class aut_num(models.Model):
#     """
#     Autonomous System Number - Used in BGPv4 to represent an
#                                administrative domain where internet prefixes
#                                are exchanged.
# 
#     asn:        The actual autonomous system number of someone we neighbor.
#                 [65000]
#     name:       A specific company or personal name for the peer.
#                 [123 ISP Inc.]
#     contact:    An email address to go along with the name.
#                 [john.smith@example.com]
# 
#     Example string: 65000: 123 ISP Inc. (john.smith@example.com)
#     """
# 
#     asn        = models.BigIntegerField(unique=False)
#     name       = models.CharField(max_length=255)
#     contact    = models.EmailField(blank=True)
#     vrf        = models.ForeignKey(
#                                    'netdevice.vrf',
#                                    on_delete=models.CASCADE,
#                                    null=True,
#                                    blank=True
#                                   )
#     class Meta:
#         unique_together = ("asn", "vrf")
# 
#     def __str__(self):
#         return str(self.asn) + ": " + self.name + " (" + self.contact + ")"
# 
# class neighbor(models.Model):
#     """
#     BGP Neighbor - Peering sesssions with our neighbors over BGP.
# 
#     router:          Router that the peer session is tied to.
#     aut_num:         ASN that the peer session is tied to.
#     peer_ip:         IP Address of BGP neighbor.
#                      [203.0.113.1]
#     soft_inbound:    Boolean value for if soft-reconfiguration inbound is
#                      enabled on the peer session.
#                      [True]
# 
#     Example string: PeeringBuddy - Router1 203.0.113.1
#     """
# 
#     router        = models.ForeignKey(
#                                       'netdevice.router',
#                                       on_delete=models.CASCADE
#                                      )
#     vrf           = models.ForeignKey(
#                                       'netdevice.vrf',
#                                       on_delete=models.CASCADE,
#                                       null=True,
#                                       blank=True
#                                      )
#     aut_num       = models.ForeignKey('aut_num', on_delete=models.CASCADE)
#     peer_ip       = models.GenericIPAddressField(unpack_ipv4=True)
#     soft_inbound  = models.BooleanField(default=True)
# 
#     def __str__(self):
#         asn_router = self.aut_num.name + " - " + self.router.hostname + " "
#         return asn_router + self.peer_ip


from django.test import TestCase
from django.urls import reverse
from django.contrib.auth.models import User
from netdevice.tests import create_router, create_interface
from bgp.models import aut_num, neighbor
# file: bgp/tests.py



def create_aut_num(asn):
    test_asn      = aut_num.objects.create(asn=asn,
                                           name='Test ASN',
                                           contact='test@test.com',
                                          )

    return test_asn

def create_neighbor(test_router, aut_num, peer_ip):
    test_neighbor = neighbor.objects.create(router=test_router,

# Path: netdevice/tests.py
# def create_router(network_os_name):
#     nos               = network_os.objects.get(name=network_os_name)
#     local_aut_num     = aut_num.objects.create(asn=65000, name='Test ASN')
#     test_router       = router.objects.create(routing_id='1.1.1.1',
#                                               hostname='test-router',
#                                               ibgp=True,
#                                               network_os=nos,
#                                               local_aut_num=local_aut_num,
#                                              )
# 
#     return test_router
# 
# def create_interface(test_router):
#     test_interface          = interface.objects.create(router=test_router,
#                                                        name='ge-0/0/0',
#                                                        description="A test description.",
#                                                        mtu=9000,
#                                                        dot1q=True,
#                                                       )
# 
#     test_logical_interface  = logical_interface.objects.create(interface=test_interface,
#                                                                name='10',
#                                                                description="A logical test description.",
#                                                                mtu=4170,
#                                                                vlan=10,
#                                                                physical_interface=False,
#                                                                ldp=True,
#                                                                inet_dhcp_client=False,
#                                                                inet6_dhcp_client=False,
#                                                               )
# 
#     return test_logical_interface
# 
# Path: bgp/models.py
# class aut_num(models.Model):
#     """
#     Autonomous System Number - Used in BGPv4 to represent an
#                                administrative domain where internet prefixes
#                                are exchanged.
# 
#     asn:        The actual autonomous system number of someone we neighbor.
#                 [65000]
#     name:       A specific company or personal name for the peer.
#                 [123 ISP Inc.]
#     contact:    An email address to go along with the name.
#                 [john.smith@example.com]
# 
#     Example string: 65000: 123 ISP Inc. (john.smith@example.com)
#     """
# 
#     asn        = models.BigIntegerField(unique=False)
#     name       = models.CharField(max_length=255)
#     contact    = models.EmailField(blank=True)
#     vrf        = models.ForeignKey(
#                                    'netdevice.vrf',
#                                    on_delete=models.CASCADE,
#                                    null=True,
#                                    blank=True
#                                   )
#     class Meta:
#         unique_together = ("asn", "vrf")
# 
#     def __str__(self):
#         return str(self.asn) + ": " + self.name + " (" + self.contact + ")"
# 
# class neighbor(models.Model):
#     """
#     BGP Neighbor - Peering sesssions with our neighbors over BGP.
# 
#     router:          Router that the peer session is tied to.
#     aut_num:         ASN that the peer session is tied to.
#     peer_ip:         IP Address of BGP neighbor.
#                      [203.0.113.1]
#     soft_inbound:    Boolean value for if soft-reconfiguration inbound is
#                      enabled on the peer session.
#                      [True]
# 
#     Example string: PeeringBuddy - Router1 203.0.113.1
#     """
# 
#     router        = models.ForeignKey(
#                                       'netdevice.router',
#                                       on_delete=models.CASCADE
#                                      )
#     vrf           = models.ForeignKey(
#                                       'netdevice.vrf',
#                                       on_delete=models.CASCADE,
#                                       null=True,
#                                       blank=True
#                                      )
#     aut_num       = models.ForeignKey('aut_num', on_delete=models.CASCADE)
#     peer_ip       = models.GenericIPAddressField(unpack_ipv4=True)
#     soft_inbound  = models.BooleanField(default=True)
# 
#     def __str__(self):
#         asn_router = self.aut_num.name + " - " + self.router.hostname + " "
#         return asn_router + self.peer_ip


# Path: bgp/tests.py
from django.test import TestCase
from django.urls import reverse
from django.contrib.auth.models import User
from netdevice.tests import create_router, create_interface
from bgp.models import aut_num, neighbor

# file: bgp/tests.py



def create_aut_num(asn):
    test_asn      = aut_num.objects.create(asn=asn,
                                           name='Test ASN',
                                           contact='test@test.com',
                                          )

    return test_asn

def create_neighbor(test_router, aut_num, peer_ip):
    test_neighbor = neighbor.objects.create(router=test_router,

                                            aut_num=aut_num,