Search in sources :

Example 1 with OFGroupAdd

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

the class VerificationFlowGenerator method generateFlow.

@Override
public SwitchFlowTuple generateFlow(IOFSwitch sw) {
    ArrayList<OFAction> actionList = new ArrayList<>();
    OFMeterMod meter = generateAddMeterForDefaultRule(sw, meterId, meterRate, config.getSystemMeterBurstSizeInPackets(), config.getDiscoPacketSize());
    OFInstructionMeter ofInstructionMeter = buildMeterInstruction(meterId, sw, actionList);
    OFGroupAdd group = null;
    if (broadcast && featureDetectorService.detectSwitch(sw).contains(SwitchFeature.GROUP_PACKET_OUT_CONTROLLER)) {
        group = getInstallRoundTripLatencyGroupInstruction(sw);
        actionList.add(sw.getOFFactory().actions().group(group.getGroup()));
    } else {
        addStandardDiscoveryActions(sw, actionList);
    }
    OFFlowMod flowMod = buildVerificationRule(sw, broadcast, cookie, ofInstructionMeter, actionList);
    return SwitchFlowTuple.builder().sw(sw).flow(flowMod).meter(meter).group(group).build();
}
Also used : OFInstructionMeter(org.projectfloodlight.openflow.protocol.instruction.OFInstructionMeter) OFGroupAdd(org.projectfloodlight.openflow.protocol.OFGroupAdd) OFMeterMod(org.projectfloodlight.openflow.protocol.OFMeterMod) OFAction(org.projectfloodlight.openflow.protocol.action.OFAction) ArrayList(java.util.ArrayList) OFFlowMod(org.projectfloodlight.openflow.protocol.OFFlowMod)

Example 2 with OFGroupAdd

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

the class SwitchManagerTest method validateRoundTripLatencyGroup.

@Test
public void validateRoundTripLatencyGroup() {
    OFGroupAdd groupAdd = getOfGroupAddInstruction();
    assertTrue(runValidateRoundTripLatencyGroup(groupAdd.getBuckets()));
}
Also used : OFGroupAdd(org.projectfloodlight.openflow.protocol.OFGroupAdd) Test(org.junit.Test)

Example 3 with OFGroupAdd

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

the class OfGroupConverterTest method testConvertInstallGroupCommand.

@Test
public void testConvertInstallGroupCommand() {
    List<Bucket> buckets = new ArrayList<>();
    buckets.add(Bucket.builder().watchPort(WatchPort.ANY).watchGroup(WatchGroup.ALL).writeActions(Sets.newHashSet(new PortOutAction(new PortNumber(2, null)))).build());
    buckets.add(Bucket.builder().watchPort(WatchPort.ANY).watchGroup(WatchGroup.ALL).writeActions(Sets.newHashSet(new PortOutAction(new PortNumber(1, null)))).build());
    GroupSpeakerData groupSpeakerData = GroupSpeakerData.builder().groupId(new GroupId(GROUP_ID)).type(GroupType.ALL).buckets(buckets).build();
    OFFactoryVer13 factory = new OFFactoryVer13();
    OFGroupAdd ofGroupAdd = OfGroupConverter.INSTANCE.convertInstallGroupCommand(groupSpeakerData, factory);
    assertEquals(OFGroup.of(GROUP_ID), ofGroupAdd.getGroup());
    assertEquals(OFGroupType.ALL, ofGroupAdd.getGroupType());
    assertEquals(2, ofGroupAdd.getBuckets().size());
    List<OFBucket> expectedBuckets = new ArrayList<>();
    expectedBuckets.add(factory.buildBucket().setWatchPort(OFPort.ANY).setWatchGroup(OFGroup.ALL).setActions(getActions(factory, 2)).build());
    expectedBuckets.add(factory.buildBucket().setWatchPort(OFPort.ANY).setWatchGroup(OFGroup.ALL).setActions(getActions(factory, 1)).build());
    assertEquals(expectedBuckets, ofGroupAdd.getBuckets());
}
Also used : OFGroupAdd(org.projectfloodlight.openflow.protocol.OFGroupAdd) OFBucket(org.projectfloodlight.openflow.protocol.OFBucket) OFBucket(org.projectfloodlight.openflow.protocol.OFBucket) Bucket(org.openkilda.rulemanager.group.Bucket) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) OFFactoryVer13(org.projectfloodlight.openflow.protocol.ver13.OFFactoryVer13) ArrayList(java.util.ArrayList) GroupSpeakerData(org.openkilda.rulemanager.GroupSpeakerData) PortNumber(org.openkilda.rulemanager.ProtoConstants.PortNumber) GroupId(org.openkilda.model.GroupId) Test(org.junit.Test)

Aggregations

OFGroupAdd (org.projectfloodlight.openflow.protocol.OFGroupAdd)3 ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2 GroupId (org.openkilda.model.GroupId)1 GroupSpeakerData (org.openkilda.rulemanager.GroupSpeakerData)1 PortNumber (org.openkilda.rulemanager.ProtoConstants.PortNumber)1 PortOutAction (org.openkilda.rulemanager.action.PortOutAction)1 Bucket (org.openkilda.rulemanager.group.Bucket)1 OFBucket (org.projectfloodlight.openflow.protocol.OFBucket)1 OFFlowMod (org.projectfloodlight.openflow.protocol.OFFlowMod)1 OFMeterMod (org.projectfloodlight.openflow.protocol.OFMeterMod)1 OFAction (org.projectfloodlight.openflow.protocol.action.OFAction)1 OFInstructionMeter (org.projectfloodlight.openflow.protocol.instruction.OFInstructionMeter)1 OFFactoryVer13 (org.projectfloodlight.openflow.protocol.ver13.OFFactoryVer13)1