def setUpTestData(cls): RoutingPolicy.objects.bulk_create([ RoutingPolicy( name="Routing Policy 1", slug="routing-policy-1", type=RoutingPolicyType.EXPORT, weight=0, ), RoutingPolicy( name="Routing Policy 2", slug="routing-policy-2", type=RoutingPolicyType.IMPORT, weight=0, ), RoutingPolicy( name="Routing Policy 3", slug="routing-policy-3", type=RoutingPolicyType.IMPORT_EXPORT, weight=0, ), ]) cls.form_data = { "name": "Routing Policy 4", "slug": "routing-policy-4", "type": RoutingPolicyType.IMPORT, "address_family": 6, "weight": 1, "comments": "", "tags": "", } cls.bulk_edit_data = {"weight": 10, "comments": "New comments"}
def setUpTestData(cls): cls.routing_policies = [ RoutingPolicy(name="test-1", slug="test-1", type=RoutingPolicyType.EXPORT), RoutingPolicy(name="test-2", slug="test-2", type=RoutingPolicyType.IMPORT), RoutingPolicy( name="test-3", slug="test-3", type=RoutingPolicyType.IMPORT_EXPORT ), RoutingPolicy(name="test-4", slug="test-4", type="unknown"), ] RoutingPolicy.objects.bulk_create(cls.routing_policies)
def setUpTestData(cls): RoutingPolicy.objects.bulk_create([ RoutingPolicy( name="Example 1", slug="example-1", type=RoutingPolicyType.EXPORT, weight=0, ), RoutingPolicy( name="Example 2", slug="example-2", type=RoutingPolicyType.IMPORT, weight=0, ), RoutingPolicy( name="Example 3", slug="example-3", type=RoutingPolicyType.EXPORT, weight=0, ), ])
def setUpTestData(cls): RoutingPolicy.objects.bulk_create([ RoutingPolicy( name="Routing Policy 1", slug="routing-policy-1", type=RoutingPolicyType.EXPORT, weight=0, ), RoutingPolicy( name="Routing Policy 2", slug="routing-policy-2", type=RoutingPolicyType.IMPORT, weight=0, address_family=6, ), RoutingPolicy( name="Routing Policy 3", slug="routing-policy-3", type=RoutingPolicyType.IMPORT_EXPORT, weight=10, ), ])
def setUpTestData(cls): cls.tags = [ Tag(name="Tag 1", slug="tag-1"), Tag(name="Tag 2", slug="tag-2"), Tag(name="Tag 3", slug="tag-3"), ] Tag.objects.bulk_create(cls.tags) cls.routing_policies = [ RoutingPolicy(name="Reject All", slug="reject-all", weight=255), RoutingPolicy(name="Accept All", slug="accept-all", weight=255), RoutingPolicy(name="Import Known Prefixes", slug="import-known-prefixes", weight=128), RoutingPolicy(name="Export Supernets", slug="export-supernets", weight=64), RoutingPolicy( name="Export Deaggregated v4", slug="export-deaggregated-v4", address_family=IPFamily.IPV4, ), RoutingPolicy( name="Export Deaggregated v6", slug="export-deaggregated-v6", address_family=IPFamily.IPV6, ), ] RoutingPolicy.objects.bulk_create(cls.routing_policies) cls.communities = [ Community(name="Learnt from IXP", slug="learnt-from-ixp", value="123:1"), Community( name="Learnt from direct peer", slug="learnt-from-direct-peer", value="123:2", ), Community( name="Learnt from transit", slug="learnt-from-transit", value="123:3", type=CommunityType.INGRESS, ), ] Community.objects.bulk_create(cls.communities) AutonomousSystem.objects.create(asn=64520, name="Useless") cls.a_s = AutonomousSystem.objects.create(asn=64510, name="Test", ipv6_max_prefixes=100) cls.a_s.import_routing_policies.add( RoutingPolicy.objects.get(slug="import-known-prefixes")) cls.a_s.export_routing_policies.add( RoutingPolicy.objects.get(slug="export-supernets"), RoutingPolicy.objects.get(slug="export-deaggregated-v4"), RoutingPolicy.objects.get(slug="export-deaggregated-v6"), ) cls.a_s.communities.add( Community.objects.get(slug="learnt-from-transit")) cls.a_s.tags.add(*cls.tags) cls.router = Router.objects.create(name="test", hostname="test.example.com") cls.ixp = InternetExchange.objects.create( local_autonomous_system=AutonomousSystem.objects.create( asn=64500, name="Autonomous System", affiliated=True), name="Test IXP", slug="test-ixp", ) cls.ixp.import_routing_policies.add( RoutingPolicy.objects.get(slug="reject-all")) cls.ixp.export_routing_policies.add( RoutingPolicy.objects.get(slug="reject-all")) cls.ixp.communities.add(Community.objects.get(slug="learnt-from-ixp")) cls.ixp_connection = Connection.objects.create( vlan=10, internet_exchange_point=cls.ixp, ipv4_address="192.0.2.10", ipv6_address="2001:db8::a", router=cls.router, ) cls.session6 = InternetExchangePeeringSession.objects.create( autonomous_system=cls.a_s, ixp_connection=cls.ixp_connection, ip_address="2001:db8::1", password="******", ) cls.session4 = InternetExchangePeeringSession.objects.create( autonomous_system=cls.a_s, ixp_connection=cls.ixp_connection, ip_address="192.0.2.1", password="******", ) cls.rs_session6 = InternetExchangePeeringSession.objects.create( autonomous_system=cls.a_s, ixp_connection=cls.ixp_connection, ip_address="2001:db8::ffff", is_route_server=True, ) cls.rs_session4 = InternetExchangePeeringSession.objects.create( autonomous_system=cls.a_s, ixp_connection=cls.ixp_connection, ip_address="192.0.2.255", is_route_server=True, ) cls.session6.import_routing_policies.add( RoutingPolicy.objects.get(slug="accept-all")) cls.session6.export_routing_policies.add( RoutingPolicy.objects.get(slug="accept-all"), RoutingPolicy.objects.get(slug="export-supernets"), )