Permalink
Browse files

Output log on a failure of resource registration

Change-Id: I9a98dc49ae0f5f265fdc3b03142181348f86ee0f
  • Loading branch information...
1 parent e113df4 commit f84ea7fb57fbc53e34a9509db1344802b48024da @oshothebig oshothebig committed with jonohart Dec 22, 2016
@@ -142,7 +142,12 @@ public void event(DeviceEvent event) {
}
private void registerDeviceResource(Device device) {
- executor.execute(() -> adminService.register(Resources.discrete(device.id()).resource()));
+ executor.execute(() -> {
+ boolean success = adminService.register(Resources.discrete(device.id()).resource());
+ if (!success) {
+ log.warn("Failed to register Device: {}", device.id());
+ }
+ });
}
private void unregisterDeviceResource(Device device) {
@@ -170,33 +175,45 @@ private void registerPortResource(Device device, Port port) {
// for VLAN IDs
Set<VlanId> vlans = queryVlanIds(device.id(), port.number());
if (!vlans.isEmpty()) {
- adminService.register(vlans.stream()
+ boolean success = adminService.register(vlans.stream()
.map(portPath::child)
.collect(Collectors.toList()));
+ if (!success) {
+ log.warn("Failed to register VLAN IDs for {}", portPath.id());
+ }
}
// for MPLS labels
Set<MplsLabel> mplsLabels = queryMplsLabels(device.id(), port.number());
if (!mplsLabels.isEmpty()) {
- adminService.register(mplsLabels.stream()
+ boolean success = adminService.register(mplsLabels.stream()
.map(portPath::child)
.collect(Collectors.toList()));
+ if (!success) {
+ log.warn("Failed to register MPLS Labels for {}", portPath.id());
+ }
}
// for Lambdas
Set<OchSignal> lambdas = queryLambdas(device.id(), port.number());
if (!lambdas.isEmpty()) {
- adminService.register(lambdas.stream()
+ boolean success = adminService.register(lambdas.stream()
.map(portPath::child)
.collect(Collectors.toList()));
+ if (!success) {
+ log.warn("Failed to register lambdas for {}", portPath.id());
+ }
}
// for Tributary slots
Set<TributarySlot> tSlots = queryTributarySlots(device.id(), port.number());
if (!tSlots.isEmpty()) {
- adminService.register(tSlots.stream()
+ boolean success = adminService.register(tSlots.stream()
.map(portPath::child)
.collect(Collectors.toList()));
+ if (!success) {
+ log.warn("Failed to register tributary slots for {}", portPath.id());
+ }
}
});
}

0 comments on commit f84ea7f

Please sign in to comment.