blob: c83461c8d00467cf5c74360e9835c960f1dc50de [file] [log] [blame]
srikanth116e6e82014-08-19 07:22:37 -07001#
2# Copyright (c) 2013 Big Switch Networks, Inc.
3#
4# Licensed under the Eclipse Public License, Version 1.0 (the
5# "License"); you may not use this file except in compliance with the
6# License. You may obtain a copy of the License at
7#
8# http://www.eclipse.org/legal/epl-v10.html
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13# implied. See the License for the specific language governing
14# permissions and limitations under the License.
15#
16
17from django.db import models
Srikanth Vavilapalli669ba8a2014-10-16 11:41:19 -070018"""
srikanth116e6e82014-08-19 07:22:37 -070019class SyncdConfig(models.Model):
20
21 # id is set to the local cluster id.
22 id = models.CharField(
23 primary_key=True,
24 max_length=128)
25
26 # Enable syncing to the cloud
27 enabled = models.BooleanField(
28 verbose_name='Enabled',
29 help_text='Is syncing to the cloud enabled',
30 default=False)
31
32 # Log level for the syncd daemon process
33 log_level = models.CharField(
34 max_length=32,
35 verbose_name='Log Level',
36 help_text='Log level for the syncd daemon process',
37 default='warning')
38
39 sync_period = models.PositiveIntegerField(
40 verbose_name='Sync Period',
41 help_text='How often (in seconds) local data is synced to the cloud',
42 default=300)
43
44 sync_overlap = models.PositiveIntegerField(
45 verbose_name='Sync Overlap',
46 help_text='Overlap (in seconds) of the time range of a sync iteration with the previous sync iteration',
47 default=30)
48
49 class Rest:
50 NAME = 'syncd-config'
51 FIELD_INFO = (
52 {'name': 'log_level', 'rest_name': 'log-level'},
53 {'name': 'sync_period', 'rest_name': 'sync-period'},
54 {'name': 'sync_overlap', 'rest_name': 'sync-overlap'},
55 )
56
57class SyncdTransportConfig(models.Model):
58
59 # Composite key of <syncd-config-id>:<transport-name>
60 id = models.CharField(
61 primary_key=True,
62 max_length=256)
63
64 config = models.ForeignKey(
65 SyncdConfig,
66 blank=True,
67 null=True)
68
69 name = models.CharField(
70 max_length=128,
71 blank=True,
72 null=True)
73
74 type = models.CharField(
75 max_length=32,
76 blank=True,
77 null=True)
78
79 args = models.TextField(
80 blank=True,
81 null=True)
82
83 target_cluster = models.CharField(
84 max_length=256,
85 blank=True,
86 null=True)
87
88 class Rest:
89 NAME = 'syncd-transport-config'
90 FIELD_INFO = (
91 {'name': 'target_cluster', 'rest_name': 'target-cluster'},
92 )
93
94class SyncdProgressInfo(models.Model):
95
96 # id value is per-controller-node and per-syncd-transport, so the id is
97 # <controller-node id>:<transport-name>
98 id = models.CharField(
99 primary_key=True,
100 max_length=256)
101
102 data_start_time = models.PositiveIntegerField(
103 verbose_name='Data Start Time',
104 help_text='Timestamp of earliest data available for syncing',
105 blank=True,
106 null=True)
107
108 last_sync_time = models.PositiveIntegerField(
109 verbose_name='Last Sync Time',
110 help_text='Last time that data was successfully synced to the cloud from the local controller node',
111 blank=True,
112 null=True)
113
114 class Rest:
115 NAME = 'syncd-progress-info'
116 FIELD_INFO = (
117 {'name': 'data_start_time', 'rest_name': 'data-start-time'},
118 {'name': 'last_sync_time', 'rest_name': 'last-sync-time'},
119 )
Srikanth Vavilapalli669ba8a2014-10-16 11:41:19 -0700120"""