VOL-648: Single ONU adapter can support multiple vendor IDs
Tested with broadcom_onu adapter supporting BRCM (Broadcom
reference) and ALPH (Alpha) vendor ids.
Change-Id: I8fd055dfad61751be67b14ed0563d659b1ea9380
diff --git a/voltha/adapters/broadcom_onu/broadcom_onu.py b/voltha/adapters/broadcom_onu/broadcom_onu.py
index 3543776..d5c966f 100644
--- a/voltha/adapters/broadcom_onu/broadcom_onu.py
+++ b/voltha/adapters/broadcom_onu/broadcom_onu.py
@@ -63,7 +63,7 @@
supported_device_types = [
DeviceType(
id=name,
- vendor_id='BRCM',
+ vendor_ids=['BRCM', 'ALPH'],
adapter=name,
accepts_bulk_flow_update=True
)
diff --git a/voltha/core/adapter_agent.py b/voltha/core/adapter_agent.py
index f67d9eb..6fb309f 100644
--- a/voltha/core/adapter_agent.py
+++ b/voltha/core/adapter_agent.py
@@ -710,9 +710,16 @@
proxy_address,
admin_state,
**kw):
- device_type = next((dt for dt in self.root_proxy.get('/device_types')
- if dt.vendor_id == vendor_id and \
- dt.id.endswith("_onu")), None)
+
+ device_type = None
+
+ for dt in self.root_proxy.get('/device_types'):
+ if (dt.vendor_id == vendor_id or vendor_id in dt.vendor_ids) and \
+ dt.id.endswith("_onu"):
+ device_type = dt
+
+ assert device_type is not None
+
# we create new ONU device objects and insert them into the config
device = Device(
id=create_cluster_device_id(self.core.core_store_id),
diff --git a/voltha/protos/device.proto b/voltha/protos/device.proto
index 6bb3f41..0eb32f1 100644
--- a/voltha/protos/device.proto
+++ b/voltha/protos/device.proto
@@ -21,6 +21,8 @@
// 4 bytes of vendor id from ONU serial number
string vendor_id = 5;
+ repeated string vendor_ids = 6;
+
// Name of the adapter that handles device type
string adapter = 2;