@Test(expected = ClientHandlerException.class) public void processResolvedPolicyNotificationTest() { iomInstance = new IovisorModuleInstanceBuilder().setId(new IovisorModuleId(iom1)).setUri(new Uri(iom1)).build(); List<IovisorModuleInstanceId> listIomId = new ArrayList<>(); listIomId.add(new IovisorModuleInstanceIdBuilder().setId(new IovisorModuleId(iom1)).build()); when(iovisorModuleManager.getActiveIovisorModule(any(IovisorModuleId.class))).thenReturn(iomInstance); when(iovisorModuleManager.getIovisorModulesByTenantByEpg(any(TenantId.class), any(EndpointGroupId.class))) .thenReturn(listIomId); resolvedPolicyListener.processResolvedPolicyNotification(resolvedPolicy); }
@VisibleForTesting void processResolvedPolicyNotification(ResolvedPolicy resolvedPolicy) { checkNotNull(resolvedPolicy); Set<IovisorModuleInstanceId> ioms = new HashSet<>(); List<IovisorModuleInstanceId> tempIoms = new ArrayList<>(); tempIoms = iovisorModuleManager.getIovisorModulesByTenantByEpg(resolvedPolicy.getProviderTenantId(), resolvedPolicy.getProviderEpgId()); if (tempIoms == null || tempIoms.isEmpty()) { LOG.info("No IovisorModule found for Tenant: {} EndpointGroup: {}. Therefore no endpoints to process.", resolvedPolicy.getProviderTenantId().getValue(), resolvedPolicy.getProviderEpgId().getValue()); return; } ioms.addAll(tempIoms); tempIoms = iovisorModuleManager.getIovisorModulesByTenantByEpg(resolvedPolicy.getConsumerTenantId(), resolvedPolicy.getConsumerEpgId()); if (tempIoms == null || tempIoms.isEmpty()) { LOG.info("No IovisorModule found for Tenant: {} EndpointGroup: {}. Therefore no endpoints to process.", resolvedPolicy.getConsumerTenantId().getValue(), resolvedPolicy.getConsumerEpgId().getValue()); return; } ioms.addAll(tempIoms); for (IovisorModuleInstanceId iom : ioms) { IovisorModuleInstance iomInstance = iovisorModuleManager.getActiveIovisorModule(iom.getId()); RestClient restClient = new RestClient("http: restClient.post(IovisorRenderer.IOVISOR_MODULE_LISTENER_BASE_URL, buildPolicyUris(resolvedPolicy)); } }
ResolvedPolicyListener extends DataTreeChangeHandler<ResolvedPolicy> { @VisibleForTesting void processResolvedPolicyNotification(ResolvedPolicy resolvedPolicy) { checkNotNull(resolvedPolicy); Set<IovisorModuleInstanceId> ioms = new HashSet<>(); List<IovisorModuleInstanceId> tempIoms = new ArrayList<>(); tempIoms = iovisorModuleManager.getIovisorModulesByTenantByEpg(resolvedPolicy.getProviderTenantId(), resolvedPolicy.getProviderEpgId()); if (tempIoms == null || tempIoms.isEmpty()) { LOG.info("No IovisorModule found for Tenant: {} EndpointGroup: {}. Therefore no endpoints to process.", resolvedPolicy.getProviderTenantId().getValue(), resolvedPolicy.getProviderEpgId().getValue()); return; } ioms.addAll(tempIoms); tempIoms = iovisorModuleManager.getIovisorModulesByTenantByEpg(resolvedPolicy.getConsumerTenantId(), resolvedPolicy.getConsumerEpgId()); if (tempIoms == null || tempIoms.isEmpty()) { LOG.info("No IovisorModule found for Tenant: {} EndpointGroup: {}. Therefore no endpoints to process.", resolvedPolicy.getConsumerTenantId().getValue(), resolvedPolicy.getConsumerEpgId().getValue()); return; } ioms.addAll(tempIoms); for (IovisorModuleInstanceId iom : ioms) { IovisorModuleInstance iomInstance = iovisorModuleManager.getActiveIovisorModule(iom.getId()); RestClient restClient = new RestClient("http: restClient.post(IovisorRenderer.IOVISOR_MODULE_LISTENER_BASE_URL, buildPolicyUris(resolvedPolicy)); } } }
ResolvedPolicyListener extends DataTreeChangeHandler<ResolvedPolicy> { @VisibleForTesting void processResolvedPolicyNotification(ResolvedPolicy resolvedPolicy) { checkNotNull(resolvedPolicy); Set<IovisorModuleInstanceId> ioms = new HashSet<>(); List<IovisorModuleInstanceId> tempIoms = new ArrayList<>(); tempIoms = iovisorModuleManager.getIovisorModulesByTenantByEpg(resolvedPolicy.getProviderTenantId(), resolvedPolicy.getProviderEpgId()); if (tempIoms == null || tempIoms.isEmpty()) { LOG.info("No IovisorModule found for Tenant: {} EndpointGroup: {}. Therefore no endpoints to process.", resolvedPolicy.getProviderTenantId().getValue(), resolvedPolicy.getProviderEpgId().getValue()); return; } ioms.addAll(tempIoms); tempIoms = iovisorModuleManager.getIovisorModulesByTenantByEpg(resolvedPolicy.getConsumerTenantId(), resolvedPolicy.getConsumerEpgId()); if (tempIoms == null || tempIoms.isEmpty()) { LOG.info("No IovisorModule found for Tenant: {} EndpointGroup: {}. Therefore no endpoints to process.", resolvedPolicy.getConsumerTenantId().getValue(), resolvedPolicy.getConsumerEpgId().getValue()); return; } ioms.addAll(tempIoms); for (IovisorModuleInstanceId iom : ioms) { IovisorModuleInstance iomInstance = iovisorModuleManager.getActiveIovisorModule(iom.getId()); RestClient restClient = new RestClient("http: restClient.post(IovisorRenderer.IOVISOR_MODULE_LISTENER_BASE_URL, buildPolicyUris(resolvedPolicy)); } } ResolvedPolicyListener(DataBroker dataBroker, IovisorModuleManager iovisorModuleManager); }
ResolvedPolicyListener extends DataTreeChangeHandler<ResolvedPolicy> { @VisibleForTesting void processResolvedPolicyNotification(ResolvedPolicy resolvedPolicy) { checkNotNull(resolvedPolicy); Set<IovisorModuleInstanceId> ioms = new HashSet<>(); List<IovisorModuleInstanceId> tempIoms = new ArrayList<>(); tempIoms = iovisorModuleManager.getIovisorModulesByTenantByEpg(resolvedPolicy.getProviderTenantId(), resolvedPolicy.getProviderEpgId()); if (tempIoms == null || tempIoms.isEmpty()) { LOG.info("No IovisorModule found for Tenant: {} EndpointGroup: {}. Therefore no endpoints to process.", resolvedPolicy.getProviderTenantId().getValue(), resolvedPolicy.getProviderEpgId().getValue()); return; } ioms.addAll(tempIoms); tempIoms = iovisorModuleManager.getIovisorModulesByTenantByEpg(resolvedPolicy.getConsumerTenantId(), resolvedPolicy.getConsumerEpgId()); if (tempIoms == null || tempIoms.isEmpty()) { LOG.info("No IovisorModule found for Tenant: {} EndpointGroup: {}. Therefore no endpoints to process.", resolvedPolicy.getConsumerTenantId().getValue(), resolvedPolicy.getConsumerEpgId().getValue()); return; } ioms.addAll(tempIoms); for (IovisorModuleInstanceId iom : ioms) { IovisorModuleInstance iomInstance = iovisorModuleManager.getActiveIovisorModule(iom.getId()); RestClient restClient = new RestClient("http: restClient.post(IovisorRenderer.IOVISOR_MODULE_LISTENER_BASE_URL, buildPolicyUris(resolvedPolicy)); } } ResolvedPolicyListener(DataBroker dataBroker, IovisorModuleManager iovisorModuleManager);  }
ResolvedPolicyListener extends DataTreeChangeHandler<ResolvedPolicy> { @VisibleForTesting void processResolvedPolicyNotification(ResolvedPolicy resolvedPolicy) { checkNotNull(resolvedPolicy); Set<IovisorModuleInstanceId> ioms = new HashSet<>(); List<IovisorModuleInstanceId> tempIoms = new ArrayList<>(); tempIoms = iovisorModuleManager.getIovisorModulesByTenantByEpg(resolvedPolicy.getProviderTenantId(), resolvedPolicy.getProviderEpgId()); if (tempIoms == null || tempIoms.isEmpty()) { LOG.info("No IovisorModule found for Tenant: {} EndpointGroup: {}. Therefore no endpoints to process.", resolvedPolicy.getProviderTenantId().getValue(), resolvedPolicy.getProviderEpgId().getValue()); return; } ioms.addAll(tempIoms); tempIoms = iovisorModuleManager.getIovisorModulesByTenantByEpg(resolvedPolicy.getConsumerTenantId(), resolvedPolicy.getConsumerEpgId()); if (tempIoms == null || tempIoms.isEmpty()) { LOG.info("No IovisorModule found for Tenant: {} EndpointGroup: {}. Therefore no endpoints to process.", resolvedPolicy.getConsumerTenantId().getValue(), resolvedPolicy.getConsumerEpgId().getValue()); return; } ioms.addAll(tempIoms); for (IovisorModuleInstanceId iom : ioms) { IovisorModuleInstance iomInstance = iovisorModuleManager.getActiveIovisorModule(iom.getId()); RestClient restClient = new RestClient("http: restClient.post(IovisorRenderer.IOVISOR_MODULE_LISTENER_BASE_URL, buildPolicyUris(resolvedPolicy)); } } ResolvedPolicyListener(DataBroker dataBroker, IovisorModuleManager iovisorModuleManager);   }