[VOL-5224] - vgc port delete by port name
Change-Id: I6d8b03b93e0b9ac826f437df468753e93104fab0
diff --git a/internal/pkg/controller/device.go b/internal/pkg/controller/device.go
index 129b935..618afae 100644
--- a/internal/pkg/controller/device.go
+++ b/internal/pkg/controller/device.go
@@ -508,10 +508,15 @@
// DelPort to delete the port as requested by the device/VOLTHA
// Inform the application if the port is successfully deleted
-func (d *Device) DelPort(cntx context.Context, id uint32) error {
+func (d *Device) DelPort(cntx context.Context, id uint32, portName string) error {
p := d.GetPortByID(id)
if p == nil {
- return errors.New("unknown port")
+ p = d.GetPortByName(portName)
+ if p == nil {
+ return errors.New("unknown port")
+ } else {
+ logger.Infow(ctx, "Found port by name", log.Fields{"PortName": p.Name, "PortID": p.ID})
+ }
}
if p.State == PortStateUp {
GetController().PortDownInd(cntx, d.ID, p.Name)