Пример #1
0
 def _interface_factory(self, ifname, netbox):
     interface = Interface()
     interface.id = self._next_id()
     interface.ifname = ifname
     if netbox and isinstance(netbox, Netbox):
         interface.netbox = netbox
     elif netbox:
         interface.netbox = self._netbox_factory(netbox, interface)
     return interface
Пример #2
0
def netbox(db):
    box = Netbox(ip='10.254.254.254', sysname='example-sw.example.org',
                 organization_id='myorg', room_id='myroom', category_id='SW',
                 snmp_version=2, read_only='public')
    box.save()

    device = Device(serial="1234test")
    device.save()
    module = Module(device=device, netbox=box, name='Module 1', model='')
    module.save()

    interface = Interface(netbox=box, module=module, ifname='1',
                          ifdescr='Port 1')
    interface.save()

    return box
Пример #3
0
def netbox(db, management_profile):
    box = Netbox(ip='10.254.254.254', sysname='example-sw.example.org',
                 organization_id='myorg', room_id='myroom', category_id='SW')
    box.save()
    NetboxProfile(netbox=box, profile=management_profile).save()

    device = Device(serial="1234test")
    device.save()
    module = Module(device=device, netbox=box, name='Module 1', model='')
    module.save()

    interface = Interface(netbox=box, module=module, ifname='1',
                          ifdescr='Port 1')
    interface.save()

    return box