Revision b4401a0c
b/.gitignore | ||
---|---|---|
1 | 1 |
settings.py |
2 | 2 |
*.pyc |
3 | 3 |
celerybeat-schedule |
4 |
celery_jobs.log |
|
4 |
*.log |
b/flowspec/forms.py | ||
---|---|---|
7 | 7 |
from ipaddr import * |
8 | 8 |
from django.core.urlresolvers import reverse |
9 | 9 |
from django.contrib.auth.models import User |
10 |
from django.conf import settings |
|
10 | 11 |
import datetime |
11 | 12 |
|
12 | 13 |
|
... | ... | |
43 | 44 |
|
44 | 45 |
def clean_destination(self): |
45 | 46 |
data = self.cleaned_data['destination'] |
47 |
error = None |
|
46 | 48 |
if data: |
47 | 49 |
try: |
48 | 50 |
address = IPNetwork(data) |
51 |
if address.prefixlen < settings.PREFIX_LENGTH: |
|
52 |
error = "Currently no prefix lengths < %s are allowed" %settings.PREFIX_LENGTH |
|
53 |
raise forms.ValidationError('error') |
|
49 | 54 |
return self.cleaned_data["destination"] |
50 | 55 |
except Exception: |
51 |
raise forms.ValidationError('Invalid network address format') |
|
56 |
if error: |
|
57 |
error_text = error |
|
58 |
else: |
|
59 |
error_text = 'Invalid network address format' |
|
60 |
raise forms.ValidationError(error_text) |
|
52 | 61 |
|
53 | 62 |
def clean_expires(self): |
54 | 63 |
date = self.cleaned_data['expires'] |
b/flowspec/tasks.py | ||
---|---|---|
9 | 9 |
|
10 | 10 |
import os |
11 | 11 |
|
12 |
cwd = os.getcwd() |
|
13 | 12 |
|
14 |
LOG_FILENAME = os.path.join(cwd, 'log/celery_jobs.log') |
|
13 |
|
|
14 |
LOG_FILENAME = os.path.join(settings.LOG_FILE_LOCATION, 'celery_jobs.log') |
|
15 | 15 |
|
16 | 16 |
#FORMAT = '%(asctime)s %(levelname)s: %(message)s' |
17 | 17 |
#logging.basicConfig(format=FORMAT) |
b/flowspec/views.py | ||
---|---|---|
37 | 37 |
cwd = os.getcwd() |
38 | 38 |
|
39 | 39 |
|
40 |
LOG_FILENAME = os.path.join(cwd, 'log/celery_jobs.log') |
|
41 |
|
|
40 |
LOG_FILENAME = os.path.join(settings.LOG_FILE_LOCATION, 'celery_jobs.log') |
|
42 | 41 |
#FORMAT = '%(asctime)s %(levelname)s: %(message)s' |
43 | 42 |
#logging.basicConfig(format=FORMAT) |
44 | 43 |
formatter = logging.Formatter('%(asctime)s %(levelname)s: %(message)s') |
b/settings.py.dist | ||
---|---|---|
1 | 1 |
# Django settings for flowspy project. |
2 | 2 |
|
3 |
import os |
|
4 |
import djcelery |
|
5 |
djcelery.setup_loader() |
|
6 |
from celery.schedules import crontab |
|
7 |
|
|
3 | 8 |
DEBUG = True |
4 | 9 |
TEMPLATE_DEBUG = DEBUG |
5 | 10 |
|
6 | 11 |
ADMINS = ( |
7 |
# ('Your Name', 'your_email@domain.com'),
|
|
12 |
('Admin', 'admin_mail@admin.ad'),
|
|
8 | 13 |
) |
9 | 14 |
|
10 |
import djcelery |
|
11 |
djcelery.setup_loader() |
|
15 |
|
|
16 |
here = lambda x: os.path.join(os.path.abspath(os.path.dirname(__file__)), x) |
|
17 |
|
|
12 | 18 |
|
13 | 19 |
|
14 | 20 |
MANAGERS = ADMINS |
... | ... | |
139 | 145 |
|
140 | 146 |
LOGIN_URL = '/fod/welcome' |
141 | 147 |
|
142 |
CACHE_BACKEND = "memcached://127.0.0.1:11211/?timeout=600" |
|
148 |
CACHE_BACKEND = "memcached://127.0.0.1:11211/?timeout=3600"
|
|
143 | 149 |
|
144 | 150 |
AUTH_PROFILE_MODULE = 'accounts.UserProfile' |
145 | 151 |
|
146 | 152 |
NETCONF_DEVICE = "" |
147 | 153 |
NETCONF_USER = "" |
148 | 154 |
NETCONF_PASS = "" |
155 |
|
|
149 | 156 |
ROUTES_FILTER = "<configuration><routing-options><flow/></routing-options></configuration>" |
150 | 157 |
ROUTE_FILTER = "<configuration><routing-options><flow><route><name>%s</name></route></flow></routing-options></configuration>" |
151 | 158 |
COMMIT_CONFIRMED_TIMEOUT = "120" |
... | ... | |
164 | 171 |
CELERY_IMPORTS = ("flowspec.tasks", ) |
165 | 172 |
|
166 | 173 |
SERVER_EMAIL = "noreply@grnet.gr" |
167 |
EMAIL_SUBJECT_PREFIX = "[fod] " |
|
174 |
EMAIL_SUBJECT_PREFIX = "[FoD] " |
|
175 |
|
|
176 |
LOG_FILE_LOCATION = here("log") |
|
177 |
|
|
178 |
EXPIRATION_NOTIFY_DAYS = 4 |
|
179 |
PREFIX_LENGTH = 32 |
|
180 |
POLL_SESSION_UPDATE = 60.0 |
|
168 | 181 |
|
169 | 182 |
BROKER_URL = "beanstalk://localhost:11300//" |
170 | 183 |
|
... | ... | |
172 | 185 |
SHIB_ADMIN_DOMAIN = 'grnet.gr' |
173 | 186 |
SHIB_LOGOUT_URL = 'https://netdev.grnet.gr/Shibboleth.sso/Logout' |
174 | 187 |
|
175 |
from celery.schedules import crontab |
|
176 |
|
|
177 | 188 |
CELERYBEAT_SCHEDULE = { |
178 | 189 |
# Executes every day at 01:35 AM |
179 | 190 |
"every-day-sync": { |
180 | 191 |
"task": "flowspec.tasks.check_sync", |
181 |
"schedule": crontab(minute=35, hour=01),
|
|
192 |
"schedule": crontab(minute=01, hour=01),
|
|
182 | 193 |
"args": (), |
183 | 194 |
}, |
184 | 195 |
} |
b/utils/proxy.py | ||
---|---|---|
10 | 10 |
cwd = os.getcwd() |
11 | 11 |
|
12 | 12 |
|
13 |
LOG_FILENAME = os.path.join(cwd, 'log/celery_jobs.log')
|
|
13 |
LOG_FILENAME = os.path.join(settings.LOG_FILE_LOCATION, 'celery_jobs.log')
|
|
14 | 14 |
|
15 | 15 |
#FORMAT = '%(asctime)s %(levelname)s: %(message)s' |
16 | 16 |
#logging.basicConfig(format=FORMAT) |
Also available in: Unified diff