@Test public void getEgKeysForEndpointTest() { Endpoint endpoint = mock(Endpoint.class); Set<EgKey> egKeys; when(endpoint.getEndpointGroups()).thenReturn(null); egKeys = manager.getEgKeysForEndpoint(endpoint); assertTrue(egKeys.isEmpty()); EndpointGroupId endpointGroupId = mock(EndpointGroupId.class); when(endpoint.getEndpointGroup()).thenReturn(endpointGroupId); egKeys = manager.getEgKeysForEndpoint(endpoint); assertEquals(1, egKeys.size()); EndpointGroupId epgId = mock(EndpointGroupId.class); List<EndpointGroupId> endpointGroups = Collections.singletonList(epgId); when(endpoint.getEndpointGroups()).thenReturn(endpointGroups); egKeys = manager.getEgKeysForEndpoint(endpoint); assertEquals(2, egKeys.size()); }
public Set<EgKey> getEgKeysForEndpoint(Endpoint ep) { Set<EgKey> egKeys = new HashSet<>(); if (ep.getEndpointGroup() != null) { egKeys.add(new EgKey(ep.getTenant(), ep.getEndpointGroup())); } if (ep.getEndpointGroups() != null) { for (EndpointGroupId epgId : ep.getEndpointGroups()) { egKeys.add(new EgKey(ep.getTenant(), epgId)); } } return egKeys; }
EndpointManager implements AutoCloseable { public Set<EgKey> getEgKeysForEndpoint(Endpoint ep) { Set<EgKey> egKeys = new HashSet<>(); if (ep.getEndpointGroup() != null) { egKeys.add(new EgKey(ep.getTenant(), ep.getEndpointGroup())); } if (ep.getEndpointGroups() != null) { for (EndpointGroupId epgId : ep.getEndpointGroups()) { egKeys.add(new EgKey(ep.getTenant(), epgId)); } } return egKeys; } }
EndpointManager implements AutoCloseable { public Set<EgKey> getEgKeysForEndpoint(Endpoint ep) { Set<EgKey> egKeys = new HashSet<>(); if (ep.getEndpointGroup() != null) { egKeys.add(new EgKey(ep.getTenant(), ep.getEndpointGroup())); } if (ep.getEndpointGroups() != null) { for (EndpointGroupId epgId : ep.getEndpointGroups()) { egKeys.add(new EgKey(ep.getTenant(), epgId)); } } return egKeys; } EndpointManager(DataBroker dataProvider,PacketProcessingService packetProcessingService,
            SalFlowService flowService, NotificationService notificationService,
            ScheduledExecutorService executor, SwitchManager switchManager); }
EndpointManager implements AutoCloseable { public Set<EgKey> getEgKeysForEndpoint(Endpoint ep) { Set<EgKey> egKeys = new HashSet<>(); if (ep.getEndpointGroup() != null) { egKeys.add(new EgKey(ep.getTenant(), ep.getEndpointGroup())); } if (ep.getEndpointGroups() != null) { for (EndpointGroupId epgId : ep.getEndpointGroups()) { egKeys.add(new EgKey(ep.getTenant(), epgId)); } } return egKeys; } EndpointManager(DataBroker dataProvider,PacketProcessingService packetProcessingService,
            SalFlowService flowService, NotificationService notificationService,
            ScheduledExecutorService executor, SwitchManager switchManager); void registerListener(EndpointListener listener); synchronized Set<EgKey> getGroupsForNode(NodeId nodeId); synchronized Set<NodeId> getNodesForGroup(final EgKey egKey); synchronized Collection<Endpoint> getEndpointsForNode(NodeId nodeId, EgKey eg); synchronized Collection<Endpoint> getEndpointsForNode(final NodeId nodeId); Endpoint getEndpoint(EpKey epKey); HashSet<Endpoint> getEndpoints(); synchronized Collection<Endpoint> getEndpointsForGroup(EgKey eg); synchronized Collection<Endpoint> getExtEpsNoLocForGroup(final EgKey eg); @Override void close(); static boolean isExternal(Endpoint ep, @Nullable Collection<ExternalImplicitGroup> eigs); static boolean isInternal(Endpoint ep, @Nullable Collection<ExternalImplicitGroup> eigs); Endpoint getL2EndpointFromL3(EndpointL3 endpointL3); EndpointL3 getL3Endpoint(L3ContextId l3c, IpAddress ipAddress, @Nullable TenantId tenantId); Collection<EndpointL3Prefix> getEndpointsL3PrefixForTenant(final TenantId tenantId); @Nonnull Collection<EndpointL3> getL3EndpointsWithNat(); @SuppressWarnings({"UnusedParameters", "EmptyMethod"}) void setLearningMode(OfOverlayConfig.LearningMode learningMode); List<ConditionName> getConditionsForEndpoint(Endpoint endpoint); NodeId getEndpointNodeId(Endpoint endpoint); NodeConnectorId getEndpointNodeConnectorId(Endpoint endpoint); Set<EgKey> getEgKeysForEndpoint(Endpoint ep); EgKey getEgKey(Endpoint endpoint); }
EndpointManager implements AutoCloseable { public Set<EgKey> getEgKeysForEndpoint(Endpoint ep) { Set<EgKey> egKeys = new HashSet<>(); if (ep.getEndpointGroup() != null) { egKeys.add(new EgKey(ep.getTenant(), ep.getEndpointGroup())); } if (ep.getEndpointGroups() != null) { for (EndpointGroupId epgId : ep.getEndpointGroups()) { egKeys.add(new EgKey(ep.getTenant(), epgId)); } } return egKeys; } EndpointManager(DataBroker dataProvider,PacketProcessingService packetProcessingService,
            SalFlowService flowService, NotificationService notificationService,
            ScheduledExecutorService executor, SwitchManager switchManager); void registerListener(EndpointListener listener); synchronized Set<EgKey> getGroupsForNode(NodeId nodeId); synchronized Set<NodeId> getNodesForGroup(final EgKey egKey); synchronized Collection<Endpoint> getEndpointsForNode(NodeId nodeId, EgKey eg); synchronized Collection<Endpoint> getEndpointsForNode(final NodeId nodeId); Endpoint getEndpoint(EpKey epKey); HashSet<Endpoint> getEndpoints(); synchronized Collection<Endpoint> getEndpointsForGroup(EgKey eg); synchronized Collection<Endpoint> getExtEpsNoLocForGroup(final EgKey eg); @Override void close(); static boolean isExternal(Endpoint ep, @Nullable Collection<ExternalImplicitGroup> eigs); static boolean isInternal(Endpoint ep, @Nullable Collection<ExternalImplicitGroup> eigs); Endpoint getL2EndpointFromL3(EndpointL3 endpointL3); EndpointL3 getL3Endpoint(L3ContextId l3c, IpAddress ipAddress, @Nullable TenantId tenantId); Collection<EndpointL3Prefix> getEndpointsL3PrefixForTenant(final TenantId tenantId); @Nonnull Collection<EndpointL3> getL3EndpointsWithNat(); @SuppressWarnings({"UnusedParameters", "EmptyMethod"}) void setLearningMode(OfOverlayConfig.LearningMode learningMode); List<ConditionName> getConditionsForEndpoint(Endpoint endpoint); NodeId getEndpointNodeId(Endpoint endpoint); NodeConnectorId getEndpointNodeConnectorId(Endpoint endpoint); Set<EgKey> getEgKeysForEndpoint(Endpoint ep); EgKey getEgKey(Endpoint endpoint);  }