def setUpTestData(cls): Router.objects.bulk_create([ Router(name="Router 1", hostname="router1.example.net"), Router(name="Router 2", hostname="router2.example.net"), Router(name="Router 3", hostname="router3.example.net"), ]) cls.form_data = { "name": "Router 4", "hostname": "router4.example.net", "configuration_template": None, "last_deployment_id": None, "encrypt_passwords": False, "platform": Platform.JUNOS, "netbox_device_id": 0, "use_netbox": False, "comments": "", "tags": "", "napalm_args": None, "napalm_password": None, "napalm_timeout": 30, "napalm_username": "", } cls.bulk_edit_data = { "platform": Platform.JUNOS, "comments": "New comments" }
def setUpTestData(cls): cls.local_as = AutonomousSystem.objects.create( asn=64501, name="Autonomous System 1", affiliated=True) cls.configuration = Configuration.objects.create( name="Configuration 1", template="Configuration 1") Router.objects.bulk_create([ Router( name="Router 1", hostname="router1.example.net", device_state=DeviceState.ENABLED, encrypt_passwords=True, local_autonomous_system=cls.local_as, ), Router( name="Router 2", hostname="router2.example.net", device_state=DeviceState.DISABLED, encrypt_passwords=True, local_autonomous_system=cls.local_as, ), Router( name="Router 3", hostname="router3.example.net", device_state=DeviceState.ENABLED, configuration_template=cls.configuration, local_autonomous_system=cls.local_as, ), ])
def setUpTestData(cls): cls.local_as = AutonomousSystem.objects.create( asn=64501, name="Autonomous System 1", affiliated=True ) cls.configuration = Configuration.objects.create( name="Configuration 1", template="Configuration 1" ) Router.objects.bulk_create( [ Router( name="Router 1", hostname="router1.example.net", platform=Platform.JUNOS, encrypt_passwords=True, local_autonomous_system=cls.local_as, ), Router( name="Router 2", hostname="router2.example.net", platform=Platform.IOSXR, encrypt_passwords=True, local_autonomous_system=cls.local_as, ), Router( name="Router 3", hostname="router3.example.net", configuration_template=cls.configuration, local_autonomous_system=cls.local_as, ), ] )
def setUpTestData(cls): cls.configuration = Configuration.objects.create( name="Configuration 1", template="Configuration 1" ) Router.objects.bulk_create( [ Router( name="Router 1", hostname="router1.example.net", platform=Platform.JUNOS, encrypt_passwords=True, ), Router( name="Router 2", hostname="router2.example.net", platform=Platform.IOSXR, encrypt_passwords=True, ), Router( name="Router 3", hostname="router3.example.net", configuration_template=cls.configuration, ), ] )
def setUpTestData(cls): cls.local_autonomous_system = AutonomousSystem.objects.create( asn=201281, name="Guillaume Mazoyer", affiliated=True) cls.platform = Platform.objects.create(name="No Bugs OS", slug="nobugsos") cls.template = Configuration.objects.create(name="Test", template="Nothing useful") Router.objects.bulk_create([ Router( name="Example 1", hostname="1.example.com", device_state=DeviceState.ENABLED, configuration_template=cls.template, local_autonomous_system=cls.local_autonomous_system, ), Router( name="Example 2", hostname="2.example.com", device_state=DeviceState.ENABLED, configuration_template=cls.template, local_autonomous_system=cls.local_autonomous_system, ), Router( name="Example 3", hostname="3.example.com", device_state=DeviceState.ENABLED, configuration_template=cls.template, local_autonomous_system=cls.local_autonomous_system, ), ]) cls.router = Router.objects.get(hostname="1.example.com") cls.create_data = [ { "name": "Test 1", "hostname": "test1.example.com", "device_state": DeviceState.ENABLED, "configuration_template": cls.template.pk, "local_autonomous_system": cls.local_autonomous_system.pk, "platform": cls.platform.pk, }, { "name": "Test 2", "hostname": "test2.example.com", "device_state": DeviceState.MAINTENANCE, "configuration_template": cls.template.pk, "local_autonomous_system": cls.local_autonomous_system.pk, "platform": cls.platform.pk, }, { "name": "Test 3", "hostname": "test3.example.com", "device_state": DeviceState.DISABLED, "configuration_template": cls.template.pk, "local_autonomous_system": cls.local_autonomous_system.pk, "platform": cls.platform.pk, }, ]
def setUpTestData(cls): Router.objects.bulk_create([ Router( name="Router 1", hostname="router1.example.net", platform=PLATFORM_JUNOS, ), Router( name="Router 2", hostname="router2.example.net", platform=PLATFORM_IOSXR, ), Router(name="Router 3", hostname="router3.example.net"), ])
def setUpTestData(cls): local_as = AutonomousSystem.objects.create( asn=64500, name="Autonomous System", affiliated=True, ) Router.objects.bulk_create([ Router( name="Router 1", hostname="router1.example.net", local_autonomous_system=local_as, device_state=DeviceState.ENABLED, ), Router( name="Router 2", hostname="router2.example.net", local_autonomous_system=local_as, device_state=DeviceState.ENABLED, ), Router( name="Router 3", hostname="router3.example.net", local_autonomous_system=local_as, device_state=DeviceState.ENABLED, ), ]) cls.form_data = { "name": "Router 4", "hostname": "router4.example.net", "configuration_template": None, "local_autonomous_system": local_as.pk, "encrypt_passwords": False, "platform": None, "device_state": DeviceState.ENABLED, "netbox_device_id": 0, "use_netbox": False, "comments": "", "tags": [], "napalm_args": None, "napalm_password": None, "napalm_timeout": 30, "napalm_username": "", } cls.bulk_edit_data = {"comments": "New comments"}