blob: 0b9df0f87cb767b417320c6d9303a8b9971d766c [file] [log] [blame]
Matteo Scandoloa4a279a2019-03-14 15:56:22 -07001# Copyright 2017-present Open Networking Foundation
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15# -*- coding: utf-8 -*-
16# Generated by Django 1.11.11 on 2019-03-14 22:35
17from __future__ import unicode_literals
18
19import core.models.xosbase_header
20from django.db import migrations, models
21import django.db.models.deletion
22import django.utils.timezone
23
24
25class Migration(migrations.Migration):
26
27 def forwards(apps, schema_editor):
28 # create a default bandwidth profile
29 Model = apps.get_model('rcord', 'BandwidthProfile')
30 bp = Model(
31 name="default",
32 cir=10000,
33 cbs=10000,
34 eir=10000,
35 ebs=10000,
36 air=10000,
37 )
38 bp.save()
39
40 # assign the default bandwidth profile to all subscribers
41 subscribers = apps.get_model('rcord', 'RCORDSubscriber')
42
43 for s in subscribers.objects.all():
44 s.downstream_bps = bp
45 s.upstream_bps = bp
46 s.save()
47
48 dependencies = [
49 ('rcord', '0004_bandwidth_profiles'),
50 ]
51
52 operations = [
53 migrations.RunPython(forwards),
54 ]