Murat Parlakisik | b224cc9 | 2017-02-16 16:27:12 -0800 | [diff] [blame] | 1 | from django.db import models |
| 2 | from core.models import Service, PlCoreBase, Slice, Instance, Tenant, TenantWithContainer, Node, Image, User, Flavor, Subscriber, NetworkParameter, NetworkParameterType, Port, AddressPool |
| 3 | from core.models.plcorebase import StrippedCharField |
| 4 | import os |
| 5 | from django.db import models, transaction |
| 6 | from django.forms.models import model_to_dict |
| 7 | from django.db.models import Q |
| 8 | from operator import itemgetter, attrgetter, methodcaller |
| 9 | from core.models import Tag |
| 10 | from core.models.service import LeastLoadedNodeScheduler |
| 11 | import traceback |
| 12 | from xos.exceptions import * |
| 13 | from xos.config import Config |
| 14 | |
| 15 | |
| 16 | class ConfigurationError(Exception): |
| 17 | pass |
| 18 | |
| 19 | |
| 20 | PROGRAN_KIND = "Progran" |
| 21 | APP_LABEL = "progran" |
| 22 | |
| 23 | |
| 24 | |
| 25 | class VProgranService(Service): |
| 26 | KIND = PROGRAN_KIND |
| 27 | |
| 28 | class Meta: |
| 29 | app_label = APP_LABEL |
| 30 | verbose_name = "Progran Service" |
| 31 | proxy = True |
| 32 | |
| 33 | default_attributes = { |
| 34 | "rest_hostname": "10.6.0.1", |
| 35 | "rest_port": "8183", |
| 36 | "rest_user": "onos", |
| 37 | "rest_pass": "rocks" |
| 38 | } |
| 39 | |
| 40 | @property |
| 41 | def rest_hostname(self): |
| 42 | return self.get_attribute("rest_hostname", self.default_attributes["rest_hostname"]) |
| 43 | |
| 44 | @rest_hostname.setter |
| 45 | def rest_hostname(self, value): |
| 46 | self.set_attribute("rest_hostname", value) |
| 47 | |
| 48 | @property |
| 49 | def rest_port(self): |
| 50 | return self.get_attribute("rest_port", self.default_attributes["rest_port"]) |
| 51 | |
| 52 | @rest_port.setter |
| 53 | def rest_port(self, value): |
| 54 | self.set_attribute("rest_port", value) |
| 55 | |
| 56 | @property |
| 57 | def rest_user(self): |
| 58 | return self.get_attribute("rest_user", self.default_attributes["rest_user"]) |
| 59 | |
| 60 | @rest_user.setter |
| 61 | def rest_user(self, value): |
| 62 | self.set_attribute("rest_user", value) |
| 63 | |
| 64 | @property |
| 65 | def rest_pass(self): |
| 66 | return self.get_attribute("rest_pass", self.default_attributes["rest_pass"]) |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | class VProgranImsi(PlCoreBase): |
| 72 | class Meta: |
| 73 | app_label = APP_LABEL |
| 74 | verbose_name = "vProgran Imsi" |
| 75 | |
| 76 | uiid = models.IntegerField( help_text="uiid ", null=False, blank=False) |
| 77 | imsi = models.CharField(max_length=20, help_text="imsi ", null=False, blank=False) |
| 78 | profile = models.CharField(max_length=20, help_text="profile name", null=True, blank=True) |
| 79 | |
| 80 | |
| 81 | class VProgranProfile(PlCoreBase): |
| 82 | |
| 83 | class Meta: |
| 84 | app_label = APP_LABEL |
| 85 | verbose_name = "vProgran Profile" |
| 86 | |
| 87 | uiid = models.IntegerField( help_text="uiid ", null=False, blank=False) |
| 88 | profile = models.CharField(max_length=20, help_text="profile name", null=False, blank=False) |
| 89 | dlrate = models.IntegerField( help_text="device download rate", null=False, blank=False) |
| 90 | ulrate = models.IntegerField( help_text="device upload rate", null=False, blank=False ) |
| 91 | |