Search in sources :

Example 1 with OFGroupDelete

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

the class OfGroupConverterTest method testConvertDeleteGroupCommand.

@Test
public void testConvertDeleteGroupCommand() {
    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();
    OFGroupDelete ofGroupDelete = OfGroupConverter.INSTANCE.convertDeleteGroupCommand(groupSpeakerData, factory);
    assertEquals(OFGroup.of(GROUP_ID), ofGroupDelete.getGroup());
    assertEquals(OFGroupType.ALL, ofGroupDelete.getGroupType());
}
Also used : 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) OFGroupDelete(org.projectfloodlight.openflow.protocol.OFGroupDelete) GroupId(org.openkilda.model.GroupId) Test(org.junit.Test)

Example 2 with OFGroupDelete

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

the class SwitchManager method deleteGroup.

private void deleteGroup(IOFSwitch sw, int groupId) throws OfInstallException {
    OFGroupDelete groupDelete = sw.getOFFactory().buildGroupDelete().setGroup(OFGroup.of(groupId)).setGroupType(OFGroupType.ALL).build();
    pushFlow(sw, "--DeleteGroup--", groupDelete);
    sendBarrierRequest(sw);
}
Also used : OFGroupDelete(org.projectfloodlight.openflow.protocol.OFGroupDelete)

Example 3 with OFGroupDelete

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

the class GroupRemoveCommand method makeExecutePlan.

@Override
protected CompletableFuture<GroupRemoveReport> makeExecutePlan(SpeakerCommandProcessor commandProcessor) throws Exception {
    ensureSwitchSupportGroups();
    IOFSwitch sw = getSw();
    OFGroupDelete groupDelete = sw.getOFFactory().buildGroupDelete().setGroup(OFGroup.of(groupId.intValue())).setGroupType(OFGroupType.ALL).build();
    try (Session session = getSessionService().open(messageContext, sw)) {
        return session.write(groupDelete).thenApply(ignore -> makeSuccessReport());
    }
}
Also used : IOFSwitch(net.floodlightcontroller.core.IOFSwitch) OFGroupDelete(org.projectfloodlight.openflow.protocol.OFGroupDelete) Session(org.openkilda.floodlight.service.session.Session)

Aggregations

OFGroupDelete (org.projectfloodlight.openflow.protocol.OFGroupDelete)3 ArrayList (java.util.ArrayList)1 IOFSwitch (net.floodlightcontroller.core.IOFSwitch)1 Test (org.junit.Test)1 Session (org.openkilda.floodlight.service.session.Session)1 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 OFFactoryVer13 (org.projectfloodlight.openflow.protocol.ver13.OFFactoryVer13)1