예제 #1
0
 def setUpTestData(cls):
     cls.local_as = AutonomousSystem.objects.create(
         asn=64501, name="Autonomous System 1", affiliated=True)
     cls.a_s = AutonomousSystem.objects.create(asn=64502,
                                               name="Autonomous System 2")
     cls.router = Router.objects.create(
         name="Router 1",
         hostname="router1.example.net",
         local_autonomous_system=cls.local_as,
     )
     DirectPeeringSession.objects.bulk_create([
         DirectPeeringSession(
             local_autonomous_system=cls.local_as,
             autonomous_system=cls.a_s,
             ip_address="192.0.2.1",
             relationship=BGPRelationship.TRANSIT_PROVIDER,
             router=cls.router,
         ),
         DirectPeeringSession(
             local_autonomous_system=cls.local_as,
             autonomous_system=cls.a_s,
             ip_address="192.0.2.2",
             relationship=BGPRelationship.PRIVATE_PEERING,
             multihop_ttl=2,
         ),
         DirectPeeringSession(
             local_autonomous_system=cls.local_as,
             autonomous_system=cls.a_s,
             ip_address="192.0.2.3",
             relationship=BGPRelationship.CUSTOMER,
             enabled=False,
         ),
     ])
예제 #2
0
    def setUpTestData(cls):
        local_as = AutonomousSystem.objects.create(asn=64501,
                                                   name="Autonomous System 1",
                                                   affiliated=True)
        a_s = AutonomousSystem.objects.create(asn=64502,
                                              name="Autonomous System 2")
        relationship_private_peering = Relationship.objects.create(
            name="Private Peering", slug="private-peering")
        DirectPeeringSession.objects.bulk_create([
            DirectPeeringSession(
                local_autonomous_system=local_as,
                autonomous_system=a_s,
                ip_address="192.0.2.1",
                relationship=relationship_private_peering,
            ),
            DirectPeeringSession(
                local_autonomous_system=local_as,
                autonomous_system=a_s,
                ip_address="192.0.2.2",
                relationship=relationship_private_peering,
            ),
            DirectPeeringSession(
                local_autonomous_system=local_as,
                autonomous_system=a_s,
                ip_address="192.0.2.3",
                relationship=relationship_private_peering,
            ),
        ])

        cls.form_data = {
            "local_autonomous_system": local_as.pk,
            "local_ip_address": None,
            "autonomous_system": a_s.pk,
            "ip_address": ipaddress.ip_interface("2001:db8::4/128"),
            "multihop_ttl": 1,
            "relationship": relationship_private_peering.pk,
            "password": None,
            "encrypted_password": None,
            "enabled": True,
            "bgp_group": None,
            "router": None,
            "export_routing_policies": [],
            "import_routing_policies": [],
            "bgp_state": None,
            "last_established_state": None,
            "advertised_prefix_count": 0,
            "received_prefix_count": 0,
            "comments": "",
            "tags": [],
        }
        cls.bulk_edit_data = {"enabled": False, "comments": "New comments"}
예제 #3
0
 def setUpTestData(cls):
     local_autonomous_system = AutonomousSystem.objects.create(
         asn=201281, name="Guillaume Mazoyer", affiliated=True)
     autonomous_system = AutonomousSystem.objects.create(asn=64500,
                                                         name="Dummy")
     relationship_private_peering = Relationship.objects.create(
         name="Private Peering", slug="private-peering")
     DirectPeeringSession.objects.bulk_create([
         DirectPeeringSession(
             local_autonomous_system=local_autonomous_system,
             autonomous_system=autonomous_system,
             relationship=relationship_private_peering,
             ip_address="2001:db8::1",
             password="******",
         ),
         DirectPeeringSession(
             local_autonomous_system=local_autonomous_system,
             autonomous_system=autonomous_system,
             relationship=relationship_private_peering,
             ip_address="2001:db8::2",
         ),
         DirectPeeringSession(
             local_autonomous_system=local_autonomous_system,
             autonomous_system=autonomous_system,
             relationship=relationship_private_peering,
             ip_address="2001:db8::3",
         ),
     ])
     cls.create_data = [
         {
             "service_reference": "PNI-0001",
             "local_autonomous_system": local_autonomous_system.pk,
             "autonomous_system": autonomous_system.pk,
             "relationship": relationship_private_peering.pk,
             "ip_address": "198.51.100.1/32",
         },
         {
             "local_autonomous_system": local_autonomous_system.pk,
             "autonomous_system": autonomous_system.pk,
             "relationship": relationship_private_peering.pk,
             "ip_address": "198.51.100.2/32",
         },
         {
             "local_autonomous_system": local_autonomous_system.pk,
             "autonomous_system": autonomous_system.pk,
             "relationship": relationship_private_peering.pk,
             "ip_address": "198.51.100.3/32",
         },
     ]
    def setUpTestData(cls):
        cls.a_s = AutonomousSystem.objects.create(asn=64501,
                                                  name="Autonomous System 1")
        DirectPeeringSession.objects.bulk_create([
            DirectPeeringSession(
                local_asn=64500,
                autonomous_system=cls.a_s,
                ip_address="192.0.2.1",
                relationship=BGPRelationship.PRIVATE_PEERING,
            ),
            DirectPeeringSession(
                local_asn=64500,
                autonomous_system=cls.a_s,
                ip_address="192.0.2.2",
                relationship=BGPRelationship.PRIVATE_PEERING,
            ),
            DirectPeeringSession(
                local_asn=64500,
                autonomous_system=cls.a_s,
                ip_address="192.0.2.3",
                relationship=BGPRelationship.PRIVATE_PEERING,
            ),
        ])

        cls.form_data = {
            "local_asn": 64500,
            "local_ip_address": None,
            "autonomous_system": cls.a_s.pk,
            "ip_address": ipaddress.ip_address("2001:db8::4"),
            "multihop_ttl": 1,
            "relationship": BGPRelationship.PRIVATE_PEERING,
            "password": None,
            "encrypted_password": None,
            "enabled": True,
            "bgp_group": None,
            "router": None,
            "export_routing_policies": [],
            "import_routing_policies": [],
            "bgp_state": None,
            "last_established_state": None,
            "advertised_prefix_count": 0,
            "received_prefix_count": 0,
            "comments": "",
            "tags": "",
        }
        cls.bulk_edit_data = {"enabled": False, "comments": "New comments"}
 def setUpTestData(cls):
     cls.local_as = AutonomousSystem.objects.create(
         asn=64501, name="Autonomous System 1", affiliated=True)
     cls.a_s = AutonomousSystem.objects.create(asn=64502,
                                               name="Autonomous System 2")
     cls.router = Router.objects.create(
         name="Router 1",
         hostname="router1.example.net",
         local_autonomous_system=cls.local_as,
     )
     cls.relationship_transit = Relationship.objects.create(name="Transit",
                                                            slug="transit")
     relationship_private_peering = Relationship.objects.create(
         name="Private Peering", slug="private-peering")
     relationship_customer = Relationship.objects.create(name="Customer",
                                                         slug="customer")
     DirectPeeringSession.objects.bulk_create([
         DirectPeeringSession(
             service_reference="TRANSIT-0001",
             local_autonomous_system=cls.local_as,
             autonomous_system=cls.a_s,
             ip_address="192.0.2.1",
             relationship=cls.relationship_transit,
             router=cls.router,
         ),
         DirectPeeringSession(
             local_autonomous_system=cls.local_as,
             autonomous_system=cls.a_s,
             ip_address="192.0.2.2",
             relationship=relationship_private_peering,
             multihop_ttl=2,
         ),
         DirectPeeringSession(
             local_autonomous_system=cls.local_as,
             autonomous_system=cls.a_s,
             ip_address="192.0.2.3",
             relationship=relationship_customer,
             enabled=False,
         ),
     ])