Sho SHIMIZU
Committed by Gerrit Code Review

ONOS-2693: Unregister a link from resources when it is removed

Change-Id: I69a8070898f28d7d1fb006383a96c3ef1538146e
......@@ -52,6 +52,9 @@ final class ResourceLinkListener implements LinkListener {
case LINK_ADDED:
registerLinkResource(link);
break;
case LINK_REMOVED:
unregisterLinkResource(link);
break;
default:
break;
}
......@@ -61,4 +64,9 @@ final class ResourceLinkListener implements LinkListener {
LinkKey linkKey = LinkKey.linkKey(link);
executor.submit(() -> adminService.registerResources(ResourcePath.ROOT, linkKey));
}
private void unregisterLinkResource(Link link) {
LinkKey linkKey = LinkKey.linkKey(link);
executor.submit(() -> adminService.unregisterResources(ResourcePath.ROOT, linkKey));
}
}
......