Exemple #1
0
    def setUp(self):

        self.client = Client()

        site = Site(name='Site 1', slug='site-1')
        site.save()

        manufacturer = Manufacturer(name='Manufacturer 1',
                                    slug='manufacturer-1')
        manufacturer.save()

        devicetype = DeviceType(model='Device Type 1',
                                manufacturer=manufacturer)
        devicetype.save()

        devicerole = DeviceRole(name='Device Role 1', slug='device-role-1')
        devicerole.save()

        device1 = Device(name='Device 1',
                         site=site,
                         device_type=devicetype,
                         device_role=devicerole)
        device1.save()
        device2 = Device(name='Device 2',
                         site=site,
                         device_type=devicetype,
                         device_role=devicerole)
        device2.save()

        iface1 = Interface(device=device1,
                           name='Interface 1',
                           form_factor=IFACE_FF_1GE_FIXED)
        iface1.save()
        iface2 = Interface(device=device1,
                           name='Interface 2',
                           form_factor=IFACE_FF_1GE_FIXED)
        iface2.save()
        iface3 = Interface(device=device1,
                           name='Interface 3',
                           form_factor=IFACE_FF_1GE_FIXED)
        iface3.save()
        iface4 = Interface(device=device2,
                           name='Interface 1',
                           form_factor=IFACE_FF_1GE_FIXED)
        iface4.save()
        iface5 = Interface(device=device2,
                           name='Interface 2',
                           form_factor=IFACE_FF_1GE_FIXED)
        iface5.save()
        iface6 = Interface(device=device2,
                           name='Interface 3',
                           form_factor=IFACE_FF_1GE_FIXED)
        iface6.save()

        Cable(termination_a=iface1, termination_b=iface4,
              type=CABLE_TYPE_CAT6).save()
        Cable(termination_a=iface2, termination_b=iface5,
              type=CABLE_TYPE_CAT6).save()
        Cable(termination_a=iface3, termination_b=iface6,
              type=CABLE_TYPE_CAT6).save()
Exemple #2
0
    def setUp(self):

        self.client = Client()

        site = Site(name='Site 1', slug='site-1')
        site.save()

        manufacturer = Manufacturer(name='Manufacturer 1',
                                    slug='manufacturer-1')
        manufacturer.save()

        devicetype = DeviceType(model='Device Type 1',
                                manufacturer=manufacturer)
        devicetype.save()

        devicerole = DeviceRole(name='Device Role 1', slug='device-role-1')
        devicerole.save()

        Device.objects.bulk_create([
            Device(name='Device 1',
                   site=site,
                   device_type=devicetype,
                   device_role=devicerole),
            Device(name='Device 2',
                   site=site,
                   device_type=devicetype,
                   device_role=devicerole),
            Device(name='Device 3',
                   site=site,
                   device_type=devicetype,
                   device_role=devicerole),
        ])
Exemple #3
0
    def setUp(self):

        self.client = Client()

        site = Site(name='Site 1', slug='site-1')
        site.save()

        manufacturer = Manufacturer(name='Manufacturer 1',
                                    slug='manufacturer-1')
        manufacturer.save()

        devicetype = DeviceType(model='Device Type 1',
                                manufacturer=manufacturer)
        devicetype.save()

        devicerole = DeviceRole(name='Device Role 1', slug='device-role-1')
        devicerole.save()

        device = Device(name='Device 1',
                        site=site,
                        device_type=devicetype,
                        device_role=devicerole)
        device.save()

        InventoryItem.objects.bulk_create([
            InventoryItem(device=device, name='Inventory Item 1'),
            InventoryItem(device=device, name='Inventory Item 2'),
            InventoryItem(device=device, name='Inventory Item 3'),
        ])
Exemple #4
0
    def setUp(self):
        user = create_test_user(permissions=['dcim.view_inventoryitem'])
        self.client = Client()
        self.client.force_login(user)

        site = Site(name='Site 1', slug='site-1')
        site.save()

        manufacturer = Manufacturer(name='Manufacturer 1',
                                    slug='manufacturer-1')
        manufacturer.save()

        devicetype = DeviceType(model='Device Type 1',
                                manufacturer=manufacturer)
        devicetype.save()

        devicerole = DeviceRole(name='Device Role 1', slug='device-role-1')
        devicerole.save()

        device = Device(name='Device 1',
                        site=site,
                        device_type=devicetype,
                        device_role=devicerole)
        device.save()

        InventoryItem.objects.bulk_create([
            InventoryItem(device=device, name='Inventory Item 1'),
            InventoryItem(device=device, name='Inventory Item 2'),
            InventoryItem(device=device, name='Inventory Item 3'),
        ])
    def setUp(self):
        user = create_test_user(permissions=['secrets.view_secret'])
        self.client = Client()
        self.client.force_login(user)

        site = Site(name='Site 1', slug='site-1')
        site.save()

        manufacturer = Manufacturer(name='Manufacturer 1', slug='manufacturer-1')
        manufacturer.save()

        devicetype = DeviceType(manufacturer=manufacturer, model='Device Type 1')
        devicetype.save()

        devicerole = DeviceRole(name='Device Role 1', slug='device-role-1')
        devicerole.save()

        device = Device(name='Device 1', site=site, device_type=devicetype, device_role=devicerole)
        device.save()

        secretrole = SecretRole(name='Secret Role 1', slug='secret-role-1')
        secretrole.save()

        Secret.objects.bulk_create([
            Secret(device=device, role=secretrole, name='Secret 1', ciphertext=b'1234567890'),
            Secret(device=device, role=secretrole, name='Secret 2', ciphertext=b'1234567890'),
            Secret(device=device, role=secretrole, name='Secret 3', ciphertext=b'1234567890'),
        ])
Exemple #6
0
    def setUp(self):
        user = create_test_user(permissions=['dcim.view_device'])
        self.client = Client()
        self.client.force_login(user)

        site = Site(name='Site 1', slug='site-1')
        site.save()

        manufacturer = Manufacturer(name='Manufacturer 1',
                                    slug='manufacturer-1')
        manufacturer.save()

        devicetype = DeviceType(model='Device Type 1',
                                manufacturer=manufacturer)
        devicetype.save()

        devicerole = DeviceRole(name='Device Role 1', slug='device-role-1')
        devicerole.save()

        Device.objects.bulk_create([
            Device(name='Device 1',
                   site=site,
                   device_type=devicetype,
                   device_role=devicerole),
            Device(name='Device 2',
                   site=site,
                   device_type=devicetype,
                   device_role=devicerole),
            Device(name='Device 3',
                   site=site,
                   device_type=devicetype,
                   device_role=devicerole),
        ])
Exemple #7
0
    def setUp(self):

        self.client = Client()

        site = Site(name='Site 1', slug='site-1')
        site.save()

        manufacturer = Manufacturer(name='Manufacturer 1', slug='manufacturer-1')
        manufacturer.save()

        devicetype = DeviceType(manufacturer=manufacturer, model='Device Type 1')
        devicetype.save()

        devicerole = DeviceRole(name='Device Role 1', slug='device-role-1')
        devicerole.save()

        device = Device(name='Device 1', site=site, device_type=devicetype, device_role=devicerole)
        device.save()

        secretrole = SecretRole(name='Secret Role 1', slug='secret-role-1')
        secretrole.save()

        Secret.objects.bulk_create([
            Secret(device=device, role=secretrole, name='Secret 1', ciphertext=b'1234567890'),
            Secret(device=device, role=secretrole, name='Secret 2', ciphertext=b'1234567890'),
            Secret(device=device, role=secretrole, name='Secret 3', ciphertext=b'1234567890'),
        ])
Exemple #8
0
    def setUp(self):
        user = create_test_user(permissions=[
            'secrets.view_secret',
            'secrets.add_secret',
        ])

        # Set up a master key
        userkey = UserKey(user=user, public_key=PUBLIC_KEY)
        userkey.save()
        master_key = userkey.get_master_key(PRIVATE_KEY)
        self.session_key = SessionKey(userkey=userkey)
        self.session_key.save(master_key)

        self.client = Client()
        self.client.force_login(user)

        site = Site(name='Site 1', slug='site-1')
        site.save()

        manufacturer = Manufacturer(name='Manufacturer 1',
                                    slug='manufacturer-1')
        manufacturer.save()

        devicetype = DeviceType(manufacturer=manufacturer,
                                model='Device Type 1')
        devicetype.save()

        devicerole = DeviceRole(name='Device Role 1', slug='device-role-1')
        devicerole.save()

        device = Device(name='Device 1',
                        site=site,
                        device_type=devicetype,
                        device_role=devicerole)
        device.save()

        secretrole = SecretRole(name='Secret Role 1', slug='secret-role-1')
        secretrole.save()

        Secret.objects.bulk_create([
            Secret(device=device,
                   role=secretrole,
                   name='Secret 1',
                   ciphertext=b'1234567890'),
            Secret(device=device,
                   role=secretrole,
                   name='Secret 2',
                   ciphertext=b'1234567890'),
            Secret(device=device,
                   role=secretrole,
                   name='Secret 3',
                   ciphertext=b'1234567890'),
        ])
Exemple #9
0
    def setUp(self):

        self.client = Client()

        site = Site(name='Site 1', slug='site-1')
        site.save()

        manufacturer = Manufacturer(name='Manufacturer 1', slug='manufacturer-1')
        manufacturer.save()

        devicetype = DeviceType(model='Device Type 1', manufacturer=manufacturer)
        devicetype.save()

        devicerole = DeviceRole(name='Device Role 1', slug='device-role-1')
        devicerole.save()

        Device.objects.bulk_create([
            Device(name='Device 1', site=site, device_type=devicetype, device_role=devicerole),
            Device(name='Device 2', site=site, device_type=devicetype, device_role=devicerole),
            Device(name='Device 3', site=site, device_type=devicetype, device_role=devicerole),
        ])
    def setUp(self):
        user = create_test_user(permissions=['ipam.view_service'])
        self.client = Client()
        self.client.force_login(user)

        site = Site(name='Site 1', slug='site-1')
        site.save()

        manufacturer = Manufacturer(name='Manufacturer 1',
                                    slug='manufacturer-1')
        manufacturer.save()

        devicetype = DeviceType(manufacturer=manufacturer,
                                model='Device Type 1')
        devicetype.save()

        devicerole = DeviceRole(name='Device Role 1', slug='device-role-1')
        devicerole.save()

        device = Device(name='Device 1',
                        site=site,
                        device_type=devicetype,
                        device_role=devicerole)
        device.save()

        Service.objects.bulk_create([
            Service(device=device,
                    name='Service 1',
                    protocol=IP_PROTOCOL_TCP,
                    port=101),
            Service(device=device,
                    name='Service 2',
                    protocol=IP_PROTOCOL_TCP,
                    port=102),
            Service(device=device,
                    name='Service 3',
                    protocol=IP_PROTOCOL_TCP,
                    port=103),
        ])
Exemple #11
0
    def setUp(self):

        self.client = Client()

        site = Site(name='Site 1', slug='site-1')
        site.save()

        manufacturer = Manufacturer(name='Manufacturer 1', slug='manufacturer-1')
        manufacturer.save()

        devicetype = DeviceType(model='Device Type 1', manufacturer=manufacturer)
        devicetype.save()

        devicerole = DeviceRole(name='Device Role 1', slug='device-role-1')
        devicerole.save()

        device1 = Device(name='Device 1', site=site, device_type=devicetype, device_role=devicerole)
        device1.save()
        device2 = Device(name='Device 2', site=site, device_type=devicetype, device_role=devicerole)
        device2.save()

        iface1 = Interface(device=device1, name='Interface 1', form_factor=IFACE_FF_1GE_FIXED)
        iface1.save()
        iface2 = Interface(device=device1, name='Interface 2', form_factor=IFACE_FF_1GE_FIXED)
        iface2.save()
        iface3 = Interface(device=device1, name='Interface 3', form_factor=IFACE_FF_1GE_FIXED)
        iface3.save()
        iface4 = Interface(device=device2, name='Interface 1', form_factor=IFACE_FF_1GE_FIXED)
        iface4.save()
        iface5 = Interface(device=device2, name='Interface 2', form_factor=IFACE_FF_1GE_FIXED)
        iface5.save()
        iface6 = Interface(device=device2, name='Interface 3', form_factor=IFACE_FF_1GE_FIXED)
        iface6.save()

        Cable(termination_a=iface1, termination_b=iface4, type=CABLE_TYPE_CAT6).save()
        Cable(termination_a=iface2, termination_b=iface5, type=CABLE_TYPE_CAT6).save()
        Cable(termination_a=iface3, termination_b=iface6, type=CABLE_TYPE_CAT6).save()
Exemple #12
0
    def setUp(self):

        self.client = Client()

        site = Site(name='Site 1', slug='site-1')
        site.save()

        manufacturer = Manufacturer(name='Manufacturer 1', slug='manufacturer-1')
        manufacturer.save()

        devicetype = DeviceType(model='Device Type 1', manufacturer=manufacturer)
        devicetype.save()

        devicerole = DeviceRole(name='Device Role 1', slug='device-role-1')
        devicerole.save()

        device = Device(name='Device 1', site=site, device_type=devicetype, device_role=devicerole)
        device.save()

        InventoryItem.objects.bulk_create([
            InventoryItem(device=device, name='Inventory Item 1'),
            InventoryItem(device=device, name='Inventory Item 2'),
            InventoryItem(device=device, name='Inventory Item 3'),
        ])
Exemple #13
0
    def setUp(self):

        self.client = Client()

        site = Site(name='Site 1', slug='site-1')
        site.save()

        manufacturer = Manufacturer(name='Manufacturer 1', slug='manufacturer-1')
        manufacturer.save()

        devicetype = DeviceType(manufacturer=manufacturer, model='Device Type 1')
        devicetype.save()

        devicerole = DeviceRole(name='Device Role 1', slug='device-role-1')
        devicerole.save()

        device = Device(name='Device 1', site=site, device_type=devicetype, device_role=devicerole)
        device.save()

        Service.objects.bulk_create([
            Service(device=device, name='Service 1', protocol=IP_PROTOCOL_TCP, port=101),
            Service(device=device, name='Service 2', protocol=IP_PROTOCOL_TCP, port=102),
            Service(device=device, name='Service 3', protocol=IP_PROTOCOL_TCP, port=103),
        ])
Exemple #14
0
    def setUp(self):
        user = create_test_user(permissions=['dcim.view_cable'])
        self.client = Client()
        self.client.force_login(user)

        site = Site(name='Site 1', slug='site-1')
        site.save()

        manufacturer = Manufacturer(name='Manufacturer 1',
                                    slug='manufacturer-1')
        manufacturer.save()

        devicetype = DeviceType(model='Device Type 1',
                                manufacturer=manufacturer)
        devicetype.save()

        devicerole = DeviceRole(name='Device Role 1', slug='device-role-1')
        devicerole.save()

        device1 = Device(name='Device 1',
                         site=site,
                         device_type=devicetype,
                         device_role=devicerole)
        device1.save()
        device2 = Device(name='Device 2',
                         site=site,
                         device_type=devicetype,
                         device_role=devicerole)
        device2.save()

        iface1 = Interface(device=device1,
                           name='Interface 1',
                           type=IFACE_TYPE_1GE_FIXED)
        iface1.save()
        iface2 = Interface(device=device1,
                           name='Interface 2',
                           type=IFACE_TYPE_1GE_FIXED)
        iface2.save()
        iface3 = Interface(device=device1,
                           name='Interface 3',
                           type=IFACE_TYPE_1GE_FIXED)
        iface3.save()
        iface4 = Interface(device=device2,
                           name='Interface 1',
                           type=IFACE_TYPE_1GE_FIXED)
        iface4.save()
        iface5 = Interface(device=device2,
                           name='Interface 2',
                           type=IFACE_TYPE_1GE_FIXED)
        iface5.save()
        iface6 = Interface(device=device2,
                           name='Interface 3',
                           type=IFACE_TYPE_1GE_FIXED)
        iface6.save()

        Cable(termination_a=iface1, termination_b=iface4,
              type=CABLE_TYPE_CAT6).save()
        Cable(termination_a=iface2, termination_b=iface5,
              type=CABLE_TYPE_CAT6).save()
        Cable(termination_a=iface3, termination_b=iface6,
              type=CABLE_TYPE_CAT6).save()