target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void convertFlowWithIngressVlanIdMatchesTransitVlanId() { Flow flow = buildFlow(FlowEncapsulationType.TRANSIT_VLAN); Assert.assertNotEquals(0, flow.getSrcVlan()); Assert.assertNotNull(flow.getForwardPath()); TransitVlan encapsulation = TransitVlan.builder() .flowId(flow.getFlowId()) .pathId(flow.getForward... | public List<SimpleSwitchRule> convertFlowPathToSimpleSwitchRules(Flow flow, FlowPath flowPath, EncapsulationId encapsulationId, long flowMeterMinBurstSizeInKbits, double flowMeterBurstCoefficient) { List<SimpleSwitchRule> rules = new ArrayList<>(); if (!flowPath.isProtected()) { rules.add(buildIngressSimpleSwitchRule(f... | SimpleSwitchRuleConverter { public List<SimpleSwitchRule> convertFlowPathToSimpleSwitchRules(Flow flow, FlowPath flowPath, EncapsulationId encapsulationId, long flowMeterMinBurstSizeInKbits, double flowMeterBurstCoefficient) { List<SimpleSwitchRule> rules = new ArrayList<>(); if (!flowPath.isProtected()) { rules.add(bu... | SimpleSwitchRuleConverter { public List<SimpleSwitchRule> convertFlowPathToSimpleSwitchRules(Flow flow, FlowPath flowPath, EncapsulationId encapsulationId, long flowMeterMinBurstSizeInKbits, double flowMeterBurstCoefficient) { List<SimpleSwitchRule> rules = new ArrayList<>(); if (!flowPath.isProtected()) { rules.add(bu... | SimpleSwitchRuleConverter { public List<SimpleSwitchRule> convertFlowPathToSimpleSwitchRules(Flow flow, FlowPath flowPath, EncapsulationId encapsulationId, long flowMeterMinBurstSizeInKbits, double flowMeterBurstCoefficient) { List<SimpleSwitchRule> rules = new ArrayList<>(); if (!flowPath.isProtected()) { rules.add(bu... | SimpleSwitchRuleConverter { public List<SimpleSwitchRule> convertFlowPathToSimpleSwitchRules(Flow flow, FlowPath flowPath, EncapsulationId encapsulationId, long flowMeterMinBurstSizeInKbits, double flowMeterBurstCoefficient) { List<SimpleSwitchRule> rules = new ArrayList<>(); if (!flowPath.isProtected()) { rules.add(bu... |
@Test public void shouldConvertFlowPathWithVxlanEncapToSimpleSwitchRules() { Flow flow = buildFlow(FlowEncapsulationType.VXLAN); List<SimpleSwitchRule> expectedSwitchRules = getSimpleSwitchRuleForVxlan(); List<SimpleSwitchRule> switchRules = simpleSwitchRuleConverter.convertFlowPathToSimpleSwitchRules(flow, flow.getFor... | public List<SimpleSwitchRule> convertFlowPathToSimpleSwitchRules(Flow flow, FlowPath flowPath, EncapsulationId encapsulationId, long flowMeterMinBurstSizeInKbits, double flowMeterBurstCoefficient) { List<SimpleSwitchRule> rules = new ArrayList<>(); if (!flowPath.isProtected()) { rules.add(buildIngressSimpleSwitchRule(f... | SimpleSwitchRuleConverter { public List<SimpleSwitchRule> convertFlowPathToSimpleSwitchRules(Flow flow, FlowPath flowPath, EncapsulationId encapsulationId, long flowMeterMinBurstSizeInKbits, double flowMeterBurstCoefficient) { List<SimpleSwitchRule> rules = new ArrayList<>(); if (!flowPath.isProtected()) { rules.add(bu... | SimpleSwitchRuleConverter { public List<SimpleSwitchRule> convertFlowPathToSimpleSwitchRules(Flow flow, FlowPath flowPath, EncapsulationId encapsulationId, long flowMeterMinBurstSizeInKbits, double flowMeterBurstCoefficient) { List<SimpleSwitchRule> rules = new ArrayList<>(); if (!flowPath.isProtected()) { rules.add(bu... | SimpleSwitchRuleConverter { public List<SimpleSwitchRule> convertFlowPathToSimpleSwitchRules(Flow flow, FlowPath flowPath, EncapsulationId encapsulationId, long flowMeterMinBurstSizeInKbits, double flowMeterBurstCoefficient) { List<SimpleSwitchRule> rules = new ArrayList<>(); if (!flowPath.isProtected()) { rules.add(bu... | SimpleSwitchRuleConverter { public List<SimpleSwitchRule> convertFlowPathToSimpleSwitchRules(Flow flow, FlowPath flowPath, EncapsulationId encapsulationId, long flowMeterMinBurstSizeInKbits, double flowMeterBurstCoefficient) { List<SimpleSwitchRule> rules = new ArrayList<>(); if (!flowPath.isProtected()) { rules.add(bu... |
@Test public void shouldConvertFlowPathOneSwitchFlowToSimpleSwitchRules() { Flow flow = buildOneSwitchPortFlow(); List<SimpleSwitchRule> expectedSwitchRules = getSimpleSwitchRuleForOneSwitchFlow(); List<SimpleSwitchRule> switchRules = simpleSwitchRuleConverter.convertFlowPathToSimpleSwitchRules(flow, flow.getForwardPat... | public List<SimpleSwitchRule> convertFlowPathToSimpleSwitchRules(Flow flow, FlowPath flowPath, EncapsulationId encapsulationId, long flowMeterMinBurstSizeInKbits, double flowMeterBurstCoefficient) { List<SimpleSwitchRule> rules = new ArrayList<>(); if (!flowPath.isProtected()) { rules.add(buildIngressSimpleSwitchRule(f... | SimpleSwitchRuleConverter { public List<SimpleSwitchRule> convertFlowPathToSimpleSwitchRules(Flow flow, FlowPath flowPath, EncapsulationId encapsulationId, long flowMeterMinBurstSizeInKbits, double flowMeterBurstCoefficient) { List<SimpleSwitchRule> rules = new ArrayList<>(); if (!flowPath.isProtected()) { rules.add(bu... | SimpleSwitchRuleConverter { public List<SimpleSwitchRule> convertFlowPathToSimpleSwitchRules(Flow flow, FlowPath flowPath, EncapsulationId encapsulationId, long flowMeterMinBurstSizeInKbits, double flowMeterBurstCoefficient) { List<SimpleSwitchRule> rules = new ArrayList<>(); if (!flowPath.isProtected()) { rules.add(bu... | SimpleSwitchRuleConverter { public List<SimpleSwitchRule> convertFlowPathToSimpleSwitchRules(Flow flow, FlowPath flowPath, EncapsulationId encapsulationId, long flowMeterMinBurstSizeInKbits, double flowMeterBurstCoefficient) { List<SimpleSwitchRule> rules = new ArrayList<>(); if (!flowPath.isProtected()) { rules.add(bu... | SimpleSwitchRuleConverter { public List<SimpleSwitchRule> convertFlowPathToSimpleSwitchRules(Flow flow, FlowPath flowPath, EncapsulationId encapsulationId, long flowMeterMinBurstSizeInKbits, double flowMeterBurstCoefficient) { List<SimpleSwitchRule> rules = new ArrayList<>(); if (!flowPath.isProtected()) { rules.add(bu... |
@Test public void shouldConvertFlowEntriesTransitVlanFlowToSimpleSwitchRules() { List<SimpleSwitchRule> expectedSwitchRules = getSimpleSwitchRuleForTransitVlan(); List<SwitchFlowEntries> switchFlowEntries = getSwitchFlowEntriesWithTransitVlan(); List<SwitchMeterEntries> switchMeterEntries = getSwitchMeterEntries(); for... | public List<SimpleSwitchRule> convertSwitchFlowEntriesToSimpleSwitchRules(SwitchFlowEntries rules, SwitchMeterEntries meters) { if (rules == null || rules.getFlowEntries() == null) { return Collections.emptyList(); } List<SimpleSwitchRule> simpleRules = new ArrayList<>(); for (FlowEntry flowEntry : rules.getFlowEntries... | SimpleSwitchRuleConverter { public List<SimpleSwitchRule> convertSwitchFlowEntriesToSimpleSwitchRules(SwitchFlowEntries rules, SwitchMeterEntries meters) { if (rules == null || rules.getFlowEntries() == null) { return Collections.emptyList(); } List<SimpleSwitchRule> simpleRules = new ArrayList<>(); for (FlowEntry flow... | SimpleSwitchRuleConverter { public List<SimpleSwitchRule> convertSwitchFlowEntriesToSimpleSwitchRules(SwitchFlowEntries rules, SwitchMeterEntries meters) { if (rules == null || rules.getFlowEntries() == null) { return Collections.emptyList(); } List<SimpleSwitchRule> simpleRules = new ArrayList<>(); for (FlowEntry flow... | SimpleSwitchRuleConverter { public List<SimpleSwitchRule> convertSwitchFlowEntriesToSimpleSwitchRules(SwitchFlowEntries rules, SwitchMeterEntries meters) { if (rules == null || rules.getFlowEntries() == null) { return Collections.emptyList(); } List<SimpleSwitchRule> simpleRules = new ArrayList<>(); for (FlowEntry flow... | SimpleSwitchRuleConverter { public List<SimpleSwitchRule> convertSwitchFlowEntriesToSimpleSwitchRules(SwitchFlowEntries rules, SwitchMeterEntries meters) { if (rules == null || rules.getFlowEntries() == null) { return Collections.emptyList(); } List<SimpleSwitchRule> simpleRules = new ArrayList<>(); for (FlowEntry flow... |
@Test public void shouldConvertFlowEntriesVxlanFlowToSimpleSwitchRules() { List<SimpleSwitchRule> expectedSwitchRules = getSimpleSwitchRuleForVxlan(); List<SwitchFlowEntries> switchFlowEntries = getSwitchFlowEntriesWithVxlan(); List<SwitchMeterEntries> switchMeterEntries = getSwitchMeterEntries(); for (int i = 0; i < s... | public List<SimpleSwitchRule> convertSwitchFlowEntriesToSimpleSwitchRules(SwitchFlowEntries rules, SwitchMeterEntries meters) { if (rules == null || rules.getFlowEntries() == null) { return Collections.emptyList(); } List<SimpleSwitchRule> simpleRules = new ArrayList<>(); for (FlowEntry flowEntry : rules.getFlowEntries... | SimpleSwitchRuleConverter { public List<SimpleSwitchRule> convertSwitchFlowEntriesToSimpleSwitchRules(SwitchFlowEntries rules, SwitchMeterEntries meters) { if (rules == null || rules.getFlowEntries() == null) { return Collections.emptyList(); } List<SimpleSwitchRule> simpleRules = new ArrayList<>(); for (FlowEntry flow... | SimpleSwitchRuleConverter { public List<SimpleSwitchRule> convertSwitchFlowEntriesToSimpleSwitchRules(SwitchFlowEntries rules, SwitchMeterEntries meters) { if (rules == null || rules.getFlowEntries() == null) { return Collections.emptyList(); } List<SimpleSwitchRule> simpleRules = new ArrayList<>(); for (FlowEntry flow... | SimpleSwitchRuleConverter { public List<SimpleSwitchRule> convertSwitchFlowEntriesToSimpleSwitchRules(SwitchFlowEntries rules, SwitchMeterEntries meters) { if (rules == null || rules.getFlowEntries() == null) { return Collections.emptyList(); } List<SimpleSwitchRule> simpleRules = new ArrayList<>(); for (FlowEntry flow... | SimpleSwitchRuleConverter { public List<SimpleSwitchRule> convertSwitchFlowEntriesToSimpleSwitchRules(SwitchFlowEntries rules, SwitchMeterEntries meters) { if (rules == null || rules.getFlowEntries() == null) { return Collections.emptyList(); } List<SimpleSwitchRule> simpleRules = new ArrayList<>(); for (FlowEntry flow... |
@Test(expected = IslNotFoundException.class) public void shouldFailIfThereIsNoIslForBfdEnableFlagUpdateRequest() throws IslNotFoundException { linkOperationsService.updateEnableBfdFlag( Endpoint.of(TEST_SWITCH_A_ID, TEST_SWITCH_A_PORT), Endpoint.of(TEST_SWITCH_B_ID, TEST_SWITCH_B_PORT), true); } | public Collection<Isl> updateEnableBfdFlag(Endpoint source, Endpoint destination, boolean flagValue) throws IslNotFoundException { return transactionManager.doInTransaction(() -> { List<Isl> processed = new ArrayList<>(2); boolean madeChange; madeChange = updateUniIslEnableBfdFlag(source, destination, flagValue, proces... | LinkOperationsService { public Collection<Isl> updateEnableBfdFlag(Endpoint source, Endpoint destination, boolean flagValue) throws IslNotFoundException { return transactionManager.doInTransaction(() -> { List<Isl> processed = new ArrayList<>(2); boolean madeChange; madeChange = updateUniIslEnableBfdFlag(source, destin... | LinkOperationsService { public Collection<Isl> updateEnableBfdFlag(Endpoint source, Endpoint destination, boolean flagValue) throws IslNotFoundException { return transactionManager.doInTransaction(() -> { List<Isl> processed = new ArrayList<>(2); boolean madeChange; madeChange = updateUniIslEnableBfdFlag(source, destin... | LinkOperationsService { public Collection<Isl> updateEnableBfdFlag(Endpoint source, Endpoint destination, boolean flagValue) throws IslNotFoundException { return transactionManager.doInTransaction(() -> { List<Isl> processed = new ArrayList<>(2); boolean madeChange; madeChange = updateUniIslEnableBfdFlag(source, destin... | LinkOperationsService { public Collection<Isl> updateEnableBfdFlag(Endpoint source, Endpoint destination, boolean flagValue) throws IslNotFoundException { return transactionManager.doInTransaction(() -> { List<Isl> processed = new ArrayList<>(2); boolean madeChange; madeChange = updateUniIslEnableBfdFlag(source, destin... |
@Test public void shouldConvertFlowEntriesOneSwitchFlowToSimpleSwitchRules() { List<SimpleSwitchRule> expectedSwitchRules = getSimpleSwitchRuleForOneSwitchFlow(); List<SwitchFlowEntries> switchFlowEntries = getSwitchFlowEntriesOneSwitchFlow(); List<SimpleSwitchRule> switchRules = simpleSwitchRuleConverter.convertSwitch... | public List<SimpleSwitchRule> convertSwitchFlowEntriesToSimpleSwitchRules(SwitchFlowEntries rules, SwitchMeterEntries meters) { if (rules == null || rules.getFlowEntries() == null) { return Collections.emptyList(); } List<SimpleSwitchRule> simpleRules = new ArrayList<>(); for (FlowEntry flowEntry : rules.getFlowEntries... | SimpleSwitchRuleConverter { public List<SimpleSwitchRule> convertSwitchFlowEntriesToSimpleSwitchRules(SwitchFlowEntries rules, SwitchMeterEntries meters) { if (rules == null || rules.getFlowEntries() == null) { return Collections.emptyList(); } List<SimpleSwitchRule> simpleRules = new ArrayList<>(); for (FlowEntry flow... | SimpleSwitchRuleConverter { public List<SimpleSwitchRule> convertSwitchFlowEntriesToSimpleSwitchRules(SwitchFlowEntries rules, SwitchMeterEntries meters) { if (rules == null || rules.getFlowEntries() == null) { return Collections.emptyList(); } List<SimpleSwitchRule> simpleRules = new ArrayList<>(); for (FlowEntry flow... | SimpleSwitchRuleConverter { public List<SimpleSwitchRule> convertSwitchFlowEntriesToSimpleSwitchRules(SwitchFlowEntries rules, SwitchMeterEntries meters) { if (rules == null || rules.getFlowEntries() == null) { return Collections.emptyList(); } List<SimpleSwitchRule> simpleRules = new ArrayList<>(); for (FlowEntry flow... | SimpleSwitchRuleConverter { public List<SimpleSwitchRule> convertSwitchFlowEntriesToSimpleSwitchRules(SwitchFlowEntries rules, SwitchMeterEntries meters) { if (rules == null || rules.getFlowEntries() == null) { return Collections.emptyList(); } List<SimpleSwitchRule> simpleRules = new ArrayList<>(); for (FlowEntry flow... |
@Test public void cookiePool() { transactionManager.doInTransaction(() -> { Set<Long> cookies = new HashSet<>(); for (long i = MIN_COOKIE; i <= MAX_COOKIE; i++) { cookies.add(cookiePool.allocate(format("flow_%d", i))); } assertEquals(MAX_COOKIE - MIN_COOKIE + 1, cookies.size()); cookies.forEach(cookie -> assertTrue(coo... | public CookiePool(PersistenceManager persistenceManager, long minCookie, long maxCookie, int poolSize) { transactionManager = persistenceManager.getTransactionManager(); RepositoryFactory repositoryFactory = persistenceManager.getRepositoryFactory(); flowCookieRepository = repositoryFactory.createFlowCookieRepository()... | CookiePool { public CookiePool(PersistenceManager persistenceManager, long minCookie, long maxCookie, int poolSize) { transactionManager = persistenceManager.getTransactionManager(); RepositoryFactory repositoryFactory = persistenceManager.getRepositoryFactory(); flowCookieRepository = repositoryFactory.createFlowCooki... | CookiePool { public CookiePool(PersistenceManager persistenceManager, long minCookie, long maxCookie, int poolSize) { transactionManager = persistenceManager.getTransactionManager(); RepositoryFactory repositoryFactory = persistenceManager.getRepositoryFactory(); flowCookieRepository = repositoryFactory.createFlowCooki... | CookiePool { public CookiePool(PersistenceManager persistenceManager, long minCookie, long maxCookie, int poolSize) { transactionManager = persistenceManager.getTransactionManager(); RepositoryFactory repositoryFactory = persistenceManager.getRepositoryFactory(); flowCookieRepository = repositoryFactory.createFlowCooki... | CookiePool { public CookiePool(PersistenceManager persistenceManager, long minCookie, long maxCookie, int poolSize) { transactionManager = persistenceManager.getTransactionManager(); RepositoryFactory repositoryFactory = persistenceManager.getRepositoryFactory(); flowCookieRepository = repositoryFactory.createFlowCooki... |
@Test(expected = ResourceNotAvailableException.class) public void cookiePoolFullTest() { transactionManager.doInTransaction(() -> { for (long i = MIN_COOKIE; i <= MAX_COOKIE + 1; i++) { assertTrue(cookiePool.allocate(format("flow_%d", i)) > 0); } }); } | @TransactionRequired public long allocate(String flowId) { if (nextCookie > 0) { if (nextCookie <= maxCookie && !flowCookieRepository.exists(nextCookie)) { addCookie(flowId, nextCookie); return nextCookie++; } else { nextCookie = 0; } } if (nextCookie == 0) { long numOfPools = (maxCookie - minCookie) / poolSize; if (nu... | CookiePool { @TransactionRequired public long allocate(String flowId) { if (nextCookie > 0) { if (nextCookie <= maxCookie && !flowCookieRepository.exists(nextCookie)) { addCookie(flowId, nextCookie); return nextCookie++; } else { nextCookie = 0; } } if (nextCookie == 0) { long numOfPools = (maxCookie - minCookie) / poo... | CookiePool { @TransactionRequired public long allocate(String flowId) { if (nextCookie > 0) { if (nextCookie <= maxCookie && !flowCookieRepository.exists(nextCookie)) { addCookie(flowId, nextCookie); return nextCookie++; } else { nextCookie = 0; } } if (nextCookie == 0) { long numOfPools = (maxCookie - minCookie) / poo... | CookiePool { @TransactionRequired public long allocate(String flowId) { if (nextCookie > 0) { if (nextCookie <= maxCookie && !flowCookieRepository.exists(nextCookie)) { addCookie(flowId, nextCookie); return nextCookie++; } else { nextCookie = 0; } } if (nextCookie == 0) { long numOfPools = (maxCookie - minCookie) / poo... | CookiePool { @TransactionRequired public long allocate(String flowId) { if (nextCookie > 0) { if (nextCookie <= maxCookie && !flowCookieRepository.exists(nextCookie)) { addCookie(flowId, nextCookie); return nextCookie++; } else { nextCookie = 0; } } if (nextCookie == 0) { long numOfPools = (maxCookie - minCookie) / poo... |
@Test public void cookieLldp() { transactionManager.doInTransaction(() -> { String flowId = "flow_1"; long flowCookie = cookiePool.allocate(flowId); long lldpCookie = cookiePool.allocate(flowId); assertNotEquals(flowCookie, lldpCookie); }); } | @TransactionRequired public long allocate(String flowId) { if (nextCookie > 0) { if (nextCookie <= maxCookie && !flowCookieRepository.exists(nextCookie)) { addCookie(flowId, nextCookie); return nextCookie++; } else { nextCookie = 0; } } if (nextCookie == 0) { long numOfPools = (maxCookie - minCookie) / poolSize; if (nu... | CookiePool { @TransactionRequired public long allocate(String flowId) { if (nextCookie > 0) { if (nextCookie <= maxCookie && !flowCookieRepository.exists(nextCookie)) { addCookie(flowId, nextCookie); return nextCookie++; } else { nextCookie = 0; } } if (nextCookie == 0) { long numOfPools = (maxCookie - minCookie) / poo... | CookiePool { @TransactionRequired public long allocate(String flowId) { if (nextCookie > 0) { if (nextCookie <= maxCookie && !flowCookieRepository.exists(nextCookie)) { addCookie(flowId, nextCookie); return nextCookie++; } else { nextCookie = 0; } } if (nextCookie == 0) { long numOfPools = (maxCookie - minCookie) / poo... | CookiePool { @TransactionRequired public long allocate(String flowId) { if (nextCookie > 0) { if (nextCookie <= maxCookie && !flowCookieRepository.exists(nextCookie)) { addCookie(flowId, nextCookie); return nextCookie++; } else { nextCookie = 0; } } if (nextCookie == 0) { long numOfPools = (maxCookie - minCookie) / poo... | CookiePool { @TransactionRequired public long allocate(String flowId) { if (nextCookie > 0) { if (nextCookie <= maxCookie && !flowCookieRepository.exists(nextCookie)) { addCookie(flowId, nextCookie); return nextCookie++; } else { nextCookie = 0; } } if (nextCookie == 0) { long numOfPools = (maxCookie - minCookie) / poo... |
@Test public void shouldAllocateForFlow() throws ResourceAllocationException { transactionManager.doInTransaction(() -> { Flow flow = convertFlow(firstFlow); verifyAllocation(resourcesManager.allocateFlowResources(flow)); }); } | public FlowResources allocateFlowResources(Flow flow) throws ResourceAllocationException { log.debug("Allocate flow resources for {}.", flow); PathId forwardPathId = generatePathId(flow.getFlowId()); PathId reversePathId = generatePathId(flow.getFlowId()); try { return allocateResources(flow, forwardPathId, reversePath... | FlowResourcesManager { public FlowResources allocateFlowResources(Flow flow) throws ResourceAllocationException { log.debug("Allocate flow resources for {}.", flow); PathId forwardPathId = generatePathId(flow.getFlowId()); PathId reversePathId = generatePathId(flow.getFlowId()); try { return allocateResources(flow, for... | FlowResourcesManager { public FlowResources allocateFlowResources(Flow flow) throws ResourceAllocationException { log.debug("Allocate flow resources for {}.", flow); PathId forwardPathId = generatePathId(flow.getFlowId()); PathId reversePathId = generatePathId(flow.getFlowId()); try { return allocateResources(flow, for... | FlowResourcesManager { public FlowResources allocateFlowResources(Flow flow) throws ResourceAllocationException { log.debug("Allocate flow resources for {}.", flow); PathId forwardPathId = generatePathId(flow.getFlowId()); PathId reversePathId = generatePathId(flow.getFlowId()); try { return allocateResources(flow, for... | FlowResourcesManager { public FlowResources allocateFlowResources(Flow flow) throws ResourceAllocationException { log.debug("Allocate flow resources for {}.", flow); PathId forwardPathId = generatePathId(flow.getFlowId()); PathId reversePathId = generatePathId(flow.getFlowId()); try { return allocateResources(flow, for... |
@Test public void shouldAllocateForNoBandwidthFlow() throws ResourceAllocationException { transactionManager.doInTransaction(() -> { Flow flow = convertFlow(fourthFlow); verifyMeterLessAllocation(resourcesManager.allocateFlowResources(flow)); }); } | public FlowResources allocateFlowResources(Flow flow) throws ResourceAllocationException { log.debug("Allocate flow resources for {}.", flow); PathId forwardPathId = generatePathId(flow.getFlowId()); PathId reversePathId = generatePathId(flow.getFlowId()); try { return allocateResources(flow, forwardPathId, reversePath... | FlowResourcesManager { public FlowResources allocateFlowResources(Flow flow) throws ResourceAllocationException { log.debug("Allocate flow resources for {}.", flow); PathId forwardPathId = generatePathId(flow.getFlowId()); PathId reversePathId = generatePathId(flow.getFlowId()); try { return allocateResources(flow, for... | FlowResourcesManager { public FlowResources allocateFlowResources(Flow flow) throws ResourceAllocationException { log.debug("Allocate flow resources for {}.", flow); PathId forwardPathId = generatePathId(flow.getFlowId()); PathId reversePathId = generatePathId(flow.getFlowId()); try { return allocateResources(flow, for... | FlowResourcesManager { public FlowResources allocateFlowResources(Flow flow) throws ResourceAllocationException { log.debug("Allocate flow resources for {}.", flow); PathId forwardPathId = generatePathId(flow.getFlowId()); PathId reversePathId = generatePathId(flow.getFlowId()); try { return allocateResources(flow, for... | FlowResourcesManager { public FlowResources allocateFlowResources(Flow flow) throws ResourceAllocationException { log.debug("Allocate flow resources for {}.", flow); PathId forwardPathId = generatePathId(flow.getFlowId()); PathId reversePathId = generatePathId(flow.getFlowId()); try { return allocateResources(flow, for... |
@Test public void shouldNotConsumeVlansForSingleSwitchFlows() throws ResourceAllocationException { transactionManager.doInTransaction(() -> { final int attemps = (flowResourcesConfig.getMaxFlowTransitVlan() - flowResourcesConfig.getMinFlowTransitVlan()) / 2 + 1; for (int i = 0; i < attemps; i++) { thirdFlow.setFlowId(f... | public FlowResources allocateFlowResources(Flow flow) throws ResourceAllocationException { log.debug("Allocate flow resources for {}.", flow); PathId forwardPathId = generatePathId(flow.getFlowId()); PathId reversePathId = generatePathId(flow.getFlowId()); try { return allocateResources(flow, forwardPathId, reversePath... | FlowResourcesManager { public FlowResources allocateFlowResources(Flow flow) throws ResourceAllocationException { log.debug("Allocate flow resources for {}.", flow); PathId forwardPathId = generatePathId(flow.getFlowId()); PathId reversePathId = generatePathId(flow.getFlowId()); try { return allocateResources(flow, for... | FlowResourcesManager { public FlowResources allocateFlowResources(Flow flow) throws ResourceAllocationException { log.debug("Allocate flow resources for {}.", flow); PathId forwardPathId = generatePathId(flow.getFlowId()); PathId reversePathId = generatePathId(flow.getFlowId()); try { return allocateResources(flow, for... | FlowResourcesManager { public FlowResources allocateFlowResources(Flow flow) throws ResourceAllocationException { log.debug("Allocate flow resources for {}.", flow); PathId forwardPathId = generatePathId(flow.getFlowId()); PathId reversePathId = generatePathId(flow.getFlowId()); try { return allocateResources(flow, for... | FlowResourcesManager { public FlowResources allocateFlowResources(Flow flow) throws ResourceAllocationException { log.debug("Allocate flow resources for {}.", flow); PathId forwardPathId = generatePathId(flow.getFlowId()); PathId reversePathId = generatePathId(flow.getFlowId()); try { return allocateResources(flow, for... |
@Test public void shouldNotConsumeMetersForUnmeteredFlows() throws ResourceAllocationException { transactionManager.doInTransaction(() -> { final int attemps = (flowResourcesConfig.getMaxFlowMeterId() - flowResourcesConfig.getMinFlowMeterId()) / 2 + 1; for (int i = 0; i < attemps; i++) { fourthFlow.setFlowId(format("fo... | public FlowResources allocateFlowResources(Flow flow) throws ResourceAllocationException { log.debug("Allocate flow resources for {}.", flow); PathId forwardPathId = generatePathId(flow.getFlowId()); PathId reversePathId = generatePathId(flow.getFlowId()); try { return allocateResources(flow, forwardPathId, reversePath... | FlowResourcesManager { public FlowResources allocateFlowResources(Flow flow) throws ResourceAllocationException { log.debug("Allocate flow resources for {}.", flow); PathId forwardPathId = generatePathId(flow.getFlowId()); PathId reversePathId = generatePathId(flow.getFlowId()); try { return allocateResources(flow, for... | FlowResourcesManager { public FlowResources allocateFlowResources(Flow flow) throws ResourceAllocationException { log.debug("Allocate flow resources for {}.", flow); PathId forwardPathId = generatePathId(flow.getFlowId()); PathId reversePathId = generatePathId(flow.getFlowId()); try { return allocateResources(flow, for... | FlowResourcesManager { public FlowResources allocateFlowResources(Flow flow) throws ResourceAllocationException { log.debug("Allocate flow resources for {}.", flow); PathId forwardPathId = generatePathId(flow.getFlowId()); PathId reversePathId = generatePathId(flow.getFlowId()); try { return allocateResources(flow, for... | FlowResourcesManager { public FlowResources allocateFlowResources(Flow flow) throws ResourceAllocationException { log.debug("Allocate flow resources for {}.", flow); PathId forwardPathId = generatePathId(flow.getFlowId()); PathId reversePathId = generatePathId(flow.getFlowId()); try { return allocateResources(flow, for... |
@Test public void deallocatePathResourcesTest() throws Exception { transactionManager.doInTransaction(() -> { Flow flow = convertFlow(firstFlow); FlowResources resources = resourcesManager.allocateFlowResources(flow); resourcesManager.deallocatePathResources(resources.getForward().getPathId(), resources.getUnmaskedCook... | public void deallocatePathResources(PathId pathId, long unmaskedCookie, FlowEncapsulationType encapsulationType) { log.debug("Deallocate flow resources for path {}, cookie: {}.", pathId, unmaskedCookie); transactionManager.doInTransaction(() -> { cookiePool.deallocate(unmaskedCookie); meterPool.deallocate(pathId); Enca... | FlowResourcesManager { public void deallocatePathResources(PathId pathId, long unmaskedCookie, FlowEncapsulationType encapsulationType) { log.debug("Deallocate flow resources for path {}, cookie: {}.", pathId, unmaskedCookie); transactionManager.doInTransaction(() -> { cookiePool.deallocate(unmaskedCookie); meterPool.d... | FlowResourcesManager { public void deallocatePathResources(PathId pathId, long unmaskedCookie, FlowEncapsulationType encapsulationType) { log.debug("Deallocate flow resources for path {}, cookie: {}.", pathId, unmaskedCookie); transactionManager.doInTransaction(() -> { cookiePool.deallocate(unmaskedCookie); meterPool.d... | FlowResourcesManager { public void deallocatePathResources(PathId pathId, long unmaskedCookie, FlowEncapsulationType encapsulationType) { log.debug("Deallocate flow resources for path {}, cookie: {}.", pathId, unmaskedCookie); transactionManager.doInTransaction(() -> { cookiePool.deallocate(unmaskedCookie); meterPool.d... | FlowResourcesManager { public void deallocatePathResources(PathId pathId, long unmaskedCookie, FlowEncapsulationType encapsulationType) { log.debug("Deallocate flow resources for path {}, cookie: {}.", pathId, unmaskedCookie); transactionManager.doInTransaction(() -> { cookiePool.deallocate(unmaskedCookie); meterPool.d... |
@Test public void vlanPoolTest() { transactionManager.doInTransaction(() -> { Set<Integer> transitVlans = new HashSet<>(); for (int i = MIN_TRANSIT_VLAN; i <= MAX_TRANSIT_VLAN; i++) { Flow flow = Flow.builder() .flowId(format("flow_%d", i)).srcSwitch(SWITCH_A).destSwitch(SWITCH_B).build(); transitVlans.add(transitVlanP... | @Override public TransitVlanEncapsulation allocate(Flow flow, PathId pathId, PathId oppositePathId) { return get(oppositePathId, null) .orElseGet(() -> allocate(flow, pathId)); } | TransitVlanPool implements EncapsulationResourcesProvider<TransitVlanEncapsulation> { @Override public TransitVlanEncapsulation allocate(Flow flow, PathId pathId, PathId oppositePathId) { return get(oppositePathId, null) .orElseGet(() -> allocate(flow, pathId)); } } | TransitVlanPool implements EncapsulationResourcesProvider<TransitVlanEncapsulation> { @Override public TransitVlanEncapsulation allocate(Flow flow, PathId pathId, PathId oppositePathId) { return get(oppositePathId, null) .orElseGet(() -> allocate(flow, pathId)); } TransitVlanPool(PersistenceManager persistenceManager, ... | TransitVlanPool implements EncapsulationResourcesProvider<TransitVlanEncapsulation> { @Override public TransitVlanEncapsulation allocate(Flow flow, PathId pathId, PathId oppositePathId) { return get(oppositePathId, null) .orElseGet(() -> allocate(flow, pathId)); } TransitVlanPool(PersistenceManager persistenceManager, ... | TransitVlanPool implements EncapsulationResourcesProvider<TransitVlanEncapsulation> { @Override public TransitVlanEncapsulation allocate(Flow flow, PathId pathId, PathId oppositePathId) { return get(oppositePathId, null) .orElseGet(() -> allocate(flow, pathId)); } TransitVlanPool(PersistenceManager persistenceManager, ... |
@Test(expected = IslNotFoundException.class) public void shouldFailIfThereIsUniIslOnlyForBfdEnableFlagUpdateRequest() throws IslNotFoundException { Isl isl = Isl.builder() .srcSwitch(createSwitchIfNotExist(TEST_SWITCH_A_ID)) .srcPort(TEST_SWITCH_A_PORT) .destSwitch(createSwitchIfNotExist(TEST_SWITCH_B_ID)) .destPort(TE... | public Collection<Isl> updateEnableBfdFlag(Endpoint source, Endpoint destination, boolean flagValue) throws IslNotFoundException { return transactionManager.doInTransaction(() -> { List<Isl> processed = new ArrayList<>(2); boolean madeChange; madeChange = updateUniIslEnableBfdFlag(source, destination, flagValue, proces... | LinkOperationsService { public Collection<Isl> updateEnableBfdFlag(Endpoint source, Endpoint destination, boolean flagValue) throws IslNotFoundException { return transactionManager.doInTransaction(() -> { List<Isl> processed = new ArrayList<>(2); boolean madeChange; madeChange = updateUniIslEnableBfdFlag(source, destin... | LinkOperationsService { public Collection<Isl> updateEnableBfdFlag(Endpoint source, Endpoint destination, boolean flagValue) throws IslNotFoundException { return transactionManager.doInTransaction(() -> { List<Isl> processed = new ArrayList<>(2); boolean madeChange; madeChange = updateUniIslEnableBfdFlag(source, destin... | LinkOperationsService { public Collection<Isl> updateEnableBfdFlag(Endpoint source, Endpoint destination, boolean flagValue) throws IslNotFoundException { return transactionManager.doInTransaction(() -> { List<Isl> processed = new ArrayList<>(2); boolean madeChange; madeChange = updateUniIslEnableBfdFlag(source, destin... | LinkOperationsService { public Collection<Isl> updateEnableBfdFlag(Endpoint source, Endpoint destination, boolean flagValue) throws IslNotFoundException { return transactionManager.doInTransaction(() -> { List<Isl> processed = new ArrayList<>(2); boolean madeChange; madeChange = updateUniIslEnableBfdFlag(source, destin... |
@Test(expected = ResourceNotAvailableException.class) public void vlanPoolFullTest() { transactionManager.doInTransaction(() -> { for (int i = MIN_TRANSIT_VLAN; i <= MAX_TRANSIT_VLAN + 1; i++) { Flow flow = Flow.builder() .flowId(format("flow_%d", i)).srcSwitch(SWITCH_A).destSwitch(SWITCH_B).build(); assertTrue(transit... | @Override public TransitVlanEncapsulation allocate(Flow flow, PathId pathId, PathId oppositePathId) { return get(oppositePathId, null) .orElseGet(() -> allocate(flow, pathId)); } | TransitVlanPool implements EncapsulationResourcesProvider<TransitVlanEncapsulation> { @Override public TransitVlanEncapsulation allocate(Flow flow, PathId pathId, PathId oppositePathId) { return get(oppositePathId, null) .orElseGet(() -> allocate(flow, pathId)); } } | TransitVlanPool implements EncapsulationResourcesProvider<TransitVlanEncapsulation> { @Override public TransitVlanEncapsulation allocate(Flow flow, PathId pathId, PathId oppositePathId) { return get(oppositePathId, null) .orElseGet(() -> allocate(flow, pathId)); } TransitVlanPool(PersistenceManager persistenceManager, ... | TransitVlanPool implements EncapsulationResourcesProvider<TransitVlanEncapsulation> { @Override public TransitVlanEncapsulation allocate(Flow flow, PathId pathId, PathId oppositePathId) { return get(oppositePathId, null) .orElseGet(() -> allocate(flow, pathId)); } TransitVlanPool(PersistenceManager persistenceManager, ... | TransitVlanPool implements EncapsulationResourcesProvider<TransitVlanEncapsulation> { @Override public TransitVlanEncapsulation allocate(Flow flow, PathId pathId, PathId oppositePathId) { return get(oppositePathId, null) .orElseGet(() -> allocate(flow, pathId)); } TransitVlanPool(PersistenceManager persistenceManager, ... |
@Test public void gotSameVlanForOppositePath() { Flow flow = Flow.builder().flowId("flow_1").srcSwitch(SWITCH_A).destSwitch(SWITCH_B).build(); final PathId forwardPathId = new PathId("forward"); final PathId reversePathId = new PathId("reverse"); transactionManager.doInTransaction(() -> { TransitVlan forward = transitV... | @Override public TransitVlanEncapsulation allocate(Flow flow, PathId pathId, PathId oppositePathId) { return get(oppositePathId, null) .orElseGet(() -> allocate(flow, pathId)); } | TransitVlanPool implements EncapsulationResourcesProvider<TransitVlanEncapsulation> { @Override public TransitVlanEncapsulation allocate(Flow flow, PathId pathId, PathId oppositePathId) { return get(oppositePathId, null) .orElseGet(() -> allocate(flow, pathId)); } } | TransitVlanPool implements EncapsulationResourcesProvider<TransitVlanEncapsulation> { @Override public TransitVlanEncapsulation allocate(Flow flow, PathId pathId, PathId oppositePathId) { return get(oppositePathId, null) .orElseGet(() -> allocate(flow, pathId)); } TransitVlanPool(PersistenceManager persistenceManager, ... | TransitVlanPool implements EncapsulationResourcesProvider<TransitVlanEncapsulation> { @Override public TransitVlanEncapsulation allocate(Flow flow, PathId pathId, PathId oppositePathId) { return get(oppositePathId, null) .orElseGet(() -> allocate(flow, pathId)); } TransitVlanPool(PersistenceManager persistenceManager, ... | TransitVlanPool implements EncapsulationResourcesProvider<TransitVlanEncapsulation> { @Override public TransitVlanEncapsulation allocate(Flow flow, PathId pathId, PathId oppositePathId) { return get(oppositePathId, null) .orElseGet(() -> allocate(flow, pathId)); } TransitVlanPool(PersistenceManager persistenceManager, ... |
@Test public void vxlanIdPool() { transactionManager.doInTransaction(() -> { Set<Integer> vxlans = new HashSet<>(); for (int i = MIN_VXLAN; i <= MAX_VXLAN; i++) { Flow flow = Flow.builder() .flowId(format("flow_%d", i)).srcSwitch(SWITCH_A).destSwitch(SWITCH_B).build(); vxlans.add(vxlanPool.allocate( flow, new PathId(fo... | @Override public VxlanEncapsulation allocate(Flow flow, PathId pathId, PathId oppositePathId) { return get(oppositePathId, null) .orElseGet(() -> allocate(flow, pathId)); } | VxlanPool implements EncapsulationResourcesProvider<VxlanEncapsulation> { @Override public VxlanEncapsulation allocate(Flow flow, PathId pathId, PathId oppositePathId) { return get(oppositePathId, null) .orElseGet(() -> allocate(flow, pathId)); } } | VxlanPool implements EncapsulationResourcesProvider<VxlanEncapsulation> { @Override public VxlanEncapsulation allocate(Flow flow, PathId pathId, PathId oppositePathId) { return get(oppositePathId, null) .orElseGet(() -> allocate(flow, pathId)); } VxlanPool(PersistenceManager persistenceManager, int minVxlan, int maxVxl... | VxlanPool implements EncapsulationResourcesProvider<VxlanEncapsulation> { @Override public VxlanEncapsulation allocate(Flow flow, PathId pathId, PathId oppositePathId) { return get(oppositePathId, null) .orElseGet(() -> allocate(flow, pathId)); } VxlanPool(PersistenceManager persistenceManager, int minVxlan, int maxVxl... | VxlanPool implements EncapsulationResourcesProvider<VxlanEncapsulation> { @Override public VxlanEncapsulation allocate(Flow flow, PathId pathId, PathId oppositePathId) { return get(oppositePathId, null) .orElseGet(() -> allocate(flow, pathId)); } VxlanPool(PersistenceManager persistenceManager, int minVxlan, int maxVxl... |
@Test(expected = ResourceNotAvailableException.class) public void vxlanPoolFullTest() { transactionManager.doInTransaction(() -> { for (int i = MIN_VXLAN; i <= MAX_VXLAN + 1; i++) { Flow flow = Flow.builder() .flowId(format("flow_%d", i)).srcSwitch(SWITCH_A).destSwitch(SWITCH_B).build(); assertTrue(vxlanPool.allocate(f... | @Override public VxlanEncapsulation allocate(Flow flow, PathId pathId, PathId oppositePathId) { return get(oppositePathId, null) .orElseGet(() -> allocate(flow, pathId)); } | VxlanPool implements EncapsulationResourcesProvider<VxlanEncapsulation> { @Override public VxlanEncapsulation allocate(Flow flow, PathId pathId, PathId oppositePathId) { return get(oppositePathId, null) .orElseGet(() -> allocate(flow, pathId)); } } | VxlanPool implements EncapsulationResourcesProvider<VxlanEncapsulation> { @Override public VxlanEncapsulation allocate(Flow flow, PathId pathId, PathId oppositePathId) { return get(oppositePathId, null) .orElseGet(() -> allocate(flow, pathId)); } VxlanPool(PersistenceManager persistenceManager, int minVxlan, int maxVxl... | VxlanPool implements EncapsulationResourcesProvider<VxlanEncapsulation> { @Override public VxlanEncapsulation allocate(Flow flow, PathId pathId, PathId oppositePathId) { return get(oppositePathId, null) .orElseGet(() -> allocate(flow, pathId)); } VxlanPool(PersistenceManager persistenceManager, int minVxlan, int maxVxl... | VxlanPool implements EncapsulationResourcesProvider<VxlanEncapsulation> { @Override public VxlanEncapsulation allocate(Flow flow, PathId pathId, PathId oppositePathId) { return get(oppositePathId, null) .orElseGet(() -> allocate(flow, pathId)); } VxlanPool(PersistenceManager persistenceManager, int minVxlan, int maxVxl... |
@Test public void meterPoolTest() { transactionManager.doInTransaction(() -> { long minMeterId = MIN_METER_ID.getValue(); long maxMeterId = MAX_METER_ID.getValue(); Set<MeterId> meterIds = new HashSet<>(); for (long i = minMeterId; i <= maxMeterId; i++) { meterIds.add(meterPool.allocate(SWITCH_ID, format("flow_%d", i),... | public MeterPool(PersistenceManager persistenceManager, MeterId minMeterId, MeterId maxMeterId, int poolSize) { transactionManager = persistenceManager.getTransactionManager(); RepositoryFactory repositoryFactory = persistenceManager.getRepositoryFactory(); flowMeterRepository = repositoryFactory.createFlowMeterReposit... | MeterPool { public MeterPool(PersistenceManager persistenceManager, MeterId minMeterId, MeterId maxMeterId, int poolSize) { transactionManager = persistenceManager.getTransactionManager(); RepositoryFactory repositoryFactory = persistenceManager.getRepositoryFactory(); flowMeterRepository = repositoryFactory.createFlow... | MeterPool { public MeterPool(PersistenceManager persistenceManager, MeterId minMeterId, MeterId maxMeterId, int poolSize) { transactionManager = persistenceManager.getTransactionManager(); RepositoryFactory repositoryFactory = persistenceManager.getRepositoryFactory(); flowMeterRepository = repositoryFactory.createFlow... | MeterPool { public MeterPool(PersistenceManager persistenceManager, MeterId minMeterId, MeterId maxMeterId, int poolSize) { transactionManager = persistenceManager.getTransactionManager(); RepositoryFactory repositoryFactory = persistenceManager.getRepositoryFactory(); flowMeterRepository = repositoryFactory.createFlow... | MeterPool { public MeterPool(PersistenceManager persistenceManager, MeterId minMeterId, MeterId maxMeterId, int poolSize) { transactionManager = persistenceManager.getTransactionManager(); RepositoryFactory repositoryFactory = persistenceManager.getRepositoryFactory(); flowMeterRepository = repositoryFactory.createFlow... |
@Test(expected = ResourceNotAvailableException.class) public void meterPoolFullTest() { transactionManager.doInTransaction(() -> { for (long i = MIN_METER_ID.getValue(); i <= MAX_METER_ID.getValue() + 1; i++) { meterPool.allocate(SWITCH_ID, format("flow_%d", i), new PathId(format("path_%d", i))); } }); } | @TransactionRequired public MeterId allocate(SwitchId switchId, String flowId, PathId pathId) { MeterId nextMeter = nextMeters.get(switchId); if (nextMeter != null && nextMeter.getValue() > 0) { if (nextMeter.compareTo(maxMeterId) <= 0 && !flowMeterRepository.exists(switchId, nextMeter)) { addMeter(flowId, pathId, swit... | MeterPool { @TransactionRequired public MeterId allocate(SwitchId switchId, String flowId, PathId pathId) { MeterId nextMeter = nextMeters.get(switchId); if (nextMeter != null && nextMeter.getValue() > 0) { if (nextMeter.compareTo(maxMeterId) <= 0 && !flowMeterRepository.exists(switchId, nextMeter)) { addMeter(flowId, ... | MeterPool { @TransactionRequired public MeterId allocate(SwitchId switchId, String flowId, PathId pathId) { MeterId nextMeter = nextMeters.get(switchId); if (nextMeter != null && nextMeter.getValue() > 0) { if (nextMeter.compareTo(maxMeterId) <= 0 && !flowMeterRepository.exists(switchId, nextMeter)) { addMeter(flowId, ... | MeterPool { @TransactionRequired public MeterId allocate(SwitchId switchId, String flowId, PathId pathId) { MeterId nextMeter = nextMeters.get(switchId); if (nextMeter != null && nextMeter.getValue() > 0) { if (nextMeter.compareTo(maxMeterId) <= 0 && !flowMeterRepository.exists(switchId, nextMeter)) { addMeter(flowId, ... | MeterPool { @TransactionRequired public MeterId allocate(SwitchId switchId, String flowId, PathId pathId) { MeterId nextMeter = nextMeters.get(switchId); if (nextMeter != null && nextMeter.getValue() > 0) { if (nextMeter.compareTo(maxMeterId) <= 0 && !flowMeterRepository.exists(switchId, nextMeter)) { addMeter(flowId, ... |
@Ignore("InMemoryGraph doesn't enforce constraint") @Test(expected = ConstraintViolationException.class) public void createTwoMeterForOnePathTest() { transactionManager.doInTransaction(() -> { long first = meterPool.allocate(SWITCH_ID, FLOW_1, PATH_ID_1).getValue(); long second = meterPool.allocate(SWITCH_ID, FLOW_1, P... | @TransactionRequired public MeterId allocate(SwitchId switchId, String flowId, PathId pathId) { MeterId nextMeter = nextMeters.get(switchId); if (nextMeter != null && nextMeter.getValue() > 0) { if (nextMeter.compareTo(maxMeterId) <= 0 && !flowMeterRepository.exists(switchId, nextMeter)) { addMeter(flowId, pathId, swit... | MeterPool { @TransactionRequired public MeterId allocate(SwitchId switchId, String flowId, PathId pathId) { MeterId nextMeter = nextMeters.get(switchId); if (nextMeter != null && nextMeter.getValue() > 0) { if (nextMeter.compareTo(maxMeterId) <= 0 && !flowMeterRepository.exists(switchId, nextMeter)) { addMeter(flowId, ... | MeterPool { @TransactionRequired public MeterId allocate(SwitchId switchId, String flowId, PathId pathId) { MeterId nextMeter = nextMeters.get(switchId); if (nextMeter != null && nextMeter.getValue() > 0) { if (nextMeter.compareTo(maxMeterId) <= 0 && !flowMeterRepository.exists(switchId, nextMeter)) { addMeter(flowId, ... | MeterPool { @TransactionRequired public MeterId allocate(SwitchId switchId, String flowId, PathId pathId) { MeterId nextMeter = nextMeters.get(switchId); if (nextMeter != null && nextMeter.getValue() > 0) { if (nextMeter.compareTo(maxMeterId) <= 0 && !flowMeterRepository.exists(switchId, nextMeter)) { addMeter(flowId, ... | MeterPool { @TransactionRequired public MeterId allocate(SwitchId switchId, String flowId, PathId pathId) { MeterId nextMeter = nextMeters.get(switchId); if (nextMeter != null && nextMeter.getValue() > 0) { if (nextMeter.compareTo(maxMeterId) <= 0 && !flowMeterRepository.exists(switchId, nextMeter)) { addMeter(flowId, ... |
@Test public void shouldReturnTrueWhenSelfLooped() { final SwitchId switchId = new SwitchId("00:00:00:00:00:00:00:01"); PathNode source = new PathNode(switchId, 1, 0); PathNode destination = new PathNode(switchId, 2, 1); IslInfoData isl = new IslInfoData(source, destination, IslChangeType.DISCOVERED, false); assertTrue... | @JsonIgnore public boolean isSelfLooped() { return Objects.equals(source.getSwitchId(), destination.getSwitchId()); } | IslInfoData extends CacheTimeTag { @JsonIgnore public boolean isSelfLooped() { return Objects.equals(source.getSwitchId(), destination.getSwitchId()); } } | IslInfoData extends CacheTimeTag { @JsonIgnore public boolean isSelfLooped() { return Objects.equals(source.getSwitchId(), destination.getSwitchId()); } IslInfoData(IslInfoData that); IslInfoData(PathNode source, PathNode destination, IslChangeType state, boolean underMaintenance); @Builder(toBuilder = true) @JsonCrea... | IslInfoData extends CacheTimeTag { @JsonIgnore public boolean isSelfLooped() { return Objects.equals(source.getSwitchId(), destination.getSwitchId()); } IslInfoData(IslInfoData that); IslInfoData(PathNode source, PathNode destination, IslChangeType state, boolean underMaintenance); @Builder(toBuilder = true) @JsonCrea... | IslInfoData extends CacheTimeTag { @JsonIgnore public boolean isSelfLooped() { return Objects.equals(source.getSwitchId(), destination.getSwitchId()); } IslInfoData(IslInfoData that); IslInfoData(PathNode source, PathNode destination, IslChangeType state, boolean underMaintenance); @Builder(toBuilder = true) @JsonCrea... |
@Test public void shouldReturnFalseWhenNotSelfLooped() { final SwitchId srcSwitch = new SwitchId("00:00:00:00:00:00:00:01"); final SwitchId dstSwitch = new SwitchId("00:00:00:00:00:00:00:02"); PathNode source = new PathNode(srcSwitch, 1, 0); PathNode destination = new PathNode(dstSwitch, 2, 1); IslInfoData isl = new Is... | @JsonIgnore public boolean isSelfLooped() { return Objects.equals(source.getSwitchId(), destination.getSwitchId()); } | IslInfoData extends CacheTimeTag { @JsonIgnore public boolean isSelfLooped() { return Objects.equals(source.getSwitchId(), destination.getSwitchId()); } } | IslInfoData extends CacheTimeTag { @JsonIgnore public boolean isSelfLooped() { return Objects.equals(source.getSwitchId(), destination.getSwitchId()); } IslInfoData(IslInfoData that); IslInfoData(PathNode source, PathNode destination, IslChangeType state, boolean underMaintenance); @Builder(toBuilder = true) @JsonCrea... | IslInfoData extends CacheTimeTag { @JsonIgnore public boolean isSelfLooped() { return Objects.equals(source.getSwitchId(), destination.getSwitchId()); } IslInfoData(IslInfoData that); IslInfoData(PathNode source, PathNode destination, IslChangeType state, boolean underMaintenance); @Builder(toBuilder = true) @JsonCrea... | IslInfoData extends CacheTimeTag { @JsonIgnore public boolean isSelfLooped() { return Objects.equals(source.getSwitchId(), destination.getSwitchId()); } IslInfoData(IslInfoData that); IslInfoData(PathNode source, PathNode destination, IslChangeType state, boolean underMaintenance); @Builder(toBuilder = true) @JsonCrea... |
@Test public void testNoviflowTimstampToLong() { long seconds = 123456789; long nanoseconds = 987654321; long timestampNovi = (seconds << 32) + nanoseconds; assertEquals(123456789_987654321L, noviflowTimestamp(timestampNovi)); } | @VisibleForTesting static long noviflowTimestamp(Long v) { long seconds = (v >> 32); long nanoseconds = (v & 0xFFFFFFFFL); return seconds * TEN_TO_NINE + nanoseconds; } | FlowRttMetricGenBolt extends MetricGenBolt { @VisibleForTesting static long noviflowTimestamp(Long v) { long seconds = (v >> 32); long nanoseconds = (v & 0xFFFFFFFFL); return seconds * TEN_TO_NINE + nanoseconds; } } | FlowRttMetricGenBolt extends MetricGenBolt { @VisibleForTesting static long noviflowTimestamp(Long v) { long seconds = (v >> 32); long nanoseconds = (v & 0xFFFFFFFFL); return seconds * TEN_TO_NINE + nanoseconds; } FlowRttMetricGenBolt(String metricPrefix); } | FlowRttMetricGenBolt extends MetricGenBolt { @VisibleForTesting static long noviflowTimestamp(Long v) { long seconds = (v >> 32); long nanoseconds = (v & 0xFFFFFFFFL); return seconds * TEN_TO_NINE + nanoseconds; } FlowRttMetricGenBolt(String metricPrefix); } | FlowRttMetricGenBolt extends MetricGenBolt { @VisibleForTesting static long noviflowTimestamp(Long v) { long seconds = (v >> 32); long nanoseconds = (v & 0xFFFFFFFFL); return seconds * TEN_TO_NINE + nanoseconds; } FlowRttMetricGenBolt(String metricPrefix); static final long TEN_TO_NINE; } |
@Test public void mapFlowToFlowRequestTest() { FlowRequest flowRequest = RequestedFlowMapper.INSTANCE.toFlowRequest(flow); assertEquals(FLOW_ID, flowRequest.getFlowId()); assertEquals(SRC_SWITCH_ID, flowRequest.getSource().getSwitchId()); assertEquals(SRC_PORT, flowRequest.getSource().getPortNumber()); assertEquals(SRC... | @Mapping(target = "flowId", source = "flowId") @Mapping(target = "source", expression = "java(new FlowEndpoint(flow.getSrcSwitchId(), " + "flow.getSrcPort(), flow.getSrcVlan()))") @Mapping(target = "destination", expression = "java(new FlowEndpoint(flow.getDestSwitchId(), " + "flow.getDestPort(), flow.getDestVlan()))")... | RequestedFlowMapper { @Mapping(target = "flowId", source = "flowId") @Mapping(target = "source", expression = "java(new FlowEndpoint(flow.getSrcSwitchId(), " + "flow.getSrcPort(), flow.getSrcVlan()))") @Mapping(target = "destination", expression = "java(new FlowEndpoint(flow.getDestSwitchId(), " + "flow.getDestPort(), ... | RequestedFlowMapper { @Mapping(target = "flowId", source = "flowId") @Mapping(target = "source", expression = "java(new FlowEndpoint(flow.getSrcSwitchId(), " + "flow.getSrcPort(), flow.getSrcVlan()))") @Mapping(target = "destination", expression = "java(new FlowEndpoint(flow.getDestSwitchId(), " + "flow.getDestPort(), ... | RequestedFlowMapper { @Mapping(target = "flowId", source = "flowId") @Mapping(target = "source", expression = "java(new FlowEndpoint(flow.getSrcSwitchId(), " + "flow.getSrcPort(), flow.getSrcVlan()))") @Mapping(target = "destination", expression = "java(new FlowEndpoint(flow.getDestSwitchId(), " + "flow.getDestPort(), ... | RequestedFlowMapper { @Mapping(target = "flowId", source = "flowId") @Mapping(target = "source", expression = "java(new FlowEndpoint(flow.getSrcSwitchId(), " + "flow.getSrcPort(), flow.getSrcVlan()))") @Mapping(target = "destination", expression = "java(new FlowEndpoint(flow.getDestSwitchId(), " + "flow.getDestPort(), ... |
@Test public void findDirectionTest() throws Exception { assertEquals(Direction.FORWARD, FlowDirectionHelper.findDirection(FORWARD_COOKIE)); assertEquals(Direction.REVERSE, FlowDirectionHelper.findDirection(REVERSE_COOKIE)); thrown.expect(FlowCookieException.class); FlowDirectionHelper.findDirection(BAD_COOKIE); } | public static Direction findDirection(long rawCookie) throws FlowCookieException { return findDirectionSafe(rawCookie) .orElseThrow(() -> new FlowCookieException(String.format( "unknown direction for %s", new Cookie(rawCookie)))); } | FlowDirectionHelper { public static Direction findDirection(long rawCookie) throws FlowCookieException { return findDirectionSafe(rawCookie) .orElseThrow(() -> new FlowCookieException(String.format( "unknown direction for %s", new Cookie(rawCookie)))); } } | FlowDirectionHelper { public static Direction findDirection(long rawCookie) throws FlowCookieException { return findDirectionSafe(rawCookie) .orElseThrow(() -> new FlowCookieException(String.format( "unknown direction for %s", new Cookie(rawCookie)))); } private FlowDirectionHelper(); } | FlowDirectionHelper { public static Direction findDirection(long rawCookie) throws FlowCookieException { return findDirectionSafe(rawCookie) .orElseThrow(() -> new FlowCookieException(String.format( "unknown direction for %s", new Cookie(rawCookie)))); } private FlowDirectionHelper(); static Direction findDirection(lo... | FlowDirectionHelper { public static Direction findDirection(long rawCookie) throws FlowCookieException { return findDirectionSafe(rawCookie) .orElseThrow(() -> new FlowCookieException(String.format( "unknown direction for %s", new Cookie(rawCookie)))); } private FlowDirectionHelper(); static Direction findDirection(lo... |
@Test @WithMockUser(username = USERNAME, password = PASSWORD, roles = ROLE) public void createFlow() throws Exception { MvcResult mvcResult = mockMvc.perform(put("/v1/flows") .header(CORRELATION_ID, testCorrelationId()) .contentType(APPLICATION_JSON_VALUE) .content(MAPPER.writeValueAsString(TestMessageMock.flow))) .and... | @ApiOperation(value = "Creates new flow", response = FlowResponsePayload.class) @PutMapping @ResponseStatus(HttpStatus.OK) public CompletableFuture<FlowResponsePayload> createFlow(@RequestBody FlowCreatePayload flow) { return flowService.createFlow(flow); } | FlowController extends BaseController { @ApiOperation(value = "Creates new flow", response = FlowResponsePayload.class) @PutMapping @ResponseStatus(HttpStatus.OK) public CompletableFuture<FlowResponsePayload> createFlow(@RequestBody FlowCreatePayload flow) { return flowService.createFlow(flow); } } | FlowController extends BaseController { @ApiOperation(value = "Creates new flow", response = FlowResponsePayload.class) @PutMapping @ResponseStatus(HttpStatus.OK) public CompletableFuture<FlowResponsePayload> createFlow(@RequestBody FlowCreatePayload flow) { return flowService.createFlow(flow); } } | FlowController extends BaseController { @ApiOperation(value = "Creates new flow", response = FlowResponsePayload.class) @PutMapping @ResponseStatus(HttpStatus.OK) public CompletableFuture<FlowResponsePayload> createFlow(@RequestBody FlowCreatePayload flow) { return flowService.createFlow(flow); } @ApiOperation(value =... | FlowController extends BaseController { @ApiOperation(value = "Creates new flow", response = FlowResponsePayload.class) @PutMapping @ResponseStatus(HttpStatus.OK) public CompletableFuture<FlowResponsePayload> createFlow(@RequestBody FlowCreatePayload flow) { return flowService.createFlow(flow); } @ApiOperation(value =... |
@Test @WithMockUser(username = USERNAME, password = PASSWORD, roles = ROLE) public void getFlow() throws Exception { MvcResult mvcResult = mockMvc.perform(get("/v1/flows/{flow-id}", TestMessageMock.FLOW_ID) .header(CORRELATION_ID, testCorrelationId()) .contentType(APPLICATION_JSON_VALUE)) .andReturn(); MvcResult result... | @ApiOperation(value = "Gets flow", response = FlowResponsePayload.class) @GetMapping(value = "/{flow-id:.+}") @ResponseStatus(HttpStatus.OK) public CompletableFuture<FlowResponsePayload> getFlow(@PathVariable(name = "flow-id") String flowId) { return flowService.getFlow(flowId); } | FlowController extends BaseController { @ApiOperation(value = "Gets flow", response = FlowResponsePayload.class) @GetMapping(value = "/{flow-id:.+}") @ResponseStatus(HttpStatus.OK) public CompletableFuture<FlowResponsePayload> getFlow(@PathVariable(name = "flow-id") String flowId) { return flowService.getFlow(flowId); ... | FlowController extends BaseController { @ApiOperation(value = "Gets flow", response = FlowResponsePayload.class) @GetMapping(value = "/{flow-id:.+}") @ResponseStatus(HttpStatus.OK) public CompletableFuture<FlowResponsePayload> getFlow(@PathVariable(name = "flow-id") String flowId) { return flowService.getFlow(flowId); ... | FlowController extends BaseController { @ApiOperation(value = "Gets flow", response = FlowResponsePayload.class) @GetMapping(value = "/{flow-id:.+}") @ResponseStatus(HttpStatus.OK) public CompletableFuture<FlowResponsePayload> getFlow(@PathVariable(name = "flow-id") String flowId) { return flowService.getFlow(flowId); ... | FlowController extends BaseController { @ApiOperation(value = "Gets flow", response = FlowResponsePayload.class) @GetMapping(value = "/{flow-id:.+}") @ResponseStatus(HttpStatus.OK) public CompletableFuture<FlowResponsePayload> getFlow(@PathVariable(name = "flow-id") String flowId) { return flowService.getFlow(flowId); ... |
@Test @WithMockUser(username = USERNAME, password = PASSWORD, roles = ROLE) public void deleteFlow() throws Exception { MvcResult mvcResult = mockMvc.perform(delete("/v1/flows/{flow-id}", TestMessageMock.FLOW_ID) .header(CORRELATION_ID, testCorrelationId()) .contentType(APPLICATION_JSON_VALUE)) .andReturn(); MvcResult ... | @ApiOperation(value = "Deletes flow", response = FlowResponsePayload.class) @DeleteMapping(value = "/{flow-id:.+}") @ResponseStatus(HttpStatus.OK) public CompletableFuture<FlowResponsePayload> deleteFlow(@PathVariable(name = "flow-id") String flowId) { return flowService.deleteFlow(flowId); } | FlowController extends BaseController { @ApiOperation(value = "Deletes flow", response = FlowResponsePayload.class) @DeleteMapping(value = "/{flow-id:.+}") @ResponseStatus(HttpStatus.OK) public CompletableFuture<FlowResponsePayload> deleteFlow(@PathVariable(name = "flow-id") String flowId) { return flowService.deleteFl... | FlowController extends BaseController { @ApiOperation(value = "Deletes flow", response = FlowResponsePayload.class) @DeleteMapping(value = "/{flow-id:.+}") @ResponseStatus(HttpStatus.OK) public CompletableFuture<FlowResponsePayload> deleteFlow(@PathVariable(name = "flow-id") String flowId) { return flowService.deleteFl... | FlowController extends BaseController { @ApiOperation(value = "Deletes flow", response = FlowResponsePayload.class) @DeleteMapping(value = "/{flow-id:.+}") @ResponseStatus(HttpStatus.OK) public CompletableFuture<FlowResponsePayload> deleteFlow(@PathVariable(name = "flow-id") String flowId) { return flowService.deleteFl... | FlowController extends BaseController { @ApiOperation(value = "Deletes flow", response = FlowResponsePayload.class) @DeleteMapping(value = "/{flow-id:.+}") @ResponseStatus(HttpStatus.OK) public CompletableFuture<FlowResponsePayload> deleteFlow(@PathVariable(name = "flow-id") String flowId) { return flowService.deleteFl... |
@Test @WithMockUser(username = USERNAME, password = PASSWORD, roles = ROLE) public void deleteFlows() throws Exception { MvcResult mvcResult = mockMvc.perform(delete("/v1/flows") .header(CORRELATION_ID, testCorrelationId()) .header(EXTRA_AUTH, System.currentTimeMillis() - TimeUnit.SECONDS.toMillis(119)) .contentType(AP... | @ApiOperation(value = "Delete all flows. Requires special authorization", response = FlowResponsePayload.class, responseContainer = "List") @DeleteMapping @ResponseStatus(HttpStatus.OK) @ExtraAuthRequired public CompletableFuture<List<FlowResponsePayload>> deleteFlows() { return flowService.deleteAllFlows(); } | FlowController extends BaseController { @ApiOperation(value = "Delete all flows. Requires special authorization", response = FlowResponsePayload.class, responseContainer = "List") @DeleteMapping @ResponseStatus(HttpStatus.OK) @ExtraAuthRequired public CompletableFuture<List<FlowResponsePayload>> deleteFlows() { return ... | FlowController extends BaseController { @ApiOperation(value = "Delete all flows. Requires special authorization", response = FlowResponsePayload.class, responseContainer = "List") @DeleteMapping @ResponseStatus(HttpStatus.OK) @ExtraAuthRequired public CompletableFuture<List<FlowResponsePayload>> deleteFlows() { return ... | FlowController extends BaseController { @ApiOperation(value = "Delete all flows. Requires special authorization", response = FlowResponsePayload.class, responseContainer = "List") @DeleteMapping @ResponseStatus(HttpStatus.OK) @ExtraAuthRequired public CompletableFuture<List<FlowResponsePayload>> deleteFlows() { return ... | FlowController extends BaseController { @ApiOperation(value = "Delete all flows. Requires special authorization", response = FlowResponsePayload.class, responseContainer = "List") @DeleteMapping @ResponseStatus(HttpStatus.OK) @ExtraAuthRequired public CompletableFuture<List<FlowResponsePayload>> deleteFlows() { return ... |
@Test @WithMockUser(username = USERNAME, password = PASSWORD, roles = ROLE) public void updateFlow() throws Exception { MvcResult mvcResult = mockMvc.perform(put("/v1/flows/{flow-id}", TestMessageMock.FLOW_ID) .header(CORRELATION_ID, testCorrelationId()) .contentType(APPLICATION_JSON_VALUE) .content(MAPPER.writeValueAs... | @ApiOperation(value = "Updates flow", response = FlowResponsePayload.class) @PutMapping(value = "/{flow-id:.+}") @ResponseStatus(HttpStatus.OK) public CompletableFuture<FlowResponsePayload> updateFlow(@PathVariable(name = "flow-id") String flowId, @RequestBody FlowUpdatePayload flow) { return flowService.updateFlow(flo... | FlowController extends BaseController { @ApiOperation(value = "Updates flow", response = FlowResponsePayload.class) @PutMapping(value = "/{flow-id:.+}") @ResponseStatus(HttpStatus.OK) public CompletableFuture<FlowResponsePayload> updateFlow(@PathVariable(name = "flow-id") String flowId, @RequestBody FlowUpdatePayload f... | FlowController extends BaseController { @ApiOperation(value = "Updates flow", response = FlowResponsePayload.class) @PutMapping(value = "/{flow-id:.+}") @ResponseStatus(HttpStatus.OK) public CompletableFuture<FlowResponsePayload> updateFlow(@PathVariable(name = "flow-id") String flowId, @RequestBody FlowUpdatePayload f... | FlowController extends BaseController { @ApiOperation(value = "Updates flow", response = FlowResponsePayload.class) @PutMapping(value = "/{flow-id:.+}") @ResponseStatus(HttpStatus.OK) public CompletableFuture<FlowResponsePayload> updateFlow(@PathVariable(name = "flow-id") String flowId, @RequestBody FlowUpdatePayload f... | FlowController extends BaseController { @ApiOperation(value = "Updates flow", response = FlowResponsePayload.class) @PutMapping(value = "/{flow-id:.+}") @ResponseStatus(HttpStatus.OK) public CompletableFuture<FlowResponsePayload> updateFlow(@PathVariable(name = "flow-id") String flowId, @RequestBody FlowUpdatePayload f... |
@Test @WithMockUser(username = USERNAME, password = PASSWORD, roles = ROLE) public void getFlows() throws Exception { MvcResult mvcResult = mockMvc.perform(get("/v1/flows", TestMessageMock.FLOW_ID) .header(CORRELATION_ID, testCorrelationId()) .contentType(APPLICATION_JSON_VALUE)) .andReturn(); MvcResult result = mockMv... | @ApiOperation(value = "Dumps all flows", response = FlowResponsePayload.class, responseContainer = "List") @GetMapping @ResponseStatus(HttpStatus.OK) public CompletableFuture<List<FlowResponsePayload>> getFlows() { return flowService.getAllFlows(); } | FlowController extends BaseController { @ApiOperation(value = "Dumps all flows", response = FlowResponsePayload.class, responseContainer = "List") @GetMapping @ResponseStatus(HttpStatus.OK) public CompletableFuture<List<FlowResponsePayload>> getFlows() { return flowService.getAllFlows(); } } | FlowController extends BaseController { @ApiOperation(value = "Dumps all flows", response = FlowResponsePayload.class, responseContainer = "List") @GetMapping @ResponseStatus(HttpStatus.OK) public CompletableFuture<List<FlowResponsePayload>> getFlows() { return flowService.getAllFlows(); } } | FlowController extends BaseController { @ApiOperation(value = "Dumps all flows", response = FlowResponsePayload.class, responseContainer = "List") @GetMapping @ResponseStatus(HttpStatus.OK) public CompletableFuture<List<FlowResponsePayload>> getFlows() { return flowService.getAllFlows(); } @ApiOperation(value = "Creat... | FlowController extends BaseController { @ApiOperation(value = "Dumps all flows", response = FlowResponsePayload.class, responseContainer = "List") @GetMapping @ResponseStatus(HttpStatus.OK) public CompletableFuture<List<FlowResponsePayload>> getFlows() { return flowService.getAllFlows(); } @ApiOperation(value = "Creat... |
@Test @WithMockUser(username = USERNAME, password = PASSWORD, roles = ROLE) public void statusFlow() throws Exception { MvcResult mvcResult = mockMvc.perform(get("/v1/flows/status/{flow-id}", TestMessageMock.FLOW_ID) .header(CORRELATION_ID, testCorrelationId()) .contentType(APPLICATION_JSON_VALUE)) .andReturn(); MvcRes... | @ApiOperation(value = "Gets flow status", response = FlowIdStatusPayload.class) @GetMapping(value = "/status/{flow-id:.+}") @ResponseStatus(HttpStatus.OK) public CompletableFuture<FlowIdStatusPayload> statusFlow(@PathVariable(name = "flow-id") String flowId) { return flowService.statusFlow(flowId); } | FlowController extends BaseController { @ApiOperation(value = "Gets flow status", response = FlowIdStatusPayload.class) @GetMapping(value = "/status/{flow-id:.+}") @ResponseStatus(HttpStatus.OK) public CompletableFuture<FlowIdStatusPayload> statusFlow(@PathVariable(name = "flow-id") String flowId) { return flowService.... | FlowController extends BaseController { @ApiOperation(value = "Gets flow status", response = FlowIdStatusPayload.class) @GetMapping(value = "/status/{flow-id:.+}") @ResponseStatus(HttpStatus.OK) public CompletableFuture<FlowIdStatusPayload> statusFlow(@PathVariable(name = "flow-id") String flowId) { return flowService.... | FlowController extends BaseController { @ApiOperation(value = "Gets flow status", response = FlowIdStatusPayload.class) @GetMapping(value = "/status/{flow-id:.+}") @ResponseStatus(HttpStatus.OK) public CompletableFuture<FlowIdStatusPayload> statusFlow(@PathVariable(name = "flow-id") String flowId) { return flowService.... | FlowController extends BaseController { @ApiOperation(value = "Gets flow status", response = FlowIdStatusPayload.class) @GetMapping(value = "/status/{flow-id:.+}") @ResponseStatus(HttpStatus.OK) public CompletableFuture<FlowIdStatusPayload> statusFlow(@PathVariable(name = "flow-id") String flowId) { return flowService.... |
@Test @WithMockUser(username = USERNAME, password = PASSWORD, roles = ROLE) public void pathFlow() throws Exception { MvcResult mvcResult = mockMvc.perform(get("/v1/flows/{flow-id}/path", TestMessageMock.FLOW_ID) .header(CORRELATION_ID, testCorrelationId()) .contentType(APPLICATION_JSON_VALUE)) .andReturn(); MvcResult ... | @ApiOperation(value = "Gets flow path", response = FlowPathPayload.class) @GetMapping(value = "/{flow-id}/path") @ResponseStatus(HttpStatus.OK) public CompletableFuture<FlowPathPayload> pathFlow(@PathVariable(name = "flow-id") String flowId) { return flowService.pathFlow(flowId); } | FlowController extends BaseController { @ApiOperation(value = "Gets flow path", response = FlowPathPayload.class) @GetMapping(value = "/{flow-id}/path") @ResponseStatus(HttpStatus.OK) public CompletableFuture<FlowPathPayload> pathFlow(@PathVariable(name = "flow-id") String flowId) { return flowService.pathFlow(flowId);... | FlowController extends BaseController { @ApiOperation(value = "Gets flow path", response = FlowPathPayload.class) @GetMapping(value = "/{flow-id}/path") @ResponseStatus(HttpStatus.OK) public CompletableFuture<FlowPathPayload> pathFlow(@PathVariable(name = "flow-id") String flowId) { return flowService.pathFlow(flowId);... | FlowController extends BaseController { @ApiOperation(value = "Gets flow path", response = FlowPathPayload.class) @GetMapping(value = "/{flow-id}/path") @ResponseStatus(HttpStatus.OK) public CompletableFuture<FlowPathPayload> pathFlow(@PathVariable(name = "flow-id") String flowId) { return flowService.pathFlow(flowId);... | FlowController extends BaseController { @ApiOperation(value = "Gets flow path", response = FlowPathPayload.class) @GetMapping(value = "/{flow-id}/path") @ResponseStatus(HttpStatus.OK) public CompletableFuture<FlowPathPayload> pathFlow(@PathVariable(name = "flow-id") String flowId) { return flowService.pathFlow(flowId);... |
@Test public void testFlowRequestV2Mapping() { FlowRequestV2 flowRequestV2 = FlowRequestV2.builder() .flowId(FLOW_ID) .encapsulationType(ENCAPSULATION_TYPE) .source(new FlowEndpointV2(SRC_SWITCH_ID, SRC_PORT, SRC_VLAN, SRC_DETECT_CONNECTED_DEVICES)) .destination(new FlowEndpointV2(DST_SWITCH_ID, DST_PORT, DST_VLAN, DST... | @Mapping(target = "bandwidth", source = "maximumBandwidth") @Mapping(target = "detectConnectedDevices", expression = "java(new DetectConnectedDevicesDto(" + "request.getSource().getDetectConnectedDevices().isLldp(), " + "request.getSource().getDetectConnectedDevices().isArp(), " + "request.getDestination().getDetectCon... | FlowMapper { @Mapping(target = "bandwidth", source = "maximumBandwidth") @Mapping(target = "detectConnectedDevices", expression = "java(new DetectConnectedDevicesDto(" + "request.getSource().getDetectConnectedDevices().isLldp(), " + "request.getSource().getDetectConnectedDevices().isArp(), " + "request.getDestination()... | FlowMapper { @Mapping(target = "bandwidth", source = "maximumBandwidth") @Mapping(target = "detectConnectedDevices", expression = "java(new DetectConnectedDevicesDto(" + "request.getSource().getDetectConnectedDevices().isLldp(), " + "request.getSource().getDetectConnectedDevices().isArp(), " + "request.getDestination()... | FlowMapper { @Mapping(target = "bandwidth", source = "maximumBandwidth") @Mapping(target = "detectConnectedDevices", expression = "java(new DetectConnectedDevicesDto(" + "request.getSource().getDetectConnectedDevices().isLldp(), " + "request.getSource().getDetectConnectedDevices().isArp(), " + "request.getDestination()... | FlowMapper { @Mapping(target = "bandwidth", source = "maximumBandwidth") @Mapping(target = "detectConnectedDevices", expression = "java(new DetectConnectedDevicesDto(" + "request.getSource().getDetectConnectedDevices().isLldp(), " + "request.getSource().getDetectConnectedDevices().isArp(), " + "request.getDestination()... |
@Test public void isCookieMismatch0() { OfInput input = makeInput(U64.of(cookieAlpha.getValue())); Assert.assertFalse(input.packetInCookieMismatchAll(callerLogger, cookieAlpha)); } | public boolean packetInCookieMismatchAll(Logger log, U64... expected) { boolean isMismatched = packetInCookieMismatchCheck(expected); if (isMismatched) { log.debug("{} - cookie mismatch (expected one of:{}, actual:{})", this, expected, packetInCookie()); } return isMismatched; } | OfInput { public boolean packetInCookieMismatchAll(Logger log, U64... expected) { boolean isMismatched = packetInCookieMismatchCheck(expected); if (isMismatched) { log.debug("{} - cookie mismatch (expected one of:{}, actual:{})", this, expected, packetInCookie()); } return isMismatched; } } | OfInput { public boolean packetInCookieMismatchAll(Logger log, U64... expected) { boolean isMismatched = packetInCookieMismatchCheck(expected); if (isMismatched) { log.debug("{} - cookie mismatch (expected one of:{}, actual:{})", this, expected, packetInCookie()); } return isMismatched; } OfInput(IOFSwitch sw, OFMessag... | OfInput { public boolean packetInCookieMismatchAll(Logger log, U64... expected) { boolean isMismatched = packetInCookieMismatchCheck(expected); if (isMismatched) { log.debug("{} - cookie mismatch (expected one of:{}, actual:{})", this, expected, packetInCookie()); } return isMismatched; } OfInput(IOFSwitch sw, OFMessag... | OfInput { public boolean packetInCookieMismatchAll(Logger log, U64... expected) { boolean isMismatched = packetInCookieMismatchCheck(expected); if (isMismatched) { log.debug("{} - cookie mismatch (expected one of:{}, actual:{})", this, expected, packetInCookie()); } return isMismatched; } OfInput(IOFSwitch sw, OFMessag... |
@Test(expected = IllegalArgumentException.class) public void testFlowRequestV2InvalidEncapsulation() { FlowRequestV2 flowRequestV2 = FlowRequestV2.builder() .flowId(FLOW_ID) .encapsulationType("abc") .source(new FlowEndpointV2(SRC_SWITCH_ID, SRC_PORT, SRC_VLAN, SRC_DETECT_CONNECTED_DEVICES)) .destination(new FlowEndpoi... | @Mapping(target = "bandwidth", source = "maximumBandwidth") @Mapping(target = "detectConnectedDevices", expression = "java(new DetectConnectedDevicesDto(" + "request.getSource().getDetectConnectedDevices().isLldp(), " + "request.getSource().getDetectConnectedDevices().isArp(), " + "request.getDestination().getDetectCon... | FlowMapper { @Mapping(target = "bandwidth", source = "maximumBandwidth") @Mapping(target = "detectConnectedDevices", expression = "java(new DetectConnectedDevicesDto(" + "request.getSource().getDetectConnectedDevices().isLldp(), " + "request.getSource().getDetectConnectedDevices().isArp(), " + "request.getDestination()... | FlowMapper { @Mapping(target = "bandwidth", source = "maximumBandwidth") @Mapping(target = "detectConnectedDevices", expression = "java(new DetectConnectedDevicesDto(" + "request.getSource().getDetectConnectedDevices().isLldp(), " + "request.getSource().getDetectConnectedDevices().isArp(), " + "request.getDestination()... | FlowMapper { @Mapping(target = "bandwidth", source = "maximumBandwidth") @Mapping(target = "detectConnectedDevices", expression = "java(new DetectConnectedDevicesDto(" + "request.getSource().getDetectConnectedDevices().isLldp(), " + "request.getSource().getDetectConnectedDevices().isArp(), " + "request.getDestination()... | FlowMapper { @Mapping(target = "bandwidth", source = "maximumBandwidth") @Mapping(target = "detectConnectedDevices", expression = "java(new DetectConnectedDevicesDto(" + "request.getSource().getDetectConnectedDevices().isLldp(), " + "request.getSource().getDetectConnectedDevices().isArp(), " + "request.getDestination()... |
@Test public void testFlowCreatePayloadToFlowRequest() { FlowRequest flowRequest = flowMapper.toFlowCreateRequest(FLOW_CREATE_PAYLOAD); assertEquals(FLOW_CREATE_PAYLOAD.getDiverseFlowId(), flowRequest.getDiverseFlowId()); assertEquals(Type.CREATE, flowRequest.getType()); assertFlowDtos(FLOW_CREATE_PAYLOAD, flowRequest)... | public FlowRequest toFlowCreateRequest(FlowRequestV2 source) { return toFlowRequest(source).toBuilder().type(Type.CREATE).build(); } | FlowMapper { public FlowRequest toFlowCreateRequest(FlowRequestV2 source) { return toFlowRequest(source).toBuilder().type(Type.CREATE).build(); } } | FlowMapper { public FlowRequest toFlowCreateRequest(FlowRequestV2 source) { return toFlowRequest(source).toBuilder().type(Type.CREATE).build(); } } | FlowMapper { public FlowRequest toFlowCreateRequest(FlowRequestV2 source) { return toFlowRequest(source).toBuilder().type(Type.CREATE).build(); } FlowPayload toFlowOutput(FlowDto f); FlowResponsePayload toFlowResponseOutput(FlowDto f); FlowResponseV2 toFlowResponseV2(FlowDto flowDto); @Mapping(target = "flowId", ignor... | FlowMapper { public FlowRequest toFlowCreateRequest(FlowRequestV2 source) { return toFlowRequest(source).toBuilder().type(Type.CREATE).build(); } FlowPayload toFlowOutput(FlowDto f); FlowResponsePayload toFlowResponseOutput(FlowDto f); FlowResponseV2 toFlowResponseV2(FlowDto flowDto); @Mapping(target = "flowId", ignor... |
@Test public void testFlowUpdatePayloadToFlowRequest() { FlowRequest flowRequest = flowMapper.toFlowUpdateRequest(FLOW_UPDATE_PAYLOAD); assertEquals(FLOW_UPDATE_PAYLOAD.getDiverseFlowId(), flowRequest.getDiverseFlowId()); assertEquals(Type.UPDATE, flowRequest.getType()); assertFlowDtos(FLOW_UPDATE_PAYLOAD, flowRequest)... | public FlowRequest toFlowUpdateRequest(FlowUpdatePayload source) { FlowRequest target = toFlowRequest(source).toBuilder() .diverseFlowId(source.getDiverseFlowId()) .type(Type.UPDATE) .build(); if (source.getSource().getDetectConnectedDevices() != null) { DetectConnectedDevicesPayload srcDevs = source.getSource().getDet... | FlowMapper { public FlowRequest toFlowUpdateRequest(FlowUpdatePayload source) { FlowRequest target = toFlowRequest(source).toBuilder() .diverseFlowId(source.getDiverseFlowId()) .type(Type.UPDATE) .build(); if (source.getSource().getDetectConnectedDevices() != null) { DetectConnectedDevicesPayload srcDevs = source.getSo... | FlowMapper { public FlowRequest toFlowUpdateRequest(FlowUpdatePayload source) { FlowRequest target = toFlowRequest(source).toBuilder() .diverseFlowId(source.getDiverseFlowId()) .type(Type.UPDATE) .build(); if (source.getSource().getDetectConnectedDevices() != null) { DetectConnectedDevicesPayload srcDevs = source.getSo... | FlowMapper { public FlowRequest toFlowUpdateRequest(FlowUpdatePayload source) { FlowRequest target = toFlowRequest(source).toBuilder() .diverseFlowId(source.getDiverseFlowId()) .type(Type.UPDATE) .build(); if (source.getSource().getDetectConnectedDevices() != null) { DetectConnectedDevicesPayload srcDevs = source.getSo... | FlowMapper { public FlowRequest toFlowUpdateRequest(FlowUpdatePayload source) { FlowRequest target = toFlowRequest(source).toBuilder() .diverseFlowId(source.getDiverseFlowId()) .type(Type.UPDATE) .build(); if (source.getSource().getDetectConnectedDevices() != null) { DetectConnectedDevicesPayload srcDevs = source.getSo... |
@Test public void testFlowPatchDtoToFlowDto() { FlowPatchDto flowPatchDto = new FlowPatchDto(LATENCY, PRIORITY, PERIODIC_PINGS, TARGET_PATH_COMPUTATION_STRATEGY); FlowPatch flowPatch = flowMapper.toFlowPatch(flowPatchDto); assertEquals(flowPatchDto.getMaxLatency() * 1000000L, (long) flowPatch.getMaxLatency()); assertEq... | @Mapping(target = "flowId", ignore = true) @Mapping(target = "maxLatency", expression = "java(flowPatchDto.getMaxLatency() != null ? flowPatchDto.getMaxLatency() * 1000000L : null)") @Mapping(target = "priority", source = "priority") @Mapping(target = "periodicPings", source = "periodicPings") @Mapping(target = "target... | FlowMapper { @Mapping(target = "flowId", ignore = true) @Mapping(target = "maxLatency", expression = "java(flowPatchDto.getMaxLatency() != null ? flowPatchDto.getMaxLatency() * 1000000L : null)") @Mapping(target = "priority", source = "priority") @Mapping(target = "periodicPings", source = "periodicPings") @Mapping(tar... | FlowMapper { @Mapping(target = "flowId", ignore = true) @Mapping(target = "maxLatency", expression = "java(flowPatchDto.getMaxLatency() != null ? flowPatchDto.getMaxLatency() * 1000000L : null)") @Mapping(target = "priority", source = "priority") @Mapping(target = "periodicPings", source = "periodicPings") @Mapping(tar... | FlowMapper { @Mapping(target = "flowId", ignore = true) @Mapping(target = "maxLatency", expression = "java(flowPatchDto.getMaxLatency() != null ? flowPatchDto.getMaxLatency() * 1000000L : null)") @Mapping(target = "priority", source = "priority") @Mapping(target = "periodicPings", source = "periodicPings") @Mapping(tar... | FlowMapper { @Mapping(target = "flowId", ignore = true) @Mapping(target = "maxLatency", expression = "java(flowPatchDto.getMaxLatency() != null ? flowPatchDto.getMaxLatency() * 1000000L : null)") @Mapping(target = "priority", source = "priority") @Mapping(target = "periodicPings", source = "periodicPings") @Mapping(tar... |
@Test public void testFlowPatchV2ToFlowDto() { FlowPatchV2 flowPatchDto = new FlowPatchV2( new FlowPatchEndpoint(SRC_SWITCH_ID, SRC_PORT, SRC_VLAN, SRC_INNER_VLAN, SRC_DETECT_CONNECTED_DEVICES), new FlowPatchEndpoint(DST_SWITCH_ID, DST_PORT, DST_VLAN, DST_INNER_VLAN, DST_DETECT_CONNECTED_DEVICES), LATENCY, PRIORITY, PE... | @Mapping(target = "flowId", ignore = true) @Mapping(target = "maxLatency", expression = "java(flowPatchDto.getMaxLatency() != null ? flowPatchDto.getMaxLatency() * 1000000L : null)") @Mapping(target = "priority", source = "priority") @Mapping(target = "periodicPings", source = "periodicPings") @Mapping(target = "target... | FlowMapper { @Mapping(target = "flowId", ignore = true) @Mapping(target = "maxLatency", expression = "java(flowPatchDto.getMaxLatency() != null ? flowPatchDto.getMaxLatency() * 1000000L : null)") @Mapping(target = "priority", source = "priority") @Mapping(target = "periodicPings", source = "periodicPings") @Mapping(tar... | FlowMapper { @Mapping(target = "flowId", ignore = true) @Mapping(target = "maxLatency", expression = "java(flowPatchDto.getMaxLatency() != null ? flowPatchDto.getMaxLatency() * 1000000L : null)") @Mapping(target = "priority", source = "priority") @Mapping(target = "periodicPings", source = "periodicPings") @Mapping(tar... | FlowMapper { @Mapping(target = "flowId", ignore = true) @Mapping(target = "maxLatency", expression = "java(flowPatchDto.getMaxLatency() != null ? flowPatchDto.getMaxLatency() * 1000000L : null)") @Mapping(target = "priority", source = "priority") @Mapping(target = "periodicPings", source = "periodicPings") @Mapping(tar... | FlowMapper { @Mapping(target = "flowId", ignore = true) @Mapping(target = "maxLatency", expression = "java(flowPatchDto.getMaxLatency() != null ? flowPatchDto.getMaxLatency() * 1000000L : null)") @Mapping(target = "priority", source = "priority") @Mapping(target = "periodicPings", source = "periodicPings") @Mapping(tar... |
@Test public void shouldPassValidationForValidConfig() { Properties source = new Properties(); source.setProperty(TEST_KEY, String.valueOf(VALID_TEST_VALUE)); ValidatingConfigurationProvider provider = new ValidatingConfigurationProvider( new PropertiesConfigurationSource(source), new JdkProxyStaticConfigurationFactory... | @Override public <T> T getConfiguration(Class<T> configurationType) { requireNonNull(configurationType, "configurationType cannot be null"); T instance = factory.createConfiguration(configurationType, source); Set<ConstraintViolation<T>> errors = validator.validate(instance); if (!errors.isEmpty()) { Set<String> errorD... | ValidatingConfigurationProvider implements ConfigurationProvider { @Override public <T> T getConfiguration(Class<T> configurationType) { requireNonNull(configurationType, "configurationType cannot be null"); T instance = factory.createConfiguration(configurationType, source); Set<ConstraintViolation<T>> errors = valida... | ValidatingConfigurationProvider implements ConfigurationProvider { @Override public <T> T getConfiguration(Class<T> configurationType) { requireNonNull(configurationType, "configurationType cannot be null"); T instance = factory.createConfiguration(configurationType, source); Set<ConstraintViolation<T>> errors = valida... | ValidatingConfigurationProvider implements ConfigurationProvider { @Override public <T> T getConfiguration(Class<T> configurationType) { requireNonNull(configurationType, "configurationType cannot be null"); T instance = factory.createConfiguration(configurationType, source); Set<ConstraintViolation<T>> errors = valida... | ValidatingConfigurationProvider implements ConfigurationProvider { @Override public <T> T getConfiguration(Class<T> configurationType) { requireNonNull(configurationType, "configurationType cannot be null"); T instance = factory.createConfiguration(configurationType, source); Set<ConstraintViolation<T>> errors = valida... |
@Test public void shouldFailValidationForInvalidConfig() { Properties source = new Properties(); source.setProperty(TEST_KEY, String.valueOf(INVALID_TEST_VALUE)); ValidatingConfigurationProvider provider = new ValidatingConfigurationProvider( new PropertiesConfigurationSource(source), new JdkProxyStaticConfigurationFac... | @Override public <T> T getConfiguration(Class<T> configurationType) { requireNonNull(configurationType, "configurationType cannot be null"); T instance = factory.createConfiguration(configurationType, source); Set<ConstraintViolation<T>> errors = validator.validate(instance); if (!errors.isEmpty()) { Set<String> errorD... | ValidatingConfigurationProvider implements ConfigurationProvider { @Override public <T> T getConfiguration(Class<T> configurationType) { requireNonNull(configurationType, "configurationType cannot be null"); T instance = factory.createConfiguration(configurationType, source); Set<ConstraintViolation<T>> errors = valida... | ValidatingConfigurationProvider implements ConfigurationProvider { @Override public <T> T getConfiguration(Class<T> configurationType) { requireNonNull(configurationType, "configurationType cannot be null"); T instance = factory.createConfiguration(configurationType, source); Set<ConstraintViolation<T>> errors = valida... | ValidatingConfigurationProvider implements ConfigurationProvider { @Override public <T> T getConfiguration(Class<T> configurationType) { requireNonNull(configurationType, "configurationType cannot be null"); T instance = factory.createConfiguration(configurationType, source); Set<ConstraintViolation<T>> errors = valida... | ValidatingConfigurationProvider implements ConfigurationProvider { @Override public <T> T getConfiguration(Class<T> configurationType) { requireNonNull(configurationType, "configurationType cannot be null"); T instance = factory.createConfiguration(configurationType, source); Set<ConstraintViolation<T>> errors = valida... |
@Test public void buildTsdbTupleFromIslOneWayLatency() throws JsonEncodeException, IOException { List<Object> tsdbTuple = statsBolt.buildTsdbTuple( SWITCH1_ID, NODE1.getPortNo(), SWITCH2_ID, NODE2.getPortNo(), LATENCY, TIMESTAMP); assertTsdbTuple(tsdbTuple); } | @VisibleForTesting List<Object> buildTsdbTuple(SwitchId srcSwitchId, int srcPort, SwitchId dstSwitchId, int dstPort, long latency, long timestamp) throws JsonProcessingException { Map<String, String> tags = new HashMap<>(); tags.put("src_switch", srcSwitchId.toOtsdFormat()); tags.put("src_port", String.valueOf(srcPort)... | IslStatsBolt extends AbstractBolt implements IslStatsCarrier { @VisibleForTesting List<Object> buildTsdbTuple(SwitchId srcSwitchId, int srcPort, SwitchId dstSwitchId, int dstPort, long latency, long timestamp) throws JsonProcessingException { Map<String, String> tags = new HashMap<>(); tags.put("src_switch", srcSwitchI... | IslStatsBolt extends AbstractBolt implements IslStatsCarrier { @VisibleForTesting List<Object> buildTsdbTuple(SwitchId srcSwitchId, int srcPort, SwitchId dstSwitchId, int dstPort, long latency, long timestamp) throws JsonProcessingException { Map<String, String> tags = new HashMap<>(); tags.put("src_switch", srcSwitchI... | IslStatsBolt extends AbstractBolt implements IslStatsCarrier { @VisibleForTesting List<Object> buildTsdbTuple(SwitchId srcSwitchId, int srcPort, SwitchId dstSwitchId, int dstPort, long latency, long timestamp) throws JsonProcessingException { Map<String, String> tags = new HashMap<>(); tags.put("src_switch", srcSwitchI... | IslStatsBolt extends AbstractBolt implements IslStatsCarrier { @VisibleForTesting List<Object> buildTsdbTuple(SwitchId srcSwitchId, int srcPort, SwitchId dstSwitchId, int dstPort, long latency, long timestamp) throws JsonProcessingException { Map<String, String> tags = new HashMap<>(); tags.put("src_switch", srcSwitchI... |
@Test public void isRecordStillValidTest() { assertFalse(islStatsService.isRecordStillValid(new LatencyRecord(1, 0))); long expiredTimestamp = Instant.now().minusSeconds(LATENCY_TIMEOUT * 2).toEpochMilli(); assertFalse(islStatsService.isRecordStillValid(new LatencyRecord(1, expiredTimestamp))); assertTrue(islStatsServi... | @VisibleForTesting boolean isRecordStillValid(LatencyRecord record) { Instant expirationTime = Instant.ofEpochMilli(record.getTimestamp()) .plusSeconds(latencyTimeout); return Instant.now().isBefore(expirationTime); } | IslStatsService { @VisibleForTesting boolean isRecordStillValid(LatencyRecord record) { Instant expirationTime = Instant.ofEpochMilli(record.getTimestamp()) .plusSeconds(latencyTimeout); return Instant.now().isBefore(expirationTime); } } | IslStatsService { @VisibleForTesting boolean isRecordStillValid(LatencyRecord record) { Instant expirationTime = Instant.ofEpochMilli(record.getTimestamp()) .plusSeconds(latencyTimeout); return Instant.now().isBefore(expirationTime); } IslStatsService(IslStatsCarrier carrier, long latencyTimeout); } | IslStatsService { @VisibleForTesting boolean isRecordStillValid(LatencyRecord record) { Instant expirationTime = Instant.ofEpochMilli(record.getTimestamp()) .plusSeconds(latencyTimeout); return Instant.now().isBefore(expirationTime); } IslStatsService(IslStatsCarrier carrier, long latencyTimeout); void handleRoundTripL... | IslStatsService { @VisibleForTesting boolean isRecordStillValid(LatencyRecord record) { Instant expirationTime = Instant.ofEpochMilli(record.getTimestamp()) .plusSeconds(latencyTimeout); return Instant.now().isBefore(expirationTime); } IslStatsService(IslStatsCarrier carrier, long latencyTimeout); void handleRoundTripL... |
@Test public void handleOneWayLatencyEmitOnIslDownTest() { List<LatencyRecord> buffer = new ArrayList<>(); Instant time = Instant.now().minusSeconds(LATENCY_TIMEOUT).minusMillis(500); for (int i = 0; i < 4; i++) { sendForwardOneWayLatency(i, time); verifyNoMoreInteractions(carrier); buffer.add(new LatencyRecord(i, time... | public void handleIstStatusUpdateNotification(IslStatusUpdateNotification notification) { IslKey key = new IslKey(notification.getSrcSwitchId(), notification.getSrcPortNo(), notification.getDstSwitchId(), notification.getDstPortNo()); if (notification.getStatus() == IslStatus.MOVED) { handleIslMoved(key); handleIslMove... | IslStatsService { public void handleIstStatusUpdateNotification(IslStatusUpdateNotification notification) { IslKey key = new IslKey(notification.getSrcSwitchId(), notification.getSrcPortNo(), notification.getDstSwitchId(), notification.getDstPortNo()); if (notification.getStatus() == IslStatus.MOVED) { handleIslMoved(k... | IslStatsService { public void handleIstStatusUpdateNotification(IslStatusUpdateNotification notification) { IslKey key = new IslKey(notification.getSrcSwitchId(), notification.getSrcPortNo(), notification.getDstSwitchId(), notification.getDstPortNo()); if (notification.getStatus() == IslStatus.MOVED) { handleIslMoved(k... | IslStatsService { public void handleIstStatusUpdateNotification(IslStatusUpdateNotification notification) { IslKey key = new IslKey(notification.getSrcSwitchId(), notification.getSrcPortNo(), notification.getDstSwitchId(), notification.getDstPortNo()); if (notification.getStatus() == IslStatus.MOVED) { handleIslMoved(k... | IslStatsService { public void handleIstStatusUpdateNotification(IslStatusUpdateNotification notification) { IslKey key = new IslKey(notification.getSrcSwitchId(), notification.getSrcPortNo(), notification.getDstSwitchId(), notification.getDstPortNo()); if (notification.getStatus() == IslStatus.MOVED) { handleIslMoved(k... |
@Test public void isCookieMismatch1() { OfInput input = makeInput(U64.of(-1)); Assert.assertFalse(input.packetInCookieMismatchAll(callerLogger, cookieAlpha)); input = makeInput(U64.ZERO); Assert.assertFalse(input.packetInCookieMismatchAll(callerLogger, cookieAlpha)); } | public boolean packetInCookieMismatchAll(Logger log, U64... expected) { boolean isMismatched = packetInCookieMismatchCheck(expected); if (isMismatched) { log.debug("{} - cookie mismatch (expected one of:{}, actual:{})", this, expected, packetInCookie()); } return isMismatched; } | OfInput { public boolean packetInCookieMismatchAll(Logger log, U64... expected) { boolean isMismatched = packetInCookieMismatchCheck(expected); if (isMismatched) { log.debug("{} - cookie mismatch (expected one of:{}, actual:{})", this, expected, packetInCookie()); } return isMismatched; } } | OfInput { public boolean packetInCookieMismatchAll(Logger log, U64... expected) { boolean isMismatched = packetInCookieMismatchCheck(expected); if (isMismatched) { log.debug("{} - cookie mismatch (expected one of:{}, actual:{})", this, expected, packetInCookie()); } return isMismatched; } OfInput(IOFSwitch sw, OFMessag... | OfInput { public boolean packetInCookieMismatchAll(Logger log, U64... expected) { boolean isMismatched = packetInCookieMismatchCheck(expected); if (isMismatched) { log.debug("{} - cookie mismatch (expected one of:{}, actual:{})", this, expected, packetInCookie()); } return isMismatched; } OfInput(IOFSwitch sw, OFMessag... | OfInput { public boolean packetInCookieMismatchAll(Logger log, U64... expected) { boolean isMismatched = packetInCookieMismatchCheck(expected); if (isMismatched) { log.debug("{} - cookie mismatch (expected one of:{}, actual:{})", this, expected, packetInCookie()); } return isMismatched; } OfInput(IOFSwitch sw, OFMessag... |
@Test public void handleOneWayLatencyIslMovedTest() { Instant time = Instant.now().minusSeconds(LATENCY_TIMEOUT).minusMillis(500); for (int i = 0; i < 4; i++) { sendForwardOneWayLatency(i, time); verifyNoMoreInteractions(carrier); time = time.plusSeconds(1); } islStatsService.handleIstStatusUpdateNotification( new IslS... | public void handleIstStatusUpdateNotification(IslStatusUpdateNotification notification) { IslKey key = new IslKey(notification.getSrcSwitchId(), notification.getSrcPortNo(), notification.getDstSwitchId(), notification.getDstPortNo()); if (notification.getStatus() == IslStatus.MOVED) { handleIslMoved(key); handleIslMove... | IslStatsService { public void handleIstStatusUpdateNotification(IslStatusUpdateNotification notification) { IslKey key = new IslKey(notification.getSrcSwitchId(), notification.getSrcPortNo(), notification.getDstSwitchId(), notification.getDstPortNo()); if (notification.getStatus() == IslStatus.MOVED) { handleIslMoved(k... | IslStatsService { public void handleIstStatusUpdateNotification(IslStatusUpdateNotification notification) { IslKey key = new IslKey(notification.getSrcSwitchId(), notification.getSrcPortNo(), notification.getDstSwitchId(), notification.getDstPortNo()); if (notification.getStatus() == IslStatus.MOVED) { handleIslMoved(k... | IslStatsService { public void handleIstStatusUpdateNotification(IslStatusUpdateNotification notification) { IslKey key = new IslKey(notification.getSrcSwitchId(), notification.getSrcPortNo(), notification.getDstSwitchId(), notification.getDstPortNo()); if (notification.getStatus() == IslStatus.MOVED) { handleIslMoved(k... | IslStatsService { public void handleIstStatusUpdateNotification(IslStatusUpdateNotification notification) { IslKey key = new IslKey(notification.getSrcSwitchId(), notification.getSrcPortNo(), notification.getDstSwitchId(), notification.getDstPortNo()); if (notification.getStatus() == IslStatus.MOVED) { handleIslMoved(k... |
@Test public void handleOneWayLatencyEmitOnEachIslDownTest() throws InterruptedException { List<LatencyRecord> buffer = new ArrayList<>(); Instant time = Instant.now().minusSeconds(LATENCY_TIMEOUT).minusMillis(500); for (int i = 0; i < 4; i++) { sendForwardOneWayLatency(i, time); verifyNoMoreInteractions(carrier); buff... | public void handleIstStatusUpdateNotification(IslStatusUpdateNotification notification) { IslKey key = new IslKey(notification.getSrcSwitchId(), notification.getSrcPortNo(), notification.getDstSwitchId(), notification.getDstPortNo()); if (notification.getStatus() == IslStatus.MOVED) { handleIslMoved(key); handleIslMove... | IslStatsService { public void handleIstStatusUpdateNotification(IslStatusUpdateNotification notification) { IslKey key = new IslKey(notification.getSrcSwitchId(), notification.getSrcPortNo(), notification.getDstSwitchId(), notification.getDstPortNo()); if (notification.getStatus() == IslStatus.MOVED) { handleIslMoved(k... | IslStatsService { public void handleIstStatusUpdateNotification(IslStatusUpdateNotification notification) { IslKey key = new IslKey(notification.getSrcSwitchId(), notification.getSrcPortNo(), notification.getDstSwitchId(), notification.getDstPortNo()); if (notification.getStatus() == IslStatus.MOVED) { handleIslMoved(k... | IslStatsService { public void handleIstStatusUpdateNotification(IslStatusUpdateNotification notification) { IslKey key = new IslKey(notification.getSrcSwitchId(), notification.getSrcPortNo(), notification.getDstSwitchId(), notification.getDstPortNo()); if (notification.getStatus() == IslStatus.MOVED) { handleIslMoved(k... | IslStatsService { public void handleIstStatusUpdateNotification(IslStatusUpdateNotification notification) { IslKey key = new IslKey(notification.getSrcSwitchId(), notification.getSrcPortNo(), notification.getDstSwitchId(), notification.getDstPortNo()); if (notification.getStatus() == IslStatus.MOVED) { handleIslMoved(k... |
@Test public void handleOneWayLatencyEmitOnFirstIslDownTest() throws InterruptedException { List<LatencyRecord> buffer = new ArrayList<>(); Instant time = Instant.now().minusSeconds(LATENCY_TIMEOUT).minusMillis(500); for (int i = 0; i < 4; i++) { sendForwardOneWayLatency(i, time); verifyNoMoreInteractions(carrier); buf... | public void handleIstStatusUpdateNotification(IslStatusUpdateNotification notification) { IslKey key = new IslKey(notification.getSrcSwitchId(), notification.getSrcPortNo(), notification.getDstSwitchId(), notification.getDstPortNo()); if (notification.getStatus() == IslStatus.MOVED) { handleIslMoved(key); handleIslMove... | IslStatsService { public void handleIstStatusUpdateNotification(IslStatusUpdateNotification notification) { IslKey key = new IslKey(notification.getSrcSwitchId(), notification.getSrcPortNo(), notification.getDstSwitchId(), notification.getDstPortNo()); if (notification.getStatus() == IslStatus.MOVED) { handleIslMoved(k... | IslStatsService { public void handleIstStatusUpdateNotification(IslStatusUpdateNotification notification) { IslKey key = new IslKey(notification.getSrcSwitchId(), notification.getSrcPortNo(), notification.getDstSwitchId(), notification.getDstPortNo()); if (notification.getStatus() == IslStatus.MOVED) { handleIslMoved(k... | IslStatsService { public void handleIstStatusUpdateNotification(IslStatusUpdateNotification notification) { IslKey key = new IslKey(notification.getSrcSwitchId(), notification.getSrcPortNo(), notification.getDstSwitchId(), notification.getDstPortNo()); if (notification.getStatus() == IslStatus.MOVED) { handleIslMoved(k... | IslStatsService { public void handleIstStatusUpdateNotification(IslStatusUpdateNotification notification) { IslKey key = new IslKey(notification.getSrcSwitchId(), notification.getSrcPortNo(), notification.getDstSwitchId(), notification.getDstPortNo()); if (notification.getStatus() == IslStatus.MOVED) { handleIslMoved(k... |
@Test public void handleOneWayLatencyNoEmitOnEachIslMoveTest() throws InterruptedException { Instant time = Instant.now().minusSeconds(LATENCY_TIMEOUT - 1); for (int i = 0; i < 4; i++) { sendForwardOneWayLatency(i, time); time = time.plusSeconds(1); } islStatsService.handleIstStatusUpdateNotification( new IslStatusUpda... | public void handleIstStatusUpdateNotification(IslStatusUpdateNotification notification) { IslKey key = new IslKey(notification.getSrcSwitchId(), notification.getSrcPortNo(), notification.getDstSwitchId(), notification.getDstPortNo()); if (notification.getStatus() == IslStatus.MOVED) { handleIslMoved(key); handleIslMove... | IslStatsService { public void handleIstStatusUpdateNotification(IslStatusUpdateNotification notification) { IslKey key = new IslKey(notification.getSrcSwitchId(), notification.getSrcPortNo(), notification.getDstSwitchId(), notification.getDstPortNo()); if (notification.getStatus() == IslStatus.MOVED) { handleIslMoved(k... | IslStatsService { public void handleIstStatusUpdateNotification(IslStatusUpdateNotification notification) { IslKey key = new IslKey(notification.getSrcSwitchId(), notification.getSrcPortNo(), notification.getDstSwitchId(), notification.getDstPortNo()); if (notification.getStatus() == IslStatus.MOVED) { handleIslMoved(k... | IslStatsService { public void handleIstStatusUpdateNotification(IslStatusUpdateNotification notification) { IslKey key = new IslKey(notification.getSrcSwitchId(), notification.getSrcPortNo(), notification.getDstSwitchId(), notification.getDstPortNo()); if (notification.getStatus() == IslStatus.MOVED) { handleIslMoved(k... | IslStatsService { public void handleIstStatusUpdateNotification(IslStatusUpdateNotification notification) { IslKey key = new IslKey(notification.getSrcSwitchId(), notification.getSrcPortNo(), notification.getDstSwitchId(), notification.getDstPortNo()); if (notification.getStatus() == IslStatus.MOVED) { handleIslMoved(k... |
@Test() public void handleGetDataFromCacheTest() { IslRoundTripLatency forward = new IslRoundTripLatency(SWITCH_ID_1, PORT_1, 1, 0L); IslRoundTripLatency reverse = new IslRoundTripLatency(SWITCH_ID_2, PORT_2, 1, 0L); checkHandleGetDataFromCache(forward, SWITCH_ID_2, PORT_2); checkHandleGetDataFromCache(reverse, SWITCH_... | public void handleGetDataFromCache(IslRoundTripLatency roundTripLatency) { Endpoint source = Endpoint.of(roundTripLatency.getSrcSwitchId(), roundTripLatency.getSrcPortNo()); Endpoint destination = cache.get(source); try { if (destination == null) { destination = updateCache(source); } carrier.emitCachedData(roundTripLa... | CacheService { public void handleGetDataFromCache(IslRoundTripLatency roundTripLatency) { Endpoint source = Endpoint.of(roundTripLatency.getSrcSwitchId(), roundTripLatency.getSrcPortNo()); Endpoint destination = cache.get(source); try { if (destination == null) { destination = updateCache(source); } carrier.emitCachedD... | CacheService { public void handleGetDataFromCache(IslRoundTripLatency roundTripLatency) { Endpoint source = Endpoint.of(roundTripLatency.getSrcSwitchId(), roundTripLatency.getSrcPortNo()); Endpoint destination = cache.get(source); try { if (destination == null) { destination = updateCache(source); } carrier.emitCachedD... | CacheService { public void handleGetDataFromCache(IslRoundTripLatency roundTripLatency) { Endpoint source = Endpoint.of(roundTripLatency.getSrcSwitchId(), roundTripLatency.getSrcPortNo()); Endpoint destination = cache.get(source); try { if (destination == null) { destination = updateCache(source); } carrier.emitCachedD... | CacheService { public void handleGetDataFromCache(IslRoundTripLatency roundTripLatency) { Endpoint source = Endpoint.of(roundTripLatency.getSrcSwitchId(), roundTripLatency.getSrcPortNo()); Endpoint destination = cache.get(source); try { if (destination == null) { destination = updateCache(source); } carrier.emitCachedD... |
@Test() public void handleUpdateCacheInactiveTest() { IslStatusUpdateNotification notification = new IslStatusUpdateNotification(SWITCH_ID_1, PORT_1, SWITCH_ID_2, PORT_2, INACTIVE); updateIslStatus(SWITCH_ID_1, PORT_1, SWITCH_ID_2, PORT_2, INACTIVE); updateIslStatus(SWITCH_ID_2, PORT_2, SWITCH_ID_1, PORT_1, INACTIVE); ... | public void handleUpdateCache(IslStatusUpdateNotification notification) { if (notification.getStatus() == IslStatus.MOVED || notification.getStatus() == IslStatus.INACTIVE) { Endpoint source = Endpoint.of(notification.getSrcSwitchId(), notification.getSrcPortNo()); Endpoint destination = Endpoint.of(notification.getDst... | CacheService { public void handleUpdateCache(IslStatusUpdateNotification notification) { if (notification.getStatus() == IslStatus.MOVED || notification.getStatus() == IslStatus.INACTIVE) { Endpoint source = Endpoint.of(notification.getSrcSwitchId(), notification.getSrcPortNo()); Endpoint destination = Endpoint.of(noti... | CacheService { public void handleUpdateCache(IslStatusUpdateNotification notification) { if (notification.getStatus() == IslStatus.MOVED || notification.getStatus() == IslStatus.INACTIVE) { Endpoint source = Endpoint.of(notification.getSrcSwitchId(), notification.getSrcPortNo()); Endpoint destination = Endpoint.of(noti... | CacheService { public void handleUpdateCache(IslStatusUpdateNotification notification) { if (notification.getStatus() == IslStatus.MOVED || notification.getStatus() == IslStatus.INACTIVE) { Endpoint source = Endpoint.of(notification.getSrcSwitchId(), notification.getSrcPortNo()); Endpoint destination = Endpoint.of(noti... | CacheService { public void handleUpdateCache(IslStatusUpdateNotification notification) { if (notification.getStatus() == IslStatus.MOVED || notification.getStatus() == IslStatus.INACTIVE) { Endpoint source = Endpoint.of(notification.getSrcSwitchId(), notification.getSrcPortNo()); Endpoint destination = Endpoint.of(noti... |
@Test(expected = IslNotFoundException.class) public void updateIslLatencyNonExistentSrcEndpointTest() throws IslNotFoundException, SwitchNotFoundException { islLatencyService.updateIslLatency(NON_EXISTENT_SWITCH_ID, PORT_1, SWITCH_ID_2, PORT_2, 0); } | @VisibleForTesting void updateIslLatency( SwitchId srcSwitchId, int srcPort, SwitchId dstSwitchId, int dstPort, long latency) throws SwitchNotFoundException, IslNotFoundException { transactionManager.doInTransaction(() -> { Isl isl = islRepository.findByEndpoints(srcSwitchId, srcPort, dstSwitchId, dstPort) .orElseThrow... | IslLatencyService { @VisibleForTesting void updateIslLatency( SwitchId srcSwitchId, int srcPort, SwitchId dstSwitchId, int dstPort, long latency) throws SwitchNotFoundException, IslNotFoundException { transactionManager.doInTransaction(() -> { Isl isl = islRepository.findByEndpoints(srcSwitchId, srcPort, dstSwitchId, d... | IslLatencyService { @VisibleForTesting void updateIslLatency( SwitchId srcSwitchId, int srcPort, SwitchId dstSwitchId, int dstPort, long latency) throws SwitchNotFoundException, IslNotFoundException { transactionManager.doInTransaction(() -> { Isl isl = islRepository.findByEndpoints(srcSwitchId, srcPort, dstSwitchId, d... | IslLatencyService { @VisibleForTesting void updateIslLatency( SwitchId srcSwitchId, int srcPort, SwitchId dstSwitchId, int dstPort, long latency) throws SwitchNotFoundException, IslNotFoundException { transactionManager.doInTransaction(() -> { Isl isl = islRepository.findByEndpoints(srcSwitchId, srcPort, dstSwitchId, d... | IslLatencyService { @VisibleForTesting void updateIslLatency( SwitchId srcSwitchId, int srcPort, SwitchId dstSwitchId, int dstPort, long latency) throws SwitchNotFoundException, IslNotFoundException { transactionManager.doInTransaction(() -> { Isl isl = islRepository.findByEndpoints(srcSwitchId, srcPort, dstSwitchId, d... |
@Test(expected = IslNotFoundException.class) public void updateIslLatencyNonExistentDstEndpointTest() throws IslNotFoundException, SwitchNotFoundException { islLatencyService.updateIslLatency(SWITCH_ID_1, PORT_1, NON_EXISTENT_SWITCH_ID, PORT_2, 0); } | @VisibleForTesting void updateIslLatency( SwitchId srcSwitchId, int srcPort, SwitchId dstSwitchId, int dstPort, long latency) throws SwitchNotFoundException, IslNotFoundException { transactionManager.doInTransaction(() -> { Isl isl = islRepository.findByEndpoints(srcSwitchId, srcPort, dstSwitchId, dstPort) .orElseThrow... | IslLatencyService { @VisibleForTesting void updateIslLatency( SwitchId srcSwitchId, int srcPort, SwitchId dstSwitchId, int dstPort, long latency) throws SwitchNotFoundException, IslNotFoundException { transactionManager.doInTransaction(() -> { Isl isl = islRepository.findByEndpoints(srcSwitchId, srcPort, dstSwitchId, d... | IslLatencyService { @VisibleForTesting void updateIslLatency( SwitchId srcSwitchId, int srcPort, SwitchId dstSwitchId, int dstPort, long latency) throws SwitchNotFoundException, IslNotFoundException { transactionManager.doInTransaction(() -> { Isl isl = islRepository.findByEndpoints(srcSwitchId, srcPort, dstSwitchId, d... | IslLatencyService { @VisibleForTesting void updateIslLatency( SwitchId srcSwitchId, int srcPort, SwitchId dstSwitchId, int dstPort, long latency) throws SwitchNotFoundException, IslNotFoundException { transactionManager.doInTransaction(() -> { Isl isl = islRepository.findByEndpoints(srcSwitchId, srcPort, dstSwitchId, d... | IslLatencyService { @VisibleForTesting void updateIslLatency( SwitchId srcSwitchId, int srcPort, SwitchId dstSwitchId, int dstPort, long latency) throws SwitchNotFoundException, IslNotFoundException { transactionManager.doInTransaction(() -> { Isl isl = islRepository.findByEndpoints(srcSwitchId, srcPort, dstSwitchId, d... |
@Test(expected = IslNotFoundException.class) public void updateIslLatencyNonExistentIslTest() throws IslNotFoundException, SwitchNotFoundException { islLatencyService.updateIslLatency(SWITCH_ID_1, NON_EXISTENT_PORT, SWITCH_ID_2, NON_EXISTENT_PORT, 0); } | @VisibleForTesting void updateIslLatency( SwitchId srcSwitchId, int srcPort, SwitchId dstSwitchId, int dstPort, long latency) throws SwitchNotFoundException, IslNotFoundException { transactionManager.doInTransaction(() -> { Isl isl = islRepository.findByEndpoints(srcSwitchId, srcPort, dstSwitchId, dstPort) .orElseThrow... | IslLatencyService { @VisibleForTesting void updateIslLatency( SwitchId srcSwitchId, int srcPort, SwitchId dstSwitchId, int dstPort, long latency) throws SwitchNotFoundException, IslNotFoundException { transactionManager.doInTransaction(() -> { Isl isl = islRepository.findByEndpoints(srcSwitchId, srcPort, dstSwitchId, d... | IslLatencyService { @VisibleForTesting void updateIslLatency( SwitchId srcSwitchId, int srcPort, SwitchId dstSwitchId, int dstPort, long latency) throws SwitchNotFoundException, IslNotFoundException { transactionManager.doInTransaction(() -> { Isl isl = islRepository.findByEndpoints(srcSwitchId, srcPort, dstSwitchId, d... | IslLatencyService { @VisibleForTesting void updateIslLatency( SwitchId srcSwitchId, int srcPort, SwitchId dstSwitchId, int dstPort, long latency) throws SwitchNotFoundException, IslNotFoundException { transactionManager.doInTransaction(() -> { Isl isl = islRepository.findByEndpoints(srcSwitchId, srcPort, dstSwitchId, d... | IslLatencyService { @VisibleForTesting void updateIslLatency( SwitchId srcSwitchId, int srcPort, SwitchId dstSwitchId, int dstPort, long latency) throws SwitchNotFoundException, IslNotFoundException { transactionManager.doInTransaction(() -> { Isl isl = islRepository.findByEndpoints(srcSwitchId, srcPort, dstSwitchId, d... |
@Test public void updateIslLatencyTest() throws IslNotFoundException, SwitchNotFoundException { islLatencyService.updateIslLatency(SWITCH_ID_1, PORT_1, SWITCH_ID_2, PORT_2, 1000); assertForwardLatency(1000); } | @VisibleForTesting void updateIslLatency( SwitchId srcSwitchId, int srcPort, SwitchId dstSwitchId, int dstPort, long latency) throws SwitchNotFoundException, IslNotFoundException { transactionManager.doInTransaction(() -> { Isl isl = islRepository.findByEndpoints(srcSwitchId, srcPort, dstSwitchId, dstPort) .orElseThrow... | IslLatencyService { @VisibleForTesting void updateIslLatency( SwitchId srcSwitchId, int srcPort, SwitchId dstSwitchId, int dstPort, long latency) throws SwitchNotFoundException, IslNotFoundException { transactionManager.doInTransaction(() -> { Isl isl = islRepository.findByEndpoints(srcSwitchId, srcPort, dstSwitchId, d... | IslLatencyService { @VisibleForTesting void updateIslLatency( SwitchId srcSwitchId, int srcPort, SwitchId dstSwitchId, int dstPort, long latency) throws SwitchNotFoundException, IslNotFoundException { transactionManager.doInTransaction(() -> { Isl isl = islRepository.findByEndpoints(srcSwitchId, srcPort, dstSwitchId, d... | IslLatencyService { @VisibleForTesting void updateIslLatency( SwitchId srcSwitchId, int srcPort, SwitchId dstSwitchId, int dstPort, long latency) throws SwitchNotFoundException, IslNotFoundException { transactionManager.doInTransaction(() -> { Isl isl = islRepository.findByEndpoints(srcSwitchId, srcPort, dstSwitchId, d... | IslLatencyService { @VisibleForTesting void updateIslLatency( SwitchId srcSwitchId, int srcPort, SwitchId dstSwitchId, int dstPort, long latency) throws SwitchNotFoundException, IslNotFoundException { transactionManager.doInTransaction(() -> { Isl isl = islRepository.findByEndpoints(srcSwitchId, srcPort, dstSwitchId, d... |
@Test public void isCookieMismatch3() { OfInput input = makeInput(cookieAlpha); Assert.assertTrue(input.packetInCookieMismatchAll(callerLogger, cookieBeta)); } | public boolean packetInCookieMismatchAll(Logger log, U64... expected) { boolean isMismatched = packetInCookieMismatchCheck(expected); if (isMismatched) { log.debug("{} - cookie mismatch (expected one of:{}, actual:{})", this, expected, packetInCookie()); } return isMismatched; } | OfInput { public boolean packetInCookieMismatchAll(Logger log, U64... expected) { boolean isMismatched = packetInCookieMismatchCheck(expected); if (isMismatched) { log.debug("{} - cookie mismatch (expected one of:{}, actual:{})", this, expected, packetInCookie()); } return isMismatched; } } | OfInput { public boolean packetInCookieMismatchAll(Logger log, U64... expected) { boolean isMismatched = packetInCookieMismatchCheck(expected); if (isMismatched) { log.debug("{} - cookie mismatch (expected one of:{}, actual:{})", this, expected, packetInCookie()); } return isMismatched; } OfInput(IOFSwitch sw, OFMessag... | OfInput { public boolean packetInCookieMismatchAll(Logger log, U64... expected) { boolean isMismatched = packetInCookieMismatchCheck(expected); if (isMismatched) { log.debug("{} - cookie mismatch (expected one of:{}, actual:{})", this, expected, packetInCookie()); } return isMismatched; } OfInput(IOFSwitch sw, OFMessag... | OfInput { public boolean packetInCookieMismatchAll(Logger log, U64... expected) { boolean isMismatched = packetInCookieMismatchCheck(expected); if (isMismatched) { log.debug("{} - cookie mismatch (expected one of:{}, actual:{})", this, expected, packetInCookie()); } return isMismatched; } OfInput(IOFSwitch sw, OFMessag... |
@Test(expected = IllegalSwitchPropertiesException.class) public void shouldValidateFlowWithLldpFlagWhenUpdatingSwitchProperties() { Switch firstSwitch = Switch.builder().switchId(TEST_SWITCH_ID).status(SwitchStatus.ACTIVE).build(); Switch secondSwitch = Switch.builder().switchId(TEST_SWITCH_ID_2).status(SwitchStatus.AC... | public SwitchPropertiesDto updateSwitchProperties(SwitchId switchId, SwitchPropertiesDto switchPropertiesDto) { if (isEmpty(switchPropertiesDto.getSupportedTransitEncapsulation())) { throw new IllegalSwitchPropertiesException("Supported transit encapsulations should not be null or empty"); } SwitchProperties update = S... | SwitchOperationsService implements ILinkOperationsServiceCarrier { public SwitchPropertiesDto updateSwitchProperties(SwitchId switchId, SwitchPropertiesDto switchPropertiesDto) { if (isEmpty(switchPropertiesDto.getSupportedTransitEncapsulation())) { throw new IllegalSwitchPropertiesException("Supported transit encapsul... | SwitchOperationsService implements ILinkOperationsServiceCarrier { public SwitchPropertiesDto updateSwitchProperties(SwitchId switchId, SwitchPropertiesDto switchPropertiesDto) { if (isEmpty(switchPropertiesDto.getSupportedTransitEncapsulation())) { throw new IllegalSwitchPropertiesException("Supported transit encapsul... | SwitchOperationsService implements ILinkOperationsServiceCarrier { public SwitchPropertiesDto updateSwitchProperties(SwitchId switchId, SwitchPropertiesDto switchPropertiesDto) { if (isEmpty(switchPropertiesDto.getSupportedTransitEncapsulation())) { throw new IllegalSwitchPropertiesException("Supported transit encapsul... | SwitchOperationsService implements ILinkOperationsServiceCarrier { public SwitchPropertiesDto updateSwitchProperties(SwitchId switchId, SwitchPropertiesDto switchPropertiesDto) { if (isEmpty(switchPropertiesDto.getSupportedTransitEncapsulation())) { throw new IllegalSwitchPropertiesException("Supported transit encapsul... |
@Test public void handleOneWayIslLatencyTest() { assertTrue(islLatencyService.isUpdateRequired(FORWARD_ISL_KEY)); islLatencyService.handleOneWayIslLatency(createForwardOneWayLatency(1), System.currentTimeMillis()); assertForwardLatency(1); assertFalse(islLatencyService.isUpdateRequired(FORWARD_ISL_KEY)); islLatencyServ... | public void handleOneWayIslLatency(IslOneWayLatency data, long timestamp) { log.debug("Received one way latency {} for ISL {}_{} ===> {}_{}, Packet Id: {}", data.getLatency(), data.getSrcSwitchId(), data.getSrcPortNo(), data.getDstSwitchId(), data.getDstPortNo(), data.getPacketId()); IslKey islKey = new IslKey(data); o... | IslLatencyService { public void handleOneWayIslLatency(IslOneWayLatency data, long timestamp) { log.debug("Received one way latency {} for ISL {}_{} ===> {}_{}, Packet Id: {}", data.getLatency(), data.getSrcSwitchId(), data.getSrcPortNo(), data.getDstSwitchId(), data.getDstPortNo(), data.getPacketId()); IslKey islKey =... | IslLatencyService { public void handleOneWayIslLatency(IslOneWayLatency data, long timestamp) { log.debug("Received one way latency {} for ISL {}_{} ===> {}_{}, Packet Id: {}", data.getLatency(), data.getSrcSwitchId(), data.getSrcPortNo(), data.getDstSwitchId(), data.getDstPortNo(), data.getPacketId()); IslKey islKey =... | IslLatencyService { public void handleOneWayIslLatency(IslOneWayLatency data, long timestamp) { log.debug("Received one way latency {} for ISL {}_{} ===> {}_{}, Packet Id: {}", data.getLatency(), data.getSrcSwitchId(), data.getSrcPortNo(), data.getDstSwitchId(), data.getDstPortNo(), data.getPacketId()); IslKey islKey =... | IslLatencyService { public void handleOneWayIslLatency(IslOneWayLatency data, long timestamp) { log.debug("Received one way latency {} for ISL {}_{} ===> {}_{}, Packet Id: {}", data.getLatency(), data.getSrcSwitchId(), data.getSrcPortNo(), data.getDstSwitchId(), data.getDstPortNo(), data.getPacketId()); IslKey islKey =... |
@Test public void handleRoundTripIslLatencyTest() { assertTrue(islLatencyService.isUpdateRequired(FORWARD_ISL_KEY)); islLatencyService.handleRoundTripIslLatency( createForwardRoundTripLatency(5), FORWARD_DESTINATION, System.currentTimeMillis()); assertForwardLatency(5); assertFalse(islLatencyService.isUpdateRequired(FO... | public void handleRoundTripIslLatency(IslRoundTripLatency data, Endpoint destination, long timestamp) { if (data.getLatency() < 0) { log.warn("Received invalid round trip latency {} for ISL {}_{} ===> {}_{}. Packet Id: {}", data.getLatency(), data.getSrcSwitchId(), data.getSrcPortNo(), destination.getDatapath(), destin... | IslLatencyService { public void handleRoundTripIslLatency(IslRoundTripLatency data, Endpoint destination, long timestamp) { if (data.getLatency() < 0) { log.warn("Received invalid round trip latency {} for ISL {}_{} ===> {}_{}. Packet Id: {}", data.getLatency(), data.getSrcSwitchId(), data.getSrcPortNo(), destination.g... | IslLatencyService { public void handleRoundTripIslLatency(IslRoundTripLatency data, Endpoint destination, long timestamp) { if (data.getLatency() < 0) { log.warn("Received invalid round trip latency {} for ISL {}_{} ===> {}_{}. Packet Id: {}", data.getLatency(), data.getSrcSwitchId(), data.getSrcPortNo(), destination.g... | IslLatencyService { public void handleRoundTripIslLatency(IslRoundTripLatency data, Endpoint destination, long timestamp) { if (data.getLatency() < 0) { log.warn("Received invalid round trip latency {} for ISL {}_{} ===> {}_{}. Packet Id: {}", data.getLatency(), data.getSrcSwitchId(), data.getSrcPortNo(), destination.g... | IslLatencyService { public void handleRoundTripIslLatency(IslRoundTripLatency data, Endpoint destination, long timestamp) { if (data.getLatency() < 0) { log.warn("Received invalid round trip latency {} for ISL {}_{} ===> {}_{}. Packet Id: {}", data.getLatency(), data.getSrcSwitchId(), data.getSrcPortNo(), destination.g... |
@Test public void isUpdateRequiredTest() { assertTrue(islLatencyService.isUpdateRequired(FORWARD_ISL_KEY)); IslRoundTripLatency data = new IslRoundTripLatency(SWITCH_ID_1, PORT_1, 1L, 0L); Endpoint destination = Endpoint.of(SWITCH_ID_2, PORT_2); islLatencyService.handleRoundTripIslLatency(data, destination, System.curr... | @VisibleForTesting boolean isUpdateRequired(IslKey islKey) { return Instant.now().isAfter(nextUpdateTimeMap.getOrDefault(islKey, Instant.MIN)); } | IslLatencyService { @VisibleForTesting boolean isUpdateRequired(IslKey islKey) { return Instant.now().isAfter(nextUpdateTimeMap.getOrDefault(islKey, Instant.MIN)); } } | IslLatencyService { @VisibleForTesting boolean isUpdateRequired(IslKey islKey) { return Instant.now().isAfter(nextUpdateTimeMap.getOrDefault(islKey, Instant.MIN)); } IslLatencyService(TransactionManager transactionManager,
RepositoryFactory repositoryFactory, long latencyUpdateInterval,
... | IslLatencyService { @VisibleForTesting boolean isUpdateRequired(IslKey islKey) { return Instant.now().isAfter(nextUpdateTimeMap.getOrDefault(islKey, Instant.MIN)); } IslLatencyService(TransactionManager transactionManager,
RepositoryFactory repositoryFactory, long latencyUpdateInterval,
... | IslLatencyService { @VisibleForTesting boolean isUpdateRequired(IslKey islKey) { return Instant.now().isAfter(nextUpdateTimeMap.getOrDefault(islKey, Instant.MIN)); } IslLatencyService(TransactionManager transactionManager,
RepositoryFactory repositoryFactory, long latencyUpdateInterval,
... |
@Test public void getNextUpdateTimeTest() { Instant actualTime = islLatencyService.getNextUpdateTime(); long expectedTime = System.currentTimeMillis() + LATENCY_UPDATE_INTERVAL * 1000; assertEquals(expectedTime, actualTime.toEpochMilli(), 50); } | @VisibleForTesting Instant getNextUpdateTime() { return Instant.now().plusSeconds(latencyUpdateInterval); } | IslLatencyService { @VisibleForTesting Instant getNextUpdateTime() { return Instant.now().plusSeconds(latencyUpdateInterval); } } | IslLatencyService { @VisibleForTesting Instant getNextUpdateTime() { return Instant.now().plusSeconds(latencyUpdateInterval); } IslLatencyService(TransactionManager transactionManager,
RepositoryFactory repositoryFactory, long latencyUpdateInterval,
long latency... | IslLatencyService { @VisibleForTesting Instant getNextUpdateTime() { return Instant.now().plusSeconds(latencyUpdateInterval); } IslLatencyService(TransactionManager transactionManager,
RepositoryFactory repositoryFactory, long latencyUpdateInterval,
long latency... | IslLatencyService { @VisibleForTesting Instant getNextUpdateTime() { return Instant.now().plusSeconds(latencyUpdateInterval); } IslLatencyService(TransactionManager transactionManager,
RepositoryFactory repositoryFactory, long latencyUpdateInterval,
long latency... |
@Test public void calculateAverageLatencyTest() { Queue<LatencyRecord> latencyRecords = new LinkedList<>(); for (int i = 1; i <= 5; i++) { latencyRecords.add(new LatencyRecord(i, 1)); } assertEquals(3, islLatencyService.calculateAverageLatency(latencyRecords)); } | @VisibleForTesting long calculateAverageLatency(Queue<LatencyRecord> recordsQueue) { if (recordsQueue.isEmpty()) { log.error("Couldn't calculate average latency. Records queue is empty"); return -1; } long sum = 0; for (LatencyRecord record : recordsQueue) { sum += record.getLatency(); } return sum / recordsQueue.size(... | IslLatencyService { @VisibleForTesting long calculateAverageLatency(Queue<LatencyRecord> recordsQueue) { if (recordsQueue.isEmpty()) { log.error("Couldn't calculate average latency. Records queue is empty"); return -1; } long sum = 0; for (LatencyRecord record : recordsQueue) { sum += record.getLatency(); } return sum ... | IslLatencyService { @VisibleForTesting long calculateAverageLatency(Queue<LatencyRecord> recordsQueue) { if (recordsQueue.isEmpty()) { log.error("Couldn't calculate average latency. Records queue is empty"); return -1; } long sum = 0; for (LatencyRecord record : recordsQueue) { sum += record.getLatency(); } return sum ... | IslLatencyService { @VisibleForTesting long calculateAverageLatency(Queue<LatencyRecord> recordsQueue) { if (recordsQueue.isEmpty()) { log.error("Couldn't calculate average latency. Records queue is empty"); return -1; } long sum = 0; for (LatencyRecord record : recordsQueue) { sum += record.getLatency(); } return sum ... | IslLatencyService { @VisibleForTesting long calculateAverageLatency(Queue<LatencyRecord> recordsQueue) { if (recordsQueue.isEmpty()) { log.error("Couldn't calculate average latency. Records queue is empty"); return -1; } long sum = 0; for (LatencyRecord record : recordsQueue) { sum += record.getLatency(); } return sum ... |
@Test public void calculateAverageLatencyEmptyTest() { assertEquals(-1, islLatencyService.calculateAverageLatency(new LinkedList<>())); } | @VisibleForTesting long calculateAverageLatency(Queue<LatencyRecord> recordsQueue) { if (recordsQueue.isEmpty()) { log.error("Couldn't calculate average latency. Records queue is empty"); return -1; } long sum = 0; for (LatencyRecord record : recordsQueue) { sum += record.getLatency(); } return sum / recordsQueue.size(... | IslLatencyService { @VisibleForTesting long calculateAverageLatency(Queue<LatencyRecord> recordsQueue) { if (recordsQueue.isEmpty()) { log.error("Couldn't calculate average latency. Records queue is empty"); return -1; } long sum = 0; for (LatencyRecord record : recordsQueue) { sum += record.getLatency(); } return sum ... | IslLatencyService { @VisibleForTesting long calculateAverageLatency(Queue<LatencyRecord> recordsQueue) { if (recordsQueue.isEmpty()) { log.error("Couldn't calculate average latency. Records queue is empty"); return -1; } long sum = 0; for (LatencyRecord record : recordsQueue) { sum += record.getLatency(); } return sum ... | IslLatencyService { @VisibleForTesting long calculateAverageLatency(Queue<LatencyRecord> recordsQueue) { if (recordsQueue.isEmpty()) { log.error("Couldn't calculate average latency. Records queue is empty"); return -1; } long sum = 0; for (LatencyRecord record : recordsQueue) { sum += record.getLatency(); } return sum ... | IslLatencyService { @VisibleForTesting long calculateAverageLatency(Queue<LatencyRecord> recordsQueue) { if (recordsQueue.isEmpty()) { log.error("Couldn't calculate average latency. Records queue is empty"); return -1; } long sum = 0; for (LatencyRecord record : recordsQueue) { sum += record.getLatency(); } return sum ... |
@Test public void pollExpiredRecordsTest() { Instant time = Instant.now().minusSeconds(LATENCY_UPDATE_TIME_RANGE * 2); Queue<LatencyRecord> latencyRecords = new LinkedList<>(); for (int i = 0; i < 5; i++) { latencyRecords.add(new LatencyRecord(i, time.toEpochMilli())); time = time.plusSeconds(1); } time = Instant.now()... | @VisibleForTesting void pollExpiredRecords(Queue<LatencyRecord> recordsQueue) { if (recordsQueue == null) { return; } Instant oldestTimeInRange = Instant.now().minusSeconds(latencyUpdateTimeRange); while (!recordsQueue.isEmpty() && Instant.ofEpochMilli(recordsQueue.peek().getTimestamp()).isBefore(oldestTimeInRange)) { ... | IslLatencyService { @VisibleForTesting void pollExpiredRecords(Queue<LatencyRecord> recordsQueue) { if (recordsQueue == null) { return; } Instant oldestTimeInRange = Instant.now().minusSeconds(latencyUpdateTimeRange); while (!recordsQueue.isEmpty() && Instant.ofEpochMilli(recordsQueue.peek().getTimestamp()).isBefore(ol... | IslLatencyService { @VisibleForTesting void pollExpiredRecords(Queue<LatencyRecord> recordsQueue) { if (recordsQueue == null) { return; } Instant oldestTimeInRange = Instant.now().minusSeconds(latencyUpdateTimeRange); while (!recordsQueue.isEmpty() && Instant.ofEpochMilli(recordsQueue.peek().getTimestamp()).isBefore(ol... | IslLatencyService { @VisibleForTesting void pollExpiredRecords(Queue<LatencyRecord> recordsQueue) { if (recordsQueue == null) { return; } Instant oldestTimeInRange = Instant.now().minusSeconds(latencyUpdateTimeRange); while (!recordsQueue.isEmpty() && Instant.ofEpochMilli(recordsQueue.peek().getTimestamp()).isBefore(ol... | IslLatencyService { @VisibleForTesting void pollExpiredRecords(Queue<LatencyRecord> recordsQueue) { if (recordsQueue == null) { return; } Instant oldestTimeInRange = Instant.now().minusSeconds(latencyUpdateTimeRange); while (!recordsQueue.isEmpty() && Instant.ofEpochMilli(recordsQueue.peek().getTimestamp()).isBefore(ol... |
@Test public void testGetFlowHistory() throws Exception { try { mockMvc.perform(get("/api/flows/all/history/{flowId}", TestFlowMock.FLOW_ID) .contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()); assertTrue(true); } catch (Exception exception) { assertTrue(false); } } | @RequestMapping(value = "/all/history/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.FW_FLOW_HISTORY }) public @ResponseBody List<FlowHistory> getFlowHistory(@PathVariable final String flowId, @RequestParam(name = "timeFrom", required = false) String ... | FlowController extends BaseController { @RequestMapping(value = "/all/history/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.FW_FLOW_HISTORY }) public @ResponseBody List<FlowHistory> getFlowHistory(@PathVariable final String flowId, @RequestParam(name... | FlowController extends BaseController { @RequestMapping(value = "/all/history/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.FW_FLOW_HISTORY }) public @ResponseBody List<FlowHistory> getFlowHistory(@PathVariable final String flowId, @RequestParam(name... | FlowController extends BaseController { @RequestMapping(value = "/all/history/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.FW_FLOW_HISTORY }) public @ResponseBody List<FlowHistory> getFlowHistory(@PathVariable final String flowId, @RequestParam(name... | FlowController extends BaseController { @RequestMapping(value = "/all/history/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.FW_FLOW_HISTORY }) public @ResponseBody List<FlowHistory> getFlowHistory(@PathVariable final String flowId, @RequestParam(name... |
@Test public void testGetFlowHistoryIfRequestParamsPassed() throws Exception { List<FlowHistory> flowHistories = new ArrayList<FlowHistory>(); try { when(flowController.getFlowHistory(TestFlowMock.FLOW_ID, TestFlowMock.TIME_FROM, TestFlowMock.TIME_TO)) .thenReturn(flowHistories); mockMvc.perform(get("/api/flows/all/his... | @RequestMapping(value = "/all/history/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.FW_FLOW_HISTORY }) public @ResponseBody List<FlowHistory> getFlowHistory(@PathVariable final String flowId, @RequestParam(name = "timeFrom", required = false) String ... | FlowController extends BaseController { @RequestMapping(value = "/all/history/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.FW_FLOW_HISTORY }) public @ResponseBody List<FlowHistory> getFlowHistory(@PathVariable final String flowId, @RequestParam(name... | FlowController extends BaseController { @RequestMapping(value = "/all/history/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.FW_FLOW_HISTORY }) public @ResponseBody List<FlowHistory> getFlowHistory(@PathVariable final String flowId, @RequestParam(name... | FlowController extends BaseController { @RequestMapping(value = "/all/history/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.FW_FLOW_HISTORY }) public @ResponseBody List<FlowHistory> getFlowHistory(@PathVariable final String flowId, @RequestParam(name... | FlowController extends BaseController { @RequestMapping(value = "/all/history/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.FW_FLOW_HISTORY }) public @ResponseBody List<FlowHistory> getFlowHistory(@PathVariable final String flowId, @RequestParam(name... |
@Test public void testGetFlowsHistoryIfFlowIdNotPassed() throws Exception { List<FlowHistory> flowHistories = new ArrayList<FlowHistory>(); try { when(flowController.getFlowHistory(TestFlowMock.FLOW_ID_NULL, TestFlowMock.TIME_FROM, TestFlowMock.TIME_TO)) .thenReturn(flowHistories); mockMvc.perform(get("/api/flows/all/h... | @RequestMapping(value = "/all/history/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.FW_FLOW_HISTORY }) public @ResponseBody List<FlowHistory> getFlowHistory(@PathVariable final String flowId, @RequestParam(name = "timeFrom", required = false) String ... | FlowController extends BaseController { @RequestMapping(value = "/all/history/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.FW_FLOW_HISTORY }) public @ResponseBody List<FlowHistory> getFlowHistory(@PathVariable final String flowId, @RequestParam(name... | FlowController extends BaseController { @RequestMapping(value = "/all/history/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.FW_FLOW_HISTORY }) public @ResponseBody List<FlowHistory> getFlowHistory(@PathVariable final String flowId, @RequestParam(name... | FlowController extends BaseController { @RequestMapping(value = "/all/history/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.FW_FLOW_HISTORY }) public @ResponseBody List<FlowHistory> getFlowHistory(@PathVariable final String flowId, @RequestParam(name... | FlowController extends BaseController { @RequestMapping(value = "/all/history/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.FW_FLOW_HISTORY }) public @ResponseBody List<FlowHistory> getFlowHistory(@PathVariable final String flowId, @RequestParam(name... |
@Test public void errorReporting() throws Exception { final ExecutionException error = new ExecutionException("Emulate kafka send error", new IOException()); Future promise = mock(Future.class); expect(promise.get()).andThrow(error).anyTimes(); replay(promise); expect(kafkaProducer.send(anyObject(), anyObject(Callback.... | public void sendMessageAndTrack(String topic, Message message) { produce(encode(topic, message), new SendStatusCallback(this, topic, message)); } | KafkaProducerService implements IKafkaProducerService { public void sendMessageAndTrack(String topic, Message message) { produce(encode(topic, message), new SendStatusCallback(this, topic, message)); } } | KafkaProducerService implements IKafkaProducerService { public void sendMessageAndTrack(String topic, Message message) { produce(encode(topic, message), new SendStatusCallback(this, topic, message)); } } | KafkaProducerService implements IKafkaProducerService { public void sendMessageAndTrack(String topic, Message message) { produce(encode(topic, message), new SendStatusCallback(this, topic, message)); } @Override void setup(FloodlightModuleContext moduleContext); void sendMessageAndTrack(String topic, Message message);... | KafkaProducerService implements IKafkaProducerService { public void sendMessageAndTrack(String topic, Message message) { produce(encode(topic, message), new SendStatusCallback(this, topic, message)); } @Override void setup(FloodlightModuleContext moduleContext); void sendMessageAndTrack(String topic, Message message);... |
@Test public void testGetFlowById() throws Exception { FlowInfo flowInfo = new FlowInfo(); try { when(flowService.getFlowById(TestFlowMock.FLOW_ID, TestFlowMock.CONTROLLER_FLAG)).thenReturn(flowInfo); mockMvc.perform(get("/api/flows/{flowId}", TestFlowMock.FLOW_ID).contentType(MediaType.APPLICATION_JSON)) .andExpect(st... | @RequestMapping(value = "/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.MENU_FLOWS }) public @ResponseBody FlowInfo getFlowById(@PathVariable final String flowId, @RequestParam(name = "controller", required = false) boolean controller) { LOGGER.info(... | FlowController extends BaseController { @RequestMapping(value = "/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.MENU_FLOWS }) public @ResponseBody FlowInfo getFlowById(@PathVariable final String flowId, @RequestParam(name = "controller", required = f... | FlowController extends BaseController { @RequestMapping(value = "/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.MENU_FLOWS }) public @ResponseBody FlowInfo getFlowById(@PathVariable final String flowId, @RequestParam(name = "controller", required = f... | FlowController extends BaseController { @RequestMapping(value = "/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.MENU_FLOWS }) public @ResponseBody FlowInfo getFlowById(@PathVariable final String flowId, @RequestParam(name = "controller", required = f... | FlowController extends BaseController { @RequestMapping(value = "/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.MENU_FLOWS }) public @ResponseBody FlowInfo getFlowById(@PathVariable final String flowId, @RequestParam(name = "controller", required = f... |
@Test public void testGetFlowByIdWhenFlowIdNotPassed() throws Exception { FlowInfo flowInfo = new FlowInfo(); try { when(flowService.getFlowById(TestFlowMock.FLOW_ID_NULL, TestFlowMock.CONTROLLER_FLAG)).thenReturn(flowInfo); mockMvc.perform(get("/api/flows/{flowId}", TestFlowMock.FLOW_ID_NULL, true) .contentType(MediaT... | @RequestMapping(value = "/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.MENU_FLOWS }) public @ResponseBody FlowInfo getFlowById(@PathVariable final String flowId, @RequestParam(name = "controller", required = false) boolean controller) { LOGGER.info(... | FlowController extends BaseController { @RequestMapping(value = "/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.MENU_FLOWS }) public @ResponseBody FlowInfo getFlowById(@PathVariable final String flowId, @RequestParam(name = "controller", required = f... | FlowController extends BaseController { @RequestMapping(value = "/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.MENU_FLOWS }) public @ResponseBody FlowInfo getFlowById(@PathVariable final String flowId, @RequestParam(name = "controller", required = f... | FlowController extends BaseController { @RequestMapping(value = "/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.MENU_FLOWS }) public @ResponseBody FlowInfo getFlowById(@PathVariable final String flowId, @RequestParam(name = "controller", required = f... | FlowController extends BaseController { @RequestMapping(value = "/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.MENU_FLOWS }) public @ResponseBody FlowInfo getFlowById(@PathVariable final String flowId, @RequestParam(name = "controller", required = f... |
@Test public void testGetFlowPath() throws Exception { FlowPayload flowPayload = new FlowPayload(); try { when(flowService.getFlowPath(Mockito.anyString())).thenReturn(flowPayload); mockMvc.perform(get("/api/flows/path/{flowId}", TestFlowMock.FLOW_ID) .contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()... | @RequestMapping(value = "/path/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) public @ResponseBody FlowPayload getFlowPath(@PathVariable final String flowId) { LOGGER.info("Get flow path. Flow id: '" + flowId + "'"); return flowService.getFlowPath(flowId); } | FlowController extends BaseController { @RequestMapping(value = "/path/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) public @ResponseBody FlowPayload getFlowPath(@PathVariable final String flowId) { LOGGER.info("Get flow path. Flow id: '" + flowId + "'"); return flowService.getFlowPath(flowId); ... | FlowController extends BaseController { @RequestMapping(value = "/path/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) public @ResponseBody FlowPayload getFlowPath(@PathVariable final String flowId) { LOGGER.info("Get flow path. Flow id: '" + flowId + "'"); return flowService.getFlowPath(flowId); ... | FlowController extends BaseController { @RequestMapping(value = "/path/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) public @ResponseBody FlowPayload getFlowPath(@PathVariable final String flowId) { LOGGER.info("Get flow path. Flow id: '" + flowId + "'"); return flowService.getFlowPath(flowId); ... | FlowController extends BaseController { @RequestMapping(value = "/path/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) public @ResponseBody FlowPayload getFlowPath(@PathVariable final String flowId) { LOGGER.info("Get flow path. Flow id: '" + flowId + "'"); return flowService.getFlowPath(flowId); ... |
@Test public void testGetFlowPathWhenFlowIdNotPassed() throws Exception { FlowPayload flowPayload = new FlowPayload(); try { when(flowService.getFlowPath(Mockito.anyString())).thenReturn(flowPayload); mockMvc.perform(get("/api/flows/get/path/{flowId}", TestFlowMock.FLOW_ID_NULL) .contentType(MediaType.APPLICATION_JSON)... | @RequestMapping(value = "/path/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) public @ResponseBody FlowPayload getFlowPath(@PathVariable final String flowId) { LOGGER.info("Get flow path. Flow id: '" + flowId + "'"); return flowService.getFlowPath(flowId); } | FlowController extends BaseController { @RequestMapping(value = "/path/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) public @ResponseBody FlowPayload getFlowPath(@PathVariable final String flowId) { LOGGER.info("Get flow path. Flow id: '" + flowId + "'"); return flowService.getFlowPath(flowId); ... | FlowController extends BaseController { @RequestMapping(value = "/path/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) public @ResponseBody FlowPayload getFlowPath(@PathVariable final String flowId) { LOGGER.info("Get flow path. Flow id: '" + flowId + "'"); return flowService.getFlowPath(flowId); ... | FlowController extends BaseController { @RequestMapping(value = "/path/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) public @ResponseBody FlowPayload getFlowPath(@PathVariable final String flowId) { LOGGER.info("Get flow path. Flow id: '" + flowId + "'"); return flowService.getFlowPath(flowId); ... | FlowController extends BaseController { @RequestMapping(value = "/path/{flowId}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) public @ResponseBody FlowPayload getFlowPath(@PathVariable final String flowId) { LOGGER.info("Get flow path. Flow id: '" + flowId + "'"); return flowService.getFlowPath(flowId); ... |
@Test public void testGetAllSwitchFlows() { ResponseEntity<List<?>> responseList = new ResponseEntity<List<?>>(HttpStatus.OK); try { when(serviceSwitch.getPortFlows(TestSwitchMock.SWITCH_ID, TestSwitchMock.PORT, TestFlowMock.CONTROLLER_FLAG)).thenReturn(responseList); mockMvc.perform(get("/api/switch/{switchId}/flows",... | @RequestMapping(path = "/{switchId}/flows", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) public @ResponseBody ResponseEntity<List<?>> getPortFlows(@PathVariable final String switchId, @RequestParam(value = "port", required = false) final String port, @RequestParam(value = "inventory", required = false) fi... | SwitchController { @RequestMapping(path = "/{switchId}/flows", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) public @ResponseBody ResponseEntity<List<?>> getPortFlows(@PathVariable final String switchId, @RequestParam(value = "port", required = false) final String port, @RequestParam(value = "inventory", r... | SwitchController { @RequestMapping(path = "/{switchId}/flows", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) public @ResponseBody ResponseEntity<List<?>> getPortFlows(@PathVariable final String switchId, @RequestParam(value = "port", required = false) final String port, @RequestParam(value = "inventory", r... | SwitchController { @RequestMapping(path = "/{switchId}/flows", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) public @ResponseBody ResponseEntity<List<?>> getPortFlows(@PathVariable final String switchId, @RequestParam(value = "port", required = false) final String port, @RequestParam(value = "inventory", r... | SwitchController { @RequestMapping(path = "/{switchId}/flows", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) public @ResponseBody ResponseEntity<List<?>> getPortFlows(@PathVariable final String switchId, @RequestParam(value = "port", required = false) final String port, @RequestParam(value = "inventory", r... |
@Test public void testDeleteSwitch() { SwitchInfo switcheInfo = new SwitchInfo(); try { when(serviceSwitch.deleteSwitch(TestSwitchMock.SWITCH_ID, false)).thenReturn(switcheInfo); mockMvc.perform(delete("/api/switch/{switchId}", TestSwitchMock.SWITCH_ID, true) .contentType(MediaType.APPLICATION_JSON)) .andExpect(status(... | @RequestMapping(value = "/{switchId}", method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.SW_SWITCH_DELETE }) public @ResponseBody SwitchInfo deleteSwitch(@PathVariable final String switchId, @RequestParam(name = "force", required = false) boolean force) { activi... | SwitchController { @RequestMapping(value = "/{switchId}", method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.SW_SWITCH_DELETE }) public @ResponseBody SwitchInfo deleteSwitch(@PathVariable final String switchId, @RequestParam(name = "force", required = false) bool... | SwitchController { @RequestMapping(value = "/{switchId}", method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.SW_SWITCH_DELETE }) public @ResponseBody SwitchInfo deleteSwitch(@PathVariable final String switchId, @RequestParam(name = "force", required = false) bool... | SwitchController { @RequestMapping(value = "/{switchId}", method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.SW_SWITCH_DELETE }) public @ResponseBody SwitchInfo deleteSwitch(@PathVariable final String switchId, @RequestParam(name = "force", required = false) bool... | SwitchController { @RequestMapping(value = "/{switchId}", method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.SW_SWITCH_DELETE }) public @ResponseBody SwitchInfo deleteSwitch(@PathVariable final String switchId, @RequestParam(name = "force", required = false) bool... |
@Test public void testDeleteIsl() throws Exception { LinkParametersDto linkParametersDto = new LinkParametersDto(); linkParametersDto.setSrcPort(Integer.valueOf(TestIslMock.SRC_PORT)); linkParametersDto.setSrcSwitch(TestIslMock.SRC_SWITCH); linkParametersDto.setDstPort(Integer.valueOf(TestIslMock.DST_PORT)); linkParame... | @RequestMapping(value = "/links", method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.ISL_DELETE_LINK }) public @ResponseBody List<IslLinkInfo> deleteIsl(@RequestBody final LinkParametersDto linkParametersDto) { Long userId = null; if (serverContext.getRequestCont... | SwitchController { @RequestMapping(value = "/links", method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.ISL_DELETE_LINK }) public @ResponseBody List<IslLinkInfo> deleteIsl(@RequestBody final LinkParametersDto linkParametersDto) { Long userId = null; if (serverCon... | SwitchController { @RequestMapping(value = "/links", method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.ISL_DELETE_LINK }) public @ResponseBody List<IslLinkInfo> deleteIsl(@RequestBody final LinkParametersDto linkParametersDto) { Long userId = null; if (serverCon... | SwitchController { @RequestMapping(value = "/links", method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.ISL_DELETE_LINK }) public @ResponseBody List<IslLinkInfo> deleteIsl(@RequestBody final LinkParametersDto linkParametersDto) { Long userId = null; if (serverCon... | SwitchController { @RequestMapping(value = "/links", method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.ISL_DELETE_LINK }) public @ResponseBody List<IslLinkInfo> deleteIsl(@RequestBody final LinkParametersDto linkParametersDto) { Long userId = null; if (serverCon... |
@Test public void testUpdateSwitchPortProperty() throws Exception { try { SwitchProperty switchProperty = new SwitchProperty(); switchProperty.setDiscoveryEnabled(true); String inputJson = mapToJson(switchProperty); MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders .put("/api/switch/{switchId}/ports/{port}/p... | @RequestMapping(value = "/{switchId}/ports/{port}/properties", method = RequestMethod.PUT) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.SW_UPDATE_PORT_PROPERTIES }) public @ResponseBody SwitchProperty updateSwitchPortProperty(@PathVariable final String switchId, @PathVariable final Strin... | SwitchController { @RequestMapping(value = "/{switchId}/ports/{port}/properties", method = RequestMethod.PUT) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.SW_UPDATE_PORT_PROPERTIES }) public @ResponseBody SwitchProperty updateSwitchPortProperty(@PathVariable final String switchId, @PathV... | SwitchController { @RequestMapping(value = "/{switchId}/ports/{port}/properties", method = RequestMethod.PUT) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.SW_UPDATE_PORT_PROPERTIES }) public @ResponseBody SwitchProperty updateSwitchPortProperty(@PathVariable final String switchId, @PathV... | SwitchController { @RequestMapping(value = "/{switchId}/ports/{port}/properties", method = RequestMethod.PUT) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.SW_UPDATE_PORT_PROPERTIES }) public @ResponseBody SwitchProperty updateSwitchPortProperty(@PathVariable final String switchId, @PathV... | SwitchController { @RequestMapping(value = "/{switchId}/ports/{port}/properties", method = RequestMethod.PUT) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.SW_UPDATE_PORT_PROPERTIES }) public @ResponseBody SwitchProperty updateSwitchPortProperty(@PathVariable final String switchId, @PathV... |
@Test public void testGetSwitchPortProperties() { SwitchProperty switchProperty = new SwitchProperty(); try { when(serviceSwitch.getSwitchPortProperty(TestSwitchMock.SWITCH_ID, TestSwitchMock.PORT)) .thenReturn(switchProperty); mockMvc.perform(get("/api/switch/{switchId}/ports/{port}/properties", TestSwitchMock.SWITCH_... | @RequestMapping(value = "/{switchId}/ports/{port}/properties", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) public @ResponseBody SwitchProperty getSwitchPortProperty(@PathVariable final String switchId, @PathVariable final String port) { return serviceSwitch.getSwitchPortProperty(switchId, port); } | SwitchController { @RequestMapping(value = "/{switchId}/ports/{port}/properties", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) public @ResponseBody SwitchProperty getSwitchPortProperty(@PathVariable final String switchId, @PathVariable final String port) { return serviceSwitch.getSwitchPortProperty(switch... | SwitchController { @RequestMapping(value = "/{switchId}/ports/{port}/properties", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) public @ResponseBody SwitchProperty getSwitchPortProperty(@PathVariable final String switchId, @PathVariable final String port) { return serviceSwitch.getSwitchPortProperty(switch... | SwitchController { @RequestMapping(value = "/{switchId}/ports/{port}/properties", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) public @ResponseBody SwitchProperty getSwitchPortProperty(@PathVariable final String switchId, @PathVariable final String port) { return serviceSwitch.getSwitchPortProperty(switch... | SwitchController { @RequestMapping(value = "/{switchId}/ports/{port}/properties", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) public @ResponseBody SwitchProperty getSwitchPortProperty(@PathVariable final String switchId, @PathVariable final String port) { return serviceSwitch.getSwitchPortProperty(switch... |
@Test public void testGetFlowStats() throws Exception { try { mockMvc.perform( get("/api/stats/flowid/{flowId}/{startDate}/{endDate}/{downsample}/{metric}", TestMockStats.FLOW_ID, TestMockStats.START_DATE, TestMockStats.END_DATE, TestMockStats.DOWNSAMPLE, TestMockStats.METRIC_BITS, TestMockStats.DIRECTION_FORWARD) .con... | @RequestMapping(value = "flowid/{flowid}/{startDate}/{endDate}/{downsample}/{metric}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.MENU_FLOWS }) @ResponseBody public String getFlowStats(@PathVariable String flowid,... | StatsController { @RequestMapping(value = "flowid/{flowid}/{startDate}/{endDate}/{downsample}/{metric}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.MENU_FLOWS }) @ResponseBody public String getFlowStats(@PathVaria... | StatsController { @RequestMapping(value = "flowid/{flowid}/{startDate}/{endDate}/{downsample}/{metric}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.MENU_FLOWS }) @ResponseBody public String getFlowStats(@PathVaria... | StatsController { @RequestMapping(value = "flowid/{flowid}/{startDate}/{endDate}/{downsample}/{metric}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.MENU_FLOWS }) @ResponseBody public String getFlowStats(@PathVaria... | StatsController { @RequestMapping(value = "flowid/{flowid}/{startDate}/{endDate}/{downsample}/{metric}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.OK) @Permissions(values = { IConstants.Permission.MENU_FLOWS }) @ResponseBody public String getFlowStats(@PathVaria... |
@Test public void errorDetection() throws Exception { Future promise = mock(Future.class); final ExecutionException error = new ExecutionException("Emulate kafka send error", new IOException()); expect(promise.get()).andThrow(error).anyTimes(); replay(promise); expect(kafkaProducer.send(anyObject(), anyObject(Callback.... | public SendStatus sendMessage(String topic, Message message) { SendStatus sendStatus = produce(encode(topic, message), null); return sendStatus; } | KafkaProducerService implements IKafkaProducerService { public SendStatus sendMessage(String topic, Message message) { SendStatus sendStatus = produce(encode(topic, message), null); return sendStatus; } } | KafkaProducerService implements IKafkaProducerService { public SendStatus sendMessage(String topic, Message message) { SendStatus sendStatus = produce(encode(topic, message), null); return sendStatus; } } | KafkaProducerService implements IKafkaProducerService { public SendStatus sendMessage(String topic, Message message) { SendStatus sendStatus = produce(encode(topic, message), null); return sendStatus; } @Override void setup(FloodlightModuleContext moduleContext); void sendMessageAndTrack(String topic, Message message)... | KafkaProducerService implements IKafkaProducerService { public SendStatus sendMessage(String topic, Message message) { SendStatus sendStatus = produce(encode(topic, message), null); return sendStatus; } @Override void setup(FloodlightModuleContext moduleContext); void sendMessageAndTrack(String topic, Message message)... |
@Test public void addWatch() { WatcherService w = new WatcherService(carrier, 10); w.addWatch(new SwitchId(1), 1, 1); w.addWatch(new SwitchId(1), 2, 1); w.addWatch(new SwitchId(2), 1, 2); w.addWatch(new SwitchId(2), 1, 2); w.addWatch(new SwitchId(2), 2, 3); assertThat(w.getConfirmations().size(), is(0)); assertThat(w.g... | public void addWatch(SwitchId switchId, int portNo, long currentTime) { Packet packet = Packet.of(switchId, portNo, packetNo); timeouts.computeIfAbsent(currentTime + awaitTime, mappingFunction -> new HashSet<>()) .add(packet); carrier.sendDiscovery(switchId, portNo, packetNo, currentTime); packetNo += 1; } | WatcherService { public void addWatch(SwitchId switchId, int portNo, long currentTime) { Packet packet = Packet.of(switchId, portNo, packetNo); timeouts.computeIfAbsent(currentTime + awaitTime, mappingFunction -> new HashSet<>()) .add(packet); carrier.sendDiscovery(switchId, portNo, packetNo, currentTime); packetNo += ... | WatcherService { public void addWatch(SwitchId switchId, int portNo, long currentTime) { Packet packet = Packet.of(switchId, portNo, packetNo); timeouts.computeIfAbsent(currentTime + awaitTime, mappingFunction -> new HashSet<>()) .add(packet); carrier.sendDiscovery(switchId, portNo, packetNo, currentTime); packetNo += ... | WatcherService { public void addWatch(SwitchId switchId, int portNo, long currentTime) { Packet packet = Packet.of(switchId, portNo, packetNo); timeouts.computeIfAbsent(currentTime + awaitTime, mappingFunction -> new HashSet<>()) .add(packet); carrier.sendDiscovery(switchId, portNo, packetNo, currentTime); packetNo += ... | WatcherService { public void addWatch(SwitchId switchId, int portNo, long currentTime) { Packet packet = Packet.of(switchId, portNo, packetNo); timeouts.computeIfAbsent(currentTime + awaitTime, mappingFunction -> new HashSet<>()) .add(packet); carrier.sendDiscovery(switchId, portNo, packetNo, currentTime); packetNo += ... |
@Test public void removeWatch() { } | public void removeWatch(SwitchId switchId, int portNo) { } | WatcherService { public void removeWatch(SwitchId switchId, int portNo) { } } | WatcherService { public void removeWatch(SwitchId switchId, int portNo) { } WatcherService(IWatcherServiceCarrier carrier, long awaitTime); } | WatcherService { public void removeWatch(SwitchId switchId, int portNo) { } WatcherService(IWatcherServiceCarrier carrier, long awaitTime); void addWatch(SwitchId switchId, int portNo, long currentTime); void removeWatch(SwitchId switchId, int portNo); void tick(long tickTime); void confirmation(SwitchId switchId, int ... | WatcherService { public void removeWatch(SwitchId switchId, int portNo) { } WatcherService(IWatcherServiceCarrier carrier, long awaitTime); void addWatch(SwitchId switchId, int portNo, long currentTime); void removeWatch(SwitchId switchId, int portNo); void tick(long tickTime); void confirmation(SwitchId switchId, int ... |
@Test public void tick() { WatcherService w = new WatcherService(carrier, 10); w.addWatch(new SwitchId(1), 1, 1); w.addWatch(new SwitchId(1), 2, 1); w.addWatch(new SwitchId(2), 1, 2); w.addWatch(new SwitchId(2), 1, 2); w.addWatch(new SwitchId(2), 2, 3); assertThat(w.getConfirmations().size(), is(0)); assertThat(w.getTi... | public void tick(long tickTime) { SortedMap<Long, Set<Packet>> range = timeouts.subMap(0L, tickTime + 1); if (!range.isEmpty()) { for (Set<Packet> e : range.values()) { for (Packet ee : e) { if (confirmations.remove(ee)) { carrier.failed(ee.switchId, ee.port, tickTime); } } } range.clear(); } } | WatcherService { public void tick(long tickTime) { SortedMap<Long, Set<Packet>> range = timeouts.subMap(0L, tickTime + 1); if (!range.isEmpty()) { for (Set<Packet> e : range.values()) { for (Packet ee : e) { if (confirmations.remove(ee)) { carrier.failed(ee.switchId, ee.port, tickTime); } } } range.clear(); } } } | WatcherService { public void tick(long tickTime) { SortedMap<Long, Set<Packet>> range = timeouts.subMap(0L, tickTime + 1); if (!range.isEmpty()) { for (Set<Packet> e : range.values()) { for (Packet ee : e) { if (confirmations.remove(ee)) { carrier.failed(ee.switchId, ee.port, tickTime); } } } range.clear(); } } Watcher... | WatcherService { public void tick(long tickTime) { SortedMap<Long, Set<Packet>> range = timeouts.subMap(0L, tickTime + 1); if (!range.isEmpty()) { for (Set<Packet> e : range.values()) { for (Packet ee : e) { if (confirmations.remove(ee)) { carrier.failed(ee.switchId, ee.port, tickTime); } } } range.clear(); } } Watcher... | WatcherService { public void tick(long tickTime) { SortedMap<Long, Set<Packet>> range = timeouts.subMap(0L, tickTime + 1); if (!range.isEmpty()) { for (Set<Packet> e : range.values()) { for (Packet ee : e) { if (confirmations.remove(ee)) { carrier.failed(ee.switchId, ee.port, tickTime); } } } range.clear(); } } Watcher... |
@Test public void discovery() { WatcherService w = new WatcherService(carrier, 10); w.addWatch(new SwitchId(1), 1, 1); w.addWatch(new SwitchId(1), 2, 1); w.addWatch(new SwitchId(2), 1, 2); w.addWatch(new SwitchId(2), 1, 2); w.addWatch(new SwitchId(2), 2, 3); assertThat(w.getConfirmations().size(), is(0)); assertThat(w.... | public void discovery(SwitchId switchId, int portNo, SwitchId endSwitchId, int endPortNo, long packetNo, long currentTime) { Packet packet = Packet.of(switchId, portNo, packetNo); confirmations.remove(packet); carrier.discovered(switchId, portNo, endSwitchId, endPortNo, currentTime); } | WatcherService { public void discovery(SwitchId switchId, int portNo, SwitchId endSwitchId, int endPortNo, long packetNo, long currentTime) { Packet packet = Packet.of(switchId, portNo, packetNo); confirmations.remove(packet); carrier.discovered(switchId, portNo, endSwitchId, endPortNo, currentTime); } } | WatcherService { public void discovery(SwitchId switchId, int portNo, SwitchId endSwitchId, int endPortNo, long packetNo, long currentTime) { Packet packet = Packet.of(switchId, portNo, packetNo); confirmations.remove(packet); carrier.discovered(switchId, portNo, endSwitchId, endPortNo, currentTime); } WatcherService(I... | WatcherService { public void discovery(SwitchId switchId, int portNo, SwitchId endSwitchId, int endPortNo, long packetNo, long currentTime) { Packet packet = Packet.of(switchId, portNo, packetNo); confirmations.remove(packet); carrier.discovered(switchId, portNo, endSwitchId, endPortNo, currentTime); } WatcherService(I... | WatcherService { public void discovery(SwitchId switchId, int portNo, SwitchId endSwitchId, int endPortNo, long packetNo, long currentTime) { Packet packet = Packet.of(switchId, portNo, packetNo); confirmations.remove(packet); carrier.discovered(switchId, portNo, endSwitchId, endPortNo, currentTime); } WatcherService(I... |
@Test public void discovered() { DecisionMakerService w = new DecisionMakerService(carrier, 10, 5); w.discovered(new SwitchId(1), 10, new SwitchId(2), 20, 1L); w.discovered(new SwitchId(2), 20, new SwitchId(3), 30, 2L); verify(carrier).discovered(eq(new SwitchId(1)), eq(10), eq(new SwitchId(2)), eq(20), anyLong()); ver... | void discovered(SwitchId switchId, int portNo, SwitchId endSwitchId, int endPortNo, long currentTime) { carrier.discovered(switchId, portNo, endSwitchId, endPortNo, currentTime); lastDiscovery.put(Endpoint.of(switchId, portNo), currentTime); } | DecisionMakerService { void discovered(SwitchId switchId, int portNo, SwitchId endSwitchId, int endPortNo, long currentTime) { carrier.discovered(switchId, portNo, endSwitchId, endPortNo, currentTime); lastDiscovery.put(Endpoint.of(switchId, portNo), currentTime); } } | DecisionMakerService { void discovered(SwitchId switchId, int portNo, SwitchId endSwitchId, int endPortNo, long currentTime) { carrier.discovered(switchId, portNo, endSwitchId, endPortNo, currentTime); lastDiscovery.put(Endpoint.of(switchId, portNo), currentTime); } DecisionMakerService(IDecisionMakerCarrier carrier, i... | DecisionMakerService { void discovered(SwitchId switchId, int portNo, SwitchId endSwitchId, int endPortNo, long currentTime) { carrier.discovered(switchId, portNo, endSwitchId, endPortNo, currentTime); lastDiscovery.put(Endpoint.of(switchId, portNo), currentTime); } DecisionMakerService(IDecisionMakerCarrier carrier, i... | DecisionMakerService { void discovered(SwitchId switchId, int portNo, SwitchId endSwitchId, int endPortNo, long currentTime) { carrier.discovered(switchId, portNo, endSwitchId, endPortNo, currentTime); lastDiscovery.put(Endpoint.of(switchId, portNo), currentTime); } DecisionMakerService(IDecisionMakerCarrier carrier, i... |
@Test public void failed() { DecisionMakerService w = new DecisionMakerService(carrier, 10, 5); w.failed(new SwitchId(1), 10, 0); w.failed(new SwitchId(1), 10, 1); w.failed(new SwitchId(1), 10, 11); w.failed(new SwitchId(1), 10, 12); verify(carrier, times(2)).failed(eq(new SwitchId(1)), eq(10), anyLong()); w.discovered... | void failed(SwitchId switchId, int portNo, long currentTime) { Endpoint endpoint = Endpoint.of(switchId, portNo); if (!lastDiscovery.containsKey(endpoint)) { lastDiscovery.put(endpoint, currentTime - awaitTime); } long timeWindow = lastDiscovery.get(endpoint) + failTimeout; if (currentTime >= timeWindow) { carrier.fail... | DecisionMakerService { void failed(SwitchId switchId, int portNo, long currentTime) { Endpoint endpoint = Endpoint.of(switchId, portNo); if (!lastDiscovery.containsKey(endpoint)) { lastDiscovery.put(endpoint, currentTime - awaitTime); } long timeWindow = lastDiscovery.get(endpoint) + failTimeout; if (currentTime >= tim... | DecisionMakerService { void failed(SwitchId switchId, int portNo, long currentTime) { Endpoint endpoint = Endpoint.of(switchId, portNo); if (!lastDiscovery.containsKey(endpoint)) { lastDiscovery.put(endpoint, currentTime - awaitTime); } long timeWindow = lastDiscovery.get(endpoint) + failTimeout; if (currentTime >= tim... | DecisionMakerService { void failed(SwitchId switchId, int portNo, long currentTime) { Endpoint endpoint = Endpoint.of(switchId, portNo); if (!lastDiscovery.containsKey(endpoint)) { lastDiscovery.put(endpoint, currentTime - awaitTime); } long timeWindow = lastDiscovery.get(endpoint) + failTimeout; if (currentTime >= tim... | DecisionMakerService { void failed(SwitchId switchId, int portNo, long currentTime) { Endpoint endpoint = Endpoint.of(switchId, portNo); if (!lastDiscovery.containsKey(endpoint)) { lastDiscovery.put(endpoint, currentTime - awaitTime); } long timeWindow = lastDiscovery.get(endpoint) + failTimeout; if (currentTime >= tim... |
@Test public void positive() throws Exception { IOFSwitch sw = createMock(IOFSwitch.class); setupSwitchMock(sw, dpId); swWriteAlwaysSuccess(sw); doneWithSetUp(sw); CompletableFuture<Optional<OFMessage>> future; OFPacketOut pktOut = makePacketOut(sw.getOFFactory(), 1); try (Session session = subject.open(context, sw)) {... | public Session open(IOFSwitch sw) { return open(new MessageContext(), sw); } | SessionService implements IService, IInputTranslator { public Session open(IOFSwitch sw) { return open(new MessageContext(), sw); } } | SessionService implements IService, IInputTranslator { public Session open(IOFSwitch sw) { return open(new MessageContext(), sw); } } | SessionService implements IService, IInputTranslator { public Session open(IOFSwitch sw) { return open(new MessageContext(), sw); } Session open(IOFSwitch sw); Session open(MessageContext context, IOFSwitch sw); @Override void setup(FloodlightModuleContext moduleContext); @Override Command makeCommand(CommandContext c... | SessionService implements IService, IInputTranslator { public Session open(IOFSwitch sw) { return open(new MessageContext(), sw); } Session open(IOFSwitch sw); Session open(MessageContext context, IOFSwitch sw); @Override void setup(FloodlightModuleContext moduleContext); @Override Command makeCommand(CommandContext c... |
@Test public void switchWriteError() throws Throwable { IOFSwitch sw = createMock(IOFSwitch.class); setupSwitchMock(sw, dpId); swWriteSecondFail(sw); doneWithSetUp(sw); OFFactory ofFactory = sw.getOFFactory(); CompletableFuture<Optional<OFMessage>> future = null; try (Session session = subject.open(context, sw)) { sess... | public Session open(IOFSwitch sw) { return open(new MessageContext(), sw); } | SessionService implements IService, IInputTranslator { public Session open(IOFSwitch sw) { return open(new MessageContext(), sw); } } | SessionService implements IService, IInputTranslator { public Session open(IOFSwitch sw) { return open(new MessageContext(), sw); } } | SessionService implements IService, IInputTranslator { public Session open(IOFSwitch sw) { return open(new MessageContext(), sw); } Session open(IOFSwitch sw); Session open(MessageContext context, IOFSwitch sw); @Override void setup(FloodlightModuleContext moduleContext); @Override Command makeCommand(CommandContext c... | SessionService implements IService, IInputTranslator { public Session open(IOFSwitch sw) { return open(new MessageContext(), sw); } Session open(IOFSwitch sw); Session open(MessageContext context, IOFSwitch sw); @Override void setup(FloodlightModuleContext moduleContext); @Override Command makeCommand(CommandContext c... |
@Test public void sessionBarrierWriteError() throws Exception { IOFSwitch sw = createMock(IOFSwitch.class); setupSwitchMock(sw, dpId); swWriteSecondFail(sw); doneWithSetUp(sw); CompletableFuture<Optional<OFMessage>> future = null; try (Session session = subject.open(context, sw)) { future = session.write(makePacketOut(... | public Session open(IOFSwitch sw) { return open(new MessageContext(), sw); } | SessionService implements IService, IInputTranslator { public Session open(IOFSwitch sw) { return open(new MessageContext(), sw); } } | SessionService implements IService, IInputTranslator { public Session open(IOFSwitch sw) { return open(new MessageContext(), sw); } } | SessionService implements IService, IInputTranslator { public Session open(IOFSwitch sw) { return open(new MessageContext(), sw); } Session open(IOFSwitch sw); Session open(MessageContext context, IOFSwitch sw); @Override void setup(FloodlightModuleContext moduleContext); @Override Command makeCommand(CommandContext c... | SessionService implements IService, IInputTranslator { public Session open(IOFSwitch sw) { return open(new MessageContext(), sw); } Session open(IOFSwitch sw); Session open(MessageContext context, IOFSwitch sw); @Override void setup(FloodlightModuleContext moduleContext); @Override Command makeCommand(CommandContext c... |
@Test public void deserializeLldpTest() { Ethernet ethernet = buildEthernet(srcAndDstMacAddresses, ethTypeToByteArray(EthType.LLDP), LldpPacketTest.packet); LldpPacketData data = service.deserializeLldp(ethernet, null, 0); assertNotNull(data); assertTrue(data.getVlans().isEmpty()); assertEquals(LldpPacketTest.buildLldp... | @VisibleForTesting LldpPacketData deserializeLldp(Ethernet eth, SwitchId switchId, long cookie) { try { List<Integer> vlans = new ArrayList<>(); IPacket payload = EthernetPacketToolbox.extractPayload(eth, vlans); if (payload instanceof LLDP) { LldpPacket lldpPacket = new LldpPacket((LLDP) payload); return new LldpPacke... | ConnectedDevicesService implements IService, IInputTranslator { @VisibleForTesting LldpPacketData deserializeLldp(Ethernet eth, SwitchId switchId, long cookie) { try { List<Integer> vlans = new ArrayList<>(); IPacket payload = EthernetPacketToolbox.extractPayload(eth, vlans); if (payload instanceof LLDP) { LldpPacket l... | ConnectedDevicesService implements IService, IInputTranslator { @VisibleForTesting LldpPacketData deserializeLldp(Ethernet eth, SwitchId switchId, long cookie) { try { List<Integer> vlans = new ArrayList<>(); IPacket payload = EthernetPacketToolbox.extractPayload(eth, vlans); if (payload instanceof LLDP) { LldpPacket l... | ConnectedDevicesService implements IService, IInputTranslator { @VisibleForTesting LldpPacketData deserializeLldp(Ethernet eth, SwitchId switchId, long cookie) { try { List<Integer> vlans = new ArrayList<>(); IPacket payload = EthernetPacketToolbox.extractPayload(eth, vlans); if (payload instanceof LLDP) { LldpPacket l... | ConnectedDevicesService implements IService, IInputTranslator { @VisibleForTesting LldpPacketData deserializeLldp(Ethernet eth, SwitchId switchId, long cookie) { try { List<Integer> vlans = new ArrayList<>(); IPacket payload = EthernetPacketToolbox.extractPayload(eth, vlans); if (payload instanceof LLDP) { LldpPacket l... |
@Test public void deserializeLldpWithVlanTest() { short vlan = 1234; Ethernet ethernet = buildEthernet(srcAndDstMacAddresses, ethTypeToByteArray(EthType.VLAN_FRAME), shortToByteArray(vlan), ethTypeToByteArray(EthType.LLDP), LldpPacketTest.packet); LldpPacketData data = service.deserializeLldp(ethernet, null, 0); assert... | @VisibleForTesting LldpPacketData deserializeLldp(Ethernet eth, SwitchId switchId, long cookie) { try { List<Integer> vlans = new ArrayList<>(); IPacket payload = EthernetPacketToolbox.extractPayload(eth, vlans); if (payload instanceof LLDP) { LldpPacket lldpPacket = new LldpPacket((LLDP) payload); return new LldpPacke... | ConnectedDevicesService implements IService, IInputTranslator { @VisibleForTesting LldpPacketData deserializeLldp(Ethernet eth, SwitchId switchId, long cookie) { try { List<Integer> vlans = new ArrayList<>(); IPacket payload = EthernetPacketToolbox.extractPayload(eth, vlans); if (payload instanceof LLDP) { LldpPacket l... | ConnectedDevicesService implements IService, IInputTranslator { @VisibleForTesting LldpPacketData deserializeLldp(Ethernet eth, SwitchId switchId, long cookie) { try { List<Integer> vlans = new ArrayList<>(); IPacket payload = EthernetPacketToolbox.extractPayload(eth, vlans); if (payload instanceof LLDP) { LldpPacket l... | ConnectedDevicesService implements IService, IInputTranslator { @VisibleForTesting LldpPacketData deserializeLldp(Ethernet eth, SwitchId switchId, long cookie) { try { List<Integer> vlans = new ArrayList<>(); IPacket payload = EthernetPacketToolbox.extractPayload(eth, vlans); if (payload instanceof LLDP) { LldpPacket l... | ConnectedDevicesService implements IService, IInputTranslator { @VisibleForTesting LldpPacketData deserializeLldp(Ethernet eth, SwitchId switchId, long cookie) { try { List<Integer> vlans = new ArrayList<>(); IPacket payload = EthernetPacketToolbox.extractPayload(eth, vlans); if (payload instanceof LLDP) { LldpPacket l... |
@Test public void deserializeLldpWithTwoVlanTest() { short innerVlan = 1234; short outerVlan = 2345; Ethernet ethernet = buildEthernet(srcAndDstMacAddresses, ethTypeToByteArray(EthType.VLAN_FRAME), shortToByteArray(outerVlan), ethTypeToByteArray(EthType.VLAN_FRAME), shortToByteArray(innerVlan), ethTypeToByteArray(EthTy... | @VisibleForTesting LldpPacketData deserializeLldp(Ethernet eth, SwitchId switchId, long cookie) { try { List<Integer> vlans = new ArrayList<>(); IPacket payload = EthernetPacketToolbox.extractPayload(eth, vlans); if (payload instanceof LLDP) { LldpPacket lldpPacket = new LldpPacket((LLDP) payload); return new LldpPacke... | ConnectedDevicesService implements IService, IInputTranslator { @VisibleForTesting LldpPacketData deserializeLldp(Ethernet eth, SwitchId switchId, long cookie) { try { List<Integer> vlans = new ArrayList<>(); IPacket payload = EthernetPacketToolbox.extractPayload(eth, vlans); if (payload instanceof LLDP) { LldpPacket l... | ConnectedDevicesService implements IService, IInputTranslator { @VisibleForTesting LldpPacketData deserializeLldp(Ethernet eth, SwitchId switchId, long cookie) { try { List<Integer> vlans = new ArrayList<>(); IPacket payload = EthernetPacketToolbox.extractPayload(eth, vlans); if (payload instanceof LLDP) { LldpPacket l... | ConnectedDevicesService implements IService, IInputTranslator { @VisibleForTesting LldpPacketData deserializeLldp(Ethernet eth, SwitchId switchId, long cookie) { try { List<Integer> vlans = new ArrayList<>(); IPacket payload = EthernetPacketToolbox.extractPayload(eth, vlans); if (payload instanceof LLDP) { LldpPacket l... | ConnectedDevicesService implements IService, IInputTranslator { @VisibleForTesting LldpPacketData deserializeLldp(Ethernet eth, SwitchId switchId, long cookie) { try { List<Integer> vlans = new ArrayList<>(); IPacket payload = EthernetPacketToolbox.extractPayload(eth, vlans); if (payload instanceof LLDP) { LldpPacket l... |
@Test public void deserializeLldpWithQinQVlansTest() { short vlan1 = 1234; short vlan2 = 2345; short vlan3 = 4000; Ethernet ethernet = buildEthernet(srcAndDstMacAddresses, ethTypeToByteArray(EthType.Q_IN_Q), shortToByteArray(vlan1), ethTypeToByteArray(EthType.BRIDGING), shortToByteArray(vlan2), ethTypeToByteArray(EthTy... | @VisibleForTesting LldpPacketData deserializeLldp(Ethernet eth, SwitchId switchId, long cookie) { try { List<Integer> vlans = new ArrayList<>(); IPacket payload = EthernetPacketToolbox.extractPayload(eth, vlans); if (payload instanceof LLDP) { LldpPacket lldpPacket = new LldpPacket((LLDP) payload); return new LldpPacke... | ConnectedDevicesService implements IService, IInputTranslator { @VisibleForTesting LldpPacketData deserializeLldp(Ethernet eth, SwitchId switchId, long cookie) { try { List<Integer> vlans = new ArrayList<>(); IPacket payload = EthernetPacketToolbox.extractPayload(eth, vlans); if (payload instanceof LLDP) { LldpPacket l... | ConnectedDevicesService implements IService, IInputTranslator { @VisibleForTesting LldpPacketData deserializeLldp(Ethernet eth, SwitchId switchId, long cookie) { try { List<Integer> vlans = new ArrayList<>(); IPacket payload = EthernetPacketToolbox.extractPayload(eth, vlans); if (payload instanceof LLDP) { LldpPacket l... | ConnectedDevicesService implements IService, IInputTranslator { @VisibleForTesting LldpPacketData deserializeLldp(Ethernet eth, SwitchId switchId, long cookie) { try { List<Integer> vlans = new ArrayList<>(); IPacket payload = EthernetPacketToolbox.extractPayload(eth, vlans); if (payload instanceof LLDP) { LldpPacket l... | ConnectedDevicesService implements IService, IInputTranslator { @VisibleForTesting LldpPacketData deserializeLldp(Ethernet eth, SwitchId switchId, long cookie) { try { List<Integer> vlans = new ArrayList<>(); IPacket payload = EthernetPacketToolbox.extractPayload(eth, vlans); if (payload instanceof LLDP) { LldpPacket l... |
@Test public void deserializeArpTest() throws PacketParsingException { Ethernet ethernet = buildEthernet(srcAndDstMacAddresses, ethTypeToByteArray(EthType.ARP), arpPacket); ArpPacketData data = service.deserializeArp(ethernet, null, 0); assertNotNull(data); assertTrue(data.getVlans().isEmpty()); assertEquals(buildArpPa... | @VisibleForTesting ArpPacketData deserializeArp(Ethernet eth, SwitchId switchId, long cookie) { try { List<Integer> vlans = new ArrayList<>(); IPacket payload = EthernetPacketToolbox.extractPayload(eth, vlans); if (payload instanceof ARP) { return new ArpPacketData((ARP) payload, vlans); } } catch (Exception exception)... | ConnectedDevicesService implements IService, IInputTranslator { @VisibleForTesting ArpPacketData deserializeArp(Ethernet eth, SwitchId switchId, long cookie) { try { List<Integer> vlans = new ArrayList<>(); IPacket payload = EthernetPacketToolbox.extractPayload(eth, vlans); if (payload instanceof ARP) { return new ArpP... | ConnectedDevicesService implements IService, IInputTranslator { @VisibleForTesting ArpPacketData deserializeArp(Ethernet eth, SwitchId switchId, long cookie) { try { List<Integer> vlans = new ArrayList<>(); IPacket payload = EthernetPacketToolbox.extractPayload(eth, vlans); if (payload instanceof ARP) { return new ArpP... | ConnectedDevicesService implements IService, IInputTranslator { @VisibleForTesting ArpPacketData deserializeArp(Ethernet eth, SwitchId switchId, long cookie) { try { List<Integer> vlans = new ArrayList<>(); IPacket payload = EthernetPacketToolbox.extractPayload(eth, vlans); if (payload instanceof ARP) { return new ArpP... | ConnectedDevicesService implements IService, IInputTranslator { @VisibleForTesting ArpPacketData deserializeArp(Ethernet eth, SwitchId switchId, long cookie) { try { List<Integer> vlans = new ArrayList<>(); IPacket payload = EthernetPacketToolbox.extractPayload(eth, vlans); if (payload instanceof ARP) { return new ArpP... |
@Test(expected = IllegalSwitchPropertiesException.class) public void shouldValidateMultiTableFlagWhenUpdatingSwitchPropertiesWithArp() { Switch sw = Switch.builder().switchId(TEST_SWITCH_ID).status(SwitchStatus.ACTIVE).build(); switchRepository.add(sw); createSwitchProperties(sw, Collections.singleton(FlowEncapsulation... | public SwitchPropertiesDto updateSwitchProperties(SwitchId switchId, SwitchPropertiesDto switchPropertiesDto) { if (isEmpty(switchPropertiesDto.getSupportedTransitEncapsulation())) { throw new IllegalSwitchPropertiesException("Supported transit encapsulations should not be null or empty"); } SwitchProperties update = S... | SwitchOperationsService implements ILinkOperationsServiceCarrier { public SwitchPropertiesDto updateSwitchProperties(SwitchId switchId, SwitchPropertiesDto switchPropertiesDto) { if (isEmpty(switchPropertiesDto.getSupportedTransitEncapsulation())) { throw new IllegalSwitchPropertiesException("Supported transit encapsul... | SwitchOperationsService implements ILinkOperationsServiceCarrier { public SwitchPropertiesDto updateSwitchProperties(SwitchId switchId, SwitchPropertiesDto switchPropertiesDto) { if (isEmpty(switchPropertiesDto.getSupportedTransitEncapsulation())) { throw new IllegalSwitchPropertiesException("Supported transit encapsul... | SwitchOperationsService implements ILinkOperationsServiceCarrier { public SwitchPropertiesDto updateSwitchProperties(SwitchId switchId, SwitchPropertiesDto switchPropertiesDto) { if (isEmpty(switchPropertiesDto.getSupportedTransitEncapsulation())) { throw new IllegalSwitchPropertiesException("Supported transit encapsul... | SwitchOperationsService implements ILinkOperationsServiceCarrier { public SwitchPropertiesDto updateSwitchProperties(SwitchId switchId, SwitchPropertiesDto switchPropertiesDto) { if (isEmpty(switchPropertiesDto.getSupportedTransitEncapsulation())) { throw new IllegalSwitchPropertiesException("Supported transit encapsul... |
@Test public void deserializeArpWithVlanTest() throws PacketParsingException { short vlan = 1234; Ethernet ethernet = buildEthernet(srcAndDstMacAddresses, ethTypeToByteArray(EthType.VLAN_FRAME), shortToByteArray(vlan), ethTypeToByteArray(EthType.ARP), arpPacket); ArpPacketData data = service.deserializeArp(ethernet, nu... | @VisibleForTesting ArpPacketData deserializeArp(Ethernet eth, SwitchId switchId, long cookie) { try { List<Integer> vlans = new ArrayList<>(); IPacket payload = EthernetPacketToolbox.extractPayload(eth, vlans); if (payload instanceof ARP) { return new ArpPacketData((ARP) payload, vlans); } } catch (Exception exception)... | ConnectedDevicesService implements IService, IInputTranslator { @VisibleForTesting ArpPacketData deserializeArp(Ethernet eth, SwitchId switchId, long cookie) { try { List<Integer> vlans = new ArrayList<>(); IPacket payload = EthernetPacketToolbox.extractPayload(eth, vlans); if (payload instanceof ARP) { return new ArpP... | ConnectedDevicesService implements IService, IInputTranslator { @VisibleForTesting ArpPacketData deserializeArp(Ethernet eth, SwitchId switchId, long cookie) { try { List<Integer> vlans = new ArrayList<>(); IPacket payload = EthernetPacketToolbox.extractPayload(eth, vlans); if (payload instanceof ARP) { return new ArpP... | ConnectedDevicesService implements IService, IInputTranslator { @VisibleForTesting ArpPacketData deserializeArp(Ethernet eth, SwitchId switchId, long cookie) { try { List<Integer> vlans = new ArrayList<>(); IPacket payload = EthernetPacketToolbox.extractPayload(eth, vlans); if (payload instanceof ARP) { return new ArpP... | ConnectedDevicesService implements IService, IInputTranslator { @VisibleForTesting ArpPacketData deserializeArp(Ethernet eth, SwitchId switchId, long cookie) { try { List<Integer> vlans = new ArrayList<>(); IPacket payload = EthernetPacketToolbox.extractPayload(eth, vlans); if (payload instanceof ARP) { return new ArpP... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.