import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.resolved.policy.rev150828.resolved.policies.resolved.policy.policy.rule.group.with.endpoint.constraints.PolicyRuleGroupKey;
import org.opendaylight.yangtools.yang.binding.Augmentation;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class RendererConfigurationBuilder {
+ private static final Logger LOG = LoggerFactory.getLogger(RendererConfigurationBuilder.class);
+
private final Table<RendererEndpointKey, PeerEndpointKey, Set<RuleGroupWithRendererEndpointParticipation>> policiesByEpAndPeerEp =
HashBasedTable.create();
private final Table<RendererEndpointKey, PeerExternalEndpointKey, Set<RuleGroupWithRendererEndpointParticipation>> policiesByEpAndPeerExtEp =
return peerExtContEps;
}
- public Endpoints buildEndoints(EndpointInfo epInfo, EndpointLocationInfo epLocInfo,
- Map<InstanceIdentifier<?>, RendererName> rendererByNode, Set<EndpointAugmentor> augmentors) {
+ public Endpoints buildEndpoints(EndpointInfo epInfo, EndpointLocationInfo epLocInfo,
+ Map<InstanceIdentifier<?>, RendererName> rendererByNode, Set<EndpointAugmentor> augmentors) {
List<AddressEndpointWithLocation> epsWithLoc =
resolveEpsWithLoc(getAddressEndpointKeys(), epInfo, epLocInfo, rendererByNode, augmentors);
List<ContainmentEndpointWithLocation> contEpsWithLoc =
Optional<AddressEndpointLocation> potentionalEpLoc = epLocInfo.getAdressEndpointLocation(epKey);
Preconditions.checkArgument(potentionalEpLoc.isPresent());
RendererName rendererName = resolveRendererName(potentionalEpLoc.get(), rendererByNode);
+ if (rendererName == null) {
+ LOG.debug("Endpoint {} has no location, skipped", epKey);
+ continue;
+ }
result.add(createEpWithLoc(potentialEp.get(), potentionalEpLoc.get(), rendererName, augmentors));
}
return result;
private boolean writeRenderersConfigs(Map<RendererName, Optional<Configuration>> configsByRendererName) {
List<Renderer> renderers = new ArrayList<>();
for (RendererName rendererName : configsByRendererName.keySet()) {
- RendererPolicy rendererPolicy = null;
+ RendererPolicy rendererPolicy;
if (configsByRendererName.get(rendererName).isPresent()) {
rendererPolicy = new RendererPolicyBuilder().setVersion(version)
.setConfiguration(configsByRendererName.get(rendererName).get())
configBuilder.setRendererEndpoints(rendererEndpoints);
org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.renderer.rev151103.renderers.renderer.renderer.policy.configuration.Endpoints endpoints =
- rendererPolicyBuilder.buildEndoints(currentState.epInfo, currentState.epLocInfo,
+ rendererPolicyBuilder.buildEndpoints(currentState.epInfo, currentState.epLocInfo,
currentState.rendererByNode, epAugmentorRegistry.getEndpointAugmentors());
configBuilder.setEndpoints(endpoints);