Ejemplo n.º 1
0
}

PLUGINS = [
    "nautobot.extras.tests.dummy_plugin",
]

SECRET_KEY = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"

# Redis variables
REDIS_HOST = os.getenv("NAUTOBOT_REDIS_HOST", "localhost")
REDIS_PORT = os.getenv("NAUTOBOT_REDIS_PORT", 6379)
REDIS_PASSWORD = os.getenv("NAUTOBOT_REDIS_PASSWORD", "")

# Check for Redis SSL
REDIS_SCHEME = "redis"
REDIS_SSL = is_truthy(os.environ.get("NAUTOBOT_REDIS_SSL", False))
if REDIS_SSL:
    REDIS_SCHEME = "rediss"

# The django-redis cache is used to establish concurrent locks using Redis. The
# django-rq settings will use the same instance/database by default.
#
# This "default" server is now used by RQ_QUEUES.
# >> See: nautobot.core.settings.RQ_QUEUES
CACHES = {
    "default": {
        "BACKEND": "django_redis.cache.RedisCache",
        "LOCATION": f"{REDIS_SCHEME}://{REDIS_HOST}:{REDIS_PORT}/2",
        "TIMEOUT": 300,
        "OPTIONS": {
            "CLIENT_CLASS": "django_redis.client.DefaultClient",
Ejemplo n.º 2
0
     # when you run a backup job, and <foo> is the name of the platform applied to the device.
     # to the Nornir driver names ("arista_eos", "cisco_ios", etc.).
     # "dispatcher_mapping": {
     #     "eos": "nornir_nautobot.plugins.tasks.dispatcher.arista_eos.NautobotNornirDriver",
     #     "arbitrary_platform_name": "nornir_nautobot.plugins.tasks.dispatcher.arista_eos.NautobotNornirDriver",
     #     "ios": "nornir_nautobot.plugins.tasks.dispatcher.cisco_ios.NautobotNornirDriver",
     #     "iosxe": "nornir_nautobot.plugins.tasks.dispatcher.cisco_ios.NautobotNornirDriver",
     #     "junos": "nornir_nautobot.plugins.tasks.dispatcher.juniper_junos.NautobotNornirDriver",
     #     "nxos": "nornir_nautobot.plugins.tasks.dispatcher.cisco_nxos.NautobotNornirDriver",
     # },
 },
 "nautobot_golden_config": {
     "per_feature_bar_width": float(os.environ.get("PER_FEATURE_BAR_WIDTH", 0.15)),
     "per_feature_width": int(os.environ.get("PER_FEATURE_WIDTH", 13)),
     "per_feature_height": int(os.environ.get("PER_FEATURE_HEIGHT", 4)),
     "enable_backup": is_truthy(os.environ.get("ENABLE_BACKUP", True)),
     "enable_compliance": is_truthy(os.environ.get("ENABLE_COMPLIANCE", True)),
     "enable_intended": is_truthy(os.environ.get("ENABLE_INTENDED", True)),
     "enable_sotagg": is_truthy(os.environ.get("ENABLE_SOTAGG", True)),
     "sot_agg_transposer": os.environ.get("SOT_AGG_TRANSPOSER"),
     # The platform_slug_map maps an arbitrary platform slug to its corresponding parser.
     # Use this if the platform slug names in your Nautobot instance don't correspond exactly
     # to the Nornir driver names ("arista_eos", "cisco_ios", etc.).
     # Each key should == the slug of the Nautobot platform object.
     # "platform_slug_map": {
     #     "eos": "arista_eos",
     #     "ios": "cisco_ios",
     #     "iosxe": "cisco_ios",
     #     "junos": "juniper_junos",
     #     "nxos": "cisco_nxos",
     # },
Ejemplo n.º 3
0
    def test_is_truthy(self):
        self.assertTrue(is_truthy("true"))
        self.assertTrue(is_truthy("True"))
        self.assertTrue(is_truthy(True))
        self.assertTrue(is_truthy("yes"))
        self.assertTrue(is_truthy("on"))
        self.assertTrue(is_truthy("y"))
        self.assertTrue(is_truthy("1"))
        self.assertTrue(is_truthy(1))

        self.assertFalse(is_truthy("false"))
        self.assertFalse(is_truthy("False"))
        self.assertFalse(is_truthy(False))
        self.assertFalse(is_truthy("no"))
        self.assertFalse(is_truthy("n"))
        self.assertFalse(is_truthy(0))
        self.assertFalse(is_truthy("0"))
Ejemplo n.º 4
0
        "NAME": os.getenv("NAUTOBOT_DB_NAME", "nautobot"),
        "USER": os.getenv("NAUTOBOT_DB_USER", ""),
        "PASSWORD": os.getenv("NAUTOBOT_DB_PASSWORD", ""),
        "HOST": os.getenv("NAUTOBOT_DB_HOST", "localhost"),
        "PORT": os.getenv("NAUTOBOT_DB_PORT", ""),
        "CONN_MAX_AGE": int(os.getenv("NAUTOBOT_DB_TIMEOUT", 300)),
        "ENGINE": os.getenv("NAUTOBOT_DB_ENGINE",
                            "django.db.backends.postgresql"),
    }
}

#
# Debug
#

DEBUG = is_truthy(os.getenv("NAUTOBOT_DEBUG", True))

# Django Debug Toolbar
DEBUG_TOOLBAR_CONFIG = {
    "SHOW_TOOLBAR_CALLBACK": lambda _request: DEBUG and not TESTING
}

if "debug_toolbar" not in INSTALLED_APPS:
    INSTALLED_APPS.append("debug_toolbar")
if "debug_toolbar.middleware.DebugToolbarMiddleware" not in MIDDLEWARE:
    MIDDLEWARE.insert(0, "debug_toolbar.middleware.DebugToolbarMiddleware")

#
# Logging
#