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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations