Search in sources :

Example 11 with FlowResourcesConfig

use of org.openkilda.wfm.share.flow.resources.FlowResourcesConfig in project open-kilda by telstra.

the class SwitchSyncServiceImplTest method setUp.

@Before
public void setUp() {
    RepositoryFactory repositoryFactory = Mockito.mock(RepositoryFactory.class);
    FlowRepository flowRepository = Mockito.mock(FlowRepository.class);
    FlowPathRepository flowPathRepository = Mockito.mock(FlowPathRepository.class);
    TransitVlanRepository transitVlanRepository = Mockito.mock(TransitVlanRepository.class);
    when(repositoryFactory.createFlowPathRepository()).thenReturn(flowPathRepository);
    when(repositoryFactory.createFlowRepository()).thenReturn(flowRepository);
    when(repositoryFactory.createTransitVlanRepository()).thenReturn(transitVlanRepository);
    when(persistenceManager.getRepositoryFactory()).thenReturn(repositoryFactory);
    Properties configProps = new Properties();
    configProps.setProperty("flow.meter-id.max", "40");
    configProps.setProperty("flow.vlan.max", "50");
    PropertiesBasedConfigurationProvider configurationProvider = new PropertiesBasedConfigurationProvider(configProps);
    FlowResourcesConfig flowResourcesConfig = configurationProvider.getConfiguration(FlowResourcesConfig.class);
    service = new SwitchSyncServiceImpl(carrier, persistenceManager, flowResourcesConfig);
    service.commandBuilder = commandBuilder;
    request = SwitchValidateRequest.builder().switchId(SWITCH_ID).performSync(true).build();
    flowEntry = new FlowEntry(new FlowSegmentCookie(FlowPathDirection.FORWARD, 7).getValue(), 0, 0, 0, 0, "", 0, 0, 0, 0, null, null, null);
    InstallIngressFlow installingRule = new InstallIngressFlow(UUID.randomUUID(), FLOW_ID, flowEntry.getCookie(), SWITCH_ID, 1, 2, 50, 0, 60, FlowEncapsulationType.TRANSIT_VLAN, OutputVlanType.POP, 10L, 100L, EGRESS_SWITCH_ID, false, false, false, null);
    when(commandBuilder.buildCommandsToSyncMissingRules(eq(SWITCH_ID), any())).thenReturn(singletonList(installingRule));
    missingRules = singletonList(flowEntry.getCookie());
    excessRules = emptyList();
    misconfiguredRules = emptyList();
    excessMeters = emptyList();
}
Also used : InstallIngressFlow(org.openkilda.messaging.command.flow.InstallIngressFlow) FlowRepository(org.openkilda.persistence.repositories.FlowRepository) FlowPathRepository(org.openkilda.persistence.repositories.FlowPathRepository) FlowResourcesConfig(org.openkilda.wfm.share.flow.resources.FlowResourcesConfig) FlowSegmentCookie(org.openkilda.model.cookie.FlowSegmentCookie) TransitVlanRepository(org.openkilda.persistence.repositories.TransitVlanRepository) PropertiesBasedConfigurationProvider(org.openkilda.config.provider.PropertiesBasedConfigurationProvider) RepositoryFactory(org.openkilda.persistence.repositories.RepositoryFactory) Properties(java.util.Properties) FlowEntry(org.openkilda.messaging.info.rule.FlowEntry) Before(org.junit.Before)

Example 12 with FlowResourcesConfig

use of org.openkilda.wfm.share.flow.resources.FlowResourcesConfig in project open-kilda by telstra.

the class AbstractFlowTest method before.

@Before
public void before() {
    dummyFactory = new PersistenceDummyEntityFactory(persistenceManager);
    FlowResourcesConfig resourceConfig = configurationProvider.getConfiguration(FlowResourcesConfig.class);
    flowResourcesManager = spy(new FlowResourcesManager(persistenceManager, resourceConfig));
    alterFeatureToggles(true, true, true);
    dummyFactory.makeSwitch(SWITCH_SOURCE);
    dummyFactory.makeSwitch(SWITCH_DEST);
    dummyFactory.makeSwitch(SWITCH_TRANSIT);
    for (IslDirectionalReference reference : new IslDirectionalReference[] { islSourceDest, islSourceDestAlt, islSourceTransit, islTransitDest }) {
        dummyFactory.makeIsl(reference.getSourceEndpoint(), reference.getDestEndpoint());
        dummyFactory.makeIsl(reference.getDestEndpoint(), reference.getSourceEndpoint());
    }
}
Also used : FlowResourcesConfig(org.openkilda.wfm.share.flow.resources.FlowResourcesConfig) PersistenceDummyEntityFactory(org.openkilda.persistence.dummy.PersistenceDummyEntityFactory) IslDirectionalReference(org.openkilda.persistence.dummy.IslDirectionalReference) FlowResourcesManager(org.openkilda.wfm.share.flow.resources.FlowResourcesManager) Before(org.junit.Before)

Example 13 with FlowResourcesConfig

use of org.openkilda.wfm.share.flow.resources.FlowResourcesConfig in project open-kilda by telstra.

the class FlowHsTopology method flowUpdateHub.

private void flowUpdateHub(TopologyBuilder topologyBuilder, PersistenceManager persistenceManager) {
    int hubTimeout = (int) TimeUnit.SECONDS.toMillis(topologyConfig.getUpdateHubTimeoutSeconds());
    FlowUpdateConfig config = FlowUpdateConfig.flowUpdateBuilder().pathAllocationRetriesLimit(topologyConfig.getPathAllocationRetriesLimit()).pathAllocationRetryDelay(topologyConfig.getPathAllocationRetryDelay()).speakerCommandRetriesLimit(topologyConfig.getUpdateSpeakerCommandRetries()).resourceAllocationRetriesLimit(topologyConfig.getResourceAllocationRetriesLimit()).autoAck(true).timeoutMs(hubTimeout).requestSenderComponent(ComponentId.FLOW_ROUTER_BOLT.name()).workerComponent(ComponentId.FLOW_UPDATE_SPEAKER_WORKER.name()).lifeCycleEventComponent(ZooKeeperSpout.SPOUT_ID).build();
    PathComputerConfig pathComputerConfig = configurationProvider.getConfiguration(PathComputerConfig.class);
    FlowResourcesConfig flowResourcesConfig = configurationProvider.getConfiguration(FlowResourcesConfig.class);
    FlowUpdateHubBolt hubBolt = new FlowUpdateHubBolt(config, persistenceManager, pathComputerConfig, flowResourcesConfig);
    declareBolt(topologyBuilder, hubBolt, ComponentId.FLOW_UPDATE_HUB.name()).fieldsGrouping(ComponentId.FLOW_ROUTER_BOLT.name(), ROUTER_TO_FLOW_UPDATE_HUB.name(), FLOW_FIELD).directGrouping(ComponentId.FLOW_UPDATE_SPEAKER_WORKER.name(), Stream.SPEAKER_WORKER_TO_HUB_UPDATE.name()).allGrouping(ZooKeeperSpout.SPOUT_ID).directGrouping(CoordinatorBolt.ID);
}
Also used : FlowResourcesConfig(org.openkilda.wfm.share.flow.resources.FlowResourcesConfig) PathComputerConfig(org.openkilda.pce.PathComputerConfig) FlowUpdateHubBolt(org.openkilda.wfm.topology.flowhs.bolts.FlowUpdateHubBolt) YFlowUpdateHubBolt(org.openkilda.wfm.topology.flowhs.bolts.YFlowUpdateHubBolt) YFlowUpdateConfig(org.openkilda.wfm.topology.flowhs.bolts.YFlowUpdateHubBolt.YFlowUpdateConfig) FlowUpdateConfig(org.openkilda.wfm.topology.flowhs.bolts.FlowUpdateHubBolt.FlowUpdateConfig)

Example 14 with FlowResourcesConfig

use of org.openkilda.wfm.share.flow.resources.FlowResourcesConfig in project open-kilda by telstra.

the class FlowHsTopology method yFlowValidationHub.

private void yFlowValidationHub(TopologyBuilder topologyBuilder, PersistenceManager persistenceManager) {
    int hubTimeout = (int) TimeUnit.SECONDS.toMillis(topologyConfig.getValidationHubTimeoutSeconds());
    HubBolt.Config config = HubBolt.Config.builder().requestSenderComponent(ComponentId.FLOW_ROUTER_BOLT.name()).workerComponent(ComponentId.YFLOW_VALIDATION_SPEAKER_WORKER.name()).lifeCycleEventComponent(ZooKeeperSpout.SPOUT_ID).timeoutMs(hubTimeout).build();
    FlowResourcesConfig flowResourcesConfig = configurationProvider.getConfiguration(FlowResourcesConfig.class);
    YFlowValidationHubBolt hubBolt = new YFlowValidationHubBolt(config, persistenceManager, flowResourcesConfig, topologyConfig.getFlowMeterMinBurstSizeInKbits(), topologyConfig.getFlowMeterBurstCoefficient());
    declareBolt(topologyBuilder, hubBolt, ComponentId.YFLOW_VALIDATION_HUB.name()).fieldsGrouping(ComponentId.FLOW_ROUTER_BOLT.name(), Stream.ROUTER_TO_YFLOW_VALIDATION_HUB.name(), FLOW_FIELD).directGrouping(ComponentId.YFLOW_VALIDATION_SPEAKER_WORKER.name(), SPEAKER_WORKER_TO_HUB_YFLOW_VALIDATION.name()).allGrouping(ZooKeeperSpout.SPOUT_ID).directGrouping(CoordinatorBolt.ID);
}
Also used : FlowResourcesConfig(org.openkilda.wfm.share.flow.resources.FlowResourcesConfig) YFlowValidationHubBolt(org.openkilda.wfm.topology.flowhs.bolts.YFlowValidationHubBolt) YFlowValidationHubBolt(org.openkilda.wfm.topology.flowhs.bolts.YFlowValidationHubBolt) FlowMirrorPointCreateHubBolt(org.openkilda.wfm.topology.flowhs.bolts.FlowMirrorPointCreateHubBolt) FlowRerouteHubBolt(org.openkilda.wfm.topology.flowhs.bolts.FlowRerouteHubBolt) YFlowDeleteHubBolt(org.openkilda.wfm.topology.flowhs.bolts.YFlowDeleteHubBolt) FlowUpdateHubBolt(org.openkilda.wfm.topology.flowhs.bolts.FlowUpdateHubBolt) FlowMirrorPointDeleteHubBolt(org.openkilda.wfm.topology.flowhs.bolts.FlowMirrorPointDeleteHubBolt) FlowPathSwapHubBolt(org.openkilda.wfm.topology.flowhs.bolts.FlowPathSwapHubBolt) YFlowRerouteHubBolt(org.openkilda.wfm.topology.flowhs.bolts.YFlowRerouteHubBolt) FlowSwapEndpointsHubBolt(org.openkilda.wfm.topology.flowhs.bolts.FlowSwapEndpointsHubBolt) FlowCreateHubBolt(org.openkilda.wfm.topology.flowhs.bolts.FlowCreateHubBolt) HubBolt(org.openkilda.wfm.share.hubandspoke.HubBolt) FlowDeleteHubBolt(org.openkilda.wfm.topology.flowhs.bolts.FlowDeleteHubBolt) YFlowCreateHubBolt(org.openkilda.wfm.topology.flowhs.bolts.YFlowCreateHubBolt) FlowValidationHubBolt(org.openkilda.wfm.topology.flowhs.bolts.FlowValidationHubBolt) YFlowUpdateHubBolt(org.openkilda.wfm.topology.flowhs.bolts.YFlowUpdateHubBolt)

Example 15 with FlowResourcesConfig

use of org.openkilda.wfm.share.flow.resources.FlowResourcesConfig in project open-kilda by telstra.

the class FlowHsTopology method yFlowRerouteHub.

private void yFlowRerouteHub(TopologyBuilder topologyBuilder, PersistenceManager persistenceManager) {
    int hubTimeout = (int) TimeUnit.SECONDS.toMillis(topologyConfig.getRerouteHubTimeoutSeconds());
    FlowRerouteConfig flowRerouteConfig = FlowRerouteConfig.flowRerouteBuilder().resourceAllocationRetriesLimit(topologyConfig.getResourceAllocationRetriesLimit()).pathAllocationRetriesLimit(topologyConfig.getPathAllocationRetriesLimit()).pathAllocationRetryDelay(topologyConfig.getPathAllocationRetryDelay()).speakerCommandRetriesLimit(topologyConfig.getCreateSpeakerCommandRetries()).autoAck(true).timeoutMs(hubTimeout).requestSenderComponent(ComponentId.FLOW_ROUTER_BOLT.name()).workerComponent(ComponentId.YFLOW_REROUTE_SPEAKER_WORKER.name()).lifeCycleEventComponent(ZooKeeperSpout.SPOUT_ID).build();
    YFlowRerouteConfig yFlowRerouteConfig = YFlowRerouteConfig.builder().speakerCommandRetriesLimit(topologyConfig.getCreateSpeakerCommandRetries()).autoAck(true).timeoutMs(hubTimeout).requestSenderComponent(ComponentId.FLOW_ROUTER_BOLT.name()).workerComponent(ComponentId.YFLOW_REROUTE_SPEAKER_WORKER.name()).lifeCycleEventComponent(ZooKeeperSpout.SPOUT_ID).build();
    PathComputerConfig pathComputerConfig = configurationProvider.getConfiguration(PathComputerConfig.class);
    FlowResourcesConfig flowResourcesConfig = configurationProvider.getConfiguration(FlowResourcesConfig.class);
    RuleManagerConfig ruleManagerConfig = configurationProvider.getConfiguration(RuleManagerConfig.class);
    YFlowRerouteHubBolt hubBolt = new YFlowRerouteHubBolt(yFlowRerouteConfig, flowRerouteConfig, persistenceManager, pathComputerConfig, flowResourcesConfig, ruleManagerConfig);
    declareBolt(topologyBuilder, hubBolt, ComponentId.YFLOW_REROUTE_HUB.name()).fieldsGrouping(ComponentId.FLOW_ROUTER_BOLT.name(), ROUTER_TO_YFLOW_REROUTE_HUB.name(), FLOW_FIELD).directGrouping(ComponentId.YFLOW_REROUTE_SPEAKER_WORKER.name(), SPEAKER_WORKER_TO_HUB_YFLOW_REROUTE.name()).allGrouping(ZooKeeperSpout.SPOUT_ID).directGrouping(CoordinatorBolt.ID);
}
Also used : FlowResourcesConfig(org.openkilda.wfm.share.flow.resources.FlowResourcesConfig) PathComputerConfig(org.openkilda.pce.PathComputerConfig) RuleManagerConfig(org.openkilda.rulemanager.RuleManagerConfig) YFlowRerouteConfig(org.openkilda.wfm.topology.flowhs.bolts.YFlowRerouteHubBolt.YFlowRerouteConfig) FlowRerouteConfig(org.openkilda.wfm.topology.flowhs.bolts.FlowRerouteHubBolt.FlowRerouteConfig) YFlowRerouteHubBolt(org.openkilda.wfm.topology.flowhs.bolts.YFlowRerouteHubBolt) YFlowRerouteConfig(org.openkilda.wfm.topology.flowhs.bolts.YFlowRerouteHubBolt.YFlowRerouteConfig)

Aggregations

FlowResourcesConfig (org.openkilda.wfm.share.flow.resources.FlowResourcesConfig)18 PathComputerConfig (org.openkilda.pce.PathComputerConfig)7 RuleManagerConfig (org.openkilda.rulemanager.RuleManagerConfig)6 YFlowCreateHubBolt (org.openkilda.wfm.topology.flowhs.bolts.YFlowCreateHubBolt)4 YFlowDeleteHubBolt (org.openkilda.wfm.topology.flowhs.bolts.YFlowDeleteHubBolt)4 YFlowRerouteHubBolt (org.openkilda.wfm.topology.flowhs.bolts.YFlowRerouteHubBolt)4 Before (org.junit.Before)3 FlowCreateHubBolt (org.openkilda.wfm.topology.flowhs.bolts.FlowCreateHubBolt)3 FlowDeleteHubBolt (org.openkilda.wfm.topology.flowhs.bolts.FlowDeleteHubBolt)3 FlowMirrorPointCreateHubBolt (org.openkilda.wfm.topology.flowhs.bolts.FlowMirrorPointCreateHubBolt)3 FlowMirrorPointDeleteHubBolt (org.openkilda.wfm.topology.flowhs.bolts.FlowMirrorPointDeleteHubBolt)3 FlowPathSwapHubBolt (org.openkilda.wfm.topology.flowhs.bolts.FlowPathSwapHubBolt)3 FlowRerouteHubBolt (org.openkilda.wfm.topology.flowhs.bolts.FlowRerouteHubBolt)3 FlowUpdateHubBolt (org.openkilda.wfm.topology.flowhs.bolts.FlowUpdateHubBolt)3 YFlowUpdateHubBolt (org.openkilda.wfm.topology.flowhs.bolts.YFlowUpdateHubBolt)3 Properties (java.util.Properties)2 PropertiesBasedConfigurationProvider (org.openkilda.config.provider.PropertiesBasedConfigurationProvider)2 IslDirectionalReference (org.openkilda.persistence.dummy.IslDirectionalReference)2 PersistenceDummyEntityFactory (org.openkilda.persistence.dummy.PersistenceDummyEntityFactory)2 FlowResourcesManager (org.openkilda.wfm.share.flow.resources.FlowResourcesManager)2