Exemplo n.º 1
0
    raise ImportError('libcnml not installed, install it with "pip install libcnml"')

from nodeshot.core.base.utils import check_dependencies
from nodeshot.core.nodes.models import Node, Status
from nodeshot.networking.net.models import Device, Interface, Ethernet, Wireless, Ip
from nodeshot.networking.links.models import Link
from nodeshot.networking.net.models.choices import INTERFACE_TYPES
from nodeshot.networking.links.models.choices import LINK_TYPES, LINK_STATUS


from .base import GenericGisSynchronizer

check_dependencies(
    dependencies=[
        'nodeshot.networking.net',
        'nodeshot.networking.links',
    ],
    module='nodeshot.interop.sync.synchronizers.cnml'
)


class Cnml(GenericGisSynchronizer):
    """ CNML synchronizer """
    SCHEMA = GenericGisSynchronizer.SCHEMA[0:2]

    STATUS_MAPPING = {
        'planned': {
            'is_default': True,
            'slug': 'planned',
            'description': 'Planned node',
            'order': 0,
Exemplo n.º 2
0
"""
Dependencies:
    * nodeshot.core.nodes
    * nodeshot.networking.net
    * django_hstore
"""

from nodeshot.core.base.utils import check_dependencies

check_dependencies(
    dependencies=["nodeshot.core.nodes", "nodeshot.networking.net", "django_hstore"],
    module="nodeshot.networking.connector",
)


from .device_connector import DeviceConnector


__all__ = ["DeviceConnector"]
Exemplo n.º 3
0
from nodeshot.core.base.utils import check_dependencies

check_dependencies(
    dependencies=[
        'nodeshot.core.layers',
        'nodeshot.core.nodes',
    ],
    module='nodeshot.interoperability'
)


from .layer_external import LayerExternal
from .node_external import NodeExternal


__all__ = ['LayerExternal', 'NodeExternal']


# ------ patch LayerNodesList view to support external layers ------ #

from nodeshot.core.layers.views import LayerNodesList

def get_nodes(self, request, *args, **kwargs):
    if self.layer.is_external and hasattr(self.layer.external, 'get_nodes'):
        return self.layer.external.get_nodes(self.__class__.__name__, request.QUERY_PARAMS)
    else:
        return (self.list(request, *args, **kwargs)).data

LayerNodesList.get_nodes = get_nodes
Exemplo n.º 4
0
from nodeshot.core.base.utils import check_dependencies

check_dependencies(
    dependencies='nodeshot.core.nodes',
    module='nodeshot.networking.net'
)


from routing_protocol import RoutingProtocol
from device import Device
from interface import Interface
from ip import Ip

from interfaces.ethernet import Ethernet
from interfaces.wireless import Wireless
from interfaces.bridge import Bridge
from interfaces.tunnel import Tunnel
from interfaces.vlan import Vlan
from interfaces.vap import Vap


__all__ = [
    'RoutingProtocol',
    'Device',
    'Interface',
    'Ip',
    'Ethernet',
    'Wireless',
    'Bridge',
    'Tunnel',
    'Vlan',
Exemplo n.º 5
0
from nodeshot.core.base.utils import check_dependencies
from layer import Layer


__all__ = ['Layer']


check_dependencies(
    dependencies='nodeshot.core.nodes',
    module='nodeshot.core.layers'
)


# ------ Add relationship to ExtensibleNodeSerializer ------ #

from nodeshot.core.nodes.serializers import ExtensibleNodeSerializer

ExtensibleNodeSerializer.add_relationship(**{
    'name': 'layer',
    'view_name': 'api_layer_detail',
    'lookup_field': 'layer.slug'
})
Exemplo n.º 6
0
# -*- coding: utf-8 -*-
"""
this app can import data from older nodeshot versions (0.9)
developed to import data from map.ninux.org into the new version of nodeshot
"""

from nodeshot.core.base.utils import check_dependencies

check_dependencies(dependencies=[
    'nodeshot.core.nodes',
    'nodeshot.core.layers',
    'nodeshot.networking.net',
    'nodeshot.networking.links',
    'nodeshot.community.mailing',
    'nodeshot.community.profiles',
],
                   module='nodeshot.interop.oldimporter')

from django.db import models
from django.utils.translation import ugettext_lazy as _

from .choices import *

__all__ = [
    'OldNode', 'OldDevice', 'OldHna', 'OldInterface', 'OldLink',
    'OldStatistic', 'OldContact', 'OldUser'
]


class OldNode(models.Model):
    name = models.CharField(_('name'), max_length=50, unique=True)
Exemplo n.º 7
0
from nodeshot.core.base.utils import check_dependencies

check_dependencies(
    dependencies='nodeshot.networking.net',
    module='nodeshot.networking.hardware'
)


from base import ImageMixin
from manufacturer import Manufacturer
from mac_prefix import MacPrefix
from device_model import DeviceModel
from antenna_model import AntennaModel
from radiation_pattern import RadiationPattern
from antenna import Antenna
from device_to_model_rel import DeviceToModelRel


__all__ = [
    'ImageMixin',
    'Manufacturer',
    'MacPrefix',
    'DeviceModel',
    'AntennaModel',
    'RadiationPattern',
    'Antenna',
    'DeviceToModelRel'
]
Exemplo n.º 8
0
from nodeshot.core.base.utils import check_dependencies

check_dependencies(
    dependencies=['nodeshot.core.nodes', 'nodeshot.community.profiles'],
    module='nodeshot.community.participation')

from django.core.exceptions import ObjectDoesNotExist
from django.conf import settings

from comment import Comment
from vote import Vote
from rating import Rating

from node_participation_settings import NodeParticipationSettings
from node_rating_count import NodeRatingCount

__all__ = [
    'Comment',
    'Vote',
    'Rating',
    'NodeParticipationSettings',
    'NodeRatingCount',
]

# ------ Layers Operations ------ #

if 'nodeshot.core.layers' in settings.INSTALLED_APPS:
    from layer_participation_settings import LayerParticipationSettings

    __all__ += ['LayerParticipationSettings']
Exemplo n.º 9
0
except ImportError:
    raise ImportError(
        'libcnml not installed, install it with "pip install libcnml"')

from nodeshot.core.base.utils import check_dependencies
from nodeshot.core.nodes.models import Node, Status
from nodeshot.networking.net.models import Device, Interface, Ethernet, Wireless, Ip
from nodeshot.networking.links.models import Link
from nodeshot.networking.net.models.choices import INTERFACE_TYPES
from nodeshot.networking.links.models.choices import LINK_TYPES, LINK_STATUS

from .base import GenericGisSynchronizer

check_dependencies(dependencies=[
    'nodeshot.networking.net',
    'nodeshot.networking.links',
],
                   module='nodeshot.interop.sync.synchronizers.cnml')


class Cnml(GenericGisSynchronizer):
    """ CNML synchronizer """
    SCHEMA = GenericGisSynchronizer.SCHEMA[0:2]

    STATUS_MAPPING = {
        'planned': {
            'is_default': True,
            'slug': 'planned',
            'description': 'Planned node',
            'order': 0,
            'name': 'Planned',
Exemplo n.º 10
0
from nodeshot.core.base.utils import check_dependencies

check_dependencies(dependencies='nodeshot.core.nodes',
                   module='nodeshot.core.layers')

from layer import Layer

__all__ = ['Layer']
Exemplo n.º 11
0
# part of the code of this app is based on pinax.account

from django.conf import settings
from nodeshot.core.base.utils import check_dependencies

if settings.NODESHOT['SETTINGS'].get('PROFILE_EMAIL_CONFIRMATION', True):
    check_dependencies(dependencies='emailconfirmation',
                       module='nodeshot.community.profiles')

from .profile import Profile
from .social_link import SocialLink
from .password_reset import PasswordReset

__all__ = ['Profile', 'SocialLink', 'PasswordReset']

# ------ SIGNALS ------ #

# perform certain actions when some other parts of the application changes
# eg: update user statistics when a new device is added

from django.contrib.auth.models import Group
from django.dispatch import receiver
from django.db.models.signals import post_save


@receiver(post_save, sender=Profile)
def new_user(sender, **kwargs):
    """ operations to be performed each time a new user is created """
    created = kwargs['created']
    user = kwargs['instance']
    if created:
Exemplo n.º 12
0
"""
Dependencies:
    * nodeshot.core.nodes
    * nodeshot.networking.net
    * django_hstore
"""

from nodeshot.core.base.utils import check_dependencies

check_dependencies(
    dependencies=[
        'nodeshot.core.nodes',
        'nodeshot.networking.net',
        'django_hstore'
    ],
    module='nodeshot.networking.connector'
)


from .device_connector import DeviceConnector


__all__ = ['DeviceConnector']
Exemplo n.º 13
0
from nodeshot.core.base.utils import check_dependencies

check_dependencies(dependencies='nodeshot.networking.net',
                   module='nodeshot.networking.hardware')

from base import ImageMixin
from manufacturer import Manufacturer
from mac_prefix import MacPrefix
from device_model import DeviceModel
from antenna_model import AntennaModel
from radiation_pattern import RadiationPattern
from antenna import Antenna
from device_to_model_rel import DeviceToModelRel

__all__ = [
    'ImageMixin', 'Manufacturer', 'MacPrefix', 'DeviceModel', 'AntennaModel',
    'RadiationPattern', 'Antenna', 'DeviceToModelRel'
]
Exemplo n.º 14
0
from nodeshot.core.base.utils import check_dependencies

check_dependencies(
    dependencies=[
        'nodeshot.core.nodes',
        'nodeshot.community.profiles'
    ],
    module='nodeshot.community.participation'
)

from django.core.exceptions import ObjectDoesNotExist
from django.conf import settings

from comment import Comment
from vote import Vote
from rating import Rating

from node_participation_settings import NodeParticipationSettings
from node_rating_count import NodeRatingCount


__all__ = [
    'Comment',
    'Vote',
    'Rating',
    'NodeParticipationSettings',
    'NodeRatingCount',
]


# ------ Layers Operations ------ #
Exemplo n.º 15
0
# -*- coding: utf-8 -*-
"""
this app can import data from older nodeshot versions (0.9)
developed to import data from map.ninux.org into the new version of nodeshot
"""

from nodeshot.core.base.utils import check_dependencies

check_dependencies(
    dependencies=[
        'nodeshot.core.nodes',
        'nodeshot.core.layers',
        'nodeshot.networking.net',
        'nodeshot.networking.links',
        'nodeshot.community.mailing',
        'nodeshot.community.profiles',
    ],
    module='nodeshot.community.participation'
)

from django.db import models
from django.utils.translation import ugettext_lazy as _

from .choices import *


__all__ = [
    'OldNode',
    'OldDevice',
    'OldHna',
    'OldInterface',
Exemplo n.º 16
0
from nodeshot.core.base.utils import check_dependencies

check_dependencies(
    dependencies=[
        'nodeshot.core.nodes',
        'nodeshot.core.layers',
        'nodeshot.community.participation'
    ],
    module='nodeshot.interop.open311'
)
Exemplo n.º 17
0
from nodeshot.core.base.utils import check_dependencies

check_dependencies(
    dependencies='nodeshot.community.profiles',
    module='nodeshot.community.notifications'
)


from django.conf import settings
from .notification import Notification
from .user_settings import UserEmailNotificationSettings, UserWebNotificationSettings


__all__ = [
    'Notification',
    'UserWebNotificationSettings',
    'UserEmailNotificationSettings'
]


from django.dispatch import receiver
from django.db.models.signals import post_save
from nodeshot.community.profiles.models import Profile


if 'nodeshot.community.notifications' in settings.INSTALLED_APPS:
    @receiver(post_save, sender=Profile)
    def create_settings(sender, **kwargs):
        """ create user notification settings on user creation """
        created = kwargs['created']
        user = kwargs['instance']
Exemplo n.º 18
0
from nodeshot.core.base.utils import check_dependencies

check_dependencies(
    dependencies=[
        'django_hstore',
        'nodeshot.core.layers',
        'nodeshot.core.nodes',
    ],
    module='nodeshot.interop.sync'
)


from .layer_external import LayerExternal
from .node_external import NodeExternal


__all__ = ['LayerExternal', 'NodeExternal']


# ------ patch LayerNodesList view to support external layers ------ #

from nodeshot.core.layers.views import LayerNodesList

def get_nodes(self, request, *args, **kwargs):
    try:
        external = self.layer.external
    except LayerExternal.DoesNotExist:
        external = False
    # override view get_nodes method if we have a custom one
    if external and self.layer.is_external and hasattr(external, 'get_nodes'):
        return external.get_nodes(self.__class__.__name__, request.QUERY_PARAMS)
Exemplo n.º 19
0
# part of the code of this app is based on pinax.account

from django.conf import settings
from nodeshot.core.base.utils import check_dependencies

if settings.NODESHOT["SETTINGS"].get("PROFILE_EMAIL_CONFIRMATION", True):
    check_dependencies(dependencies="emailconfirmation", module="nodeshot.community.profiles")


from .profile import Profile
from .social_link import SocialLink
from .password_reset import PasswordReset

__all__ = ["Profile", "SocialLink", "PasswordReset"]


# ------ Add relationship to ExtensibleNodeSerializer ------ #

from nodeshot.core.nodes.base import ExtensibleNodeSerializer

ExtensibleNodeSerializer.add_relationship(
    **{"name": "user", "view_name": "api_profile_detail", "lookup_field": "user.username"}
)


# ------ SIGNALS ------ #

# perform certain actions when some other parts of the application changes
# eg: update user statistics when a new device is added

from django.contrib.auth.models import Group
Exemplo n.º 20
0
from nodeshot.core.base.utils import check_dependencies

check_dependencies(dependencies='nodeshot.community.profiles',
                   module='nodeshot.community.notifications')

from .notification import Notification
from .user_settings import UserEmailNotificationSettings, UserWebNotificationSettings

__all__ = [
    'Notification', 'UserWebNotificationSettings',
    'UserEmailNotificationSettings'
]
Exemplo n.º 21
0
# part of the code of this app is based on pinax.account

from django.conf import settings
from nodeshot.core.base.utils import check_dependencies

if settings.NODESHOT['SETTINGS'].get('PROFILE_EMAIL_CONFIRMATION', True):
    check_dependencies(
        dependencies='emailconfirmation',
        module='nodeshot.community.profiles'
    )


from .profile import Profile
from .social_link import SocialLink
from .password_reset import PasswordReset

__all__ = ['Profile', 'SocialLink', 'PasswordReset']


# ------ SIGNALS ------ #

# perform certain actions when some other parts of the application changes
# eg: update user statistics when a new device is added

from django.contrib.auth.models import Group
from django.dispatch import receiver
from django.db.models.signals import post_save


@receiver(post_save, sender=Profile)
def new_user(sender, **kwargs):
Exemplo n.º 22
0
"""
Dependencies:
    * nodeshot.core.nodes
    * nodeshot.networking.net
"""

from nodeshot.core.base.utils import check_dependencies

check_dependencies(
    dependencies=[
        'nodeshot.core.nodes',
        'nodeshot.core.layers',
        'nodeshot.networking.net'
    ],
    module='nodeshot.networking.links'
)


from .link import Link


__all__ = ['Link']


# ------ Add relationship to NodeDetailSerializer ------ #

from nodeshot.core.nodes.serializers import ExtensibleNodeSerializer

ExtensibleNodeSerializer.add_relationship(**{
    'name': 'links',
    'view_name': 'api_node_links',
Exemplo n.º 23
0
from nodeshot.core.base.utils import check_dependencies

check_dependencies(dependencies=[
    'nodeshot.core.layers',
    'nodeshot.core.nodes',
],
                   module='nodeshot.interoperability')

from .layer_external import LayerExternal
from .node_external import NodeExternal

__all__ = ['LayerExternal', 'NodeExternal']

# ------ patch LayerNodesList view to support external layers ------ #

from nodeshot.core.layers.views import LayerNodesList


def get_nodes(self, request, *args, **kwargs):
    if self.layer.is_external and hasattr(self.layer.external, 'get_nodes'):
        return self.layer.external.get_nodes(self.__class__.__name__,
                                             request.QUERY_PARAMS)
    else:
        return (self.list(request, *args, **kwargs)).data


LayerNodesList.get_nodes = get_nodes
Exemplo n.º 24
0
from nodeshot.core.base.utils import check_dependencies

check_dependencies(
    dependencies='nodeshot.core.nodes',
    module='nodeshot.networking.net'
)


from routing_protocol import RoutingProtocol
from device import Device
from interface import Interface
from ip import Ip

from interfaces.ethernet import Ethernet
from interfaces.wireless import Wireless
from interfaces.bridge import Bridge
from interfaces.tunnel import Tunnel
from interfaces.vlan import Vlan
from interfaces.vap import Vap


__all__ = [
    'RoutingProtocol',
    'Device',
    'Interface',
    'Ip',
    'Ethernet',
    'Wireless',
    'Bridge',
    'Tunnel',
    'Vlan',
Exemplo n.º 25
0
# -*- coding: utf-8 -*-
"""
this app can import data from older nodeshot versions (0.9)
developed to import data from map.ninux.org into the new version of nodeshot
"""

from nodeshot.core.base.utils import check_dependencies

check_dependencies(dependencies=[
    'nodeshot.core.nodes',
    'nodeshot.core.layers',
    'nodeshot.networking.net',
    'nodeshot.networking.links',
    'nodeshot.community.mailing',
    'nodeshot.community.profiles',
],
                   module='nodeshot.community.participation')

from django.db import models
from django.utils.translation import ugettext_lazy as _

from .choices import *

__all__ = [
    'OldNode',
    'OldDevice',
    'OldHna',
    'OldInterface',
    'OldLink',
    'OldStatistic',
    'OldContact',
Exemplo n.º 26
0
# -*- coding: utf-8 -*-
"""
this app can import data from older nodeshot versions (0.9)
developed to import data from map.ninux.org into the new version of nodeshot
"""

from nodeshot.core.base.utils import check_dependencies

check_dependencies(
    dependencies=[
        'nodeshot.core.nodes',
        'nodeshot.core.layers',
        'nodeshot.networking.net',
        'nodeshot.networking.links',
        'nodeshot.community.mailing',
        'nodeshot.community.profiles',
    ],
    module='nodeshot.interop.oldimporter'
)

from django.db import models
from django.utils.translation import ugettext_lazy as _

from .choices import *


__all__ = [
    'OldNode',
    'OldDevice',
    'OldHna',
    'OldInterface',
Exemplo n.º 27
0
from nodeshot.core.base.utils import check_dependencies

check_dependencies(dependencies=[
    'django_hstore',
    'nodeshot.core.layers',
    'nodeshot.core.nodes',
],
                   module='nodeshot.interop.sync')

from .layer_external import LayerExternal
from .node_external import NodeExternal

__all__ = ['LayerExternal', 'NodeExternal']

# ------ patch LayerNodesList view to support external layers ------ #

from nodeshot.core.layers.views import LayerNodesList


def get_nodes(self, request, *args, **kwargs):
    try:
        external = self.layer.external
    except LayerExternal.DoesNotExist:
        external = False
    # override view get_nodes method if we have a custom one
    if external and self.layer.is_external and hasattr(external, 'get_nodes'):
        return external.get_nodes(self.__class__.__name__,
                                  request.QUERY_PARAMS)
    # otherwise return the standard one
    else:
        return (self.list(request, *args, **kwargs)).data
Exemplo n.º 28
0
from nodeshot.core.base.utils import check_dependencies

check_dependencies(
    dependencies='nodeshot.core.nodes',
    module='nodeshot.community.mailing'
)


from inward import Inward
from outward import Outward

__all__ = [
    'Inward',
    'Outward',
]


# ------ Add relationship to ExtensibleNodeSerializer ------ #

from nodeshot.core.nodes.serializers import ExtensibleNodeSerializer

ExtensibleNodeSerializer.add_relationship(**{
    'name': 'contact',
    'view_name': 'api_node_contact',
    'lookup_field': 'slug'
})
Exemplo n.º 29
0
"""
Dependencies:
    * nodeshot.core.nodes
    * nodeshot.networking.net
"""

from nodeshot.core.base.utils import check_dependencies

check_dependencies(dependencies=["nodeshot.core.nodes", "nodeshot.networking.net"], module="nodeshot.networking.links")


from .link import Link


__all__ = ["Link"]


# ------ Add relationship to NodeDetailSerializer ------ #

from nodeshot.core.nodes.serializers import ExtensibleNodeSerializer

ExtensibleNodeSerializer.add_relationship(**{"name": "links", "view_name": "api_node_links", "lookup_field": "slug"})