[VOL-1442] This commit handles adapter registration end to end.
It introduces an adapter manager to handle all adapter admin
requests. Some protos have been cleaned as well.
Change-Id: If75d4f7665c03e841d57f5621c30301940d04d93
diff --git a/rw_core/core/adapter_request_handler.go b/rw_core/core/adapter_request_handler.go
index 6893179..98cc688 100644
--- a/rw_core/core/adapter_request_handler.go
+++ b/rw_core/core/adapter_request_handler.go
@@ -33,17 +33,19 @@
coreInstanceId string
deviceMgr *DeviceManager
lDeviceMgr *LogicalDeviceManager
+ adapterMgr *AdapterManager
localDataProxy *model.Proxy
clusterDataProxy *model.Proxy
}
-func NewAdapterRequestHandlerProxy(coreInstanceId string, dMgr *DeviceManager, ldMgr *LogicalDeviceManager, cdProxy *model.Proxy, ldProxy *model.Proxy) *AdapterRequestHandlerProxy {
+func NewAdapterRequestHandlerProxy(coreInstanceId string, dMgr *DeviceManager, ldMgr *LogicalDeviceManager, aMgr *AdapterManager, cdProxy *model.Proxy, ldProxy *model.Proxy) *AdapterRequestHandlerProxy {
var proxy AdapterRequestHandlerProxy
proxy.coreInstanceId = coreInstanceId
proxy.deviceMgr = dMgr
proxy.lDeviceMgr = ldMgr
proxy.clusterDataProxy = cdProxy
proxy.localDataProxy = ldProxy
+ proxy.adapterMgr = aMgr
return &proxy
}
@@ -70,12 +72,11 @@
}
}
log.Debugw("Register", log.Fields{"Adapter": *adapter, "DeviceTypes": deviceTypes, "coreId": rhp.coreInstanceId})
- // TODO process the request and store the data in the KV store
if rhp.TestMode { // Execute only for test cases
return &voltha.CoreInstance{InstanceId: "CoreInstance"}, nil
}
- return &voltha.CoreInstance{InstanceId: rhp.coreInstanceId}, nil
+ return rhp.adapterMgr.registerAdapter(adapter, deviceTypes), nil
}
func (rhp *AdapterRequestHandlerProxy) GetDevice(args []*ic.Argument) (*voltha.Device, error) {