VOL-456 : Remove duplicates from list device types and list adapters
Change-Id: Ied1e5763d88ba240740a58b5261469f7977f2194
diff --git a/voltha/core/local_handler.py b/voltha/core/local_handler.py
index 29f6028..2b50ef9 100644
--- a/voltha/core/local_handler.py
+++ b/voltha/core/local_handler.py
@@ -128,7 +128,8 @@
def ListAdapters(self, request, context):
log.info('grpc-request', request=request)
items = self.root.get('/adapters')
- return Adapters(items=items)
+ sorted_items = sorted(items, key=lambda i: i.id)
+ return Adapters(items=sorted_items)
@twisted_async
def ListLogicalDevices(self, request, context):
@@ -748,7 +749,8 @@
def ListDeviceTypes(self, request, context):
log.info('grpc-request', request=request)
items = self.root.get('/device_types')
- return DeviceTypes(items=items)
+ sorted_items = sorted(items, key=lambda i: i.id)
+ return DeviceTypes(items=sorted_items)
@twisted_async
def GetDeviceType(self, request, context):