[VOL-1514] Add port notification to the logical device
This update sends port status notifications to the OFAgent. This
commit also refactored the port creation logic to ensure we can
add a port to a logical device anytime.
Change-Id: Ied78e93d0feef4621b588cfd4e10bbead79b0a5b
diff --git a/rw_core/core/device_manager.go b/rw_core/core/device_manager.go
index f642107..09eca3b 100644
--- a/rw_core/core/device_manager.go
+++ b/rw_core/core/device_manager.go
@@ -490,6 +490,15 @@
}
}
}
+ // Notify the logical device manager to setup a logical port if needed
+ if port.Type == voltha.Port_ETHERNET_NNI || port.Type == voltha.Port_ETHERNET_UNI {
+ if device , err := dMgr.GetDevice(deviceId); err == nil {
+ go dMgr.logicalDeviceMgr.addLogicalPort(device, port)
+ } else {
+ log.Errorw("failed-to-retrieve-device", log.Fields{"deviceId": deviceId})
+ return err
+ }
+ }
return nil
} else {
return status.Errorf(codes.NotFound, "%s", deviceId)
@@ -814,9 +823,9 @@
return nil, status.Errorf(codes.NotFound, "%s", parentDeviceId)
}
-func (dMgr *DeviceManager) addUNILogicalPort(cDevice *voltha.Device) error {
+func (dMgr *DeviceManager) setupUNILogicalPorts(cDevice *voltha.Device) error {
log.Info("addUNILogicalPort")
- if err := dMgr.logicalDeviceMgr.addUNILogicalPort(nil, cDevice); err != nil {
+ if err := dMgr.logicalDeviceMgr.setupUNILogicalPorts(nil, cDevice); err != nil {
log.Warnw("addUNILogicalPort-error", log.Fields{"device": cDevice, "err": err})
return err
}