@Override
public void updatePorts(DeviceId deviceId,
List<PortDescription> portDescriptions) {
checkNotNull(deviceId, DEVICE_ID_NULL);
checkNotNull(portDescriptions, PORT_DESC_LIST_NULL);
checkValidity();
if (!mastershipService.isLocalMaster(deviceId)) {
log.trace("Ignoring {} port updates on standby node. {}", deviceId, portDescriptions);
return;
}
PortDescriptionsConfig portConfig = networkConfigService.getConfig(deviceId, PortDescriptionsConfig.class);
if (portConfig != null) {
portDescriptions = Lists.newArrayList(portDescriptions);
portDescriptions.addAll(portConfig.portDescriptions());
}
portDescriptions = portDescriptions.stream()
.map(e -> applyAllPortOps(deviceId, e))
.collect(Collectors.toList());
List<DeviceEvent> events = store.updatePorts(this.provider().id(),
deviceId, portDescriptions);
if (events != null) {
for (DeviceEvent event : events) {
post(event);
}
}
}