use of org.openkilda.pce.PathComputerConfig in project open-kilda by telstra.
the class FlowHsTopology method flowCreateHub.
private void flowCreateHub(TopologyBuilder topologyBuilder, PersistenceManager persistenceManager) {
int hubTimeout = (int) TimeUnit.SECONDS.toMillis(topologyConfig.getCreateHubTimeoutSeconds());
FlowCreateConfig config = FlowCreateConfig.flowCreateBuilder().flowCreationRetriesLimit(topologyConfig.getCreateHubRetries()).pathAllocationRetriesLimit(topologyConfig.getPathAllocationRetriesLimit()).pathAllocationRetryDelay(topologyConfig.getPathAllocationRetryDelay()).speakerCommandRetriesLimit(topologyConfig.getCreateSpeakerCommandRetries()).autoAck(true).timeoutMs(hubTimeout).requestSenderComponent(ComponentId.FLOW_ROUTER_BOLT.name()).workerComponent(ComponentId.FLOW_CREATE_SPEAKER_WORKER.name()).lifeCycleEventComponent(ZooKeeperSpout.SPOUT_ID).build();
PathComputerConfig pathComputerConfig = configurationProvider.getConfiguration(PathComputerConfig.class);
FlowResourcesConfig flowResourcesConfig = configurationProvider.getConfiguration(FlowResourcesConfig.class);
FlowCreateHubBolt hubBolt = new FlowCreateHubBolt(config, persistenceManager, pathComputerConfig, flowResourcesConfig);
declareBolt(topologyBuilder, hubBolt, ComponentId.FLOW_CREATE_HUB.name()).fieldsGrouping(ComponentId.FLOW_ROUTER_BOLT.name(), ROUTER_TO_FLOW_CREATE_HUB.name(), FLOW_FIELD).directGrouping(ComponentId.FLOW_CREATE_SPEAKER_WORKER.name(), Stream.SPEAKER_WORKER_TO_HUB_CREATE.name()).allGrouping(ZooKeeperSpout.SPOUT_ID).directGrouping(CoordinatorBolt.ID);
}
use of org.openkilda.pce.PathComputerConfig in project open-kilda by telstra.
the class FlowHsTopology method flowRerouteHub.
private void flowRerouteHub(TopologyBuilder topologyBuilder, PersistenceManager persistenceManager) {
int hubTimeout = (int) TimeUnit.SECONDS.toMillis(topologyConfig.getRerouteHubTimeoutSeconds());
FlowRerouteConfig config = FlowRerouteConfig.flowRerouteBuilder().pathAllocationRetriesLimit(topologyConfig.getPathAllocationRetriesLimit()).pathAllocationRetryDelay(topologyConfig.getPathAllocationRetryDelay()).speakerCommandRetriesLimit(topologyConfig.getRerouteSpeakerCommandRetries()).resourceAllocationRetriesLimit(topologyConfig.getResourceAllocationRetriesLimit()).autoAck(true).timeoutMs(hubTimeout).requestSenderComponent(ComponentId.FLOW_ROUTER_BOLT.name()).workerComponent(ComponentId.FLOW_REROUTE_SPEAKER_WORKER.name()).lifeCycleEventComponent(ZooKeeperSpout.SPOUT_ID).build();
PathComputerConfig pathComputerConfig = configurationProvider.getConfiguration(PathComputerConfig.class);
FlowResourcesConfig flowResourcesConfig = configurationProvider.getConfiguration(FlowResourcesConfig.class);
FlowRerouteHubBolt hubBolt = new FlowRerouteHubBolt(config, persistenceManager, pathComputerConfig, flowResourcesConfig);
declareBolt(topologyBuilder, hubBolt, ComponentId.FLOW_REROUTE_HUB.name()).fieldsGrouping(ComponentId.FLOW_ROUTER_BOLT.name(), ROUTER_TO_FLOW_REROUTE_HUB.name(), FLOW_FIELD).directGrouping(ComponentId.FLOW_REROUTE_SPEAKER_WORKER.name(), Stream.SPEAKER_WORKER_TO_HUB_REROUTE.name()).allGrouping(ZooKeeperSpout.SPOUT_ID).directGrouping(CoordinatorBolt.ID);
}
use of org.openkilda.pce.PathComputerConfig in project open-kilda by telstra.
the class FlowHsTopology method flowCreateMirrorPointHub.
private void flowCreateMirrorPointHub(TopologyBuilder topologyBuilder, PersistenceManager persistenceManager) {
int hubTimeout = (int) TimeUnit.SECONDS.toMillis(topologyConfig.getCreateMirrorPointHubTimeoutSeconds());
FlowMirrorPointCreateConfig config = FlowMirrorPointCreateConfig.flowMirrorPointCreateBuilder().pathAllocationRetriesLimit(topologyConfig.getPathAllocationRetriesLimit()).pathAllocationRetryDelay(topologyConfig.getPathAllocationRetryDelay()).speakerCommandRetriesLimit(topologyConfig.getCreateMirrorPointSpeakerCommandRetries()).resourceAllocationRetriesLimit(topologyConfig.getResourceAllocationRetriesLimit()).autoAck(true).timeoutMs(hubTimeout).requestSenderComponent(ComponentId.FLOW_ROUTER_BOLT.name()).workerComponent(ComponentId.FLOW_CREATE_MIRROR_POINT_WORKER.name()).lifeCycleEventComponent(ZooKeeperSpout.SPOUT_ID).build();
PathComputerConfig pathComputerConfig = configurationProvider.getConfiguration(PathComputerConfig.class);
FlowResourcesConfig flowResourcesConfig = configurationProvider.getConfiguration(FlowResourcesConfig.class);
FlowMirrorPointCreateHubBolt hubBolt = new FlowMirrorPointCreateHubBolt(config, persistenceManager, pathComputerConfig, flowResourcesConfig);
declareBolt(topologyBuilder, hubBolt, ComponentId.FLOW_CREATE_MIRROR_POINT_HUB.name()).fieldsGrouping(ComponentId.FLOW_ROUTER_BOLT.name(), ROUTER_TO_FLOW_CREATE_MIRROR_POINT_HUB.name(), FLOW_FIELD).directGrouping(ComponentId.FLOW_CREATE_MIRROR_POINT_WORKER.name(), Stream.SPEAKER_WORKER_TO_HUB_CREATE_MIRROR_POINT.name()).allGrouping(ZooKeeperSpout.SPOUT_ID).directGrouping(CoordinatorBolt.ID);
}
use of org.openkilda.pce.PathComputerConfig in project open-kilda by telstra.
the class FlowHsTopology method yFlowCreateHub.
private void yFlowCreateHub(TopologyBuilder topologyBuilder, PersistenceManager persistenceManager) {
int hubTimeout = (int) TimeUnit.SECONDS.toMillis(topologyConfig.getCreateHubTimeoutSeconds());
FlowCreateConfig config = FlowCreateConfig.flowCreateBuilder().flowCreationRetriesLimit(topologyConfig.getCreateHubRetries()).pathAllocationRetriesLimit(topologyConfig.getPathAllocationRetriesLimit()).pathAllocationRetryDelay(topologyConfig.getPathAllocationRetryDelay()).speakerCommandRetriesLimit(topologyConfig.getCreateSpeakerCommandRetries()).autoAck(true).timeoutMs(hubTimeout).requestSenderComponent(ComponentId.FLOW_ROUTER_BOLT.name()).workerComponent(ComponentId.YFLOW_CREATE_SPEAKER_WORKER.name()).lifeCycleEventComponent(ZooKeeperSpout.SPOUT_ID).build();
YFlowCreateConfig yFlowCreateConfig = YFlowCreateConfig.builder().speakerCommandRetriesLimit(topologyConfig.getYFlowCreateSpeakerCommandRetriesLimit()).autoAck(true).timeoutMs(hubTimeout).requestSenderComponent(ComponentId.FLOW_ROUTER_BOLT.name()).workerComponent(ComponentId.YFLOW_CREATE_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);
YFlowCreateHubBolt hubBolt = new YFlowCreateHubBolt(yFlowCreateConfig, config, persistenceManager, pathComputerConfig, flowResourcesConfig, ruleManagerConfig);
declareBolt(topologyBuilder, hubBolt, ComponentId.YFLOW_CREATE_HUB.name()).fieldsGrouping(ComponentId.FLOW_ROUTER_BOLT.name(), Stream.ROUTER_TO_YFLOW_CREATE_HUB.name(), FLOW_FIELD).directGrouping(ComponentId.YFLOW_CREATE_SPEAKER_WORKER.name(), Stream.SPEAKER_WORKER_TO_HUB_YFLOW_CREATE.name()).allGrouping(ZooKeeperSpout.SPOUT_ID).directGrouping(CoordinatorBolt.ID);
}
use of org.openkilda.pce.PathComputerConfig in project open-kilda by telstra.
the class NbWorkerTopology method createTopology.
@Override
public StormTopology createTopology() {
logger.info("Creating NbWorkerTopology - {}", topologyName);
TopologyBuilder tb = new TopologyBuilder();
declareSpout(tb, new CoordinatorSpout(), CoordinatorSpout.ID);
declareBolt(tb, new CoordinatorBolt(), CoordinatorBolt.ID).allGrouping(CoordinatorSpout.ID).fieldsGrouping(FlowMeterModifyHubBolt.ID, CoordinatorBolt.INCOME_STREAM, FIELDS_KEY).fieldsGrouping(METER_MODIFY_WORKER_BOLT, CoordinatorBolt.INCOME_STREAM, FIELDS_KEY);
declareKafkaSpout(tb, topologyConfig.getKafkaTopoNbTopic(), NB_SPOUT_ID);
RouterBolt router = new RouterBolt(ZooKeeperSpout.SPOUT_ID);
declareBolt(tb, router, ROUTER_BOLT_NAME).shuffleGrouping(NB_SPOUT_ID).allGrouping(ZooKeeperSpout.SPOUT_ID);
ZooKeeperSpout zooKeeperSpout = new ZooKeeperSpout(getConfig().getBlueGreenMode(), getZkTopoName(), getZookeeperConfig());
declareSpout(tb, zooKeeperSpout, ZooKeeperSpout.SPOUT_ID);
ZooKeeperBolt zooKeeperBolt = new ZooKeeperBolt(getConfig().getBlueGreenMode(), getZkTopoName(), getZookeeperConfig(), getBoltInstancesCount(ROUTER_BOLT_NAME, FlowMeterModifyHubBolt.ID));
declareBolt(tb, zooKeeperBolt, ZooKeeperBolt.BOLT_ID).allGrouping(ROUTER_BOLT_NAME, ZkStreams.ZK.toString()).allGrouping(FlowMeterModifyHubBolt.ID, ZkStreams.ZK.toString());
PersistenceManager persistenceManager = new PersistenceManager(configurationProvider);
PathComputerConfig pathComputerConfig = configurationProvider.getConfiguration(PathComputerConfig.class);
HubBolt.Config meterModifyHubConfig = HubBolt.Config.builder().requestSenderComponent(ROUTER_BOLT_NAME).workerComponent(METER_MODIFY_WORKER_BOLT).lifeCycleEventComponent(ZooKeeperSpout.SPOUT_ID).timeoutMs((int) TimeUnit.SECONDS.toMillis(topologyConfig.getProcessTimeout())).build();
declareBolt(tb, new FlowMeterModifyHubBolt(meterModifyHubConfig, persistenceManager), FlowMeterModifyHubBolt.ID).fieldsGrouping(ROUTER_BOLT_NAME, FlowMeterModifyHubBolt.INCOME_STREAM, FIELDS_KEY).directGrouping(METER_MODIFY_WORKER_BOLT, FlowMeterModifyHubBolt.INCOME_STREAM).directGrouping(CoordinatorBolt.ID).allGrouping(ZooKeeperSpout.SPOUT_ID);
WorkerBolt.Config speakerMeterModifyWorkerConfig = WorkerBolt.Config.builder().hubComponent(FlowMeterModifyHubBolt.ID).streamToHub(FlowMeterModifyHubBolt.INCOME_STREAM).workerSpoutComponent(ROUTER_BOLT_NAME).defaultTimeout((int) TimeUnit.SECONDS.toMillis(topologyConfig.getOperationTimeout())).build();
declareBolt(tb, new SpeakerWorkerBolt(speakerMeterModifyWorkerConfig), METER_MODIFY_WORKER_BOLT).fieldsGrouping(ROUTER_BOLT_NAME, SpeakerWorkerBolt.INCOME_STREAM, FIELDS_KEY).fieldsGrouping(FlowMeterModifyHubBolt.ID, StreamType.METER_MODIFY_WORKER.toString(), FIELDS_KEY).directGrouping(CoordinatorBolt.ID);
SwitchOperationsBolt switchesBolt = new SwitchOperationsBolt(persistenceManager);
declareBolt(tb, switchesBolt, SWITCHES_BOLT_NAME).shuffleGrouping(ROUTER_BOLT_NAME, StreamType.SWITCH.toString());
LinkOperationsBolt linksBolt = new LinkOperationsBolt(persistenceManager);
declareBolt(tb, linksBolt, LINKS_BOLT_NAME).shuffleGrouping(ROUTER_BOLT_NAME, StreamType.ISL.toString());
FlowOperationsBolt flowsBolt = new FlowOperationsBolt(persistenceManager);
declareBolt(tb, flowsBolt, FLOWS_BOLT_NAME).shuffleGrouping(ROUTER_BOLT_NAME, StreamType.FLOW.toString());
FlowPatchBolt flowPatchBolt = new FlowPatchBolt(persistenceManager);
declareBolt(tb, flowPatchBolt, FLOW_PATCH_BOLT_NAME).shuffleGrouping(ROUTER_BOLT_NAME, StreamType.FLOW_PATCH.toString());
FeatureTogglesBolt featureTogglesBolt = new FeatureTogglesBolt(persistenceManager);
declareBolt(tb, featureTogglesBolt, FEATURE_TOGGLES_BOLT_NAME).shuffleGrouping(ROUTER_BOLT_NAME, StreamType.FEATURE_TOGGLES.toString());
KildaConfigurationBolt kildaConfigurationBolt = new KildaConfigurationBolt(persistenceManager);
declareBolt(tb, kildaConfigurationBolt, KILDA_CONFIG_BOLT_NAME).shuffleGrouping(ROUTER_BOLT_NAME, StreamType.KILDA_CONFIG.toString());
PathsBolt pathsBolt = new PathsBolt(persistenceManager, pathComputerConfig);
declareBolt(tb, pathsBolt, PATHS_BOLT_NAME).shuffleGrouping(ROUTER_BOLT_NAME, StreamType.PATHS.toString());
HistoryOperationsBolt historyBolt = new HistoryOperationsBolt(persistenceManager);
declareBolt(tb, historyBolt, HISTORY_BOLT_NAME).shuffleGrouping(ROUTER_BOLT_NAME, StreamType.HISTORY.toString());
ResponseSplitterBolt splitterBolt = new ResponseSplitterBolt();
declareBolt(tb, splitterBolt, SPLITTER_BOLT_NAME).shuffleGrouping(SWITCHES_BOLT_NAME).shuffleGrouping(LINKS_BOLT_NAME).shuffleGrouping(FLOWS_BOLT_NAME).shuffleGrouping(FEATURE_TOGGLES_BOLT_NAME).shuffleGrouping(KILDA_CONFIG_BOLT_NAME).shuffleGrouping(PATHS_BOLT_NAME).shuffleGrouping(HISTORY_BOLT_NAME).shuffleGrouping(FlowMeterModifyHubBolt.ID).shuffleGrouping(FLOW_PATCH_BOLT_NAME);
MessageEncoder messageEncoder = new MessageEncoder();
declareBolt(tb, messageEncoder, MESSAGE_ENCODER_BOLT_NAME).shuffleGrouping(LINKS_BOLT_NAME, StreamType.ERROR.toString()).shuffleGrouping(LINKS_BOLT_NAME, StreamType.REROUTE.toString()).shuffleGrouping(FLOWS_BOLT_NAME, StreamType.ERROR.toString()).shuffleGrouping(FLOWS_BOLT_NAME, StreamType.REROUTE.toString()).shuffleGrouping(SWITCHES_BOLT_NAME, StreamType.ERROR.toString()).shuffleGrouping(SWITCHES_BOLT_NAME, StreamType.REROUTE.toString()).shuffleGrouping(SWITCHES_BOLT_NAME, StreamType.TO_SWITCH_MANAGER.toString()).shuffleGrouping(ROUTER_BOLT_NAME, StreamType.ERROR.toString()).shuffleGrouping(FEATURE_TOGGLES_BOLT_NAME, StreamType.ERROR.toString()).shuffleGrouping(FEATURE_TOGGLES_BOLT_NAME, StreamType.TO_SWITCH_MANAGER.toString()).shuffleGrouping(KILDA_CONFIG_BOLT_NAME, StreamType.ERROR.toString()).shuffleGrouping(PATHS_BOLT_NAME, StreamType.ERROR.toString()).shuffleGrouping(HISTORY_BOLT_NAME, StreamType.ERROR.toString()).shuffleGrouping(FlowMeterModifyHubBolt.ID, StreamType.ERROR.toString()).shuffleGrouping(FLOW_PATCH_BOLT_NAME, StreamType.ERROR.toString());
DiscoveryEncoderBolt discoveryEncoder = new DiscoveryEncoderBolt();
declareBolt(tb, discoveryEncoder, DISCOVERY_ENCODER_BOLT_NAME).shuffleGrouping(LINKS_BOLT_NAME, StreamType.DISCO.toString()).shuffleGrouping(SWITCHES_BOLT_NAME, StreamType.DISCO.toString()).shuffleGrouping(FEATURE_TOGGLES_BOLT_NAME, FeatureTogglesBolt.STREAM_NOTIFICATION_ID);
KafkaBolt kafkaNbBolt = buildKafkaBolt(topologyConfig.getKafkaNorthboundTopic());
declareBolt(tb, kafkaNbBolt, NB_KAFKA_BOLT_NAME).fieldsGrouping(SPLITTER_BOLT_NAME, FIELDS_KEY).shuffleGrouping(MESSAGE_ENCODER_BOLT_NAME, StreamType.ERROR.toString());
KafkaBolt kafkaFlowHsBolt = buildKafkaBolt(topologyConfig.getKafkaFlowHsTopic());
declareBolt(tb, kafkaFlowHsBolt, FLOW_HS_KAFKA_BOLT_NAME).shuffleGrouping(MESSAGE_ENCODER_BOLT_NAME, StreamType.FLOWHS.toString()).shuffleGrouping(FLOW_PATCH_BOLT_NAME, StreamType.FLOWHS.toString());
KafkaBolt kafkaDiscoBolt = buildKafkaBolt(topologyConfig.getKafkaDiscoTopic());
declareBolt(tb, kafkaDiscoBolt, DISCO_KAFKA_BOLT_NAME).shuffleGrouping(DISCOVERY_ENCODER_BOLT_NAME);
KafkaBolt kafkaPingBolt = buildKafkaBolt(topologyConfig.getKafkaPingTopic());
declareBolt(tb, kafkaPingBolt, PING_KAFKA_BOLT_NAME).shuffleGrouping(FLOW_PATCH_BOLT_NAME, StreamType.PING.toString());
declareBolt(tb, buildKafkaBolt(topologyConfig.getKafkaSpeakerTopic()), SPEAKER_KAFKA_BOLT).shuffleGrouping(METER_MODIFY_WORKER_BOLT, StreamType.TO_SPEAKER.toString());
declareBolt(tb, buildKafkaBolt(topologyConfig.getKafkaSwitchManagerTopic()), SWITCH_MANAGER_KAFKA_BOLT).shuffleGrouping(MESSAGE_ENCODER_BOLT_NAME, StreamType.TO_SWITCH_MANAGER.toString());
Server42EncoderBolt server42EncoderBolt = new Server42EncoderBolt();
declareBolt(tb, server42EncoderBolt, SERVER42_ENCODER_BOLT_NAME).shuffleGrouping(SWITCHES_BOLT_NAME, StreamType.TO_SERVER42.toString()).shuffleGrouping(FEATURE_TOGGLES_BOLT_NAME, FeatureTogglesBolt.STREAM_NOTIFICATION_ID);
declareBolt(tb, buildKafkaBolt(topologyConfig.getKafkaServer42StormNotifyTopic()), SERVER42_KAFKA_BOLT).shuffleGrouping(SERVER42_ENCODER_BOLT_NAME);
declareBolt(tb, buildKafkaBolt(topologyConfig.getKafkaRerouteTopic()), REROUTE_KAFKA_BOLT).shuffleGrouping(MESSAGE_ENCODER_BOLT_NAME, StreamType.REROUTE.toString());
metrics(tb);
return tb.createTopology();
}
Aggregations