Search in sources :

Example 6 with MeterConfig

use of org.openkilda.model.MeterConfig in project open-kilda by telstra.

the class RecordHandler method makeFlowSegmentWrappedCommand.

private FlowSegmentWrapperCommand makeFlowSegmentWrappedCommand(InstallOneSwitchMirrorFlow request, MessageContext messageContext, FlowSegmentResponseFactory responseFactory) {
    FlowEndpoint endpoint = new FlowEndpoint(request.getSwitchId(), request.getInputPort(), request.getInputVlanId(), request.getInputInnerVlanId(), request.isEnableLldp(), request.isEnableArp());
    FlowEndpoint egressEndpoint = new FlowEndpoint(request.getSwitchId(), request.getOutputPort(), request.getOutputVlanId(), request.getOutputInnerVlanId());
    MeterConfig meterConfig = makeMeterConfig(request.getMeterId(), request.getBandwidth());
    OneSwitchMirrorFlowInstallCommand command = new OneSwitchMirrorFlowInstallCommand(messageContext, EMPTY_COMMAND_ID, makeSegmentMetadata(request), endpoint, meterConfig, egressEndpoint, new RulesContext(), request.getMirrorConfig());
    return new FlowSegmentWrapperCommand(command, responseFactory);
}
Also used : FlowSegmentWrapperCommand(org.openkilda.floodlight.command.flow.FlowSegmentWrapperCommand) FlowEndpoint(org.openkilda.model.FlowEndpoint) OneSwitchMirrorFlowInstallCommand(org.openkilda.floodlight.command.flow.ingress.OneSwitchMirrorFlowInstallCommand) RulesContext(org.openkilda.floodlight.model.RulesContext) OFMeterConfig(org.projectfloodlight.openflow.protocol.OFMeterConfig) MeterConfig(org.openkilda.model.MeterConfig)

Example 7 with MeterConfig

use of org.openkilda.model.MeterConfig in project open-kilda by telstra.

the class RecordHandler method doModifyFlowMeterForSwitchManager.

private void doModifyFlowMeterForSwitchManager(CommandMessage message) {
    ModifyFlowMeterForSwitchManagerRequest request = (ModifyFlowMeterForSwitchManagerRequest) message.getData();
    IKafkaProducerService producerService = getKafkaProducer();
    long meterId = request.getMeterId();
    SwitchId switchId = request.getSwitchId();
    MeterConfig meterConfig = new MeterConfig(new MeterId(request.getMeterId()), request.getRate());
    logger.info("Modifying flow meter {} on Switch {}", meterId, switchId);
    handleSpeakerCommand(new MeterModifyCommand(new MessageContext(message), switchId, meterConfig));
    InfoMessage response = new InfoMessage(new ModifyMeterResponse(switchId, request.getMeterId()), System.currentTimeMillis(), message.getCorrelationId());
    producerService.sendMessageAndTrack(context.getKafkaSwitchManagerTopic(), message.getCorrelationId(), response);
}
Also used : MeterModifyCommand(org.openkilda.floodlight.command.meter.MeterModifyCommand) ModifyMeterResponse(org.openkilda.messaging.info.switches.ModifyMeterResponse) IKafkaProducerService(org.openkilda.floodlight.service.kafka.IKafkaProducerService) InfoMessage(org.openkilda.messaging.info.InfoMessage) SwitchId(org.openkilda.model.SwitchId) MessageContext(org.openkilda.messaging.MessageContext) OFMeterConfig(org.projectfloodlight.openflow.protocol.OFMeterConfig) MeterConfig(org.openkilda.model.MeterConfig) ModifyFlowMeterForSwitchManagerRequest(org.openkilda.messaging.command.flow.ModifyFlowMeterForSwitchManagerRequest) MeterId(org.openkilda.model.MeterId)

Example 8 with MeterConfig

use of org.openkilda.model.MeterConfig in project open-kilda by telstra.

the class RecordHandler method makeFlowSegmentWrappedCommand.

private FlowSegmentWrapperCommand makeFlowSegmentWrappedCommand(InstallIngressMirrorFlow request, MessageContext messageContext, FlowSegmentResponseFactory responseFactory) {
    FlowEndpoint endpoint = new FlowEndpoint(request.getSwitchId(), request.getInputPort(), request.getInputVlanId(), request.getInputInnerVlanId(), request.isEnableLldp(), request.isEnableArp());
    MeterConfig meterConfig = makeMeterConfig(request.getMeterId(), request.getBandwidth());
    IngressMirrorFlowSegmentInstallCommand command = new IngressMirrorFlowSegmentInstallCommand(messageContext, EMPTY_COMMAND_ID, makeSegmentMetadata(request), endpoint, meterConfig, request.getEgressSwitchId(), request.getOutputPort(), makeTransitEncapsulation(request), new RulesContext(), request.getMirrorConfig());
    return new FlowSegmentWrapperCommand(command, responseFactory);
}
Also used : FlowSegmentWrapperCommand(org.openkilda.floodlight.command.flow.FlowSegmentWrapperCommand) FlowEndpoint(org.openkilda.model.FlowEndpoint) RulesContext(org.openkilda.floodlight.model.RulesContext) IngressMirrorFlowSegmentInstallCommand(org.openkilda.floodlight.command.flow.ingress.IngressMirrorFlowSegmentInstallCommand) OFMeterConfig(org.projectfloodlight.openflow.protocol.OFMeterConfig) MeterConfig(org.openkilda.model.MeterConfig)

Example 9 with MeterConfig

use of org.openkilda.model.MeterConfig in project open-kilda by telstra.

the class RecordHandler method makeFlowSegmentWrappedCommand.

private FlowSegmentWrapperCommand makeFlowSegmentWrappedCommand(InstallIngressFlow request, MessageContext messageContext, FlowSegmentResponseFactory responseFactory) {
    FlowEndpoint endpoint = new FlowEndpoint(request.getSwitchId(), request.getInputPort(), request.getInputVlanId(), request.getInputInnerVlanId(), request.isEnableLldp(), request.isEnableArp());
    MeterConfig meterConfig = makeMeterConfig(request.getMeterId(), request.getBandwidth());
    IngressFlowSegmentInstallCommand command = new IngressFlowSegmentInstallCommand(messageContext, EMPTY_COMMAND_ID, makeSegmentMetadata(request), endpoint, meterConfig, request.getEgressSwitchId(), request.getOutputPort(), makeTransitEncapsulation(request), new RulesContext(), request.getMirrorConfig());
    return new FlowSegmentWrapperCommand(command, responseFactory);
}
Also used : IngressFlowSegmentInstallCommand(org.openkilda.floodlight.command.flow.ingress.IngressFlowSegmentInstallCommand) FlowSegmentWrapperCommand(org.openkilda.floodlight.command.flow.FlowSegmentWrapperCommand) FlowEndpoint(org.openkilda.model.FlowEndpoint) RulesContext(org.openkilda.floodlight.model.RulesContext) OFMeterConfig(org.projectfloodlight.openflow.protocol.OFMeterConfig) MeterConfig(org.openkilda.model.MeterConfig)

Example 10 with MeterConfig

use of org.openkilda.model.MeterConfig in project open-kilda by telstra.

the class RecordHandler method makeFlowSegmentWrappedCommand.

private FlowSegmentWrapperCommand makeFlowSegmentWrappedCommand(InstallOneSwitchFlow request, MessageContext messageContext, FlowSegmentResponseFactory responseFactory) {
    FlowEndpoint endpoint = new FlowEndpoint(request.getSwitchId(), request.getInputPort(), request.getInputVlanId(), request.getInputInnerVlanId(), request.isEnableLldp(), request.isEnableArp());
    FlowEndpoint egressEndpoint = new FlowEndpoint(request.getSwitchId(), request.getOutputPort(), request.getOutputVlanId(), request.getOutputInnerVlanId());
    MeterConfig meterConfig = makeMeterConfig(request.getMeterId(), request.getBandwidth());
    OneSwitchFlowInstallCommand command = new OneSwitchFlowInstallCommand(messageContext, EMPTY_COMMAND_ID, makeSegmentMetadata(request), endpoint, meterConfig, egressEndpoint, new RulesContext(), request.getMirrorConfig());
    return new FlowSegmentWrapperCommand(command, responseFactory);
}
Also used : FlowSegmentWrapperCommand(org.openkilda.floodlight.command.flow.FlowSegmentWrapperCommand) FlowEndpoint(org.openkilda.model.FlowEndpoint) OneSwitchFlowInstallCommand(org.openkilda.floodlight.command.flow.ingress.OneSwitchFlowInstallCommand) RulesContext(org.openkilda.floodlight.model.RulesContext) OFMeterConfig(org.projectfloodlight.openflow.protocol.OFMeterConfig) MeterConfig(org.openkilda.model.MeterConfig)

Aggregations

MeterConfig (org.openkilda.model.MeterConfig)12 OFMeterConfig (org.projectfloodlight.openflow.protocol.OFMeterConfig)8 MeterId (org.openkilda.model.MeterId)6 MessageContext (org.openkilda.messaging.MessageContext)5 FlowEndpoint (org.openkilda.model.FlowEndpoint)5 ArrayList (java.util.ArrayList)4 FlowSegmentWrapperCommand (org.openkilda.floodlight.command.flow.FlowSegmentWrapperCommand)4 RulesContext (org.openkilda.floodlight.model.RulesContext)4 ImmutableList (com.google.common.collect.ImmutableList)3 List (java.util.List)3 Test (org.junit.Test)3 AbstractSpeakerCommandTest (org.openkilda.floodlight.command.AbstractSpeakerCommandTest)3 SwitchId (org.openkilda.model.SwitchId)3 CompletableFuture (java.util.concurrent.CompletableFuture)2 Session (org.openkilda.floodlight.service.session.Session)2 OFMessage (org.projectfloodlight.openflow.protocol.OFMessage)2 Optional (java.util.Optional)1 Getter (lombok.Getter)1 IngressFlowSegmentRequest (org.openkilda.floodlight.api.request.IngressFlowSegmentRequest)1 OneSwitchFlowRequestFactory (org.openkilda.floodlight.api.request.factory.OneSwitchFlowRequestFactory)1