noc.ip.models.prefix

Module Contents

noc.ip.models.prefix.id_lock
class noc.ip.models.prefix.Prefix

Bases: noc.core.model.base.NOCModel

Allocated prefix

class Meta

Bases: object

verbose_name
verbose_name_plural
db_table = ip_prefix
app_label = ip
unique_together = [['vrf', 'afi', 'prefix']]
parent
vrf
afi
prefix
name
profile
asn
project
vc
description
tags
tt
state
allocated_till
ipv6_transition
prefix_discovery_policy
address_discovery_policy
source
csv_ignored_fields = ['parent']
_id_cache
has_transition

Check prefix has ipv4/ipv6 transition :return:

is_ipv4
is_ipv6
is_root

Returns true if the prefix is a root of VRF

maintainers

List of persons having write access @todo: PostgreSQL-independent implementation

short_description

Returns first line of description :return:

netmask

returns Netmask for IPv4 :return:

broadcast

Returns Broadcast for IPv4 :return:

wildcard

Returns Cisco wildcard for IPv4 :return:

size

Returns IPv4 prefix size :return:

address_ranges

All prefix-related address ranges :return:

nested_prefix_set

Queryset returning all nested prefixes inside the prefix

nested_address_set

Queryset returning all nested addresses inside the prefix

effective_address_discovery
effective_prefix_discovery
effective_prefix_special_address
usage
usage_percent
address_usage
address_usage_percent
__str__(self)
classmethod get_by_id(cls, id)
get_absolute_url(self)
classmethod get_parent(cls, vrf, afi, prefix)

Get nearest closing prefix

clean(self)

Field validation

save(self, *args, **kwargs)

Save prefix

delete(self, *args, **kwargs)

Delete prefix

delete_recursive(self)

Delete prefix and all descendancies

can_view(self, user)

Returns True if user has view access :param user: :return:

can_change(self, user)

Returns True if user has change access :param user: :return:

has_bookmark(self, user)

Check the user has bookmark on prefix :param user: :return:

toggle_bookmark(self, user)

Toggle user bookmark. Returns new bookmark state :param user: :return:

get_index(self)

Full-text search

classmethod get_search_result_url(cls, obj_id)
get_path(self)
rebase(self, vrf, new_prefix)

Rebase prefix to a new location :param vrf: :param new_prefix: :return:

iter_free(self)

Generator returning all available free prefixes inside :return:

static update_prefixes_usage(prefixes)

Bulk calculate and update prefixes usages :param prefixes: List of Prefix instances :return:

is_empty(self)

Check prefix is empty and does not contain nested prefixes and addresses :return:

disable_delete_protection(self)

Disable root delete protection :return:

get_effective_as(self)

Return effective AS (first found upwards) :return: AS instance or None