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,
""" 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"]
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
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',
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' })
# -*- 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)
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' ]
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']
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',
from nodeshot.core.base.utils import check_dependencies check_dependencies(dependencies='nodeshot.core.nodes', module='nodeshot.core.layers') from layer import Layer __all__ = ['Layer']
# 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:
""" 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']
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' ]
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 ------ #
# -*- 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',
from nodeshot.core.base.utils import check_dependencies check_dependencies( dependencies=[ 'nodeshot.core.nodes', 'nodeshot.core.layers', 'nodeshot.community.participation' ], module='nodeshot.interop.open311' )
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']
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)
# 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
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' ]
# 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):
""" 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',
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
# -*- 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',
# -*- 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',
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
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' })
""" 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"})