Sho SHIMIZU
Committed by Gerrit Code Review

ONOS-2695: Unregister a port from resources when it is removed

Change-Id: I3fa6ddde98997661f5091be332924f2f70f6997f
......@@ -58,6 +58,9 @@ final class ResourceDeviceListener implements DeviceListener {
case PORT_ADDED:
registerPortResource(device, event.port());
break;
case PORT_REMOVED:
unregisterPortResource(device, event.port());
break;
default:
break;
}
......@@ -75,4 +78,9 @@ final class ResourceDeviceListener implements DeviceListener {
ResourcePath parent = new ResourcePath(device.id());
executor.submit(() -> adminService.registerResources(parent, port.number()));
}
private void unregisterPortResource(Device device, Port port) {
ResourcePath parent = new ResourcePath(device.id());
executor.submit(() -> adminService.unregisterResources(parent, port.number()));
}
}
......