Search in sources :

Example 1 with LldpPostIngressVxlanRuleGenerator

use of org.openkilda.rulemanager.factory.generator.service.lldp.LldpPostIngressVxlanRuleGenerator in project open-kilda by telstra.

the class RuleManagerServiceRulesTest method shouldUseCorrectServiceRuleGeneratorsForSwitchInMultiTableModeWithSwitchArpAndLldp.

@Test
public void shouldUseCorrectServiceRuleGeneratorsForSwitchInMultiTableModeWithSwitchArpAndLldp() {
    Switch sw = buildSwitch("OF_13", Collections.emptySet());
    SwitchId switchId = sw.getSwitchId();
    SwitchProperties switchProperties = buildSwitchProperties(sw, true, true, true);
    List<RuleGenerator> generators = ruleManager.getServiceRuleGenerators(switchId, buildAdapter(switchId, switchProperties, new HashSet<>(), false));
    assertEquals(24, generators.size());
    assertTrue(generators.stream().anyMatch(g -> g instanceof BroadCastDiscoveryRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof UniCastDiscoveryRuleGenerator));
    assertEquals(4, generators.stream().filter(g -> g instanceof TableDefaultRuleGenerator).count());
    assertEquals(2, generators.stream().filter(g -> g instanceof TablePassThroughDefaultRuleGenerator).count());
    assertTrue(generators.stream().anyMatch(g -> g instanceof LldpPostIngressRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof LldpPostIngressVxlanRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof LldpPostIngressOneSwitchRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof ArpPostIngressRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof ArpPostIngressVxlanRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof ArpPostIngressOneSwitchRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof LldpTransitRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof LldpInputPreDropRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof LldpIngressRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof ArpTransitRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof ArpInputPreDropRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof ArpIngressRuleGenerator));
}
Also used : LldpPostIngressOneSwitchRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpPostIngressOneSwitchRuleGenerator) UniCastDiscoveryRuleGenerator(org.openkilda.rulemanager.factory.generator.service.UniCastDiscoveryRuleGenerator) InMemoryDataAdapter(org.openkilda.rulemanager.adapter.InMemoryDataAdapter) LldpPostIngressVxlanRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpPostIngressVxlanRuleGenerator) ArpTransitRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpTransitRuleGenerator) Utils.buildSwitchProperties(org.openkilda.rulemanager.Utils.buildSwitchProperties) Server42IslRttOutputRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42IslRttOutputRuleGenerator) KildaFeatureToggles(org.openkilda.model.KildaFeatureToggles) Map(java.util.Map) Utils.buildSwitch(org.openkilda.rulemanager.Utils.buildSwitch) LldpTransitRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpTransitRuleGenerator) SwitchProperties(org.openkilda.model.SwitchProperties) ArpPostIngressRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpPostIngressRuleGenerator) BfdCatchRuleGenerator(org.openkilda.rulemanager.factory.generator.service.BfdCatchRuleGenerator) Set(java.util.Set) Server42FlowRttOutputVxlanRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42FlowRttOutputVxlanRuleGenerator) Server42FlowRttOutputVlanRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42FlowRttOutputVlanRuleGenerator) Sets(com.google.common.collect.Sets) List(java.util.List) Server42FlowRttTurningRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42FlowRttTurningRuleGenerator) RoundTripLatencyRuleGenerator(org.openkilda.rulemanager.factory.generator.service.noviflow.RoundTripLatencyRuleGenerator) Mockito.mock(org.mockito.Mockito.mock) BroadCastDiscoveryRuleGenerator(org.openkilda.rulemanager.factory.generator.service.BroadCastDiscoveryRuleGenerator) ArpPostIngressVxlanRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpPostIngressVxlanRuleGenerator) HashMap(java.util.HashMap) Server42IslRttInputRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42IslRttInputRuleGenerator) HashSet(java.util.HashSet) Server42FlowRttVxlanTurningRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42FlowRttVxlanTurningRuleGenerator) ArpIngressRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpIngressRuleGenerator) RttState(org.openkilda.model.SwitchProperties.RttState) Server42IslRttTurningRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42IslRttTurningRuleGenerator) TableDefaultRuleGenerator(org.openkilda.rulemanager.factory.generator.service.TableDefaultRuleGenerator) Before(org.junit.Before) Switch(org.openkilda.model.Switch) LldpInputPreDropRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpInputPreDropRuleGenerator) DropDiscoveryLoopRuleGenerator(org.openkilda.rulemanager.factory.generator.service.DropDiscoveryLoopRuleGenerator) UnicastVerificationVxlanRuleGenerator(org.openkilda.rulemanager.factory.generator.service.UnicastVerificationVxlanRuleGenerator) ArpPostIngressOneSwitchRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpPostIngressOneSwitchRuleGenerator) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) Mockito.when(org.mockito.Mockito.when) TablePassThroughDefaultRuleGenerator(org.openkilda.rulemanager.factory.generator.service.TablePassThroughDefaultRuleGenerator) LldpIngressRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpIngressRuleGenerator) SwitchId(org.openkilda.model.SwitchId) RuleGenerator(org.openkilda.rulemanager.factory.RuleGenerator) ArpInputPreDropRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpInputPreDropRuleGenerator) LldpPostIngressRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpPostIngressRuleGenerator) Collections(java.util.Collections) Assert.assertEquals(org.junit.Assert.assertEquals) LldpInputPreDropRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpInputPreDropRuleGenerator) LldpPostIngressOneSwitchRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpPostIngressOneSwitchRuleGenerator) BroadCastDiscoveryRuleGenerator(org.openkilda.rulemanager.factory.generator.service.BroadCastDiscoveryRuleGenerator) LldpPostIngressVxlanRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpPostIngressVxlanRuleGenerator) LldpTransitRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpTransitRuleGenerator) LldpIngressRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpIngressRuleGenerator) SwitchId(org.openkilda.model.SwitchId) TableDefaultRuleGenerator(org.openkilda.rulemanager.factory.generator.service.TableDefaultRuleGenerator) ArpInputPreDropRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpInputPreDropRuleGenerator) TablePassThroughDefaultRuleGenerator(org.openkilda.rulemanager.factory.generator.service.TablePassThroughDefaultRuleGenerator) LldpPostIngressRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpPostIngressRuleGenerator) ArpIngressRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpIngressRuleGenerator) UniCastDiscoveryRuleGenerator(org.openkilda.rulemanager.factory.generator.service.UniCastDiscoveryRuleGenerator) Utils.buildSwitch(org.openkilda.rulemanager.Utils.buildSwitch) Switch(org.openkilda.model.Switch) ArpPostIngressVxlanRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpPostIngressVxlanRuleGenerator) ArpPostIngressRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpPostIngressRuleGenerator) Utils.buildSwitchProperties(org.openkilda.rulemanager.Utils.buildSwitchProperties) SwitchProperties(org.openkilda.model.SwitchProperties) LldpPostIngressOneSwitchRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpPostIngressOneSwitchRuleGenerator) UniCastDiscoveryRuleGenerator(org.openkilda.rulemanager.factory.generator.service.UniCastDiscoveryRuleGenerator) LldpPostIngressVxlanRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpPostIngressVxlanRuleGenerator) ArpTransitRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpTransitRuleGenerator) Server42IslRttOutputRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42IslRttOutputRuleGenerator) LldpTransitRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpTransitRuleGenerator) ArpPostIngressRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpPostIngressRuleGenerator) BfdCatchRuleGenerator(org.openkilda.rulemanager.factory.generator.service.BfdCatchRuleGenerator) Server42FlowRttOutputVxlanRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42FlowRttOutputVxlanRuleGenerator) Server42FlowRttOutputVlanRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42FlowRttOutputVlanRuleGenerator) Server42FlowRttTurningRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42FlowRttTurningRuleGenerator) RoundTripLatencyRuleGenerator(org.openkilda.rulemanager.factory.generator.service.noviflow.RoundTripLatencyRuleGenerator) BroadCastDiscoveryRuleGenerator(org.openkilda.rulemanager.factory.generator.service.BroadCastDiscoveryRuleGenerator) ArpPostIngressVxlanRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpPostIngressVxlanRuleGenerator) Server42IslRttInputRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42IslRttInputRuleGenerator) Server42FlowRttVxlanTurningRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42FlowRttVxlanTurningRuleGenerator) ArpIngressRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpIngressRuleGenerator) Server42IslRttTurningRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42IslRttTurningRuleGenerator) TableDefaultRuleGenerator(org.openkilda.rulemanager.factory.generator.service.TableDefaultRuleGenerator) LldpInputPreDropRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpInputPreDropRuleGenerator) DropDiscoveryLoopRuleGenerator(org.openkilda.rulemanager.factory.generator.service.DropDiscoveryLoopRuleGenerator) UnicastVerificationVxlanRuleGenerator(org.openkilda.rulemanager.factory.generator.service.UnicastVerificationVxlanRuleGenerator) ArpPostIngressOneSwitchRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpPostIngressOneSwitchRuleGenerator) TablePassThroughDefaultRuleGenerator(org.openkilda.rulemanager.factory.generator.service.TablePassThroughDefaultRuleGenerator) LldpIngressRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpIngressRuleGenerator) RuleGenerator(org.openkilda.rulemanager.factory.RuleGenerator) ArpInputPreDropRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpInputPreDropRuleGenerator) LldpPostIngressRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpPostIngressRuleGenerator) ArpPostIngressOneSwitchRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpPostIngressOneSwitchRuleGenerator) ArpTransitRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpTransitRuleGenerator) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 2 with LldpPostIngressVxlanRuleGenerator

use of org.openkilda.rulemanager.factory.generator.service.lldp.LldpPostIngressVxlanRuleGenerator in project open-kilda by telstra.

the class RuleManagerServiceRulesTest method shouldUseCorrectServiceRuleGeneratorsForSwitchInMultiTableModeWithAllRules.

@Test
public void shouldUseCorrectServiceRuleGeneratorsForSwitchInMultiTableModeWithAllRules() {
    Switch sw = buildSwitch("OF_13", Collections.emptySet());
    SwitchId switchId = sw.getSwitchId();
    SwitchProperties switchProperties = buildSwitchProperties(sw, true, true, true, true, RttState.ENABLED);
    List<RuleGenerator> generators = ruleManager.getServiceRuleGenerators(switchId, buildAdapter(switchId, switchProperties, Sets.newHashSet(ISL_PORT), true));
    assertEquals(34, generators.size());
    assertTrue(generators.stream().anyMatch(g -> g instanceof BroadCastDiscoveryRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof UniCastDiscoveryRuleGenerator));
    assertEquals(4, generators.stream().filter(g -> g instanceof TableDefaultRuleGenerator).count());
    assertEquals(2, generators.stream().filter(g -> g instanceof TablePassThroughDefaultRuleGenerator).count());
    assertTrue(generators.stream().anyMatch(g -> g instanceof LldpPostIngressRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof LldpPostIngressVxlanRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof LldpPostIngressOneSwitchRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof ArpPostIngressRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof ArpPostIngressVxlanRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof ArpPostIngressOneSwitchRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof LldpTransitRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof LldpInputPreDropRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof LldpIngressRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof ArpTransitRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof ArpInputPreDropRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof ArpIngressRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof Server42FlowRttTurningRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof Server42FlowRttVxlanTurningRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof Server42FlowRttOutputVlanRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof Server42FlowRttOutputVxlanRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof Server42IslRttInputRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof Server42IslRttTurningRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof Server42IslRttOutputRuleGenerator));
}
Also used : LldpPostIngressOneSwitchRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpPostIngressOneSwitchRuleGenerator) UniCastDiscoveryRuleGenerator(org.openkilda.rulemanager.factory.generator.service.UniCastDiscoveryRuleGenerator) InMemoryDataAdapter(org.openkilda.rulemanager.adapter.InMemoryDataAdapter) LldpPostIngressVxlanRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpPostIngressVxlanRuleGenerator) ArpTransitRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpTransitRuleGenerator) Utils.buildSwitchProperties(org.openkilda.rulemanager.Utils.buildSwitchProperties) Server42IslRttOutputRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42IslRttOutputRuleGenerator) KildaFeatureToggles(org.openkilda.model.KildaFeatureToggles) Map(java.util.Map) Utils.buildSwitch(org.openkilda.rulemanager.Utils.buildSwitch) LldpTransitRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpTransitRuleGenerator) SwitchProperties(org.openkilda.model.SwitchProperties) ArpPostIngressRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpPostIngressRuleGenerator) BfdCatchRuleGenerator(org.openkilda.rulemanager.factory.generator.service.BfdCatchRuleGenerator) Set(java.util.Set) Server42FlowRttOutputVxlanRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42FlowRttOutputVxlanRuleGenerator) Server42FlowRttOutputVlanRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42FlowRttOutputVlanRuleGenerator) Sets(com.google.common.collect.Sets) List(java.util.List) Server42FlowRttTurningRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42FlowRttTurningRuleGenerator) RoundTripLatencyRuleGenerator(org.openkilda.rulemanager.factory.generator.service.noviflow.RoundTripLatencyRuleGenerator) Mockito.mock(org.mockito.Mockito.mock) BroadCastDiscoveryRuleGenerator(org.openkilda.rulemanager.factory.generator.service.BroadCastDiscoveryRuleGenerator) ArpPostIngressVxlanRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpPostIngressVxlanRuleGenerator) HashMap(java.util.HashMap) Server42IslRttInputRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42IslRttInputRuleGenerator) HashSet(java.util.HashSet) Server42FlowRttVxlanTurningRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42FlowRttVxlanTurningRuleGenerator) ArpIngressRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpIngressRuleGenerator) RttState(org.openkilda.model.SwitchProperties.RttState) Server42IslRttTurningRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42IslRttTurningRuleGenerator) TableDefaultRuleGenerator(org.openkilda.rulemanager.factory.generator.service.TableDefaultRuleGenerator) Before(org.junit.Before) Switch(org.openkilda.model.Switch) LldpInputPreDropRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpInputPreDropRuleGenerator) DropDiscoveryLoopRuleGenerator(org.openkilda.rulemanager.factory.generator.service.DropDiscoveryLoopRuleGenerator) UnicastVerificationVxlanRuleGenerator(org.openkilda.rulemanager.factory.generator.service.UnicastVerificationVxlanRuleGenerator) ArpPostIngressOneSwitchRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpPostIngressOneSwitchRuleGenerator) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) Mockito.when(org.mockito.Mockito.when) TablePassThroughDefaultRuleGenerator(org.openkilda.rulemanager.factory.generator.service.TablePassThroughDefaultRuleGenerator) LldpIngressRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpIngressRuleGenerator) SwitchId(org.openkilda.model.SwitchId) RuleGenerator(org.openkilda.rulemanager.factory.RuleGenerator) ArpInputPreDropRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpInputPreDropRuleGenerator) LldpPostIngressRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpPostIngressRuleGenerator) Collections(java.util.Collections) Assert.assertEquals(org.junit.Assert.assertEquals) LldpPostIngressVxlanRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpPostIngressVxlanRuleGenerator) Server42FlowRttOutputVlanRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42FlowRttOutputVlanRuleGenerator) LldpTransitRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpTransitRuleGenerator) Server42FlowRttOutputVxlanRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42FlowRttOutputVxlanRuleGenerator) SwitchId(org.openkilda.model.SwitchId) TableDefaultRuleGenerator(org.openkilda.rulemanager.factory.generator.service.TableDefaultRuleGenerator) LldpPostIngressRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpPostIngressRuleGenerator) ArpIngressRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpIngressRuleGenerator) ArpPostIngressRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpPostIngressRuleGenerator) ArpPostIngressOneSwitchRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpPostIngressOneSwitchRuleGenerator) Server42IslRttTurningRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42IslRttTurningRuleGenerator) Server42IslRttInputRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42IslRttInputRuleGenerator) LldpInputPreDropRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpInputPreDropRuleGenerator) LldpPostIngressOneSwitchRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpPostIngressOneSwitchRuleGenerator) BroadCastDiscoveryRuleGenerator(org.openkilda.rulemanager.factory.generator.service.BroadCastDiscoveryRuleGenerator) LldpIngressRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpIngressRuleGenerator) ArpInputPreDropRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpInputPreDropRuleGenerator) TablePassThroughDefaultRuleGenerator(org.openkilda.rulemanager.factory.generator.service.TablePassThroughDefaultRuleGenerator) UniCastDiscoveryRuleGenerator(org.openkilda.rulemanager.factory.generator.service.UniCastDiscoveryRuleGenerator) Server42FlowRttTurningRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42FlowRttTurningRuleGenerator) Utils.buildSwitch(org.openkilda.rulemanager.Utils.buildSwitch) Switch(org.openkilda.model.Switch) Server42FlowRttVxlanTurningRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42FlowRttVxlanTurningRuleGenerator) ArpPostIngressVxlanRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpPostIngressVxlanRuleGenerator) Utils.buildSwitchProperties(org.openkilda.rulemanager.Utils.buildSwitchProperties) SwitchProperties(org.openkilda.model.SwitchProperties) LldpPostIngressOneSwitchRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpPostIngressOneSwitchRuleGenerator) UniCastDiscoveryRuleGenerator(org.openkilda.rulemanager.factory.generator.service.UniCastDiscoveryRuleGenerator) LldpPostIngressVxlanRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpPostIngressVxlanRuleGenerator) ArpTransitRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpTransitRuleGenerator) Server42IslRttOutputRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42IslRttOutputRuleGenerator) LldpTransitRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpTransitRuleGenerator) ArpPostIngressRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpPostIngressRuleGenerator) BfdCatchRuleGenerator(org.openkilda.rulemanager.factory.generator.service.BfdCatchRuleGenerator) Server42FlowRttOutputVxlanRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42FlowRttOutputVxlanRuleGenerator) Server42FlowRttOutputVlanRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42FlowRttOutputVlanRuleGenerator) Server42FlowRttTurningRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42FlowRttTurningRuleGenerator) RoundTripLatencyRuleGenerator(org.openkilda.rulemanager.factory.generator.service.noviflow.RoundTripLatencyRuleGenerator) BroadCastDiscoveryRuleGenerator(org.openkilda.rulemanager.factory.generator.service.BroadCastDiscoveryRuleGenerator) ArpPostIngressVxlanRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpPostIngressVxlanRuleGenerator) Server42IslRttInputRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42IslRttInputRuleGenerator) Server42FlowRttVxlanTurningRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42FlowRttVxlanTurningRuleGenerator) ArpIngressRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpIngressRuleGenerator) Server42IslRttTurningRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42IslRttTurningRuleGenerator) TableDefaultRuleGenerator(org.openkilda.rulemanager.factory.generator.service.TableDefaultRuleGenerator) LldpInputPreDropRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpInputPreDropRuleGenerator) DropDiscoveryLoopRuleGenerator(org.openkilda.rulemanager.factory.generator.service.DropDiscoveryLoopRuleGenerator) UnicastVerificationVxlanRuleGenerator(org.openkilda.rulemanager.factory.generator.service.UnicastVerificationVxlanRuleGenerator) ArpPostIngressOneSwitchRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpPostIngressOneSwitchRuleGenerator) TablePassThroughDefaultRuleGenerator(org.openkilda.rulemanager.factory.generator.service.TablePassThroughDefaultRuleGenerator) LldpIngressRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpIngressRuleGenerator) RuleGenerator(org.openkilda.rulemanager.factory.RuleGenerator) ArpInputPreDropRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpInputPreDropRuleGenerator) LldpPostIngressRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpPostIngressRuleGenerator) ArpTransitRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpTransitRuleGenerator) Server42IslRttOutputRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42IslRttOutputRuleGenerator) Test(org.junit.Test)

Example 3 with LldpPostIngressVxlanRuleGenerator

use of org.openkilda.rulemanager.factory.generator.service.lldp.LldpPostIngressVxlanRuleGenerator in project open-kilda by telstra.

the class RuleManagerServiceRulesTest method shouldUseCorrectServiceRuleGeneratorsForSwitchInMultiTableMode.

@Test
public void shouldUseCorrectServiceRuleGeneratorsForSwitchInMultiTableMode() {
    Switch sw = buildSwitch("OF_13", Collections.emptySet());
    SwitchId switchId = sw.getSwitchId();
    SwitchProperties switchProperties = buildSwitchProperties(sw, true);
    List<RuleGenerator> generators = ruleManager.getServiceRuleGenerators(switchId, buildAdapter(switchId, switchProperties, new HashSet<>(), false));
    assertEquals(18, generators.size());
    assertTrue(generators.stream().anyMatch(g -> g instanceof BroadCastDiscoveryRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof UniCastDiscoveryRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof DropDiscoveryLoopRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof BfdCatchRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof RoundTripLatencyRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof UnicastVerificationVxlanRuleGenerator));
    assertEquals(4, generators.stream().filter(g -> g instanceof TableDefaultRuleGenerator).count());
    assertEquals(2, generators.stream().filter(g -> g instanceof TablePassThroughDefaultRuleGenerator).count());
    assertTrue(generators.stream().anyMatch(g -> g instanceof LldpPostIngressRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof LldpPostIngressVxlanRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof LldpPostIngressOneSwitchRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof ArpPostIngressRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof ArpPostIngressVxlanRuleGenerator));
    assertTrue(generators.stream().anyMatch(g -> g instanceof ArpPostIngressOneSwitchRuleGenerator));
}
Also used : LldpPostIngressOneSwitchRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpPostIngressOneSwitchRuleGenerator) UniCastDiscoveryRuleGenerator(org.openkilda.rulemanager.factory.generator.service.UniCastDiscoveryRuleGenerator) InMemoryDataAdapter(org.openkilda.rulemanager.adapter.InMemoryDataAdapter) LldpPostIngressVxlanRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpPostIngressVxlanRuleGenerator) ArpTransitRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpTransitRuleGenerator) Utils.buildSwitchProperties(org.openkilda.rulemanager.Utils.buildSwitchProperties) Server42IslRttOutputRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42IslRttOutputRuleGenerator) KildaFeatureToggles(org.openkilda.model.KildaFeatureToggles) Map(java.util.Map) Utils.buildSwitch(org.openkilda.rulemanager.Utils.buildSwitch) LldpTransitRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpTransitRuleGenerator) SwitchProperties(org.openkilda.model.SwitchProperties) ArpPostIngressRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpPostIngressRuleGenerator) BfdCatchRuleGenerator(org.openkilda.rulemanager.factory.generator.service.BfdCatchRuleGenerator) Set(java.util.Set) Server42FlowRttOutputVxlanRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42FlowRttOutputVxlanRuleGenerator) Server42FlowRttOutputVlanRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42FlowRttOutputVlanRuleGenerator) Sets(com.google.common.collect.Sets) List(java.util.List) Server42FlowRttTurningRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42FlowRttTurningRuleGenerator) RoundTripLatencyRuleGenerator(org.openkilda.rulemanager.factory.generator.service.noviflow.RoundTripLatencyRuleGenerator) Mockito.mock(org.mockito.Mockito.mock) BroadCastDiscoveryRuleGenerator(org.openkilda.rulemanager.factory.generator.service.BroadCastDiscoveryRuleGenerator) ArpPostIngressVxlanRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpPostIngressVxlanRuleGenerator) HashMap(java.util.HashMap) Server42IslRttInputRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42IslRttInputRuleGenerator) HashSet(java.util.HashSet) Server42FlowRttVxlanTurningRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42FlowRttVxlanTurningRuleGenerator) ArpIngressRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpIngressRuleGenerator) RttState(org.openkilda.model.SwitchProperties.RttState) Server42IslRttTurningRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42IslRttTurningRuleGenerator) TableDefaultRuleGenerator(org.openkilda.rulemanager.factory.generator.service.TableDefaultRuleGenerator) Before(org.junit.Before) Switch(org.openkilda.model.Switch) LldpInputPreDropRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpInputPreDropRuleGenerator) DropDiscoveryLoopRuleGenerator(org.openkilda.rulemanager.factory.generator.service.DropDiscoveryLoopRuleGenerator) UnicastVerificationVxlanRuleGenerator(org.openkilda.rulemanager.factory.generator.service.UnicastVerificationVxlanRuleGenerator) ArpPostIngressOneSwitchRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpPostIngressOneSwitchRuleGenerator) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) Mockito.when(org.mockito.Mockito.when) TablePassThroughDefaultRuleGenerator(org.openkilda.rulemanager.factory.generator.service.TablePassThroughDefaultRuleGenerator) LldpIngressRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpIngressRuleGenerator) SwitchId(org.openkilda.model.SwitchId) RuleGenerator(org.openkilda.rulemanager.factory.RuleGenerator) ArpInputPreDropRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpInputPreDropRuleGenerator) LldpPostIngressRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpPostIngressRuleGenerator) Collections(java.util.Collections) Assert.assertEquals(org.junit.Assert.assertEquals) LldpPostIngressOneSwitchRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpPostIngressOneSwitchRuleGenerator) BroadCastDiscoveryRuleGenerator(org.openkilda.rulemanager.factory.generator.service.BroadCastDiscoveryRuleGenerator) LldpPostIngressVxlanRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpPostIngressVxlanRuleGenerator) BfdCatchRuleGenerator(org.openkilda.rulemanager.factory.generator.service.BfdCatchRuleGenerator) SwitchId(org.openkilda.model.SwitchId) TableDefaultRuleGenerator(org.openkilda.rulemanager.factory.generator.service.TableDefaultRuleGenerator) TablePassThroughDefaultRuleGenerator(org.openkilda.rulemanager.factory.generator.service.TablePassThroughDefaultRuleGenerator) LldpPostIngressRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpPostIngressRuleGenerator) UniCastDiscoveryRuleGenerator(org.openkilda.rulemanager.factory.generator.service.UniCastDiscoveryRuleGenerator) RoundTripLatencyRuleGenerator(org.openkilda.rulemanager.factory.generator.service.noviflow.RoundTripLatencyRuleGenerator) DropDiscoveryLoopRuleGenerator(org.openkilda.rulemanager.factory.generator.service.DropDiscoveryLoopRuleGenerator) Utils.buildSwitch(org.openkilda.rulemanager.Utils.buildSwitch) Switch(org.openkilda.model.Switch) UnicastVerificationVxlanRuleGenerator(org.openkilda.rulemanager.factory.generator.service.UnicastVerificationVxlanRuleGenerator) ArpPostIngressVxlanRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpPostIngressVxlanRuleGenerator) ArpPostIngressRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpPostIngressRuleGenerator) Utils.buildSwitchProperties(org.openkilda.rulemanager.Utils.buildSwitchProperties) SwitchProperties(org.openkilda.model.SwitchProperties) LldpPostIngressOneSwitchRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpPostIngressOneSwitchRuleGenerator) UniCastDiscoveryRuleGenerator(org.openkilda.rulemanager.factory.generator.service.UniCastDiscoveryRuleGenerator) LldpPostIngressVxlanRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpPostIngressVxlanRuleGenerator) ArpTransitRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpTransitRuleGenerator) Server42IslRttOutputRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42IslRttOutputRuleGenerator) LldpTransitRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpTransitRuleGenerator) ArpPostIngressRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpPostIngressRuleGenerator) BfdCatchRuleGenerator(org.openkilda.rulemanager.factory.generator.service.BfdCatchRuleGenerator) Server42FlowRttOutputVxlanRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42FlowRttOutputVxlanRuleGenerator) Server42FlowRttOutputVlanRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42FlowRttOutputVlanRuleGenerator) Server42FlowRttTurningRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42FlowRttTurningRuleGenerator) RoundTripLatencyRuleGenerator(org.openkilda.rulemanager.factory.generator.service.noviflow.RoundTripLatencyRuleGenerator) BroadCastDiscoveryRuleGenerator(org.openkilda.rulemanager.factory.generator.service.BroadCastDiscoveryRuleGenerator) ArpPostIngressVxlanRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpPostIngressVxlanRuleGenerator) Server42IslRttInputRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42IslRttInputRuleGenerator) Server42FlowRttVxlanTurningRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42FlowRttVxlanTurningRuleGenerator) ArpIngressRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpIngressRuleGenerator) Server42IslRttTurningRuleGenerator(org.openkilda.rulemanager.factory.generator.service.server42.Server42IslRttTurningRuleGenerator) TableDefaultRuleGenerator(org.openkilda.rulemanager.factory.generator.service.TableDefaultRuleGenerator) LldpInputPreDropRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpInputPreDropRuleGenerator) DropDiscoveryLoopRuleGenerator(org.openkilda.rulemanager.factory.generator.service.DropDiscoveryLoopRuleGenerator) UnicastVerificationVxlanRuleGenerator(org.openkilda.rulemanager.factory.generator.service.UnicastVerificationVxlanRuleGenerator) ArpPostIngressOneSwitchRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpPostIngressOneSwitchRuleGenerator) TablePassThroughDefaultRuleGenerator(org.openkilda.rulemanager.factory.generator.service.TablePassThroughDefaultRuleGenerator) LldpIngressRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpIngressRuleGenerator) RuleGenerator(org.openkilda.rulemanager.factory.RuleGenerator) ArpInputPreDropRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpInputPreDropRuleGenerator) LldpPostIngressRuleGenerator(org.openkilda.rulemanager.factory.generator.service.lldp.LldpPostIngressRuleGenerator) ArpPostIngressOneSwitchRuleGenerator(org.openkilda.rulemanager.factory.generator.service.arp.ArpPostIngressOneSwitchRuleGenerator) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

Sets (com.google.common.collect.Sets)3 Collections (java.util.Collections)3 HashMap (java.util.HashMap)3 HashSet (java.util.HashSet)3 List (java.util.List)3 Map (java.util.Map)3 Set (java.util.Set)3 Assert.assertEquals (org.junit.Assert.assertEquals)3 Assert.assertTrue (org.junit.Assert.assertTrue)3 Before (org.junit.Before)3 Test (org.junit.Test)3 Mockito.mock (org.mockito.Mockito.mock)3 Mockito.when (org.mockito.Mockito.when)3 KildaFeatureToggles (org.openkilda.model.KildaFeatureToggles)3 Switch (org.openkilda.model.Switch)3 SwitchId (org.openkilda.model.SwitchId)3 SwitchProperties (org.openkilda.model.SwitchProperties)3 RttState (org.openkilda.model.SwitchProperties.RttState)3 Utils.buildSwitch (org.openkilda.rulemanager.Utils.buildSwitch)3 Utils.buildSwitchProperties (org.openkilda.rulemanager.Utils.buildSwitchProperties)3