[SEBA-112] Rename PONONUPort to ANIPort

Change-Id: If3577cd4f3d3dcb7eef7452afdf89019106bf1d4
diff --git a/xos/synchronizer/migrations/0008_auto_20190520_1814.py b/xos/synchronizer/migrations/0008_auto_20190520_1814.py
new file mode 100644
index 0000000..aeccec2
--- /dev/null
+++ b/xos/synchronizer/migrations/0008_auto_20190520_1814.py
@@ -0,0 +1,65 @@
+# 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-05-20 22:14
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('volt', '0007_auto_20190515_1428'),
+    ]
+
+    operations = [
+        migrations.CreateModel(
+            name='ANIPort_decl',
+            fields=[
+                ('portbase_decl_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='volt.PortBase_decl')),
+                ('onu_device', models.ForeignKey(help_text=b'ONUDevice that owns this ANIPort', on_delete=django.db.models.deletion.CASCADE, related_name='ani_ports', to='volt.ONUDevice_decl')),
+            ],
+            options={
+                'verbose_name': 'ANI Port',
+            },
+            bases=('volt.portbase_decl',),
+        ),
+        migrations.RemoveField(
+            model_name='pononuport_decl',
+            name='onu_device',
+        ),
+        migrations.RemoveField(
+            model_name='pononuport_decl',
+            name='portbase_decl_ptr',
+        ),
+        migrations.DeleteModel(
+            name='PONONUPort',
+        ),
+        migrations.DeleteModel(
+            name='PONONUPort_decl',
+        ),
+        migrations.CreateModel(
+            name='ANIPort',
+            fields=[
+            ],
+            options={
+                'proxy': True,
+                'indexes': [],
+            },
+            bases=('volt.aniport_decl',),
+        ),
+    ]
diff --git a/xos/synchronizer/model_policies/test_model_policy_voltserviceinstance.py b/xos/synchronizer/model_policies/test_model_policy_voltserviceinstance.py
index 06101d6..1bd3192 100644
--- a/xos/synchronizer/model_policies/test_model_policy_voltserviceinstance.py
+++ b/xos/synchronizer/model_policies/test_model_policy_voltserviceinstance.py
@@ -115,7 +115,7 @@
 
     def test_associate_onu(self):
         with patch.object(ServiceInstance.objects, "get") as get_si, \
-            patch.object(ONUDevice.objects, "get") as get_onu:
+             patch.object(ONUDevice.objects, "get") as get_onu:
 
             mock_si = Mock()
             mock_si.get_westbound_service_instance_properties.return_value = "BRCM1234"
@@ -134,6 +134,6 @@
         self.policy.handle_delete(self.si)
         # handle delete does nothing, and should trivially succeed
 
+
 if __name__ == '__main__':
     unittest.main()
-
diff --git a/xos/synchronizer/models/models.py b/xos/synchronizer/models/models.py
index 59b6e66..d02adff 100644
--- a/xos/synchronizer/models/models.py
+++ b/xos/synchronizer/models/models.py
@@ -23,7 +23,7 @@
 from models_decl import PONPort_decl
 from models_decl import NNIPort_decl
 from models_decl import ONUDevice_decl
-from models_decl import PONONUPort_decl
+from models_decl import ANIPort_decl
 from models_decl import UNIPort_decl
 from models_decl import TechnologyProfile_decl
 
@@ -111,7 +111,7 @@
 
         super(ONUDevice, self).delete(*args, **kwargs)
 
-class PONONUPort(PONONUPort_decl):
+class ANIPort(ANIPort_decl):
     class Meta:
         proxy = True
 
diff --git a/xos/synchronizer/models/volt.xproto b/xos/synchronizer/models/volt.xproto
index 25fbaf1..ec06ff1 100644
--- a/xos/synchronizer/models/volt.xproto
+++ b/xos/synchronizer/models/volt.xproto
@@ -201,11 +201,11 @@
         text = True];
 }
 
-message PONONUPort (PortBase) {
+message ANIPort (PortBase) {
     option verbose_name = "ANI Port";
     option description="Access Node Interface Port";
-    required manytoone onu_device->ONUDevice:pononu_ports = 1:1001 [
-        help_text = "ONUDevice that owns this PONONUPort",
+    required manytoone onu_device->ONUDevice:ani_ports = 1:1001 [
+        help_text = "ONUDevice that owns this ANIPort",
         db_index = True];
 }
 
diff --git a/xos/synchronizer/pull_steps/pull_onus.py b/xos/synchronizer/pull_steps/pull_onus.py
index 6920f5c..be04ca9 100644
--- a/xos/synchronizer/pull_steps/pull_onus.py
+++ b/xos/synchronizer/pull_steps/pull_onus.py
@@ -13,7 +13,7 @@
 # limitations under the License.
 
 from xossynchronizer.pull_steps.pullstep import PullStep
-from xossynchronizer.modelaccessor import model_accessor, ONUDevice, VOLTService, OLTDevice, PONPort, PONONUPort, UNIPort
+from xossynchronizer.modelaccessor import model_accessor, ONUDevice, VOLTService, OLTDevice, PONPort, ANIPort, UNIPort
 
 from xosconfig import Config
 from multistructlog import create_logger
@@ -155,7 +155,7 @@
         pon_onu_ports = [p for p in ports if "PON_ONU" in p["type"]]
 
         self.create_or_update_uni_port(uni_ports, onu)
-        self.create_or_update_pon_onu_port(pon_onu_ports, onu)
+        self.create_or_update_ani_port(pon_onu_ports, onu)
 
     def get_onu_port_id(self, port, onu):
         # find the correct port id as represented in the logical_device
@@ -206,21 +206,21 @@
             update_ports.append(model)
         return update_ports
 
-    def create_or_update_pon_onu_port(self, pon_onu_ports, onu):
+    def create_or_update_ani_port(self, pon_onu_ports, onu):
         update_ports = []
 
         for port in pon_onu_ports:
             try:
-                model = PONONUPort.objects.filter(port_no=port["port_no"], onu_device_id=onu.id)[0]
+                model = ANIPort.objects.filter(port_no=port["port_no"], onu_device_id=onu.id)[0]
                 model.xos_managed = False
-                log.debug("PONONUPort already exists, updating it", port_no=port["port_no"], onu_device_id=onu.id)
+                log.debug("ANIPort already exists, updating it", port_no=port["port_no"], onu_device_id=onu.id)
             except IndexError:
-                model = PONONUPort()
+                model = ANIPort()
                 model.port_no = port["port_no"]
                 model.onu_device_id = onu.id
                 model.name = port["label"]
                 model.xos_managed = False
-                log.debug("PONONUPort is new, creating it", port_no=port["port_no"], onu_device_id=onu.id)
+                log.debug("ANIPort is new, creating it", port_no=port["port_no"], onu_device_id=onu.id)
 
             model.admin_state = port["admin_state"]
             model.oper_status = port["oper_status"]