use of org.openkilda.model.GroupId in project open-kilda by telstra.
the class OfInstructionsConverterTest method buildActions.
private static List<Action> buildActions() {
List<Action> actions = new ArrayList<>();
actions.add(new GroupAction(new GroupId(3)));
actions.add(new PortOutAction(new PortNumber(SpecialPortType.CONTROLLER)));
actions.add(new PopVlanAction());
actions.add(new PushVlanAction());
actions.add(new PopVxlanAction(ActionType.POP_VXLAN_NOVIFLOW));
actions.add(new PopVxlanAction(ActionType.POP_VXLAN_OVS));
actions.add(PushVxlanAction.builder().type(ActionType.PUSH_VXLAN_NOVIFLOW).srcMacAddress(buildMacAddress("00:00:00:00:00:0b")).dstMacAddress(buildMacAddress("00:00:00:00:00:16")).srcIpv4Address(buildIPv4Address("0.0.0.33")).dstIpv4Address(buildIPv4Address("0.0.0.44")).udpSrc(55).vni(66).build());
actions.add(PushVxlanAction.builder().type(ActionType.PUSH_VXLAN_OVS).srcMacAddress(buildMacAddress("00:00:00:00:00:6f")).dstMacAddress(buildMacAddress("00:00:00:00:00:de")).srcIpv4Address(buildIPv4Address("0.0.1.77")).dstIpv4Address(buildIPv4Address("0.0.1.188")).udpSrc(555).vni(666).build());
actions.add(SetFieldAction.builder().field(Field.UDP_DST).value(7).build());
actions.add(CopyFieldAction.builder().numberOfBits(1).srcOffset(2).dstOffset(3).oxmSrcHeader(OpenFlowOxms.ETH_SRC).oxmDstHeader(OpenFlowOxms.ETH_DST).build());
actions.add(SwapFieldAction.builder().type(ActionType.NOVI_SWAP_FIELD).numberOfBits(11).srcOffset(22).dstOffset(33).oxmSrcHeader(OpenFlowOxms.ETH_SRC).oxmDstHeader(OpenFlowOxms.ETH_DST).build());
actions.add(SwapFieldAction.builder().type(ActionType.KILDA_SWAP_FIELD).numberOfBits(111).srcOffset(222).dstOffset(333).oxmSrcHeader(OpenFlowOxms.ETH_SRC).oxmDstHeader(OpenFlowOxms.ETH_DST).build());
return actions;
}
use of org.openkilda.model.GroupId 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());
}
use of org.openkilda.model.GroupId in project open-kilda by telstra.
the class SwitchOperationsServiceTest method shouldValidateFlowMirrorPointsWhenUpdatingSwitchLldpProperties.
@Test(expected = IllegalSwitchPropertiesException.class)
public void shouldValidateFlowMirrorPointsWhenUpdatingSwitchLldpProperties() {
Switch mirrorSwitch = Switch.builder().switchId(TEST_SWITCH_ID).status(SwitchStatus.ACTIVE).build();
switchRepository.add(mirrorSwitch);
MirrorGroup mirrorGroup = MirrorGroup.builder().switchId(TEST_SWITCH_ID).groupId(new GroupId(12L)).pathId(new PathId("test_path_id")).flowId(TEST_FLOW_ID_1).mirrorGroupType(MirrorGroupType.TRAFFIC_INTEGRITY).mirrorDirection(MirrorDirection.INGRESS).build();
mirrorGroupRepository.add(mirrorGroup);
FlowMirrorPoints flowMirrorPoints = FlowMirrorPoints.builder().mirrorGroup(mirrorGroup).mirrorSwitch(mirrorSwitch).build();
flowMirrorPointsRepository.add(flowMirrorPoints);
createSwitchProperties(mirrorSwitch, Collections.singleton(FlowEncapsulationType.TRANSIT_VLAN), true, false, false);
SwitchPropertiesDto update = new SwitchPropertiesDto();
update.setSupportedTransitEncapsulation(Collections.singleton(org.openkilda.messaging.payload.flow.FlowEncapsulationType.TRANSIT_VLAN));
update.setMultiTable(true);
update.setSwitchLldp(true);
switchOperationsService.updateSwitchProperties(TEST_SWITCH_ID, update);
}
use of org.openkilda.model.GroupId in project open-kilda by telstra.
the class IngressInstallFlowModFactory method makeForwardMessageInstructions.
protected List<OFInstruction> makeForwardMessageInstructions(EffectiveIds effectiveIds, List<Integer> vlanStack) {
List<OFAction> applyActions = new ArrayList<>();
List<OFInstruction> instructions = new ArrayList<>();
MeterId effectiveMeterId = effectiveIds.getMeterId();
if (effectiveMeterId != null) {
OfAdapter.INSTANCE.makeMeterCall(of, effectiveMeterId, applyActions, instructions);
}
GroupId effectiveGroupId = effectiveIds.getGroupId();
boolean groupIsPresent = effectiveGroupId != null;
applyActions.addAll(makeTransformActions(vlanStack, groupIsPresent));
if (groupIsPresent) {
applyActions.add(makeGroupAction(effectiveGroupId));
} else {
applyActions.add(makeOutputAction());
}
instructions.add(of.instructions().applyActions(applyActions));
if (command.getMetadata().isMultiTable() && effectiveGroupId == null) {
instructions.add(of.instructions().gotoTable(TableId.of(SwitchManager.POST_INGRESS_TABLE_ID)));
instructions.addAll(makeMetadataInstructions());
}
return instructions;
}
use of org.openkilda.model.GroupId in project open-kilda by telstra.
the class FermaMirrorGroupRepositoryTest method createMirrorGroup.
private MirrorGroup createMirrorGroup(int groupId, PathId pathId) {
MirrorGroup mirrorGroup = MirrorGroup.builder().switchId(theSwitch.getSwitchId()).groupId(new GroupId(groupId)).pathId(pathId).flowId(TEST_FLOW_ID).mirrorDirection(MirrorDirection.INGRESS).mirrorGroupType(MirrorGroupType.TRAFFIC_INTEGRITY).build();
mirrorGroupRepository.add(mirrorGroup);
return mirrorGroup;
}
Aggregations