Search in sources :

Example 1 with OFMeterMod

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

the class ReplaceInstallFlowTest method installIngressPushFlow.

@Test
public void installIngressPushFlow() throws IOException, InterruptedException {
    String value = Resources.toString(getClass().getResource("/install_ingress_push_flow.json"), Charsets.UTF_8);
    InstallIngressFlow data = (InstallIngressFlow) prepareData(value);
    OFMeterMod meterCommand = scheme.installMeter(data.getBandwidth(), 1024, data.getMeterId());
    OFFlowAdd flowCommand = scheme.ingressPushFlowMod(data.getInputPort(), data.getOutputPort(), data.getTransitVlanId(), data.getMeterId(), 123L);
    runTest(value, flowCommand, meterCommand, null, null);
}
Also used : InstallIngressFlow(org.openkilda.messaging.command.flow.InstallIngressFlow) OFMeterMod(org.projectfloodlight.openflow.protocol.OFMeterMod) OFFlowAdd(org.projectfloodlight.openflow.protocol.OFFlowAdd) Test(org.junit.Test)

Example 2 with OFMeterMod

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

the class ReplaceInstallFlowTest method installIngressReplaceFlow.

@Test
public void installIngressReplaceFlow() throws IOException, InterruptedException {
    String value = Resources.toString(getClass().getResource("/install_ingress_replace_flow.json"), Charsets.UTF_8);
    InstallIngressFlow data = (InstallIngressFlow) prepareData(value);
    OFMeterMod meterCommand = scheme.installMeter(data.getBandwidth(), 1024, data.getMeterId());
    OFFlowAdd flowCommand = scheme.ingressReplaceFlowMod(data.getInputPort(), data.getOutputPort(), data.getInputVlanId(), data.getTransitVlanId(), data.getMeterId(), 123L);
    runTest(value, flowCommand, meterCommand, null, null);
}
Also used : InstallIngressFlow(org.openkilda.messaging.command.flow.InstallIngressFlow) OFMeterMod(org.projectfloodlight.openflow.protocol.OFMeterMod) OFFlowAdd(org.projectfloodlight.openflow.protocol.OFFlowAdd) Test(org.junit.Test)

Example 3 with OFMeterMod

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

the class ReplaceInstallFlowTest method installOneSwitchReplaceFlow.

@Test
public void installOneSwitchReplaceFlow() throws IOException, InterruptedException {
    String value = Resources.toString(getClass().getResource("/install_one_switch_replace_flow.json"), Charsets.UTF_8);
    InstallOneSwitchFlow data = (InstallOneSwitchFlow) prepareData(value);
    OFMeterMod meterCommand = scheme.installMeter(data.getBandwidth(), 1024, data.getMeterId());
    OFFlowAdd flowCommand = scheme.oneSwitchReplaceFlowMod(data.getInputPort(), data.getOutputPort(), data.getInputVlanId(), data.getOutputVlanId(), data.getMeterId(), 123L);
    runTest(value, flowCommand, meterCommand, null, null);
}
Also used : InstallOneSwitchFlow(org.openkilda.messaging.command.flow.InstallOneSwitchFlow) OFMeterMod(org.projectfloodlight.openflow.protocol.OFMeterMod) OFFlowAdd(org.projectfloodlight.openflow.protocol.OFFlowAdd) Test(org.junit.Test)

Example 4 with OFMeterMod

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

the class ReplaceInstallFlowTest method installOneSwitchPushFlow.

@Test
public void installOneSwitchPushFlow() throws IOException, InterruptedException {
    String value = Resources.toString(getClass().getResource("/install_one_switch_push_flow.json"), Charsets.UTF_8);
    InstallOneSwitchFlow data = (InstallOneSwitchFlow) prepareData(value);
    OFMeterMod meterCommand = scheme.installMeter(data.getBandwidth(), 1024, data.getMeterId());
    OFFlowAdd flowCommand = scheme.oneSwitchPushFlowMod(data.getInputPort(), data.getOutputPort(), data.getOutputVlanId(), data.getMeterId(), 123L);
    runTest(value, flowCommand, meterCommand, null, null);
}
Also used : InstallOneSwitchFlow(org.openkilda.messaging.command.flow.InstallOneSwitchFlow) OFMeterMod(org.projectfloodlight.openflow.protocol.OFMeterMod) OFFlowAdd(org.projectfloodlight.openflow.protocol.OFFlowAdd) Test(org.junit.Test)

Example 5 with OFMeterMod

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

the class SwitchManager method installMeter.

private long installMeter(final IOFSwitch sw, final DatapathId dpid, final long bandwidth, final long burstSize, final long meterId) throws OFInstallException {
    logger.debug("installing meter {} on switch {} width bandwidth {}", meterId, dpid, bandwidth);
    Set<OFMeterFlags> flags = new HashSet<>(asList(OFMeterFlags.KBPS, OFMeterFlags.BURST));
    OFFactory ofFactory = sw.getOFFactory();
    OFMeterBandDrop.Builder bandBuilder = ofFactory.meterBands().buildDrop().setRate(bandwidth).setBurstSize(burstSize);
    OFMeterMod.Builder meterModBuilder = ofFactory.buildMeterMod().setMeterId(meterId).setCommand(OFMeterModCommand.ADD).setFlags(flags);
    if (sw.getOFFactory().getVersion().compareTo(OF_13) > 0) {
        meterModBuilder.setBands(singletonList(bandBuilder.build()));
    } else {
        meterModBuilder.setMeters(singletonList(bandBuilder.build()));
    }
    OFMeterMod meterMod = meterModBuilder.build();
    return pushFlow(sw, "--InstallMeter--", meterMod);
}
Also used : OFMeterFlags(org.projectfloodlight.openflow.protocol.OFMeterFlags) OFMeterMod(org.projectfloodlight.openflow.protocol.OFMeterMod) OFFactory(org.projectfloodlight.openflow.protocol.OFFactory) OFMeterBandDrop(org.projectfloodlight.openflow.protocol.meterband.OFMeterBandDrop) HashSet(java.util.HashSet)

Aggregations

OFMeterMod (org.projectfloodlight.openflow.protocol.OFMeterMod)12 Test (org.junit.Test)9 OFFlowAdd (org.projectfloodlight.openflow.protocol.OFFlowAdd)9 InstallIngressFlow (org.openkilda.messaging.command.flow.InstallIngressFlow)4 InstallOneSwitchFlow (org.openkilda.messaging.command.flow.InstallOneSwitchFlow)4 OFFactory (org.projectfloodlight.openflow.protocol.OFFactory)2 HashSet (java.util.HashSet)1 ConsumerRecord (org.apache.kafka.clients.consumer.ConsumerRecord)1 MeterPool (org.openkilda.floodlight.switchmanager.MeterPool)1 OFMeterFlags (org.projectfloodlight.openflow.protocol.OFMeterFlags)1 OFMeterBandDrop (org.projectfloodlight.openflow.protocol.meterband.OFMeterBandDrop)1