示例#1
0
 def setUpTestData(cls):
     cls.local_as = AutonomousSystem.objects.create(
         asn=64500, name="Autonomous System 1", affiliated=True)
     cls.a_s = AutonomousSystem.objects.create(asn=64501,
                                               name="Autonomous System 1")
     cls.ix = InternetExchange.objects.create(
         local_autonomous_system=cls.local_as,
         name="Internet Exchange 1",
         slug="ix-1",
     )
     cls.useless_ix = InternetExchange.objects.create(
         local_autonomous_system=cls.local_as,
         name="Internet Exchange 2",
         slug="ix-2",
     )
     InternetExchangePeeringSession.objects.bulk_create([
         InternetExchangePeeringSession(
             autonomous_system=cls.a_s,
             internet_exchange=cls.ix,
             ip_address="192.0.2.1",
             multihop_ttl=2,
         ),
         InternetExchangePeeringSession(
             autonomous_system=cls.a_s,
             internet_exchange=cls.ix,
             ip_address="192.0.2.2",
             enabled=False,
         ),
         InternetExchangePeeringSession(
             autonomous_system=cls.a_s,
             internet_exchange=cls.ix,
             ip_address="192.0.2.3",
             is_route_server=True,
         ),
     ])
    def setUpTestData(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.ixp = InternetExchange.objects.create(
            name="Internet Exchange 1",
            slug="ix-1",
            local_autonomous_system=local_as)
        cls.ixp_connection = Connection.objects.create(
            vlan=2000, internet_exchange_point=cls.ixp)
        InternetExchangePeeringSession.objects.bulk_create([
            InternetExchangePeeringSession(
                autonomous_system=cls.a_s,
                ixp_connection=cls.ixp_connection,
                ip_address="192.0.2.1",
            ),
            InternetExchangePeeringSession(
                autonomous_system=cls.a_s,
                ixp_connection=cls.ixp_connection,
                ip_address="192.0.2.2",
            ),
            InternetExchangePeeringSession(
                autonomous_system=cls.a_s,
                ixp_connection=cls.ixp_connection,
                ip_address="192.0.2.3",
            ),
        ])

        cls.form_data = {
            "autonomous_system": cls.a_s.pk,
            "internet_exchange": cls.ixp.pk,
            "ixp_connection": cls.ixp_connection.pk,
            "ip_address": ipaddress.ip_address("2001:db8::4"),
            "multihop_ttl": 1,
            "password": None,
            "encrypted_password": None,
            "is_route_server": False,
            "enabled": True,
            "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 = {
            "is_route_server": True,
            "enabled": False,
            "comments": "New comments",
        }
    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")
        ixp = InternetExchange.objects.create(
            name="Test",
            slug="test",
            local_autonomous_system=local_autonomous_system)
        ixp_connection = Connection.objects.create(vlan=2000,
                                                   internet_exchange_point=ixp)

        InternetExchangePeeringSession.objects.bulk_create([
            InternetExchangePeeringSession(
                autonomous_system=autonomous_system,
                ixp_connection=ixp_connection,
                ip_address="2001:db8::1",
                password="******",
            ),
            InternetExchangePeeringSession(
                autonomous_system=autonomous_system,
                ixp_connection=ixp_connection,
                ip_address="2001:db8::2",
            ),
            InternetExchangePeeringSession(
                autonomous_system=autonomous_system,
                ixp_connection=ixp_connection,
                ip_address="2001:db8::3",
            ),
        ])
        cls.create_data = [
            {
                "service_reference": "IXP-0001",
                "autonomous_system": autonomous_system.pk,
                "ixp_connection": ixp_connection.pk,
                "ip_address": "198.51.100.1",
            },
            {
                "autonomous_system": autonomous_system.pk,
                "ixp_connection": ixp_connection.pk,
                "ip_address": "198.51.100.2",
            },
            {
                "autonomous_system": autonomous_system.pk,
                "ixp_connection": ixp_connection.pk,
                "ip_address": "198.51.100.3",
            },
        ]