diff --git a/cli/main.py b/cli/main.py
index c0dbef6..8e51851 100755
--- a/cli/main.py
+++ b/cli/main.py
@@ -257,10 +257,16 @@
     def do_xpon(self, line):
         """xpon <optional> [device_ID] - Enter xpon level command mode"""
         device_id = line.strip()
-        if not device_id:
-            sub = XponCli(self.get_channel, "")
-        else:
-            sub = XponCli(self.get_channel, device_id)
+        if device_id:
+            stub = self.get_stub()
+            try:
+                res = stub.GetDevice(voltha_pb2.ID(id=device_id))
+            except Exception:
+                self.poutput(self.colorize('Error: ', 'red') + \
+                             'No device id ' + self.colorize(device_id, 'blue') + \
+                             ' is found')
+                return
+        sub = XponCli(self.get_channel, device_id)
         sub.cmdloop()
 
     def do_pdb(self, line):
diff --git a/cli/xpon.py b/cli/xpon.py
index 61b235b..dbd7f97 100644
--- a/cli/xpon.py
+++ b/cli/xpon.py
@@ -50,65 +50,56 @@
         self.get_channel = get_channel
         self.device_id = device_id
         self.prompt = '(' + self.colorize(
-            self.colorize('voltha-xpon {}'.format(device_id), 'green'), 'bold') + ') '
+            self.colorize('voltha-xpon {}'.format(device_id), 'green'),
+            'bold') + ') '
 
     def cmdloop(self):
         self._cmdloop()
 
+    def get_ref_interfaces(self, all_interfaces, ref_interfaces):
+        interface_list = []
+        if not all_interfaces:
+            return interface_list
+        if isinstance(all_interfaces[0], (ChannelgroupConfig,
+                                          ChannelpartitionConfig,
+                                          ChannelpairConfig, OntaniConfig)):
+            for interface in all_interfaces:
+                if interface.name in ref_interfaces:
+                    interface_list.append(interface)
+        elif isinstance(all_interfaces[0], VOntaniConfig):
+            for interface in all_interfaces:
+                if interface.data.parent_ref in ref_interfaces:
+                    interface_list.append(interface)
+        elif isinstance(all_interfaces[0], VEnetConfig):
+            for interface in all_interfaces:
+                if interface.data.v_ontani_ref in ref_interfaces:
+                    interface_list.append(interface)
+        return interface_list
+
     def get_interface_based_on_device(self):
         stub = voltha_pb2.VolthaLocalServiceStub(self.get_channel())
-        temp_list = []
-        cg_list = []
-        cpart_list = []
-        cp_list = []
-        vont_list = []
-        ont_list = []
-        v_enet_list = []
-        ct = stub.GetAllChannelterminationConfig(voltha_pb2.ID(id=self.device_id))
-        cps = stub.GetAllChannelpairConfig(Empty()).channelpair_config
-        cparts = stub.GetAllChannelpartitionConfig(Empty()).channelpartition_config
-        cgs = stub.GetAllChannelgroupConfig(Empty()).channelgroup_config
-        onts = stub.GetAllOntaniConfig(Empty()).ontani_config
-        vonts = stub.GetAllVOntaniConfig(Empty()).v_ontani_config
-        venets = stub.GetAllVEnetConfig(Empty()).v_enet_config
-
-        for cterm in ct.channeltermination_config:
-            temp_list.append(cterm.data.channelpair_ref)
-        for cp in cps:
-            if cp.name in temp_list:
-                cp_list.append(cp)
-        temp_list = []
-
-        for cp in cp_list:
-            temp_list.append(cp.data.channelpartition_ref)
-        for cpart in cparts:
-            if cpart.name in temp_list:
-                cpart_list.append(cpart)
-        temp_list = []
-
-        for cpart in cpart_list:
-            temp_list.append(cpart.data.channelgroup_ref)
-        for cg in cgs:
-            if cg.name in temp_list:
-                cg_list.append(cg)
-        temp_list = []
-
-        for vont in vonts:
-            if vont.data.parent_ref in cpart_list or \
-                vont.data.preferred_chanpair in cp_list:
-                vont_list.append(vont)
-
-        for ont in onts:
-            if ont.name in vont_list:
-                ont_list.append(ont)
-                temp_list.append(ont.name)
-
-        for venet in venets:
-            if venet.data.v_ontani_ref in temp_list:
-                v_enet_list.append(venet)
-        temp_list = []
-
-        return cg_list, cpart_list, cp_list, ct.channeltermination_config, vont_list, ont_list, v_enet_list
+        channel_terminations = stub.GetAllChannelterminationConfig(
+            voltha_pb2.ID(id=self.device_id)).channeltermination_config
+        channel_pairs = self.get_ref_interfaces(
+            stub.GetAllChannelpairConfig(Empty()).channelpair_config,
+            dict((dt.data.channelpair_ref, dt) for dt in channel_terminations))
+        channel_partitions = self.get_ref_interfaces(
+            stub.GetAllChannelpartitionConfig(Empty()).channelpartition_config,
+            dict((dt.data.channelpartition_ref, dt) for dt in channel_pairs))
+        channel_groups = self.get_ref_interfaces(
+            stub.GetAllChannelgroupConfig(Empty()).channelgroup_config,
+            dict((dt.data.channelgroup_ref, dt) for dt in channel_partitions))
+        vont_anis = self.get_ref_interfaces(
+            stub.GetAllVOntaniConfig(Empty()).v_ontani_config,
+            dict((dt.name, dt) for dt in channel_partitions))
+        ont_anis = self.get_ref_interfaces(
+            stub.GetAllOntaniConfig(Empty()).ontani_config,
+            dict((dt.name, dt) for dt in vont_anis))
+        venets = self.get_ref_interfaces(
+            stub.GetAllVEnetConfig(Empty()).v_enet_config,
+            dict((dt.name, dt) for dt in vont_anis))
+        return channel_groups, channel_partitions, channel_pairs,\
+            channel_terminations, vont_anis, ont_anis, venets
 
     do_exit = Cmd.do_quit
 
@@ -116,26 +107,29 @@
         return self._STOP_AND_EXIT
 
     def do_show(self, line):
-        """Show detailed information of each interface based on device ID or all interfaces"""
+        """Show detailed information of each interface based on device ID
+        or all interfaces"""
         stub = voltha_pb2.VolthaLocalServiceStub(self.get_channel())
+        device_id = self.device_id
         if line.strip():
-            self.device_id = line.strip()
-        if self.device_id:
-            cg, cpart, cp, ct, vont, ont, venet = self.get_interface_based_on_device()
-            print_pb_list_as_table("Channel Groups for device ID = {}:".format(self.device_id),
-                                   cg, {}, self.poutput)
-            print_pb_list_as_table("Channel Partitions for device ID = {}:".format(self.device_id),
-                                   cpart, {}, self.poutput)
-            print_pb_list_as_table("Channel Pairs: for device ID = {}:".format(self.device_id),
-                                   cp, {}, self.poutput)
-            print_pb_list_as_table("Channel Terminations for device ID = {}:".format(self.device_id),
-                                   ct, {}, self.poutput)
-            print_pb_list_as_table("VOnt Anis for device ID = {}:".format(self.device_id),
-                                   vont, {}, self.poutput)
-            print_pb_list_as_table("Ont Anis for device ID = {}:".format(self.device_id),
-                                   ont, {}, self.poutput)
-            print_pb_list_as_table("VEnets for device ID = {}:".format(self.device_id),
-                                   venet, {}, self.poutput)
+            device_id = line.strip()
+        if device_id:
+            cg, cpart, cp, ct, vont, ont, venet = \
+                self.get_interface_based_on_device()
+            print_pb_list_as_table("Channel Groups for device ID = {}:"
+                                   .format(device_id), cg, {}, self.poutput)
+            print_pb_list_as_table("Channel Partitions for device ID = {}:"
+                                   .format(device_id),cpart, {}, self.poutput)
+            print_pb_list_as_table("Channel Pairs: for device ID = {}:"
+                                   .format(device_id), cp, {}, self.poutput)
+            print_pb_list_as_table("Channel Terminations for device ID = {}:"
+                                   .format(device_id), ct, {}, self.poutput)
+            print_pb_list_as_table("VOnt Anis for device ID = {}:"
+                                   .format(device_id), vont, {}, self.poutput)
+            print_pb_list_as_table("Ont Anis for device ID = {}:"
+                                   .format(device_id), ont, {}, self.poutput)
+            print_pb_list_as_table("VEnets for device ID = {}:"
+                                   .format(device_id), venet, {}, self.poutput)
         else:
             interface = stub.GetAllChannelgroupConfig(Empty())
             print_pb_list_as_table("Channel Groups:",
@@ -151,10 +145,12 @@
                                    {}, self.poutput)
             devices = stub.ListDevices(Empty())
             for d in devices.items:
-                interface = stub.GetAllChannelterminationConfig(voltha_pb2.ID(id=d.id))
-                print_pb_list_as_table("Channel Terminations for device ID = {}:".format(d.id),
-                                   interface.channeltermination_config,
-                                   {}, self.poutput)
+                interface = stub.GetAllChannelterminationConfig(
+                    voltha_pb2.ID(id=d.id))
+                print_pb_list_as_table(
+                    "Channel Terminations for device ID = {}:"
+                    .format(d.id), interface.channeltermination_config,
+                    {}, self.poutput)
             interface = stub.GetAllVOntaniConfig(Empty())
             print_pb_list_as_table("VOnt Anis:",
                                    interface.v_ontani_config,
@@ -171,16 +167,17 @@
     def help_channel_group(self):
         self.poutput(
 '''
-channel_group [get | create | update | delete] [-n <name>] [-d <description>] [-a <admin state>]
-              [-l <link up down trap enable type>] [-p <polling period>] [-s <system id>]
-              [-r <raman mitigation>]
+channel_group [get | create | update | delete] [-n <name>] [-d <description>]
+              [-a <admin state>] [-l <link up down trap enable type>]
+              [-p <polling period>] [-s <system id>] [-r <raman mitigation>]
 
 get:    displays existing channel groups
         Required flags: None
-create: creates channel group with the parameters specified with -n, -d, -a, -l, -p, -s and -r.
+create: creates channel group with the parameters specified with -n, -d, -a,
+        -l, -p, -s and -r.
         Required flags: <name>
-update: updates existing channel group specified with parameter -n by changing its parameter values 
-        specified with -d, -a, -l, -p, -s and -r.
+update: updates existing channel group specified with parameter -n by changing
+        its parameter values specified with -d, -a, -l, -p, -s and -r.
         Required flags: <name>
 delete: deletes channel group specified with parameter -n.
         Required flags: <name>
@@ -188,7 +185,7 @@
 -n: <string> name of channel group.
 -d: <string> description of channel group.
 -a: <string> admin state of channel group.
--l: <enum>   link up down trap enable type. 
+-l: <enum>   link up down trap enable type.
 -p: <int>    polling period for channel group.
 -s: <string> system id for channel group.
 -r: <enum>   raman mitigation for channel group.
@@ -203,21 +200,28 @@
         make_option('-n', '--name', action="store", dest='name', type='string',
                     help='name of channel group', default=None),
         make_option('-d', '--description', action="store", dest='description',
-                    type='string', help='description of channel group', default=None),
-        make_option('-a', '--admin_state', action="store", dest='enabled', type='string',
-                    help='admin state of channel group', default=None),
-        make_option('-l', '--trap', action="store", dest='link_up_down_trap_enable',
-                    type='string', help='link up down trap enable type', default=None),
+                    type='string', help='description of channel group',
+                    default=None),
+        make_option('-a', '--admin_state', action="store", dest='enabled',
+                    type='string', help='admin state of channel group',
+                    default=None),
+        make_option('-l', '--trap', action="store",
+                    dest='link_up_down_trap_enable', type='string',
+                    help='link up down trap enable type', default=None),
         make_option('-p', '--pp', action='store', dest='polling_period',
-                    type='int', help='polling period of channel group', default=None),
+                    type='int', help='polling period of channel group',
+                    default=None),
         make_option('-s', '--sid', action='store', dest='system_id',
-                    type='string', help='system id of channel group', default=None),
+                    type='string', help='system id of channel group',
+                    default=None),
         make_option('-r', '--rm', action='store', dest='raman_mitigation',
-                    type='string', help='raman mitigation of channel group', default=None),
+                    type='string', help='raman mitigation of channel group',
+                    default=None),
     ])
 
     def do_channel_group(self, line, opts):
-        """channel group get, create -flags <attributes>, update -flags <attributes>, delete -n <name>"""
+        """channel group get, create -flags <attributes>,
+        update -flags <attributes>, delete -n <name>"""
         # Ensure that a valid sub-command was provided
         if line.strip() not in {"get", "create", "update", "delete"}:
             self.poutput(self.colorize('Error: ', 'red') + \
@@ -229,8 +233,10 @@
 
         if line.strip() == "get":
             if self.device_id:
-                cg, cpart, cp, ct, vont, ont, venet = self.get_interface_based_on_device()
-                print_pb_list_as_table("Channel Groups for device ID = {}:".format(self.device_id),
+                cg, cpart, cp, ct, vont, ont, venet = \
+                    self.get_interface_based_on_device()
+                print_pb_list_as_table("Channel Groups for device ID = {}:"
+                                       .format(self.device_id),
                                        cg, {}, self.poutput)
             else:
                 interface = stub.GetAllChannelgroupConfig(Empty())
@@ -238,15 +244,6 @@
                                        interface.channelgroup_config,
                                        {}, self.poutput)
             return
-        #if not opts.name:
-        #    self.poutput(self.colorize('Error: ', 'red') + \
-        #                self.colorize(self.colorize('Name is required parameter', 'blue'),
-        #                              'bold'))
-        #    return
-        #if interface_instance:
-        #    self.poutput(self.colorize('Unable. Please commit or reset: ', 'yellow') + \
-        #                self.colorize(interface_instance.name, 'blue'))
-        #    return
         interface_instance = ChannelgroupConfig(name = opts.name)
         interface_instance.interface.name = opts.name
         if opts.description:
@@ -258,18 +255,22 @@
             elif opts.enabled == "down":
                 interface_instance.interface.enabled = False
             else:
-                self.poutput(self.colorize('Error: ', 'red') + \
-                            self.colorize(self.colorize('Invalid admin state parameter for channel group', 'blue'),
-                                          'bold'))
+                self.poutput(
+                    self.colorize('Error: ', 'red') + self.colorize(
+                        self.colorize(
+                            'Invalid admin state parameter for channel group',
+                            'blue'), 'bold'))
                 return
         if opts.link_up_down_trap_enable:
             types = ["trap_disabled", "trap_enabled"]
             try:
                 assert opts.link_up_down_trap_enable in types, \
-                        'Invalid Enum value for Channel Group link up down trap enable type \'{}\''\
-                        .format(opts.link_up_down_trap_enable)
+                    'Invalid Enum value for Channel Group link up down trap \
+                    enable type \'{}\''.format(opts.link_up_down_trap_enable)
                 interface_instance.interface.link_up_down_trap_enable = \
-                    ietf_interfaces_pb2._INTERFACE_LINKUPDOWNTRAPENABLETYPE.values_by_name[opts.link_up_down_trap_enable.upper()].number
+                    ietf_interfaces_pb2._INTERFACE_LINKUPDOWNTRAPENABLETYPE.\
+                    values_by_name[opts.link_up_down_trap_enable.upper()]\
+                    .number
             except AssertionError, e:
                 self.poutput(self.colorize('Error: ', 'red') + \
                             self.colorize(self.colorize(e.message, 'blue'),
@@ -282,9 +283,11 @@
             raman_mitigations = ["raman_none", "raman_miller", "raman_8b10b"]
             try:
                 assert opts.raman_mitigation in raman_mitigations, \
-                        'Invalid Enum value for Channel Group raman mitigation \'{}\''.format(opts.raman_mitigation)
+                        'Invalid Enum value for Channel Group raman mitigation\
+                         \'{}\''.format(opts.raman_mitigation)
                 interface_instance.data.raman_mitigation = \
-                    bbf_fiber_types_pb2._RAMANMITIGATIONTYPE.values_by_name[opts.raman_mitigation.upper()].number
+                    bbf_fiber_types_pb2._RAMANMITIGATIONTYPE.\
+                    values_by_name[opts.raman_mitigation.upper()].number
             except AssertionError, e:
                 self.poutput(self.colorize('Error: ', 'red') + \
                             self.colorize(self.colorize(e.message, 'blue'),
@@ -304,17 +307,22 @@
     def help_channel_partition(self):
         self.poutput(
 '''
-channel_partition  [get | create | update | delete] [-n <name>] [-d <description>] [-a <admin state>]
-                   [-l <link up down trap enable type>] [-r <differential fiber distance>]
-                   [-o <closest ont distance>] [-f <fec downstream>] [-m <multicast aes indicator>]
-                   [-u <authentication method>] [-c <channel group reference>]
+channel_partition  [get | create | update | delete] [-n <name>]
+                   [-d <description>] [-a <admin state>]
+                   [-l <link up down trap enable type>]
+                   [-r <differential fiber distance>]
+                   [-o <closest ont distance>] [-f <fec downstream>]
+                   [-m <multicast aes indicator>] [-u <authentication method>]
+                   [-c <channel group reference>]
 
 get:    displays existing channel partitions
         Required flags: None
-create: creates channel partition with the parameters specified with -n, -d, -a, -l, -r, -o, -f, -m, -u and -c.
+create: creates channel partition with the parameters specified with -n, -d,
+        -a, -l, -r, -o, -f, -m, -u and -c.
         Required flags: <name>, <channel group reference>
-update: updates existing channel partition specified with parameter -n by changing its parameter values
-        specified with -d, -a, -l, -r, -o, -f, -m, -u and -c.
+update: updates existing channel partition specified with parameter -n by
+        changing its parameter values specified with -d, -a, -l, -r, -o, -f,
+        -m, -u and -c.
         Required flags: <name>
 delete: deletes channel group specified with parameter -n.
         Required flags: <name>
@@ -332,7 +340,8 @@
 
 Example:
 
-channel_partition create -n cpart-1-1 -a up -r 20 -o 0 -f false -m false -u serial_number -c cg-1
+channel_partition create -n cpart-1-1 -a up -r 20 -o 0 -f false -m false
+                         -u serial_number -c cg-1
 '''
         )
 
@@ -340,27 +349,40 @@
         make_option('-n', '--name', action="store", dest='name', type='string',
                     help='name of channel partition', default=None),
         make_option('-d', '--description', action="store", dest='description',
-                    type='string', help='description of channel partition', default=None),
-        make_option('-a', '--admin_state', action="store", dest='enabled', type='string',
-                    help='admin state of channel partition', default=None),
-        make_option('-l', '--trap', action="store", dest='link_up_down_trap_enable',
-                    type='string', help='link up down trap enable type', default=None),
-        make_option('-r', '--diff_fib_dist', action='store', dest='differential_fiber_distance',
-                    type='int', help='differential fiber distance', default=None),
-        make_option('-o', '--ont_dist', action='store', dest='closest_ont_distance',
-                    type='int', help='closest ont distance', default=None),
+                    type='string', help='description of channel partition',
+                    default=None),
+        make_option('-a', '--admin_state', action="store", dest='enabled',
+                    type='string', help='admin state of channel partition',
+                    default=None),
+        make_option('-l', '--trap', action="store",
+                    dest='link_up_down_trap_enable', type='string',
+                    help='link up down trap enable type', default=None),
+        make_option('-r', '--diff_fib_dist', action='store',
+                    dest='differential_fiber_distance', type='int',
+                    help='differential fiber distance', default=None),
+        make_option('-o', '--ont_dist', action='store',
+                    dest='closest_ont_distance', type='int',
+                    help='closest ont distance', default=None),
         make_option('-f', '--fec_ds', action='store', dest='fec_downstream',
-                    type='string', help='forward and error correction downstream', default=None),
-        make_option('-m', '--mc_aes', action='store', dest='multicast_aes_indicator',
-                    type='string', help='multicast aes indicator of channel partition', default=None),
-        make_option('-u', '--auth', action='store', dest='authentication_method',
-                    type='string', help='authentication method', default=None),
+                    type='string',
+                    help='forward and error correction downstream',
+                    default=None),
+        make_option('-m', '--mc_aes', action='store',
+                    dest='multicast_aes_indicator', type='string',
+                    help='multicast aes indicator of channel partition',
+                    default=None),
+        make_option('-u', '--auth', action='store',
+                    dest='authentication_method', type='string',
+                    help='authentication method', default=None),
         make_option('-c', '--cg_ref', action='store', dest='channelgroup_ref',
-                    type='string', help='channel group reference for this channel partition', default=None),
+                    type='string',
+                    help='channel group reference for this channel partition',
+                    default=None),
     ])
 
     def do_channel_partition(self, line, opts):
-        """channel partition get, create -flags <attributes>, update -flags <attributes>, delete -n <name>"""
+        """channel partition get, create -flags <attributes>,
+        update -flags <attributes>, delete -n <name>"""
         # Ensure that a valid sub-command was provided
         if line.strip() not in {"get", "create", "update", "delete"}:
             self.poutput(self.colorize('Error: ', 'red') + \
@@ -372,9 +394,11 @@
 
         if line.strip() == "get":
             if self.device_id:
-                cg, cpart, cp, ct, vont, ont, venet = self.get_interface_based_on_device()
-                print_pb_list_as_table("Channel Partitions for device ID = {}:".format(self.device_id),
-                                       cpart, {}, self.poutput)
+                cg, cpart, cp, ct, vont, ont, venet = \
+                    self.get_interface_based_on_device()
+                print_pb_list_as_table("Channel Partitions for device ID = {}:"
+                                       .format(self.device_id), cpart, {},
+                                       self.poutput)
             else:
                 interface = stub.GetAllChannelpartitionConfig(Empty())
                 print_pb_list_as_table("Channel Partitions:",
@@ -393,18 +417,22 @@
             elif opts.enabled == "down":
                 interface_instance.interface.enabled = False
             else:
-                self.poutput(self.colorize('Error: ', 'red') + \
-                            self.colorize(self.colorize('Invalid admin state parameter for channel partition', 'blue'),
-                                          'bold'))
+                self.poutput(
+                    self.colorize('Error: ', 'red') + self.colorize(
+                        self.colorize('Invalid admin state parameter for \
+                        channel partition', 'blue'), 'bold'))
                 return
         if opts.link_up_down_trap_enable:
             types = ["trap_disabled", "trap_enabled"]
             try:
                 assert opts.link_up_down_trap_enable in types, \
-                        'Invalid Enum value for Channel Partition link up down trap enable type \'{}\''\
+                        'Invalid Enum value for Channel Partition link up \
+                        down trap enable type \'{}\''\
                         .format(opts.link_up_down_trap_enable)
                 interface_instance.interface.link_up_down_trap_enable = \
-                    ietf_interfaces_pb2._INTERFACE_LINKUPDOWNTRAPENABLETYPE.values_by_name[opts.link_up_down_trap_enable.upper()].number
+                    ietf_interfaces_pb2._INTERFACE_LINKUPDOWNTRAPENABLETYPE.\
+                    values_by_name[opts.link_up_down_trap_enable.upper()].\
+                    number
             except AssertionError, e:
                 self.poutput(self.colorize('Error: ', 'red') + \
                             self.colorize(self.colorize(e.message, 'blue'),
@@ -412,17 +440,19 @@
                 return
 
         if opts.differential_fiber_distance:
-            interface_instance.data.differential_fiber_distance = opts.differential_fiber_distance
+            interface_instance.data.differential_fiber_distance = \
+                opts.differential_fiber_distance
         if opts.closest_ont_distance:
-            interface_instance.data.closest_ont_distance = opts.closest_ont_distance
+            interface_instance.data.closest_ont_distance = \
+                opts.closest_ont_distance
         if opts.fec_downstream:
             if opts.fec_downstream == 'true':
                 interface_instance.data.fec_downstream = True
             elif opts.fec_downstream == 'false':
                 interface_instance.data.fec_downstream = False
             else:
-                m = 'Invalid boolean value for Channel Partition fec_downstream \'{}\''\
-                    .format(opts.fec_downstream)
+                m = 'Invalid boolean value for Channel Partition \
+                fec_downstream \'{}\''.format(opts.fec_downstream)
                 self.poutput(self.colorize('Error: ', 'red') + \
                             self.colorize(self.colorize(m, 'blue'),
                                           'bold'))
@@ -433,19 +463,24 @@
             elif opts.multicast_aes_indicator == 'false':
                 interface_instance.data.multicast_aes_indicator = False
             else:
-                m = 'Invalid boolean value for Channel Partition multicast_aes_indicator \'{}\''\
-                    .format(opts.multicast_aes_indicator)
+                m = 'Invalid boolean value for Channel Partition \
+                multicast_aes_indicator \'{}\''.format(
+                    opts.multicast_aes_indicator)
                 self.poutput(self.colorize('Error: ', 'red') + \
                             self.colorize(self.colorize(m, 'blue'),
                                           'bold'))
                 return
         if opts.authentication_method:
-            auth_method_types = ["serial_number", "loid", "registration_id", "omci", "dot1x"]
+            auth_method_types = \
+                ["serial_number", "loid", "registration_id", "omci", "dot1x"]
             try:
                 assert opts.authentication_method in auth_method_types, \
-                        'Invalid Enum value for Channel Partition authentication method \'{}\''.format(opts.authentication_method)
+                        'Invalid Enum value for Channel Partition \
+                         authentication method \'{}\''.format(
+                             opts.authentication_method)
                 interface_instance.data.authentication_method = \
-                    bbf_fiber_types_pb2._AUTHMETHODTYPE.values_by_name[opts.authentication_method.upper()].number
+                    bbf_fiber_types_pb2._AUTHMETHODTYPE.\
+                    values_by_name[opts.authentication_method.upper()].number
             except AssertionError, e:
                 self.poutput(self.colorize('Error: ', 'red') + \
                             self.colorize(self.colorize(e.message, 'blue'),
@@ -465,17 +500,20 @@
     def help_channel_pair(self):
         self.poutput(
 '''
-channel_pair [get | create | update | delete] [-n <name>] [-d <description>] [-a <admin state>]
-             [-l <link up down trap enable type>] [-r <channel pair line rate>]
-             [-t <channel pair type>] [-g <channel group reference>] [-i <gpon pon id interval>]
+channel_pair [get | create | update | delete] [-n <name>] [-d <description>]
+             [-a <admin state>] [-l <link up down trap enable type>]
+             [-r <channel pair line rate>] [-t <channel pair type>]
+             [-g <channel group reference>] [-i <gpon pon id interval>]
              [-p <channel partition reference>] [-o <gpon pon id odn class>]
 
 get:    displays existing channel pairs
         Required flags: None
-create: creates channel pair with the parameters specified with -n, -d, -a, -l, -r, -t, -g, -i, -p and -o.
+create: creates channel pair with the parameters specified with -n, -d, -a,
+        -l, -r, -t, -g, -i, -p and -o.
         Required flags: <name>, <channel pair type>
-update: updates existing channel pair specified with parameter -n by changing its parameter values
-        specified with -d, -a, -l, -r, -t, -g, -i, -p and -o.
+update: updates existing channel pair specified with parameter -n by changing
+        its parameter values specified with -d, -a, -l, -r, -t, -g, -i, -p
+        and -o.
         Required flags: <name>
 delete: deletes channel group specified with parameter -n.
         Required flags: <name>
@@ -493,7 +531,8 @@
 
 Example:
 
-channel_pair create -n cp-1 -a up -r unplanned_cp_speed -t channelpair -g cg-1 -i 0 -p cpart-1-1 -o class_a
+channel_pair create -n cp-1 -a up -r unplanned_cp_speed -t channelpair -g cg-1
+                    -i 0 -p cpart-1-1 -o class_a
 '''
         )
 
@@ -501,27 +540,36 @@
         make_option('-n', '--name', action="store", dest='name', type='string',
                     help='name of channel pair', default=None),
         make_option('-d', '--description', action="store", dest='description',
-                    type='string', help='description of channel pair', default=None),
-        make_option('-a', '--admin_state', action="store", dest='enabled', type='string',
-                    help='admin state of channel pair', default=None),
-        make_option('-l', '--trap', action="store", dest='link_up_down_trap_enable',
-                    type='string', help='link up down trap enable type', default=None),
-        make_option('-r', '--cp_line_rate', action='store', dest='channelpair_linerate',
-                    type='string', help='channel pair linerate', default=None),
+                    type='string', help='description of channel pair',
+                    default=None),
+        make_option('-a', '--admin_state', action="store", dest='enabled',
+                    type='string', help='admin state of channel pair',
+                    default=None),
+        make_option('-l', '--trap', action="store",
+                    dest='link_up_down_trap_enable', type='string',
+                    help='link up down trap enable type', default=None),
+        make_option('-r', '--cp_line_rate', action='store',
+                    dest='channelpair_linerate', type='string',
+                    help='channel pair linerate', default=None),
         make_option('-t', '--cp_type', action='store', dest='channelpair_type',
                     type='string', help='channel pair type', default=None),
         make_option('-g', '--cg_ref', action='store', dest='channelgroup_ref',
-                    type='string', help='channel group reference', default=None),
-        make_option('-i', '--interval', action='store', dest='gpon_ponid_interval',
-                    type='int', help='gpon pon id interval', default=None),
-        make_option('-p', '--cpart_ref', action='store', dest='channelpartition_ref',
-                    type='string', help='channel partition reference', default=None),
-        make_option('-o', '--odn_class', action='store', dest='gpon_ponid_odn_class',
-                    type='string', help='gpon pon id odn class', default=None),
+                    type='string', help='channel group reference',
+                    default=None),
+        make_option('-i', '--interval', action='store',
+                    dest='gpon_ponid_interval', type='int',
+                    help='gpon pon id interval', default=None),
+        make_option('-p', '--cpart_ref', action='store',
+                    dest='channelpartition_ref', type='string',
+                    help='channel partition reference', default=None),
+        make_option('-o', '--odn_class', action='store',
+                    dest='gpon_ponid_odn_class', type='string',
+                    help='gpon pon id odn class', default=None),
     ])
 
     def do_channel_pair(self, line, opts):
-        """channel pair get, create -flags <attributes>, update -flags <attributes>, delete -n <name>"""
+        """channel pair get, create -flags <attributes>,
+        update -flags <attributes>, delete -n <name>"""
         # Ensure that a valid sub-command was provided
         if line.strip() not in {"get", "create", "update", "delete"}:
             self.poutput(self.colorize('Error: ', 'red') + \
@@ -533,9 +581,11 @@
 
         if line.strip() == "get":
             if self.device_id:
-                cg, cpart, cp, ct, vont, ont, venet = self.get_interface_based_on_device()
-                print_pb_list_as_table("Channel Pairs for device ID = {}:".format(self.device_id),
-                                       cp, {}, self.poutput)
+                cg, cpart, cp, ct, vont, ont, venet = \
+                    self.get_interface_based_on_device()
+                print_pb_list_as_table("Channel Pairs for device ID = {}:"
+                                       .format(self.device_id), cp, {},
+                                       self.poutput)
             else:
                 interface = stub.GetAllChannelpairConfig(Empty())
                 print_pb_list_as_table("Channel Pairs:",
@@ -554,18 +604,22 @@
             elif opts.enabled == "down":
                 interface_instance.interface.enabled = False
             else:
-                self.poutput(self.colorize('Error: ', 'red') + \
-                            self.colorize(self.colorize('Invalid admin state parameter for channel pair', 'blue'),
-                                          'bold'))
+                self.poutput(
+                    self.colorize('Error: ', 'red') + self.colorize(
+                        self.colorize('Invalid admin state parameter for \
+                        channel pair', 'blue'), 'bold'))
                 return
         if opts.link_up_down_trap_enable:
             types = ["trap_disabled", "trap_enabled"]
             try:
                 assert opts.link_up_down_trap_enable in types, \
-                        'Invalid Enum value for Channel Pair link up down trap enable type \'{}\''\
-                        .format(opts.link_up_down_trap_enable)
+                        'Invalid Enum value for Channel Pair link up down \
+                        trap enable type \'{}\''.format(
+                            opts.link_up_down_trap_enable)
                 interface_instance.interface.link_up_down_trap_enable = \
-                    ietf_interfaces_pb2._INTERFACE_LINKUPDOWNTRAPENABLETYPE.values_by_name[opts.link_up_down_trap_enable.upper()].number
+                    ietf_interfaces_pb2._INTERFACE_LINKUPDOWNTRAPENABLETYPE.\
+                    values_by_name[opts.link_up_down_trap_enable.upper()].\
+                    number
             except AssertionError, e:
                 self.poutput(self.colorize('Error: ', 'red') + \
                             self.colorize(self.colorize(e.message, 'blue'),
@@ -573,22 +627,28 @@
                 return
 
         if opts.channelpair_linerate:
-            interface_instance.data.channelpair_linerate = opts.channelpair_linerate
+            interface_instance.data.channelpair_linerate = \
+                opts.channelpair_linerate
         if opts.channelpair_type:
             interface_instance.data.channelpair_type = opts.channelpair_type
         if opts.channelgroup_ref:
             interface_instance.data.channelgroup_ref = opts.channelgroup_ref
         if opts.gpon_ponid_interval:
-            interface_instance.data.gpon_ponid_interval = opts.gpon_ponid_interval
+            interface_instance.data.gpon_ponid_interval = \
+                opts.gpon_ponid_interval
         if opts.channelpartition_ref:
-            interface_instance.data.channelpartition_ref = opts.channelpartition_ref
+            interface_instance.data.channelpartition_ref = \
+                opts.channelpartition_ref
         if opts.gpon_ponid_odn_class:
-            class_types = ["class_a", "class_b", "class_b_plus", "class_c", "class_c_plus", "class_auto"]
+            class_types = ["class_a", "class_b", "class_b_plus", "class_c",
+                           "class_c_plus", "class_auto"]
             try:
                 assert opts.gpon_ponid_odn_class in class_types, \
-                        'Invalid enum value for Channel Pair gpon pon id odn class \'{}\''.format(opts.gpon_ponid_odn_class)
+                        'Invalid enum value for Channel Pair gpon pon id odn \
+                        class \'{}\''.format(opts.gpon_ponid_odn_class)
                 interface_instance.data.gpon_ponid_odn_class = \
-                    bbf_fiber_types_pb2._PONIDODNCLASSTYPE.values_by_name[opts.gpon_ponid_odn_class.upper()].number
+                    bbf_fiber_types_pb2._PONIDODNCLASSTYPE.\
+                    values_by_name[opts.gpon_ponid_odn_class.upper()].number
             except AssertionError, e:
                 self.poutput(self.colorize('Error: ', 'red') + \
                             self.colorize(self.colorize(e.message, 'blue'),
@@ -607,19 +667,24 @@
         self.poutput(
 '''
 channel_termination [get | create | update | delete] [-i <id>] [-n <name>]
-                    [-d <description>] [-a <admin state>] [-l <link up down trap enable type>]
-                    [-r <channel pair reference>] [-m <meant for type_b primary role>]
-                    [-w <ngpon2 time wavelength division multiplexing admin label>]
+                    [-d <description>] [-a <admin state>]
+                    [-l <link up down trap enable type>]
+                    [-r <channel pair reference>]
+                    [-m <meant for type_b primary role>]
+                    [-w <ngpon2 time wavelength division multiplexing
+                        admin label>]
                     [-p <ngpon2 ptp admin label>] [-s <xgs pon id>]
                     [-x <xgpon pon id>] [-g <gpon pon id>] [-t <pon tag>]
                     [-b <ber calc period>] [-l <location>] [-u <url to reach>]
 
 get:    displays existing channel pairs
         Required flags: None
-create: creates channel pair with the parameters specified with -i -n, -d, -a, -l, -r, -m, -w, -p, -s, -x, -g, -t, -b, -c and -u
+create: creates channel pair with the parameters specified with -i -n, -d, -a,
+        -l, -r, -m, -w, -p, -s, -x, -g, -t, -b, -c and -u
         Required flags: <id>, <name>
-update: updates existing channel termination specified with -i and -n parameters by changing
-        its parameter values specified with -d, -a, -l, -r, -m, -w, -p, -s, -x, -g, -b, -c, and -u
+update: updates existing channel termination specified with -i and -n
+        parameters by changing its parameter values specified with -d, -a, -l,
+        -r, -m, -w, -p, -s, -x, -g, -b, -c, and -u
         Required flags: <id>, <name>
 delete: deletes channel termination specified with parameter -i and -n.
         Required flags: <id>, <name>
@@ -643,7 +708,8 @@
 
 Example:
 
-channel_termination create -i f90bb953f988 -n cterm-1 -a up -r cp-1 -m false -w 0 -p 0 -s 0 -x 0 -b 0 -c raleigh -u localhost
+channel_termination create -i f90bb953f988 -n cterm-1 -a up -r cp-1 -m false
+                    -w 0 -p 0 -s 0 -x 0 -b 0 -c raleigh -u localhost
 
 '''
         )
@@ -654,19 +720,29 @@
         make_option('-n', '--name', action="store", dest='name', type='string',
                     help='name of channel pair', default=None),
         make_option('-d', '--description', action="store", dest='description',
-                    type='string', help='description of channel termination', default=None),
-        make_option('-a', '--admin_state', action="store", dest='enabled', type='string',
-                    help='admin state of channel termination', default=None),
-        make_option('-l', '--trap', action="store", dest='link_up_down_trap_enable',
-                    type='string', help='link up down trap enable type', default=None),
+                    type='string', help='description of channel termination',
+                    default=None),
+        make_option('-a', '--admin_state', action="store", dest='enabled',
+                    type='string', help='admin state of channel termination',
+                    default=None),
+        make_option('-l', '--trap', action="store",
+                    dest='link_up_down_trap_enable', type='string',
+                    help='link up down trap enable type', default=None),
         make_option('-r', '--cp_ref', action='store', dest='channelpair_ref',
-                    type='string', help='channel pair reference for this channel termination', default=None),
-        make_option('-m', '--type_b', action='store', dest='meant_for_type_b_primary_role',
-                    type='string', help='meant for type_b primary role', default=None),
-        make_option('-w', '--t_w_d_m', action='store', dest='ngpon2_twdm_admin_label',
-                    type='int', help='ngpon2 time wavelength division multiplexing admin label', default=None),
-        make_option('-p', '--ptp', action='store', dest='ngpon2_ptp_admin_label',
-                    type='int', help='ngpon2 precision time protocol admin label', default=None),
+                    type='string',
+                    help='channel pair reference for this channel termination',
+                    default=None),
+        make_option('-m', '--type_b', action='store',
+                    dest='meant_for_type_b_primary_role', type='string',
+                    help='meant for type_b primary role', default=None),
+        make_option('-w', '--t_w_d_m', action='store',
+                    dest='ngpon2_twdm_admin_label', type='int',
+                    help='ngpon2 time wavelength division multiplexing admin \
+                    label', default=None),
+        make_option('-p', '--ptp', action='store',
+                    dest='ngpon2_ptp_admin_label', type='int',
+                    help='ngpon2 precision time protocol admin label',
+                    default=None),
         make_option('-s', '--xgs', action='store', dest='xgs_ponid',
                     type='int', help='xgs pon id', default=None),
         make_option('-x', '--xgpon', action='store', dest='xgpon_ponid',
@@ -676,15 +752,19 @@
         make_option('-t', '--pon', action='store', dest='pon_tag',
                     type='string', help='pon tag', default=None),
         make_option('-b', '--ber', action='store', dest='ber_calc_period',
-                    type='int', help='bit error rate calculation period', default=None),
+                    type='int', help='bit error rate calculation period',
+                    default=None),
         make_option('-c', '--location', action='store', dest='location',
-                    type='string', help='location of channel termination', default=None),
+                    type='string', help='location of channel termination',
+                    default=None),
         make_option('-u', '--url', action='store', dest='url_to_reach',
-                    type='string', help='url to reach channel termination', default=None),
+                    type='string', help='url to reach channel termination',
+                    default=None),
     ])
 
     def do_channel_termination(self, line, opts):
-        """channel termination get, create -flags <attributes>, update -flags <attributes>, delete -i <id> -n <name>"""
+        """channel termination get, create -flags <attributes>,
+        update -flags <attributes>, delete -i <id> -n <name>"""
         # Ensure that a valid sub-command was provided
         if line.strip() not in {"get", "create", "update", "delete"}:
             self.poutput(self.colorize('Error: ', 'red') + \
@@ -696,23 +776,30 @@
 
         if line.strip() == "get":
             if self.device_id:
-                cg, cpart, cp, ct, vont, ont, venet = self.get_interface_based_on_device()
-                print_pb_list_as_table("Channel Terminations for device ID = {}:".format(self.device_id),
-                                       ct, {}, self.poutput)
+                cg, cpart, cp, ct, vont, ont, venet = \
+                    self.get_interface_based_on_device()
+                print_pb_list_as_table(
+                    "Channel Terminations for device ID = {}:"
+                    .format(self.device_id), ct, {}, self.poutput)
             elif opts.id:
-                ct = stub.GetAllChannelterminationConfig(voltha_pb2.ID(id=opts.id)).channeltermination_config
-                print_pb_list_as_table("Channel Terminations for device ID = {}:".format(opts.id),
+                ct = stub.GetAllChannelterminationConfig(
+                    voltha_pb2.ID(id=opts.id)).channeltermination_config
+                print_pb_list_as_table(
+                    "Channel Terminations for device ID = {}:".format(opts.id),
                                        ct, {}, self.poutput)
             else:
                 devices = stub.ListDevices(Empty())
                 for d in devices.items:
-                    interface = stub.GetAllChannelterminationConfig(voltha_pb2.ID(id=d.id))
-                    print_pb_list_as_table("Channel Terminations for device ID = {}:".format(d.id),
-                                       interface.channeltermination_config,
-                                       {}, self.poutput)
+                    interface = stub.GetAllChannelterminationConfig(
+                        voltha_pb2.ID(id=d.id))
+                    print_pb_list_as_table(
+                        "Channel Terminations for device ID = {}:"
+                        .format(d.id), interface.channeltermination_config,
+                        {}, self.poutput)
             return
 
-        interface_instance = ChannelterminationConfig(id = opts.id, name = opts.name)
+        interface_instance = ChannelterminationConfig(
+            id = opts.id, name = opts.name)
         interface_instance.interface.name = opts.name
         if opts.description:
             interface_instance.interface.description = opts.description
@@ -723,18 +810,22 @@
             elif opts.enabled == "down":
                 interface_instance.interface.enabled = False
             else:
-                self.poutput(self.colorize('Error: ', 'red') + \
-                            self.colorize(self.colorize('Invalid admin state parameter for channel termination', 'blue'),
-                                          'bold'))
+                self.poutput(
+                    self.colorize('Error: ', 'red') + self.colorize(
+                        self.colorize('Invalid admin state parameter for \
+                        channel termination', 'blue'), 'bold'))
                 return
         if opts.link_up_down_trap_enable:
             types = ["trap_disabled", "trap_enabled"]
             try:
                 assert opts.link_up_down_trap_enable in types, \
-                        'Invalid Enum value for Channel Termination link up down trap enable type \'{}\''\
-                        .format(opts.link_up_down_trap_enable)
+                        'Invalid Enum value for Channel Termination link up \
+                        down trap enable type \'{}\''.format(
+                            opts.link_up_down_trap_enable)
                 interface_instance.interface.link_up_down_trap_enable = \
-                    ietf_interfaces_pb2._INTERFACE_LINKUPDOWNTRAPENABLETYPE.values_by_name[opts.link_up_down_trap_enable.upper()].number
+                    ietf_interfaces_pb2._INTERFACE_LINKUPDOWNTRAPENABLETYPE.\
+                    values_by_name[opts.link_up_down_trap_enable.upper()].\
+                    number
             except AssertionError, e:
                 self.poutput(self.colorize('Error: ', 'red') + \
                             self.colorize(self.colorize(e.message, 'blue'),
@@ -749,16 +840,19 @@
             elif opts.meant_for_type_b_primary_role == 'false':
                 interface_instance.data.meant_for_type_b_primary_role = False
             else:
-                m = 'Invalid boolean value for Channel Termination meant_for_type_b_primary_role \'{}\''\
-                    .format(opts.meant_for_type_b_primary_role)
+                m = 'Invalid boolean value for Channel Termination \
+                meant_for_type_b_primary_role \'{}\''.format(
+                    opts.meant_for_type_b_primary_role)
                 self.poutput(self.colorize('Error: ', 'red') + \
                             self.colorize(self.colorize(m, 'blue'),
                                           'bold'))
                 return
         if opts.ngpon2_twdm_admin_label:
-            interface_instance.data.ngpon2_twdm_admin_label = opts.ngpon2_twdm_admin_label
+            interface_instance.data.ngpon2_twdm_admin_label = \
+                opts.ngpon2_twdm_admin_label
         if opts.ngpon2_ptp_admin_label:
-            interface_instance.data.ngpon2_ptp_admin_label = opts.ngpon2_ptp_admin_label
+            interface_instance.data.ngpon2_ptp_admin_label = \
+                opts.ngpon2_ptp_admin_label
         if opts.xgs_ponid:
             interface_instance.data.xgs_ponid = opts.xgs_ponid
         if opts.xgpon_ponid:
@@ -785,18 +879,21 @@
     def help_vont_ani(self):
         self.poutput(
 '''
-vont_ani [get | create | update | delete] [-n <name>] [-d <description>] [-a <admin state>]
-         [-l <link up down trap enable type>] [-p <parent reference>]
-         [-s <expected serial number>] [-i <expected registration id>]
-         [-r <preferred channel pair>] [-t <protection channel pair>]
-         [-u <upstream channel speed>] [-o <onu id>]
+vont_ani [get | create | update | delete] [-n <name>] [-d <description>]
+         [-a <admin state>] [-l <link up down trap enable type>]
+         [-p <parent reference>] [-s <expected serial number>]
+         [-i <expected registration id>] [-r <preferred channel pair>]
+         [-t <protection channel pair>] [-u <upstream channel speed>]
+         [-o <onu id>]
 
 get:    displays existing vont anis
         Required flags: None
-create: creates vont ani with the parameters specified with -n, -d, -a, -l, -p, -s, -i, -r, -t, -u and -o.
+create: creates vont ani with the parameters specified with -n, -d, -a, -l,
+        -p, -s, -i, -r, -t, -u and -o.
         Required flags: <name>
-update: updates existing vont ani specified with parameter -n by changing its parameter values
-        specified with -d, -a, -l, -p, -s, -i, -r, -t, -u and -o.
+update: updates existing vont ani specified with parameter -n by changing its
+        parameter values specified with -d, -a, -l, -p, -s, -i, -r, -t, -u
+        and -o.
         Required flags: <name>
 delete: deletes vont ani specified with parameter -n.
         Required flags: <name>
@@ -815,7 +912,8 @@
 
 Example:
 
-vont_ani create -n ontani-1-1-1 -a up -p cpart-1-1 -s ALCL00000001 -r cp-1 -u 0 -o 1
+vont_ani create -n ontani-1-1-1 -a up -p cpart-1-1 -s ALCL00000001 -r cp-1
+                -u 0 -o 1
 '''
         )
 
@@ -823,32 +921,42 @@
         make_option('-n', '--name', action="store", dest='name', type='string',
                     help='name of vont ani', default=None),
         make_option('-d', '--description', action="store", dest='description',
-                    type='string', help='description of vont ani', default=None),
-        make_option('-a', '--admin_state', action="store", dest='enabled', type='string',
-                    help='admin state of vont ani', default=None),
-        make_option('-l', '--trap', action="store", dest='link_up_down_trap_enable',
-                    type='string', help='link up down trap enable type', default=None),
+                    type='string', help='description of vont ani',
+                    default=None),
+        make_option('-a', '--admin_state', action="store", dest='enabled',
+                    type='string', help='admin state of vont ani',
+                     default=None),
+        make_option('-l', '--trap', action="store",
+                    dest='link_up_down_trap_enable', type='string',
+                    help='link up down trap enable type', default=None),
         make_option('-p', '--parent_ref', action='store', dest='parent_ref',
-                    type='string', help='parent reference of vont ani must be type of channel partition',
+                    type='string',
+                    help='parent reference of vont ani must be type of \
+                    channel partition', default=None),
+        make_option('-s', '--e_ser_num', action='store',
+                    dest='expected_serial_number', type='string',
+                    help='expected serial number of ONT', default=None),
+        make_option('-i', '--e_reg_id', action='store',
+                    dest='expected_registration_id', type='string',
+                    help='expected registration id of ONT', default=None),
+        make_option('-r', '--pref_cp', action='store',
+                    dest='preferred_chanpair', type='string',
+                    help='preferred channel pair must be type of channel pair',
                     default=None),
-        make_option('-s', '--e_ser_num', action='store', dest='expected_serial_number',
-                    type='string', help='expected serial number of ONT', default=None),
-        make_option('-i', '--e_reg_id', action='store', dest='expected_registration_id',
-                    type='string', help='expected registration id of ONT', default=None),
-        make_option('-r', '--pref_cp', action='store', dest='preferred_chanpair',
-                    type='string', help='preferred channel pair must be type of channel pair',
-                    default=None),
-        make_option('-t', '--prot_cp', action='store', dest='protection_chanpair',
-                    type='string', help='protection channel pair must be type of channel pair',
-                    default=None),
-        make_option('-u', '--up_cs', action='store', dest='upstream_channel_speed',
-                    type='int', help='upstream channel speed of traffic', default=None),
+        make_option('-t', '--prot_cp', action='store',
+                    dest='protection_chanpair', type='string',
+                    help='protection channel pair must be type of channel \
+                    pair', default=None),
+        make_option('-u', '--up_cs', action='store',
+                    dest='upstream_channel_speed', type='int',
+                    help='upstream channel speed of traffic', default=None),
         make_option('-o', '--onu_id', action='store', dest='onu_id',
                     type='int', help='onu id', default=None),
     ])
 
     def do_vont_ani(self, line, opts):
-        """vont ani get, create -flags <attributes>, update -flags <attributes>, delete -n <name>"""
+        """vont ani get, create -flags <attributes>,
+        update -flags <attributes>, delete -n <name>"""
         # Ensure that a valid sub-command was provided
         if line.strip() not in {"get", "create", "update", "delete"}:
             self.poutput(self.colorize('Error: ', 'red') + \
@@ -860,9 +968,11 @@
 
         if line.strip() == "get":
             if self.device_id:
-                cg, cpart, cp, ct, vont, ont, venet = self.get_interface_based_on_device()
-                print_pb_list_as_table("VOnt Anis for device ID = {}:".format(self.device_id),
-                                       vont, {}, self.poutput)
+                cg, cpart, cp, ct, vont, ont, venet = \
+                    self.get_interface_based_on_device()
+                print_pb_list_as_table("VOnt Anis for device ID = {}:"
+                                       .format(self.device_id), vont, {},
+                                       self.poutput)
             else:
                 interface = stub.GetAllVOntaniConfig(Empty())
                 print_pb_list_as_table("VOnt Anis:",
@@ -881,18 +991,22 @@
             elif opts.enabled == "down":
                 interface_instance.interface.enabled = False
             else:
-                self.poutput(self.colorize('Error: ', 'red') + \
-                            self.colorize(self.colorize('Invalid admin state parameter for vont ani', 'blue'),
-                                          'bold'))
+                self.poutput(
+                    self.colorize('Error: ', 'red') + self.colorize(
+                        self.colorize('Invalid admin state parameter for \
+                        vont ani', 'blue'), 'bold'))
                 return
         if opts.link_up_down_trap_enable:
             types = ["trap_disabled", "trap_enabled"]
             try:
                 assert opts.link_up_down_trap_enable in types, \
-                        'Invalid Enum value for VOnt Ani link up down trap enable type \'{}\''\
-                        .format(opts.link_up_down_trap_enable)
+                        'Invalid Enum value for VOnt Ani link up down trap \
+                        enable type \'{}\''.format(
+                            opts.link_up_down_trap_enable)
                 interface_instance.interface.link_up_down_trap_enable = \
-                    ietf_interfaces_pb2._INTERFACE_LINKUPDOWNTRAPENABLETYPE.values_by_name[opts.link_up_down_trap_enable.upper()].number
+                    ietf_interfaces_pb2._INTERFACE_LINKUPDOWNTRAPENABLETYPE.\
+                    values_by_name[opts.link_up_down_trap_enable.upper()].\
+                    number
             except AssertionError, e:
                 self.poutput(self.colorize('Error: ', 'red') + \
                             self.colorize(self.colorize(e.message, 'blue'),
@@ -902,15 +1016,20 @@
         if opts.parent_ref:
             interface_instance.data.parent_ref = opts.parent_ref
         if opts.expected_serial_number:
-            interface_instance.data.expected_serial_number = opts.expected_serial_number
+            interface_instance.data.expected_serial_number = \
+                opts.expected_serial_number
         if opts.expected_registration_id:
-            interface_instance.data.expected_registration_id = opts.expected_registration_id
+            interface_instance.data.expected_registration_id = \
+                opts.expected_registration_id
         if opts.preferred_chanpair:
-            interface_instance.data.preferred_chanpair = opts.preferred_chanpair
+            interface_instance.data.preferred_chanpair = \
+                opts.preferred_chanpair
         if opts.protection_chanpair:
-            interface_instance.data.protection_chanpair = opts.protection_chanpair
+            interface_instance.data.protection_chanpair = \
+                opts.protection_chanpair
         if opts.upstream_channel_speed:
-            interface_instance.data.upstream_channel_speed = opts.upstream_channel_speed
+            interface_instance.data.upstream_channel_speed = \
+                opts.upstream_channel_speed
         if opts.onu_id:
             interface_instance.data.onu_id = opts.onu_id
 
@@ -925,16 +1044,17 @@
     def help_ont_ani(self):
         self.poutput(
 '''
-ont_ani [get | create | update | delete] [-n <name>] [-d <description>] [-a <admin state>]
-        [-l <link up down trap enable type>] [-u <upstream fec indicator>]
-        [-m <management gem port aes indicator>]
+ont_ani [get | create | update | delete] [-n <name>] [-d <description>]
+        [-a <admin state>] [-l <link up down trap enable type>]
+        [-u <upstream fec indicator>] [-m <management gem port aes indicator>]
 
 get:    displays existing ont anis
         Required flags: None
-create: creates ont ani with the parameters specified with -n, -d, -a, -l, -u and -m.
+create: creates ont ani with the parameters specified with -n, -d, -a, -l, -u
+        and -m.
         Required flags: <name>
-update: updates existing ont ani specified with parameter -n by changing its parameter values
-        specified with -d, -a, -l, -u and -m.
+update: updates existing ont ani specified with parameter -n by changing its
+        parameter values specified with -d, -a, -l, -u and -m.
         Required flags: <name>
 delete: deletes ont ani specified with parameter -n.
         Required flags: <name>
@@ -956,19 +1076,25 @@
         make_option('-n', '--name', action="store", dest='name', type='string',
                     help='name of ont ani', default=None),
         make_option('-d', '--description', action="store", dest='description',
-                    type='string', help='description of ont ani', default=None),
-        make_option('-a', '--admin_state', action="store", dest='enabled', type='string',
-                    help='admin state of ont ani', default=None),
-        make_option('-l', '--trap', action="store", dest='link_up_down_trap_enable',
-                    type='string', help='link up down trap enable type', default=None),
-        make_option('-u', '--up_fec', action='store', dest='upstream_fec_indicator',
-                    type='string', help='upstream traffic fec indicator', default=None),
-        make_option('-m', '--maes', action='store', dest='mgnt_gemport_aes_indicator',
-                    type='string', help='management gem port aes indicator', default=None),
+                    type='string', help='description of ont ani',
+                    default=None),
+        make_option('-a', '--admin_state', action="store", dest='enabled',
+                    type='string', help='admin state of ont ani',
+                    default=None),
+        make_option('-l', '--trap', action="store",
+                    dest='link_up_down_trap_enable', type='string',
+                    help='link up down trap enable type', default=None),
+        make_option('-u', '--up_fec', action='store',
+                    dest='upstream_fec_indicator', type='string',
+                    help='upstream traffic fec indicator', default=None),
+        make_option('-m', '--maes', action='store',
+                    dest='mgnt_gemport_aes_indicator', type='string',
+                    help='management gem port aes indicator', default=None),
     ])
 
     def do_ont_ani(self, line, opts):
-        """ont ani get, create -flags <attributes>, update -flags <attributes>, delete -n <name>"""
+        """ont ani get, create -flags <attributes>,
+        update -flags <attributes>, delete -n <name>"""
         # Ensure that a valid sub-command was provided
         if line.strip() not in {"get", "create", "update", "delete"}:
             self.poutput(self.colorize('Error: ', 'red') + \
@@ -980,9 +1106,10 @@
 
         if line.strip() == "get":
             if self.device_id:
-                cg, cpart, cp, ct, vont, ont, venet = self.get_interface_based_on_device()
-                print_pb_list_as_table("Ont Anis for device ID = {}:".format(self.device_id),
-                                       ont, {}, self.poutput)
+                cg, cpart, cp, ct, vont, ont, venet = \
+                    self.get_interface_based_on_device()
+                print_pb_list_as_table("Ont Anis for device ID = {}:".format(
+                    self.device_id), ont, {}, self.poutput)
             else:
                 interface = stub.GetAllOntaniConfig(Empty())
                 print_pb_list_as_table("Ont Anis:",
@@ -1001,18 +1128,22 @@
             elif opts.enabled == "down":
                 interface_instance.interface.enabled = False
             else:
-                self.poutput(self.colorize('Error: ', 'red') + \
-                            self.colorize(self.colorize('Invalid admin state parameter for ont ani', 'blue'),
-                                          'bold'))
+                self.poutput(
+                    self.colorize('Error: ', 'red') + self.colorize(
+                        self.colorize('Invalid admin state parameter for \
+                        ont ani', 'blue'), 'bold'))
                 return
         if opts.link_up_down_trap_enable:
             types = ["trap_disabled", "trap_enabled"]
             try:
                 assert opts.link_up_down_trap_enable in types, \
-                        'Invalid Enum value for Ont Ani link up down trap enable type \'{}\''\
-                        .format(opts.link_up_down_trap_enable)
+                        'Invalid Enum value for Ont Ani link up down trap \
+                        enable type \'{}\''.format(
+                            opts.link_up_down_trap_enable)
                 interface_instance.interface.link_up_down_trap_enable = \
-                    ietf_interfaces_pb2._INTERFACE_LINKUPDOWNTRAPENABLETYPE.values_by_name[opts.link_up_down_trap_enable.upper()].number
+                    ietf_interfaces_pb2._INTERFACE_LINKUPDOWNTRAPENABLETYPE.\
+                    values_by_name[opts.link_up_down_trap_enable.upper()].\
+                    number
             except AssertionError, e:
                 self.poutput(self.colorize('Error: ', 'red') + \
                             self.colorize(self.colorize(e.message, 'blue'),
@@ -1025,11 +1156,12 @@
             elif opts.upstream_fec_indicator == 'false':
                 interface_instance.data.upstream_fec_indicator = False
             else:
-                m = 'Invalid boolean value for Ont Ani upstream_fec_indicator \'{}\''\
-                    .format(opts.upstream_fec_indicator)
-                self.poutput(self.colorize('Error: ', 'red') + \
-                            self.colorize(self.colorize(m, 'blue'),
-                                          'bold'))
+                m = 'Invalid boolean value for Ont Ani \
+                upstream_fec_indicator \'{}\''.format(
+                    opts.upstream_fec_indicator)
+                self.poutput(
+                    self.colorize('Error: ', 'red') + self.colorize(
+                        self.colorize(m, 'blue'), 'bold'))
                 return
         if opts.mgnt_gemport_aes_indicator:
             if opts.mgnt_gemport_aes_indicator == 'true':
@@ -1037,11 +1169,12 @@
             elif opts.mgnt_gemport_aes_indicator == 'false':
                 interface_instance.data.mgnt_gemport_aes_indicator = False
             else:
-                m = 'Invalid boolean value for Ont Ani mgnt_gemport_aes_indicator \'{}\''\
-                    .format(opts.mgnt_gemport_aes_indicator)
-                self.poutput(self.colorize('Error: ', 'red') + \
-                            self.colorize(self.colorize(m, 'blue'),
-                                          'bold'))
+                m = 'Invalid boolean value for Ont Ani \
+                mgnt_gemport_aes_indicator \'{}\''.format(
+                    opts.mgnt_gemport_aes_indicator)
+                self.poutput(
+                    self.colorize('Error: ', 'red') + self.colorize(
+                        self.colorize(m, 'blue'), 'bold'))
                 return
 
         if line.strip() == "create":
@@ -1055,15 +1188,17 @@
     def help_v_enet(self):
         self.poutput(
 '''
-v_enet [get | create | update | delete] [-n <name>] [-d <description>] [-a <admin state>]
-       [-l <link up down trap enable type>] [-r <ont ani reference>]
+v_enet [get | create | update | delete] [-n <name>] [-d <description>]
+       [-a <admin state>] [-l <link up down trap enable type>]
+       [-r <ont ani reference>]
 
 get:    displays existing venets
         Required flags: None
-create: creates venet with the parameters specified with -n, -d, -a, -l, and -r.
+create: creates venet with the parameters specified with -n, -d, -a, -l,
+        and -r.
         Required flags: <name>
-update: updates existing venet specified with parameter -n by changing its parameter values
-        specified with -d, -a, -l, -r.
+update: updates existing venet specified with parameter -n by changing its
+        parameter values specified with -d, -a, -l, -r.
         Required flags: <name>
 delete: deletes venet specified with parameter -n.
         Required flags: <name>
@@ -1085,16 +1220,18 @@
                     help='name of venet', default=None),
         make_option('-d', '--description', action="store", dest='description',
                     type='string', help='description of venet', default=None),
-        make_option('-a', '--admin_state', action="store", dest='enabled', type='string',
-                    help='admin state of venet', default=None),
-        make_option('-l', '--trap', action="store", dest='link_up_down_trap_enable',
-                    type='string', help='link up down trap enable type', default=None),
+        make_option('-a', '--admin_state', action="store", dest='enabled',
+                    type='string', help='admin state of venet', default=None),
+        make_option('-l', '--trap', action="store",
+                    dest='link_up_down_trap_enable', type='string',
+                    help='link up down trap enable type', default=None),
         make_option('-r', '--ont_ref', action='store', dest='v_ontani_ref',
                     type='string', help='ont ani reference', default=None),
     ])
 
     def do_v_enet(self, line, opts):
-        """v_enet get, create -flags <attributes>, update -flags <attributes>, delete -n <name>"""
+        """v_enet get, create -flags <attributes>,
+        update -flags <attributes>, delete -n <name>"""
         # Ensure that a valid sub-command was provided
         if line.strip() not in {"get", "create", "update", "delete"}:
             self.poutput(self.colorize('Error: ', 'red') + \
@@ -1106,9 +1243,11 @@
 
         if line.strip() == "get":
             if self.device_id:
-                cg, cpart, cp, ct, vont, ont, venet = self.get_interface_based_on_device()
-                print_pb_list_as_table("VEnet for device ID = {}:".format(self.device_id),
-                                       venet, {}, self.poutput)
+                cg, cpart, cp, ct, vont, ont, venet = \
+                    self.get_interface_based_on_device()
+                print_pb_list_as_table("VEnet for device ID = {}:"
+                                       .format(self.device_id), venet, {},
+                                       self.poutput)
             else:
                 interface = stub.GetAllVEnetConfig(Empty())
                 print_pb_list_as_table("VEnets:",
@@ -1127,18 +1266,22 @@
             elif opts.enabled == "down":
                 interface_instance.interface.enabled = False
             else:
-                self.poutput(self.colorize('Error: ', 'red') + \
-                            self.colorize(self.colorize('Invalid admin state parameter for venet', 'blue'),
-                                          'bold'))
+                self.poutput(
+                    self.colorize('Error: ', 'red') + self.colorize(
+                        self.colorize('Invalid admin state parameter for \
+                        venet', 'blue'), 'bold'))
                 return
         if opts.link_up_down_trap_enable:
             types = ["trap_disabled", "trap_enabled"]
             try:
                 assert opts.link_up_down_trap_enable in types, \
-                        'Invalid Enum value for Venet link up down trap enable type \'{}\''\
-                        .format(opts.link_up_down_trap_enable)
+                        'Invalid Enum value for Venet link up down trap \
+                        enable type \'{}\''.format(
+                            opts.link_up_down_trap_enable)
                 interface_instance.interface.link_up_down_trap_enable = \
-                    ietf_interfaces_pb2._INTERFACE_LINKUPDOWNTRAPENABLETYPE.values_by_name[opts.link_up_down_trap_enable.upper()].number
+                    ietf_interfaces_pb2._INTERFACE_LINKUPDOWNTRAPENABLETYPE.\
+                    values_by_name[opts.link_up_down_trap_enable.upper()].\
+                    number
             except AssertionError, e:
                 self.poutput(self.colorize('Error: ', 'red') + \
                             self.colorize(self.colorize(e.message, 'blue'),
diff --git a/voltha/core/xpon_agent.py b/voltha/core/xpon_agent.py
index 489ff90..4dd6a87 100644
--- a/voltha/core/xpon_agent.py
+++ b/voltha/core/xpon_agent.py
@@ -19,8 +19,9 @@
 
 from voltha.registry import registry
 from voltha.core.config.config_proxy import CallbackType
-from voltha.protos.bbf_fiber_base_pb2 import ChannelgroupConfig, ChannelpartitionConfig, \
-    ChannelpairConfig, ChannelterminationConfig, OntaniConfig, VOntaniConfig, VEnetConfig
+from voltha.protos.bbf_fiber_base_pb2 import ChannelgroupConfig, \
+    ChannelpartitionConfig, ChannelpairConfig, ChannelterminationConfig, \
+    OntaniConfig, VOntaniConfig, VEnetConfig
 from voltha.protos.device_pb2 import Device
 from voltha.protos.common_pb2 import AdminState
 
@@ -28,23 +29,92 @@
 
 class XponAgent(object):
 
-    interfaces = {ChannelgroupConfig: {'path': '/channel_groups/{}', 'path_keys': ['name'], 'device_id' : ''},
-                  ChannelpartitionConfig: {'path': '/channel_partitions/{}', 'path_keys': ['name'], 'device_id' : ''},
-                  ChannelpairConfig: {'path': '/channel_pairs/{}', 'path_keys': ['name'], 'device_id' : ''},
-                  ChannelterminationConfig: {'path': '/devices/{}/channel_terminations/{}', 'path_keys': ['id', 'name'], 'device_id' : 'id'},
-                  OntaniConfig: {'path': '/ont_anis/{}', 'path_keys': ['name'], 'device_id' : ''},
-                  VOntaniConfig: {'path': '/v_ont_anis/{}', 'path_keys': ['name'], 'device_id' : ''},
-                  VEnetConfig: {'path': '/v_enets/{}', 'path_keys': ['name'], 'device_id' : ''}
+    interfaces = {ChannelgroupConfig: {
+                      'path': '/channel_groups/{}', 'path_keys': ['name'],
+                      'device_id' : ''},
+                  ChannelpartitionConfig: {
+                      'path': '/channel_partitions/{}', 'path_keys': ['name'],
+                      'device_id' : ''},
+                  ChannelpairConfig: {
+                      'path': '/channel_pairs/{}', 'path_keys': ['name'],
+                      'device_id' : ''},
+                  ChannelterminationConfig: {
+                      'path': '/devices/{}/channel_terminations/{}',
+                      'path_keys': ['id', 'name'], 'device_id' : 'id'},
+                  OntaniConfig: {
+                      'path': '/ont_anis/{}', 'path_keys': ['name'],
+                      'device_id' : ''},
+                  VOntaniConfig: {
+                      'path': '/v_ont_anis/{}', 'path_keys': ['name'],
+                      'device_id' : ''},
+                  VEnetConfig: {
+                      'path': '/v_enets/{}', 'path_keys': ['name'],
+                      'device_id' : ''}
                   }
 
-    interface_stack = {ChannelgroupConfig: {'parent': None, 'parent_path' : None, 'parent_path_keys': [None]},
-                       ChannelpartitionConfig: {'parent': ChannelgroupConfig, 'parent_path' : '/channel_groups/{}', 'parent_path_keys': ['data.channelgroup_ref']},
-                       ChannelpairConfig: {'parent': ChannelpartitionConfig, 'parent_path': '/channel_partitions/{}', 'parent_path_keys': ['data.channelpartition_ref']},
-                       ChannelterminationConfig: {'parent': ChannelpairConfig, 'parent_path': '/channel_pairs/{}', 'parent_path_keys': ['data.channelpair_ref']},
-                       #VOntaniConfig: {'parent': ChannelpartitionConfig, 'parent_path': '/channel_partitions/{}', 'parent_path_keys': ['data.channelpartition_ref']},
-                       VOntaniConfig: {'parent': ChannelpairConfig, 'parent_path': '/channel_pairs/{}', 'parent_path_keys': ['data.preferred_chanpair']},
-                       OntaniConfig: {'parent': VOntaniConfig, 'parent_path': '/v_ont_anis/{}', 'parent_path_keys': ['name']},
-                       VEnetConfig: {'parent': VOntaniConfig, 'parent_path': '/v_ont_anis/{}', 'parent_path_keys': ['data.v_ontani_ref']}
+    interface_stack = {ChannelgroupConfig: {
+                           'parent': None, 'parent_path': None,
+                               'parent_path_keys': [None],
+                            'child': ChannelpartitionConfig,
+                                'child_path': ['/channel_partitions'],
+                            'olt_link': None, 'olt_link_path': None,
+                                'olt_link_path_keys': [None],
+                                'olt_device_id': 'from_child'},
+                       ChannelpartitionConfig: {
+                           'parent': ChannelgroupConfig,
+                               'parent_path': '/channel_groups/{}',
+                               'parent_path_keys': ['data.channelgroup_ref'],
+                            'child': ChannelpairConfig,
+                                'child_path': ['/channel_pairs'],
+                            'olt_link': None, 'olt_link_path': None,
+                                'olt_link_path_keys': [None],
+                                'olt_device_id': 'from_child'},
+                       ChannelpairConfig: {
+                           'parent': ChannelpartitionConfig,
+                               'parent_path': '/channel_partitions/{}',
+                               'parent_path_keys':\
+                                   ['data.channelpartition_ref'],
+                            'child': ChannelterminationConfig,
+                                'child_path':\
+                                    ['/devices', 'channel_terminations'],
+                            'olt_link': None, 'olt_link_path': None,
+                                'olt_link_path_keys': [None],
+                                'olt_device_id': 'from_child'},
+                       ChannelterminationConfig: {
+                           'parent': ChannelpairConfig,
+                               'parent_path': '/channel_pairs/{}',
+                               'parent_path_keys':\
+                                   ['data.channelpair_ref'],
+                            'child': None, 'child_path': [None],
+                            'olt_link': None, 'olt_link_path': None,
+                                'olt_link_path_keys': [None],
+                                'olt_device_id': 'self'},
+                       VOntaniConfig: {
+                           'parent': ChannelpartitionConfig,
+                               'parent_path': '/channel_partitions/{}',
+                               'parent_path_keys': ['data.parent_ref'],
+                            'child': VEnetConfig, 'child_path': ['/v_enets'],
+                            'olt_link': ChannelpairConfig,
+                                'olt_link_path': '/channel_pairs/{}',
+                                'olt_link_path_keys':\
+                                    ['data.preferred_chanpair'],
+                                'olt_device_id': 'from_link'},
+                       OntaniConfig: {
+                           'parent': None, 'parent_path': None,
+                               'parent_path_keys': [None],
+                            'child': None, 'child_path': [None],
+                            'olt_link': VOntaniConfig,
+                                'olt_link_path': '/v_ont_anis/{}',
+                                'olt_link_path_keys': ['name'],
+                                'olt_device_id' : 'from_link'},
+                       VEnetConfig: {
+                           'parent': VOntaniConfig,
+                               'parent_path': '/v_ont_anis/{}',
+                               'parent_path_keys': ['data.v_ontani_ref'],
+                            'child': None, 'child_path': [None],
+                            'olt_link': None, 'olt_link_path': None,
+                                'olt_link_path_keys': [None],
+                                'olt_device_id': 'from_parent'}
                       }
 
     def __init__(self, core):
@@ -57,87 +127,100 @@
         device = self.core.get_proxy('/devices/{}'.format(device_id)).get()
         assert device.adapter != ''
         adapter_agent = registry('adapter_loader').get_agent(device.adapter)
-        log.debug('get-device-adapter-agent', device=device, adapter_agent=adapter_agent)
+        log.debug('get-device-adapter-agent', device=device,
+                  adapter_agent=adapter_agent)
         return device, adapter_agent
 
     def get_interface_path(self, data):
-        val = self.interfaces[type(data)]
+        interface = self.interfaces[type(data)]
         id_val = {}
         count = 0
-        for key in val['path_keys']:
+        for key in interface['path_keys']:
             id_val[count] = getattr(data, key)
             count+=1
-        path = val['path'].format(*id_val.values())
+        path = interface['path'].format(*id_val.values())
         return path
 
-    def get_device_id(self, data):
-        val = self.interfaces[type(data)]
-        device_id = None if val['device_id'] is '' else getattr(data, val['device_id'])
+    def _child_predicate(self, data, child):
+        return self.get_parent_data(child).name == data.name
+
+    def _get_child_data_by_path (self, data, path):
+        children = self.core.get_proxy('/').get(path)
+        return next((child for child in children
+                     if self._child_predicate(data, child)), None)
+
+    def get_olt_device_id(self, data):
+        if data is None:
+            return None
+        interface = self.interfaces[type(data)]
+        interface_node = self.interface_stack[type(data)]
+        device_id = None if interface['device_id'] is '' \
+            else getattr(data, interface['device_id'])
         if device_id is None:
-            if(isinstance(data, ChannelpairConfig)):
-                device_items = self.core.get_proxy('/').get('/devices')
-                for device_item in device_items:
-                    items = self.core.get_proxy('/').get(
-                        '/devices/{}/channel_terminations'.format(device_item.id))
-                    for item in items:
-                        if item.data.channelpair_ref == data.name:
-                            return self.get_device_id(item)
-                return None
-            elif(isinstance(data, ChannelpartitionConfig)):
-                items = self.core.get_proxy('/').get('/channel_pairs')
-                for item in items:
-                    if item.data.channelpartition_ref == data.name:
-                        return self.get_device_id(item)
-                return None
-            elif(isinstance(data, ChannelgroupConfig)):
-                items = self.core.get_proxy('/').get('/channel_partitions')
-                for item in items:
-                    if item.data.channelgroup_ref == data.name:
-                        return self.get_device_id(item)
-                return None
-            # Take care of ont ani and v ont ani
-            elif(isinstance(data, VOntaniConfig)):
-                channel_part_items = self.core.get_proxy('/').get('/channel_partitions')
-                channel_pair_items = self.core.get_proxy('/').get('/channel_pairs')
-                for channel_part_item in channel_part_items:
-                    if channel_part_item.name == data.data.parent_ref:
-                        return self.get_device_id(channel_part_item)
-                for channel_pair_item in channel_pair_items:
-                    if channel_pair_item.name == data.data.preferred_chanpair or \
-                        channel_pair_item.name == data.data.protection_chanpair:
-                            return self.get_device_id(channel_pair_item)
-                return None
-            elif(isinstance(data, OntaniConfig)):
-                v_ont_ani_items = self.core.get_proxy('/').get('/v_ont_anis')
-                for v_ont_ani_item in v_ont_ani_items:
-                    if v_ont_ani_item.name == data.name:
-                        return self.get_device_id(v_ont_ani_item)
-                return None
-            elif(isinstance(data, VEnetConfig)):
-                v_ont_ani_items = self.core.get_proxy('/').get('/v_ont_anis')
-                for v_ont_ani_item in v_ont_ani_items:
-                    if v_ont_ani_item.name == data.data.v_ontani_ref:
-                        return self.get_device_id(v_ont_ani_item)
-                return None
+            if interface_node['olt_device_id'] == 'from_parent':
+                device_id = self.get_olt_device_id(self.get_parent_data(data))
+            elif interface_node['olt_device_id'] == 'from_child':
+                device_id = self.get_olt_device_id(self.get_child_data(data))
+            elif interface_node['olt_device_id'] == 'from_link':
+                device_id = self.get_olt_device_id(self.get_link_data(data))
         return device_id
 
     def get_parent_data(self, data):
         if data is None:
             return None
-        val = self.interface_stack[type(data)]
-        if val['parent'] is None:
+        interface_node = self.interface_stack[type(data)]
+        if interface_node['parent'] is None:
             return None
         id_val = {}
         count = 0
-        for key in val['parent_path_keys']:
+        for key in interface_node['parent_path_keys']:
             id_val[count] = self.rgetattr(data, key)
             count+=1
-        parent_path = val['parent_path'].format(*id_val.values())
+        parent_path = interface_node['parent_path'].format(*id_val.values())
         try:
             parent_data = self.core.get_proxy('/').get(parent_path)
             return parent_data
         except ValueError:
-            log.info('xpon-agent-warning-interface-cannot-get-parent', data=data)
+            log.info('xpon-agent-warning-interface-cannot-get-parent',
+                     data=data)
+            return None
+
+    def get_child_data(self, data):
+        interface_node = self.interface_stack[type(data)]
+        if len(interface_node['child_path']) > 1:
+            top_children = self.core.get_proxy('/').get('{}'.format(
+                interface_node['child_path'][0]))
+            for top_child in top_children:
+                child = self._get_child_data_by_path(data, '{}/{}/{}'.format(
+                    interface_node['child_path'][0], top_child.id,
+                    interface_node['child_path'][1]))
+                if child is not None:
+                    return child
+        else:
+            child = self._get_child_data_by_path(data, '{}'.format(
+                interface_node['child_path'][0]))
+        if child is None:
+            log.info('xpon-agent-warning-interface-cannot-get-child',
+                     data=data)
+        return child
+
+    def get_link_data(self, data):
+        interface_node = self.interface_stack[type(data)]
+        if interface_node['olt_link'] is None:
+            return None
+        id_val = {}
+        count = 0
+        for key in interface_node['olt_link_path_keys']:
+            id_val[count] = self.rgetattr(data, key)
+            count+=1
+        olt_link_path = interface_node['olt_link_path'].format(
+            *id_val.values())
+        try:
+            link_data = self.core.get_proxy('/').get(olt_link_path)
+            return link_data
+        except ValueError:
+            log.info('xpon-agent-warning-interface-cannot-get-link-data',
+                     data=data)
             return None
 
     def rgetattr(self, obj, attr):
@@ -156,10 +239,16 @@
         try:
             interface_proxy = self.core.get_proxy(path)
             if update:
-                interface_proxy.register_callback(CallbackType.POST_UPDATE, self.update_interface, device_id)
+                interface_proxy.register_callback(CallbackType.POST_UPDATE,
+                                                  self.update_interface,
+                                                  device_id)
             else:
-                interface_proxy.register_callback(CallbackType.POST_ADD, self.create_interface, device_id)
-                interface_proxy.register_callback(CallbackType.POST_REMOVE, self.remove_interface, device_id)
+                interface_proxy.register_callback(CallbackType.POST_ADD,
+                                                  self.create_interface,
+                                                  device_id)
+                interface_proxy.register_callback(CallbackType.POST_REMOVE,
+                                                  self.remove_interface,
+                                                  device_id)
         except:
             print "Unexpected error:", sys.exc_info()[0]
 
@@ -168,36 +257,47 @@
         try:
             interface_proxy = self.core.get_proxy(path)
             if update:
-                interface_proxy.unregister_callback(CallbackType.POST_UPDATE, self.update_interface, device_id)
+                interface_proxy.unregister_callback(CallbackType.POST_UPDATE,
+                                                    self.update_interface,
+                                                    device_id)
             else:
-                interface_proxy.unregister_callback(CallbackType.POST_ADD, self.create_interface, device_id)
-                interface_proxy.unregister_callback(CallbackType.POST_REMOVE, self.remove_interface, device_id)
+                interface_proxy.unregister_callback(CallbackType.POST_ADD,
+                                                    self.create_interface,
+                                                    device_id)
+                interface_proxy.unregister_callback(CallbackType.POST_REMOVE,
+                                                    self.remove_interface,
+                                                    device_id)
         except:
             print "Unexpected error:", sys.exc_info()[0]
 
     def create_interface(self, data, device_id=None):
         if device_id is None:
-            device_id = self.get_device_id(data)
+            device_id = self.get_olt_device_id(data)
         if not self.is_valid_interface(data):
-            log.info('xpon-agent-create-interface-invalid-interface-type', type=type(data).__name__)
+            log.info('xpon-agent-create-interface-invalid-interface-type',
+                     type=type(data).__name__)
             return
-        self.register_interface(device_id=device_id, path=self.get_interface_path(data))
+        self.register_interface(device_id=device_id,
+                                path=self.get_interface_path(data))
         if device_id is not None:
             if(isinstance(data, ChannelterminationConfig)):
                 self.create_channel_termination(data, device_id)
             elif(isinstance(data, VOntaniConfig)):
                 self.create_v_ont_ani(data, device_id)
             else:
-                log.info('xpon-agent-create-interface:', device_id=device_id, data=data)
-                device, adapter_agent = self.get_device_adapter_agent(device_id)
+                log.info('xpon-agent-create-interface:', device_id=device_id,
+                         data=data)
+                device, adapter_agent = \
+                    self.get_device_adapter_agent(device_id)
                 adapter_agent.create_interface(device=device, data=data)
 
     def update_interface(self, data, device_id):
         if not self.is_valid_interface(data):
-            log.info('xpon-agent-update-interface-invalid-interface-type', type=type(data).__name__)
+            log.info('xpon-agent-update-interface-invalid-interface-type',
+                     type=type(data).__name__)
             return
         if device_id is None:
-            device_id = self.get_device_id(data)
+            device_id = self.get_olt_device_id(data)
         if device_id is not None:
             # This can be any interface
             device, adapter_agent = self.get_device_adapter_agent(device_id)
@@ -211,12 +311,14 @@
                     parent_data = self.get_parent_data(parent_data)
 
                 for interface in interfaces:
-                    log.info('xpon-agent-creating-interface', device_id=device_id, data=interface)
-                    adapter_agent.create_interface(device=device, data=interface)
+                    log.info('xpon-agent-creating-interface',
+                             device_id=device_id, data=interface)
+                    adapter_agent.create_interface(device=device,
+                                                   data=interface)
 
                 venet_items = self.core.get_proxy('/').get('/v_enets')
                 for venet in venet_items:
-                    if device_id == self.get_device_id(venet):
+                    if device_id == self.get_olt_device_id(venet):
                         ont_interfaces.insert(0, venet)
                         parent_data = self.get_parent_data(venet)
                         while not isinstance(parent_data, ChannelpairConfig):
@@ -224,24 +326,30 @@
                             parent_data = self.get_parent_data(parent_data)
 
                         for ont_interface in ont_interfaces:
-                            log.info('xpon-agent-creating-ont-interface', device_id=device_id, data=ont_interface)
-                            adapter_agent.create_interface(device=device, data=ont_interface)
+                            log.info('xpon-agent-creating-ont-interface',
+                                     device_id=device_id, data=ont_interface)
+                            adapter_agent.create_interface(device=device,
+                                                           data=ont_interface)
 
-            log.info('xpon-agent-updating-interface', device_id=device_id, data=data)
+            log.info('xpon-agent-updating-interface', device_id=device_id,
+                     data=data)
             adapter_agent.update_interface(device=device, data=data)
 
     def remove_interface(self, data, device_id=None):
         if device_id is None:
-            device_id = self.get_device_id(data)
+            device_id = self.get_olt_device_id(data)
         if not self.is_valid_interface(data):
-            log.info('xpon-agent-remove-interface-invalid-interface-type', type=type(data).__name__)
+            log.info('xpon-agent-remove-interface-invalid-interface-type',
+                     type=type(data).__name__)
             return
-        log.info('xpon-agent-remove-interface:', device_id=device_id, data=data)
+        log.info('xpon-agent-remove-interface:', device_id=device_id,
+                 data=data)
         if device_id is not None:
             if(isinstance(data, ChannelterminationConfig)):
                 self.remove_channel_termination(data, device_id)
             else:
-                device, adapter_agent = self.get_device_adapter_agent(device_id)
+                device, adapter_agent = \
+                    self.get_device_adapter_agent(device_id)
                 adapter_agent.remove_interface(device=device, data=data)
                 if isinstance(data, VOntaniConfig):
                     self.delete_onu_device(device_id=device_id, v_ont_ani=data)
@@ -251,22 +359,25 @@
         channel_pair = self.get_parent_data(data)
         channel_part = self.get_parent_data(channel_pair)
         channel_group = self.get_parent_data(channel_part)
-
         if channel_group:
-            log.info('xpon-agent-creating-channel-group', device_id=device_id, data=channel_group)
+            log.info('xpon-agent-creating-channel-group', device_id=device_id,
+                     data=channel_group)
             adapter_agent.create_interface(device=device, data=channel_group)
         if channel_part:
-            log.info('xpon-agent-creating-channel-partition:', device_id=device_id, data=channel_part)
+            log.info('xpon-agent-creating-channel-partition:',
+                     device_id=device_id, data=channel_part)
             adapter_agent.create_interface(device=device, data=channel_part)
         if channel_pair:
-            log.info('xpon-agent-creating-channel-pair:', device_id=device_id, data=channel_pair)
+            log.info('xpon-agent-creating-channel-pair:', device_id=device_id,
+                     data=channel_pair)
             adapter_agent.create_interface(device=device, data=channel_pair)
-        log.info('xpon-agent-creating-channel-termination:', device_id=device_id, data=data)
+        log.info('xpon-agent-creating-channel-termination:',
+                 device_id=device_id, data=data)
         adapter_agent.create_interface(device=device, data=data)
         # Take care of ont ani and v ont ani
         vont_items = self.core.get_proxy('/').get('/v_ont_anis')
         for vont in vont_items:
-            vont_id = self.get_device_id(vont)
+            vont_id = self.get_olt_device_id(vont)
             if device_id == vont_id:
                 self.create_v_ont_ani(vont, device_id)
 
@@ -275,72 +386,89 @@
            self.create_onu_device(device_id=device_id, v_ont_ani=data)
         device, adapter_agent = self.get_device_adapter_agent(device_id)
         venets = self.core.get_proxy('/').get('/v_enets')
-        log.info('xpon-agent-creating-vont-ani:', device_id=device_id, data=data)
+        log.info('xpon-agent-creating-vont-ani:', device_id=device_id,
+                 data=data)
         adapter_agent.create_interface(device=device, data=data)
-
         try:
-            ont_ani = self.core.get_proxy('/').get('/ont_anis/{}'.format(data.name))
-            log.info('xpon-agent-create-v-ont-ani-creating-ont-ani:', device_id=device_id, data=ont_ani)
+            ont_ani = self.core.get_proxy('/').get('/ont_anis/{}'
+                                                   .format(data.name))
+            log.info('xpon-agent-create-v-ont-ani-creating-ont-ani:',
+                     device_id=device_id, data=ont_ani)
             adapter_agent.create_interface(device=device, data=ont_ani)
         except KeyError:
-            log.info('xpon-agent-create-v-ont-ani-there-is-no-ont-ani-to-create')
-
+            log.info(
+                'xpon-agent-create-v-ont-ani-there-is-no-ont-ani-to-create')
         for venet in venets:
             if venet.data.v_ontani_ref == data.name:
-                log.info('xpon-agent-create-v-ont-ani-creating-v-enet:', device_id=device_id, data=venet)
+                log.info('xpon-agent-create-v-ont-ani-creating-v-enet:',
+                         device_id=device_id, data=venet)
                 adapter_agent.create_interface(device=device, data=venet)
 
     def remove_channel_termination(self, data, device_id):
         device, adapter_agent = self.get_device_adapter_agent(device_id)
-        log.info('xpon-agent-removing-channel-termination:', device_id=device_id, data=data)
+        log.info('xpon-agent-removing-channel-termination:',
+                 device_id=device_id, data=data)
         adapter_agent.remove_interface(device=device, data=data)
 
         if data.data.channelpair_ref:
             channel_pair = self.get_parent_data(data)
-            log.info('xpon-agent-removing-channel-pair:', device_id=device_id, data=channel_pair)
+            log.info('xpon-agent-removing-channel-pair:', device_id=device_id,
+                     data=channel_pair)
             adapter_agent.remove_interface(device=device, data=channel_pair)
             # Remove vontani and ontani if it has reference to cpair
             items = self.core.get_proxy('/').get('/v_ont_anis')
             for item in items:
                 if (item.data.preferred_chanpair == channel_pair.name or \
                     item.data.protection_chanpair == channel_pair.name):
-                    log.info('xpon-agent-removing-vont-ani:', device_id=device_id, data=item)
+                    log.info('xpon-agent-removing-vont-ani:',
+                             device_id=device_id, data=item)
                     adapter_agent.remove_interface(device=device, data=item)
                     self.delete_onu_device(device_id=device_id, v_ont_ani=item)
 
                     venets_items = self.core.get_proxy('/').get('/v_enets')
                     for venet in venets_items:
                         if item.name == venet.data.v_ontani_ref:
-                            log.info('xpon-agent-removing-v-enet:', device_id=device_id, data=venet)
-                            adapter_agent.remove_interface(device=device, data=venet)
+                            log.info('xpon-agent-removing-v-enet:',
+                                     device_id=device_id, data=venet)
+                            adapter_agent.remove_interface(device=device,
+                                                           data=venet)
 
                     ontani_items = self.core.get_proxy('/').get('/ont_anis')
                     for ontani_item in ontani_items:
                         if ontani_item.name == item.name:
-                            log.info('xpon-agent-removing-ont-ani:', device_id=device_id, data=ontani_item)
-                            adapter_agent.remove_interface(device=device, data=ontani_item)
+                            log.info('xpon-agent-removing-ont-ani:',
+                                     device_id=device_id, data=ontani_item)
+                            adapter_agent.remove_interface(device=device,
+                                                           data=ontani_item)
             # Remove cpart if exists
             if channel_pair.data.channelpartition_ref:
                 channel_part = self.get_parent_data(channel_pair)
-                log.info('xpon-agent-removing-channel-partition:', device_id=device_id, data=channel_part)
-                adapter_agent.remove_interface(device=device, data=channel_part)
+                log.info('xpon-agent-removing-channel-partition:',
+                         device_id=device_id, data=channel_part)
+                adapter_agent.remove_interface(device=device,
+                                               data=channel_part)
 
                 if channel_part.data.channelgroup_ref:
                     channel_group = self.get_parent_data(channel_part)
-                    log.info('xpon-agent-removing-channel-group:', device_id=device_id, data=channel_group)
-                    adapter_agent.remove_interface(device=device, data=channel_group)
+                    log.info('xpon-agent-removing-channel-group:',
+                             device_id=device_id, data=channel_group)
+                    adapter_agent.remove_interface(device=device,
+                                                   data=channel_group)
 
     def replay_interface(self, device_id):
         self.inReplay = True
-        ct_items = self.core.get_proxy('/').get('/devices/{}/channel_terminations'.format(device_id))
+        ct_items = self.core.get_proxy('/').get(
+            '/devices/{}/channel_terminations'.format(device_id))
         for ct in ct_items:
             self.create_interface(data=ct, device_id=device_id)
         self.inReplay = False
 
     def get_port_num(self, device_id, label):
         log.info('get-port-num:', label=label, device_id=device_id)
-        ports = self.core.get_proxy('/').get('/devices/{}/ports'.format(device_id))
-        log.info('get-port-num:', label=label, device_id=device_id, ports=ports)
+        ports = self.core.get_proxy('/').get('/devices/{}/ports'.
+                                             format(device_id))
+        log.info('get-port-num:', label=label, device_id=device_id,
+                 ports=ports)
         for port in ports:
             if port.label == label:
                 return port.port_no
@@ -349,23 +477,27 @@
     def create_onu_device(self, device_id, v_ont_ani):
         log.info('create-onu-device', v_ont_ani=v_ont_ani, device=device_id)
         device, adapter_agent = self.get_device_adapter_agent(device_id)
-        parent_chnl_pair_id = self.get_port_num(device.id, v_ont_ani.data.preferred_chanpair)
+        parent_chnl_pair_id = self.get_port_num(
+            device.id, v_ont_ani.data.preferred_chanpair)
         log.info('create-onu-device:', parent_chnl_pair_id=parent_chnl_pair_id)
         onu_type = v_ont_ani.data.expected_serial_number[:4]
-        proxy_address = Device.ProxyAddress(device_id=device.id, channel_id=parent_chnl_pair_id,
-                                           onu_id=v_ont_ani.data.onu_id, onu_session_id=v_ont_ani.data.onu_id)
-        adapter_agent.child_device_detected(parent_device_id=device.id, parent_port_no=parent_chnl_pair_id,
-                                            child_device_type=onu_type,
-                                            proxy_address=proxy_address,
-                                            root=True, serial_number=v_ont_ani.data.expected_serial_number,
-                                            admin_state=AdminState.ENABLED if v_ont_ani.interface.enabled else AdminState.DISABLED
-                                            )
+        proxy_address = Device.ProxyAddress(
+            device_id=device.id, channel_id=parent_chnl_pair_id,
+            onu_id=v_ont_ani.data.onu_id, onu_session_id=v_ont_ani.data.onu_id)
+        adapter_agent.child_device_detected(
+            parent_device_id=device.id, parent_port_no=parent_chnl_pair_id,
+            child_device_type=onu_type, proxy_address=proxy_address, root=True,
+            serial_number=v_ont_ani.data.expected_serial_number,
+            admin_state=AdminState.ENABLED if v_ont_ani.interface.enabled else
+            AdminState.DISABLED)
         return
 
     def delete_onu_device(self, device_id, v_ont_ani):
         log.info('delete-onu-device', v_ont_ani=v_ont_ani, device=device_id)
         device, adapter_agent = self.get_device_adapter_agent(device_id)
-        onu_device = adapter_agent.get_child_device(parent_device_id=device_id, serial_number=v_ont_ani.data.expected_serial_number)
+        onu_device = adapter_agent.get_child_device(
+            parent_device_id=device_id,
+            serial_number=v_ont_ani.data.expected_serial_number)
         if onu_device is not None:
             adapter_agent.delete_child_device(device_id, onu_device.id)
         return
