Ejemplo n.º 1
0
 def _get_netbox_from_row(row):
     netbox = Netbox(ip=row['ip'], read_only=row['ro'],
                     read_write=row['rw'], snmp_version=1)
     netbox.room = get_object_or_fail(Room, id=row['roomid'])
     netbox.organization = get_object_or_fail(Organization, id=row['orgid'])
     netbox.category = get_object_or_fail(Category, id=row['catid'])
     netbox.sysname = netbox.ip
     return netbox
Ejemplo n.º 2
0
 def _netbox_factory(self, sysname, interface=None):
     netbox = Netbox()
     netbox.id = self._next_id()
     netbox.sysname = sysname
     netbox.interface = interface
     netbox.category = self.category_gw
     netbox.room = self.room
     netbox.ip = '::{0}'.format(self.model_id)
     return netbox
Ejemplo n.º 3
0
 def _netbox_factory(self, sysname, interface=None):
     netbox = Netbox()
     netbox.id = self._next_id()
     netbox.sysname = sysname
     netbox.interface = interface
     netbox.category = self.category_gw
     netbox.room = self.room
     netbox.ip = '::{0}'.format(self.model_id)
     return netbox
Ejemplo n.º 4
0
 def _get_netbox_from_row(row):
     netbox = Netbox(ip=row['ip'],
                     read_only=row['ro'],
                     read_write=row['rw'],
                     snmp_version=1)
     netbox.room = get_object_or_fail(Room, id=row['roomid'])
     netbox.organization = get_object_or_fail(Organization, id=row['orgid'])
     netbox.category = get_object_or_fail(Category, id=row['catid'])
     netbox.sysname = netbox.ip
     return netbox
Ejemplo n.º 5
0
    def _get_netbox_from_row(row):
        netbox = Netbox(ip=row['ip'])
        netbox.room = get_object_or_fail(Room, id=row['roomid'])
        netbox.organization = get_object_or_fail(Organization, id=row['orgid'])
        netbox.category = get_object_or_fail(Category, id=row['catid'])
        netbox.sysname = netbox.ip

        master = row.get('master')
        if master:
            if is_valid_ip(master, use_socket_lib=True):
                netbox.master = get_object_or_fail(Netbox, ip=master)
            else:
                netbox.master = get_object_or_fail(Netbox,
                                                   sysname__startswith=master)

        return netbox