[SEBA-742] Validating Tech-profile ID only if the subscriber is not pre-provision (same validation as onu_sn)
Change-Id: I0ff4fbc785f3a0d2e1f0c867e742ff982547a3f8
diff --git a/xos/synchronizer/migrations/0011_mandatory_tech_profile_id.py b/xos/synchronizer/migrations/0011_mandatory_tech_profile_id.py
index a1a2fbd..861aff2 100644
--- a/xos/synchronizer/migrations/0011_mandatory_tech_profile_id.py
+++ b/xos/synchronizer/migrations/0011_mandatory_tech_profile_id.py
@@ -13,7 +13,7 @@
# limitations under the License.
# -*- coding: utf-8 -*-
-# Generated by Django 1.11.20 on 2019-06-19 01:31
+# Generated by Django 1.11.21 on 2019-06-21 17:13
from __future__ import unicode_literals
import django.core.validators
@@ -23,7 +23,6 @@
class Migration(migrations.Migration):
def forwards(apps, schema_editor):
-
# set a default value on tech_profile_id for existing subscribers
subscribers = apps.get_model('rcord', 'RCORDSubscriber')
@@ -40,6 +39,6 @@
migrations.AlterField(
model_name='rcordsubscriber_decl',
name='tech_profile_id',
- field=models.IntegerField(help_text=b'Technology profile id to be used along with Technology type to retreive the profile', validators=[django.core.validators.MaxValueValidator(65535), django.core.validators.MinValueValidator(0)]),
+ field=models.IntegerField(help_text=b"Technology profile id to be used along with Technology type to retreive the profile. Make sure that the profile ID specified exists for the technology this subscriber's OLT is using.", validators=[django.core.validators.MaxValueValidator(255), django.core.validators.MinValueValidator(64)]),
),
]
diff --git a/xos/synchronizer/models/models.py b/xos/synchronizer/models/models.py
index c80cb63..fd25d01 100755
--- a/xos/synchronizer/models/models.py
+++ b/xos/synchronizer/models/models.py
@@ -251,9 +251,9 @@
if not volt_service.has_access_device(self.onu_device):
raise XOSValidationError("The onu_device you specified (%s) does not exists" % self.onu_device)
- # validate that the tech_profile_id actually exists
- if not self.validate_tech_profile_id():
- raise XOSValidationError("The technology profile you specified [%s] does not exist" % self.tech_profile_id)
+ # if the access network is managed by voltha, validate that the tech_profile_id actually exists
+ if not self.validate_tech_profile_id():
+ raise XOSValidationError("The technology profile you specified [%s] does not exist" % self.tech_profile_id)
super(RCORDSubscriber, self).save(*args, **kwargs)
self.invalidate_related_objects()
diff --git a/xos/synchronizer/models/rcord.xproto b/xos/synchronizer/models/rcord.xproto
index e08cf34..847bc23 100644
--- a/xos/synchronizer/models/rcord.xproto
+++ b/xos/synchronizer/models/rcord.xproto
@@ -63,9 +63,9 @@
help_text = "Subscriber MAC Address",
max_length = 256];
required int32 tech_profile_id = 23 [
- help_text = "Technology profile id to be used along with Technology type to retreive the profile",
- min_value = 0,
- max_value = 65535];
+ help_text = "Technology profile id to be used along with Technology type to retreive the profile. Make sure that the profile ID specified exists for the technology this subscriber's OLT is using.",
+ min_value = 64,
+ max_value = 255];
// operator specific fields
optional string nas_port_id = 20 [