SEBA-566 Add linting and fix errors in olt-service
Change-Id: I5f766180242714673500199eb55509286489b60b
diff --git a/Makefile b/Makefile
index 74fb7e5..47ae8c9 100644
--- a/Makefile
+++ b/Makefile
@@ -52,7 +52,7 @@
docker-push:
docker push ${DOCKER_IMAGENAME}
-test: test-unit test-migration
+test: test-unit test-migration test-xproto
test-unit:
tox
@@ -60,7 +60,7 @@
venv-service:
virtualenv $@;\
source ./$@/bin/activate ; set -u ;\
- pip install -r requirements.txt xosmigrate~=3.0.1
+ pip install -r requirements.txt xosmigrate~=3.2.1
create-migration: venv-service
source ./venv-service/bin/activate; set -u;\
@@ -70,6 +70,10 @@
source ./venv-service/bin/activate; set -u;\
cd xos; xos-migrate --xos-dir ${XOS_DIR} --services-dir ${SERVICES_DIR} -s ${SERVICE_NAME} --check
+test-xproto: venv-service
+ source ./venv-service/bin/activate; set -u;\
+ xosgenx --lint --strict xos/synchronizer/models/volt.xproto
+
clean:
find . -name '*.pyc' | xargs rm -f
rm -rf \
diff --git a/VERSION b/VERSION
index 924d548..cfd3054 100644
--- a/VERSION
+++ b/VERSION
@@ -1,2 +1,2 @@
-2.2.1.dev1
+2.2.1.dev2
diff --git a/requirements.txt b/requirements.txt
index e039eea..669c29b 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,3 +1,3 @@
-xossynchronizer~=3.0.1
-xosapi~=3.0.1
-xoskafka~=3.0.1
+xossynchronizer~=3.2.1
+xosapi~=3.2.1
+xoskafka~=3.2.1
diff --git a/xos/synchronizer/migrations/0005_auto_20190410_0026.py b/xos/synchronizer/migrations/0005_auto_20190410_0026.py
new file mode 100644
index 0000000..e97991f
--- /dev/null
+++ b/xos/synchronizer/migrations/0005_auto_20190410_0026.py
@@ -0,0 +1,199 @@
+# Copyright 2017-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.20 on 2019-04-10 04:26
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('volt', '0004_oltdevice_decl_link_status'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='oltdevice_decl',
+ name='admin_state',
+ field=models.CharField(blank=True, choices=[(b'DISABLED', b'DISABLED'), (b'ENABLED', b'ENABLED')], default=b'ENABLED', help_text=b'admin state, whether OLT should be enabled', max_length=32, null=True),
+ ),
+ migrations.AlterField(
+ model_name='oltdevice_decl',
+ name='device_id',
+ field=models.CharField(blank=True, help_text=b'Voltha Device ID', max_length=256, null=True),
+ ),
+ migrations.AlterField(
+ model_name='oltdevice_decl',
+ name='device_type',
+ field=models.CharField(default=b'openolt', help_text=b'Phyiscal Device Type', max_length=256),
+ ),
+ migrations.AlterField(
+ model_name='oltdevice_decl',
+ name='dp_id',
+ field=models.CharField(blank=True, help_text=b'Logical device datapath id', max_length=256, null=True),
+ ),
+ migrations.AlterField(
+ model_name='oltdevice_decl',
+ name='driver',
+ field=models.CharField(default=b'voltha', help_text=b'DEPRECATED', max_length=32),
+ ),
+ migrations.AlterField(
+ model_name='oltdevice_decl',
+ name='host',
+ field=models.CharField(blank=True, help_text=b'IP Address of physical OLT Device', max_length=256, null=True),
+ ),
+ migrations.AlterField(
+ model_name='oltdevice_decl',
+ name='link_status',
+ field=models.CharField(blank=True, choices=[(b'up', b'up'), (b'down', b'down')], help_text=b'connectivity status, whether OLT has connectivity to agg switch', max_length=32, null=True),
+ ),
+ migrations.AlterField(
+ model_name='oltdevice_decl',
+ name='mac_address',
+ field=models.CharField(blank=True, help_text=b'MAC address of physical OLT Device', max_length=17, null=True),
+ ),
+ migrations.AlterField(
+ model_name='oltdevice_decl',
+ name='name',
+ field=models.CharField(blank=True, help_text=b'Human-readable name of device', max_length=256, null=True, unique=True),
+ ),
+ migrations.AlterField(
+ model_name='oltdevice_decl',
+ name='nas_id',
+ field=models.CharField(blank=True, help_text=b'Authentication ID (propagated to the free-radius server via sadis)', max_length=256, null=True),
+ ),
+ migrations.AlterField(
+ model_name='oltdevice_decl',
+ name='of_id',
+ field=models.CharField(blank=True, help_text=b'Logical device openflow id', max_length=256, null=True),
+ ),
+ migrations.AlterField(
+ model_name='oltdevice_decl',
+ name='oper_status',
+ field=models.CharField(blank=True, help_text=b'operational status, whether OLT is active', max_length=256, null=True),
+ ),
+ migrations.AlterField(
+ model_name='oltdevice_decl',
+ name='outer_tpid',
+ field=models.CharField(blank=True, help_text=b'Outer VLAN id field EtherType', max_length=256, null=True),
+ ),
+ migrations.AlterField(
+ model_name='oltdevice_decl',
+ name='serial_number',
+ field=models.CharField(blank=True, help_text=b'Serial Number', max_length=256, null=True),
+ ),
+ migrations.AlterField(
+ model_name='oltdevice_decl',
+ name='switch_datapath_id',
+ field=models.CharField(blank=True, help_text=b'Fabric switch to which the OLT is connected', max_length=256, null=True),
+ ),
+ migrations.AlterField(
+ model_name='oltdevice_decl',
+ name='switch_port',
+ field=models.CharField(blank=True, help_text=b'Fabric port to which the OLT is connected', max_length=256, null=True),
+ ),
+ migrations.AlterField(
+ model_name='oltdevice_decl',
+ name='uplink',
+ field=models.CharField(help_text=b'uplink port, exposed via sadis', max_length=256),
+ ),
+ migrations.AlterField(
+ model_name='onudevice_decl',
+ name='admin_state',
+ field=models.CharField(blank=True, choices=[(b'DISABLED', b'DISABLED'), (b'ENABLED', b'ENABLED')], default=b'ENABLED', help_text=b'admin state, whether port should be enabled', max_length=32, null=True),
+ ),
+ migrations.AlterField(
+ model_name='onudevice_decl',
+ name='connect_status',
+ field=models.CharField(blank=True, help_text=b'operational status, whether port is active', max_length=32, null=True),
+ ),
+ migrations.AlterField(
+ model_name='onudevice_decl',
+ name='device_id',
+ field=models.CharField(blank=True, help_text=b'Voltha Device ID', max_length=256, null=True),
+ ),
+ migrations.AlterField(
+ model_name='onudevice_decl',
+ name='device_type',
+ field=models.CharField(default=b'asfvolt16_olt', help_text=b'Device Type', max_length=256),
+ ),
+ migrations.AlterField(
+ model_name='onudevice_decl',
+ name='oper_status',
+ field=models.CharField(blank=True, help_text=b'oper_status', max_length=32, null=True),
+ ),
+ migrations.AlterField(
+ model_name='onudevice_decl',
+ name='serial_number',
+ field=models.CharField(help_text=b'Serial number of ONU Device', max_length=256, unique=True),
+ ),
+ migrations.AlterField(
+ model_name='onudevice_decl',
+ name='vendor',
+ field=models.CharField(help_text=b'Vendor of ONU Device', max_length=256),
+ ),
+ migrations.AlterField(
+ model_name='portbase_decl',
+ name='admin_state',
+ field=models.CharField(blank=True, help_text=b'admin state, whether port should be enabled', max_length=32, null=True),
+ ),
+ migrations.AlterField(
+ model_name='portbase_decl',
+ name='name',
+ field=models.CharField(db_index=True, help_text=b'Human-readable name of port', max_length=256),
+ ),
+ migrations.AlterField(
+ model_name='portbase_decl',
+ name='oper_status',
+ field=models.CharField(blank=True, help_text=b'operational status, whether port is active', max_length=32, null=True),
+ ),
+ migrations.AlterField(
+ model_name='voltservice_decl',
+ name='onos_voltha_pass',
+ field=models.CharField(default=b'rocks', help_text=b'The ONOS Voltha password. By default rocks', max_length=256),
+ ),
+ migrations.AlterField(
+ model_name='voltservice_decl',
+ name='onos_voltha_url',
+ field=models.CharField(default=b'onos-voltha-ui.voltha.svc.cluster.local', help_text=b'The ONOS Voltha address. By default onos-voltha-ui.voltha.svc.cluster.local', max_length=256),
+ ),
+ migrations.AlterField(
+ model_name='voltservice_decl',
+ name='onos_voltha_user',
+ field=models.CharField(default=b'onos', help_text=b'The ONOS Voltha username. By default sdn', max_length=256),
+ ),
+ migrations.AlterField(
+ model_name='voltservice_decl',
+ name='voltha_pass',
+ field=models.CharField(default=b'admin', help_text=b'The Voltha password. By default admin', max_length=256),
+ ),
+ migrations.AlterField(
+ model_name='voltservice_decl',
+ name='voltha_url',
+ field=models.CharField(default=b'voltha.voltha.svc.cluster.local', help_text=b'The Voltha API address. By default voltha.voltha.svc.cluster.local', max_length=256),
+ ),
+ migrations.AlterField(
+ model_name='voltservice_decl',
+ name='voltha_user',
+ field=models.CharField(default=b'voltha', help_text=b'The Voltha username. By default voltha', max_length=256),
+ ),
+ migrations.AlterField(
+ model_name='voltserviceinstance_decl',
+ name='description',
+ field=models.TextField(blank=True, help_text=b'Human-readable description', null=True),
+ ),
+ ]
diff --git a/xos/synchronizer/models/volt.xproto b/xos/synchronizer/models/volt.xproto
index 20492a4..5ae85ea 100644
--- a/xos/synchronizer/models/volt.xproto
+++ b/xos/synchronizer/models/volt.xproto
@@ -10,32 +10,32 @@
required string voltha_url = 1 [
help_text = "The Voltha API address. By default voltha.voltha.svc.cluster.local",
default = "voltha.voltha.svc.cluster.local",
- max_length = 254];
+ max_length = 256];
required int32 voltha_port = 2 [
help_text = "The Voltha API port. By default 8882",
default = 8882];
required string voltha_user = 3 [
help_text = "The Voltha username. By default voltha",
default = "voltha",
- max_length = 254];
+ max_length = 256];
required string voltha_pass = 4 [
help_text = "The Voltha password. By default admin",
default = "admin",
- max_length = 254];
+ max_length = 256];
required string onos_voltha_url = 5 [
help_text = "The ONOS Voltha address. By default onos-voltha-ui.voltha.svc.cluster.local",
default = "onos-voltha-ui.voltha.svc.cluster.local",
- max_length = 254];
+ max_length = 256];
required int32 onos_voltha_port = 6 [
help_text = "The Voltha API port. By default 8181",
default = 8181];
required string onos_voltha_user = 7 [
help_text = "The ONOS Voltha username. By default sdn",
- max_length = 254,
+ max_length = 256,
default = "onos"];
required string onos_voltha_pass = 8 [
help_text = "The ONOS Voltha password. By default rocks",
- max_length = 254,
+ max_length = 256,
default = "rocks"];
}
@@ -48,58 +48,72 @@
db_index = True];
optional string name = 2 [
help_text = "Human-readable name of device",
- max_length = 254,
+ max_length = 256,
unique = True];
required string device_type = 3 [
help_text = "Phyiscal Device Type",
default = "openolt",
- max_length = 254];
+ max_length = 256];
optional string host = 4 [
help_text = "IP Address of physical OLT Device",
- max_length = 254];
+ max_length = 256];
optional int32 port = 5 [
help_text = "Port Number of physical OLT Device",
unique_with = "host"];
optional string mac_address = 6 [
- help_text = "Mac address of physical OLT Device"];
+ help_text = "MAC address of physical OLT Device",
+ max_length = 17];
optional string serial_number = 9 [
- help_text = "Serial Number"];
+ help_text = "Serial Number",
+ max_length = 256];
optional string device_id = 10 [
help_text = "Voltha Device ID",
- feedback_state = True];
+ feedback_state = True,
+ max_length = 256];
optional string admin_state = 11 [
help_text = "admin state, whether OLT should be enabled",
choices = "(('DISABLED', 'DISABLED'), ('ENABLED', 'ENABLED'))",
- default = "ENABLED"];
+ default = "ENABLED",
+ max_length = 32];
optional string oper_status = 12 [
help_text = "operational status, whether OLT is active",
- feedback_state = True];
+ feedback_state = True,
+ max_length = 256];
optional string link_status = 21 [
help_text = "connectivity status, whether OLT has connectivity to agg switch",
choices = "(('up', 'up'), ('down', 'down'))",
- feedback_state = True];
+ feedback_state = True,
+ max_length = 32];
optional string of_id = 13 [
help_text = "Logical device openflow id",
- feedback_state = True];
+ feedback_state = True,
+ max_length = 256];
optional string dp_id = 14 [
- help_text = "Logical device datapath id"];
+ help_text = "Logical device datapath id",
+ max_length = 256];
required string uplink = 15 [
- help_text = "uplink port, exposed via sadis"];
+ help_text = "uplink port, exposed via sadis",
+ max_length = 256];
required string driver = 16 [
help_text = "DEPRECATED",
- default = "voltha"]; // Used to be sent to ONOS, now unused.
+ default = "voltha",
+ max_length = 32]; // Used to be sent to ONOS, now unused.
optional string switch_datapath_id = 17 [
- help_text = "Fabric switch to which the OLT is connected"];
+ help_text = "Fabric switch to which the OLT is connected",
+ max_length = 256];
optional string switch_port = 18 [
- help_text = "Fabric port to which the OLT is connected"];
+ help_text = "Fabric port to which the OLT is connected",
+ max_length = 256];
optional string outer_tpid = 19 [
- help_text = "Outer VLAN id field EtherType"];
+ help_text = "Outer VLAN id field EtherType",
+ max_length = 256];
optional string nas_id = 20 [
- help_text = "Authentication ID (propagated to the free-radius server via sadis)"];
+ help_text = "Authentication ID (propagated to the free-radius server via sadis)",
+ max_length = 256];
}
message PortBase (XOSBase){
@@ -108,16 +122,21 @@
required string name = 1 [
help_text = "Human-readable name of port",
- db_index = True];
+ db_index = True,
+ max_length = 256];
required int32 port_no = 3 [
help_text = "Port Number"];
optional string admin_state = 4 [
help_text = "admin state, whether port should be enabled",
- feedback_state = True];
+ // TODO: Should specify "choices"
+ feedback_state = True,
+ max_length = 32];
optional string oper_status = 5 [
help_text = "operational status, whether port is active",
- feedback_state = True];
+ // TODO: Should specify "choices"
+ feedback_state = True,
+ max_length = 32];
}
message PONPort (PortBase){
@@ -147,34 +166,39 @@
db_index = True];
required string serial_number = 2 [
help_text = "Serial number of ONU Device",
- max_length = 254,
+ max_length = 256,
tosca_key=True,
unique = True];
required string vendor = 3 [
help_text = "Vendor of ONU Device",
- max_length = 254];
+ max_length = 256];
required string device_type = 4 [
help_text = "Device Type",
default = "asfvolt16_olt",
- max_length = 254];
+ max_length = 256];
optional string device_id = 5 [
help_text = "Voltha Device ID",
feedback_state = True,
- max_length = 254];
+ max_length = 256];
optional string admin_state = 6 [
help_text = "admin state, whether port should be enabled",
choices = "(('DISABLED', 'DISABLED'), ('ENABLED', 'ENABLED'))",
- default = "ENABLED"];
+ default = "ENABLED",
+ max_length = 32];
optional string oper_status = 7 [
help_text = "oper_status",
- feedback_state = True];
+ // TODO: Should add "choices"
+ feedback_state = True,
+ max_length = 32];
optional string connect_status = 8 [
help_text = "operational status, whether port is active",
- feedback_state = True];
+ feedback_state = True,
+ max_length = 32];
optional string reason = 9 [
help_text = "ONU device configuration state machine status message",
- feedback_state = True];
+ feedback_state = True,
+ text = True];
}
message PONONUPort (PortBase) {
@@ -201,7 +225,7 @@
optional string description = 1 [
help_text = "Human-readable description",
- max_length = 254];
+ text = True];
optional manytoone onu_device->ONUDevice:volt_service_instances = 2:1003 [
help_text = "ONUDevice that belongs to this Subscriber chain",
db_index = True];