Search in sources :

Example 1 with OFMeterStatsRequest

use of org.projectfloodlight.openflow.protocol.OFMeterStatsRequest in project open-kilda by telstra.

the class StatisticsService method gatherMeterStats.

@NewCorrelationContextRequired
private void gatherMeterStats(IOFSwitch iofSwitch) {
    OFFactory factory = iofSwitch.getOFFactory();
    SwitchId switchId = new SwitchId(iofSwitch.getId().getLong());
    if (factory.getVersion().compareTo(OFVersion.OF_13) >= 0) {
        OFMeterStatsRequest meterStatsRequest = factory.buildMeterStatsRequest().setMeterId(OFPM_ALL).build();
        logger.info("Getting meter stats for switch={} OF-xid:{}", iofSwitch.getId(), meterStatsRequest.getXid());
        Futures.addCallback(iofSwitch.writeStatsRequest(meterStatsRequest), new RequestCallback<>(data -> OfMeterStatsMapper.INSTANCE.toMeterStatsData(data, switchId), switchId, "meter"), directExecutor());
    }
}
Also used : InfoMessage(org.openkilda.messaging.info.InfoMessage) OfTableStatsMapper(org.openkilda.floodlight.converter.OfTableStatsMapper) OFStatsReply(org.projectfloodlight.openflow.protocol.OFStatsReply) OFPortStatsRequest(org.projectfloodlight.openflow.protocol.OFPortStatsRequest) OFFlowStatsRequest(org.projectfloodlight.openflow.protocol.OFFlowStatsRequest) LoggerFactory(org.slf4j.LoggerFactory) IOFSwitch(net.floodlightcontroller.core.IOFSwitch) OfFlowStatsMapper(org.openkilda.floodlight.converter.OfFlowStatsMapper) Map(java.util.Map) OFFactory(org.projectfloodlight.openflow.protocol.OFFactory) IKafkaProducerService(org.openkilda.floodlight.service.kafka.IKafkaProducerService) Collection(java.util.Collection) Set(java.util.Set) InfoData(org.openkilda.messaging.info.InfoData) FloodlightModuleContext(net.floodlightcontroller.core.module.FloodlightModuleContext) Collectors(java.util.stream.Collectors) String.format(java.lang.String.format) OFTableStatsRequest(org.projectfloodlight.openflow.protocol.OFTableStatsRequest) MoreExecutors.directExecutor(com.google.common.util.concurrent.MoreExecutors.directExecutor) OFPort(org.projectfloodlight.openflow.types.OFPort) CorrelationContext(org.openkilda.floodlight.utils.CorrelationContext) List(java.util.List) IFloodlightProviderService(net.floodlightcontroller.core.IFloodlightProviderService) OfPortStatsMapper(org.openkilda.floodlight.converter.OfPortStatsMapper) OFGroup(org.projectfloodlight.openflow.types.OFGroup) OFVersion(org.projectfloodlight.openflow.protocol.OFVersion) IOFSwitchService(net.floodlightcontroller.core.internal.IOFSwitchService) Function(java.util.function.Function) CollectionUtils(org.apache.commons.collections4.CollectionUtils) SwitchTableStatsData(org.openkilda.messaging.info.stats.SwitchTableStatsData) ImmutableList(com.google.common.collect.ImmutableList) OFTableStatsReply(org.projectfloodlight.openflow.protocol.OFTableStatsReply) TableStatsEntry(org.openkilda.messaging.info.stats.TableStatsEntry) Logger(org.slf4j.Logger) CorrelationContextClosable(org.openkilda.floodlight.utils.CorrelationContext.CorrelationContextClosable) IFloodlightModule(net.floodlightcontroller.core.module.IFloodlightModule) FutureCallback(com.google.common.util.concurrent.FutureCallback) OFMeterStatsRequest(org.projectfloodlight.openflow.protocol.OFMeterStatsRequest) Futures(com.google.common.util.concurrent.Futures) KafkaUtilityService(org.openkilda.floodlight.service.kafka.KafkaUtilityService) NewCorrelationContextRequired(org.openkilda.floodlight.utils.NewCorrelationContextRequired) SwitchId(org.openkilda.model.SwitchId) OfMeterStatsMapper(org.openkilda.floodlight.converter.OfMeterStatsMapper) IFloodlightService(net.floodlightcontroller.core.module.IFloodlightService) Destination(org.openkilda.messaging.Destination) NumberUtils(org.apache.commons.lang3.math.NumberUtils) DatapathId(org.projectfloodlight.openflow.types.DatapathId) Collections(java.util.Collections) IThreadPoolService(net.floodlightcontroller.threadpool.IThreadPoolService) OFMeterStatsRequest(org.projectfloodlight.openflow.protocol.OFMeterStatsRequest) OFFactory(org.projectfloodlight.openflow.protocol.OFFactory) SwitchId(org.openkilda.model.SwitchId) NewCorrelationContextRequired(org.openkilda.floodlight.utils.NewCorrelationContextRequired)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 FutureCallback (com.google.common.util.concurrent.FutureCallback)1 Futures (com.google.common.util.concurrent.Futures)1 MoreExecutors.directExecutor (com.google.common.util.concurrent.MoreExecutors.directExecutor)1 String.format (java.lang.String.format)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1 Function (java.util.function.Function)1 Collectors (java.util.stream.Collectors)1 IFloodlightProviderService (net.floodlightcontroller.core.IFloodlightProviderService)1 IOFSwitch (net.floodlightcontroller.core.IOFSwitch)1 IOFSwitchService (net.floodlightcontroller.core.internal.IOFSwitchService)1 FloodlightModuleContext (net.floodlightcontroller.core.module.FloodlightModuleContext)1 IFloodlightModule (net.floodlightcontroller.core.module.IFloodlightModule)1 IFloodlightService (net.floodlightcontroller.core.module.IFloodlightService)1 IThreadPoolService (net.floodlightcontroller.threadpool.IThreadPoolService)1 CollectionUtils (org.apache.commons.collections4.CollectionUtils)1