blob: c85cded4d01f9e196783553396f2f83dc0958c0d [file] [log] [blame]
Matteo Scandoloc3ca49b2017-08-08 13:05:26 -07001
2# Copyright 2017-present Open Networking Foundation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
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 implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16
Murat Parlakisikb224cc92017-02-16 16:27:12 -080017from django.db import models
Sapan Bhatia99529ed2017-05-19 23:10:52 +020018from core.models import Service, XOSBase, Slice, Instance, Tenant, TenantWithContainer, Node, Image, User, Flavor, Subscriber, NetworkParameter, NetworkParameterType, Port, AddressPool
19from core.models.xosbase import StrippedCharField
Murat Parlakisikb224cc92017-02-16 16:27:12 -080020import os
21from django.db import models, transaction
22from django.forms.models import model_to_dict
23from django.db.models import Q
24from operator import itemgetter, attrgetter, methodcaller
25from core.models import Tag
26from core.models.service import LeastLoadedNodeScheduler
27import traceback
28from xos.exceptions import *
29from xos.config import Config
30
31
32class ConfigurationError(Exception):
33 pass
34
35
36PROGRAN_KIND = "Progran"
37APP_LABEL = "progran"
38
39
40
41class VProgranService(Service):
42 KIND = PROGRAN_KIND
43
44 class Meta:
45 app_label = APP_LABEL
46 verbose_name = "Progran Service"
47 proxy = True
48
49 default_attributes = {
50 "rest_hostname": "10.6.0.1",
51 "rest_port": "8183",
52 "rest_user": "onos",
53 "rest_pass": "rocks"
54 }
55
56 @property
57 def rest_hostname(self):
58 return self.get_attribute("rest_hostname", self.default_attributes["rest_hostname"])
59
60 @rest_hostname.setter
61 def rest_hostname(self, value):
62 self.set_attribute("rest_hostname", value)
63
64 @property
65 def rest_port(self):
66 return self.get_attribute("rest_port", self.default_attributes["rest_port"])
67
68 @rest_port.setter
69 def rest_port(self, value):
70 self.set_attribute("rest_port", value)
71
72 @property
73 def rest_user(self):
74 return self.get_attribute("rest_user", self.default_attributes["rest_user"])
75
76 @rest_user.setter
77 def rest_user(self, value):
78 self.set_attribute("rest_user", value)
79
80 @property
81 def rest_pass(self):
82 return self.get_attribute("rest_pass", self.default_attributes["rest_pass"])
83
84
85
86
Sapan Bhatia99529ed2017-05-19 23:10:52 +020087class VProgranImsi(XOSBase):
Murat Parlakisikb224cc92017-02-16 16:27:12 -080088 class Meta:
89 app_label = APP_LABEL
90 verbose_name = "vProgran Imsi"
91
92 uiid = models.IntegerField( help_text="uiid ", null=False, blank=False)
93 imsi = models.CharField(max_length=20, help_text="imsi ", null=False, blank=False)
94 profile = models.CharField(max_length=20, help_text="profile name", null=True, blank=True)
95
96
Sapan Bhatia99529ed2017-05-19 23:10:52 +020097class VProgranProfile(XOSBase):
Murat Parlakisikb224cc92017-02-16 16:27:12 -080098
99 class Meta:
100 app_label = APP_LABEL
101 verbose_name = "vProgran Profile"
102
103 uiid = models.IntegerField( help_text="uiid ", null=False, blank=False)
104 profile = models.CharField(max_length=20, help_text="profile name", null=False, blank=False)
105 dlrate = models.IntegerField( help_text="device download rate", null=False, blank=False)
106 ulrate = models.IntegerField( help_text="device upload rate", null=False, blank=False )
107