use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase in project netvirt by opendaylight.
the class NexthopManager method getEgressActionsForInterface.
protected List<ActionInfo> getEgressActionsForInterface(final String ifName, int actionKey) {
List<ActionInfo> listActionInfo = new ArrayList<>();
try {
Future<RpcResult<GetEgressActionsForInterfaceOutput>> result = interfaceManager.getEgressActionsForInterface(new GetEgressActionsForInterfaceInputBuilder().setIntfName(ifName).build());
RpcResult<GetEgressActionsForInterfaceOutput> rpcResult = result.get();
if (!rpcResult.isSuccessful()) {
LOG.error("RPC Call to Get egress actions for interface {} returned with Errors {}", ifName, rpcResult.getErrors());
} else {
List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actions = rpcResult.getResult().getAction();
for (Action action : actions) {
actionKey = action.getKey().getOrder() + actionKey;
org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionClass = action.getAction();
if (actionClass instanceof OutputActionCase) {
listActionInfo.add(new ActionOutput(actionKey, ((OutputActionCase) actionClass).getOutputAction().getOutputNodeConnector()));
} else if (actionClass instanceof PushVlanActionCase) {
listActionInfo.add(new ActionPushVlan(actionKey));
} else if (actionClass instanceof SetFieldCase) {
if (((SetFieldCase) actionClass).getSetField().getVlanMatch() != null) {
int vlanVid = ((SetFieldCase) actionClass).getSetField().getVlanMatch().getVlanId().getVlanId().getValue();
listActionInfo.add(new ActionSetFieldVlanVid(actionKey, vlanVid));
}
} else if (actionClass instanceof NxActionResubmitRpcAddGroupCase) {
Short tableId = ((NxActionResubmitRpcAddGroupCase) actionClass).getNxResubmit().getTable();
listActionInfo.add(new ActionNxResubmit(actionKey, tableId));
} else if (actionClass instanceof NxActionRegLoadNodesNodeTableFlowApplyActionsCase) {
NxRegLoad nxRegLoad = ((NxActionRegLoadNodesNodeTableFlowApplyActionsCase) actionClass).getNxRegLoad();
listActionInfo.add(new ActionRegLoad(actionKey, NxmNxReg6.class, nxRegLoad.getDst().getStart(), nxRegLoad.getDst().getEnd(), nxRegLoad.getValue().longValue()));
}
}
}
} catch (InterruptedException | ExecutionException e) {
LOG.warn("Exception when egress actions for interface {}", ifName, e);
}
return listActionInfo;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase in project genius by opendaylight.
the class ActionSetTcpSourcePortTest method verifyAction.
private void verifyAction(Action action) {
assertTrue(action.getAction() instanceof SetFieldCase);
SetFieldCase actionCase = (SetFieldCase) action.getAction();
assertNotNull(actionCase.getSetField().getLayer4Match());
assertTrue(actionCase.getSetField().getLayer4Match() instanceof TcpMatch);
TcpMatch tcpMatch = (TcpMatch) actionCase.getSetField().getLayer4Match();
assertEquals(PORT, tcpMatch.getTcpSourcePort().getValue().intValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase in project genius by opendaylight.
the class ActionSetUdpDestinationPortTest method verifyAction.
private void verifyAction(Action action) {
assertTrue(action.getAction() instanceof SetFieldCase);
SetFieldCase actionCase = (SetFieldCase) action.getAction();
assertNotNull(actionCase.getSetField().getLayer4Match());
assertTrue(actionCase.getSetField().getLayer4Match() instanceof UdpMatch);
UdpMatch tcpMatch = (UdpMatch) actionCase.getSetField().getLayer4Match();
assertEquals(PORT, tcpMatch.getUdpDestinationPort().getValue().intValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase in project openflowplugin by opendaylight.
the class TableFeaturesConvertor method setActionTableFeatureProperty.
private static void setActionTableFeatureProperty(final TableFeaturePropertiesBuilder builder, final TableFeaturesPropType type, final List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> salActions) {
List<Action> actionList = new ArrayList<>();
for (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action currAction : salActions) {
org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionType = currAction.getAction();
ActionBuilder actionBuilder = new ActionBuilder();
if (actionType instanceof OutputActionCase) {
OutputActionCaseBuilder outputActionCaseBuilder = new OutputActionCaseBuilder();
actionBuilder.setActionChoice(outputActionCaseBuilder.build());
} else if (actionType instanceof GroupActionCase) {
GroupCaseBuilder groupActionBuilder = new GroupCaseBuilder();
actionBuilder.setActionChoice(groupActionBuilder.build());
} else if (actionType instanceof CopyTtlOutCase) {
CopyTtlOutCaseBuilder copyTtlOutCaseBuilder = new CopyTtlOutCaseBuilder();
actionBuilder.setActionChoice(copyTtlOutCaseBuilder.build());
} else if (actionType instanceof CopyTtlInCase) {
CopyTtlInCaseBuilder copyTtlInCaseBuilder = new CopyTtlInCaseBuilder();
actionBuilder.setActionChoice(copyTtlInCaseBuilder.build());
} else if (actionType instanceof SetMplsTtlActionCase) {
SetMplsTtlCaseBuilder setMplsTtlActionBuilder = new SetMplsTtlCaseBuilder();
actionBuilder.setActionChoice(setMplsTtlActionBuilder.build());
} else if (actionType instanceof DecMplsTtlCase) {
DecMplsTtlCaseBuilder decMplsTtlCaseBuilder = new DecMplsTtlCaseBuilder();
actionBuilder.setActionChoice(decMplsTtlCaseBuilder.build());
} else if (actionType instanceof PushVlanActionCase) {
PushVlanCaseBuilder pushVlanActionBuilder = new PushVlanCaseBuilder();
actionBuilder.setActionChoice(pushVlanActionBuilder.build());
} else if (actionType instanceof PopVlanActionCase) {
PopVlanCaseBuilder popVlanCaseBuilder = new PopVlanCaseBuilder();
actionBuilder.setActionChoice(popVlanCaseBuilder.build());
} else if (actionType instanceof PushMplsActionCase) {
PushMplsCaseBuilder pushMplsActionBuilder = new PushMplsCaseBuilder();
actionBuilder.setActionChoice(pushMplsActionBuilder.build());
} else if (actionType instanceof PopMplsActionCase) {
PopMplsCaseBuilder popMplsCaseBuilder = new PopMplsCaseBuilder();
actionBuilder.setActionChoice(popMplsCaseBuilder.build());
} else if (actionType instanceof SetQueueActionCase) {
SetQueueCaseBuilder setQueueActionBuilder = new SetQueueCaseBuilder();
actionBuilder.setActionChoice(setQueueActionBuilder.build());
} else if (actionType instanceof SetNwTtlActionCase) {
SetNwTtlCaseBuilder setNwTtlActionBuilder = new SetNwTtlCaseBuilder();
actionBuilder.setActionChoice(setNwTtlActionBuilder.build());
} else if (actionType instanceof DecNwTtlCase) {
DecNwTtlCaseBuilder decNwTtlCaseBuilder = new DecNwTtlCaseBuilder();
actionBuilder.setActionChoice(decNwTtlCaseBuilder.build());
} else if (actionType instanceof SetFieldCase) {
SetFieldCaseBuilder setFieldCaseBuilder = new SetFieldCaseBuilder();
actionBuilder.setActionChoice(setFieldCaseBuilder.build());
} else if (actionType instanceof PushPbbActionCase) {
PushPbbCaseBuilder pushPbbCaseBuilder = new PushPbbCaseBuilder();
actionBuilder.setActionChoice(pushPbbCaseBuilder.build());
} else if (actionType instanceof PopPbbActionCase) {
PopPbbCaseBuilder popPbbCaseBuilder = new PopPbbCaseBuilder();
actionBuilder.setActionChoice(popPbbCaseBuilder.build());
}
// Experimenter action is unhandled
actionList.add(actionBuilder.build());
}
ActionRelatedTableFeaturePropertyBuilder propBuilder = new ActionRelatedTableFeaturePropertyBuilder();
propBuilder.setAction(actionList);
builder.setType(type);
builder.addAugmentation(ActionRelatedTableFeatureProperty.class, propBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase in project openflowplugin by opendaylight.
the class TableFeaturesResponseConvertorTest method createEmptySetFieldCase.
private static SetFieldCase createEmptySetFieldCase() {
SetFieldCaseBuilder setFieldCaseBuilder = new SetFieldCaseBuilder();
SetFieldActionBuilder setFieldActionBuilder = new SetFieldActionBuilder();
List<MatchEntry> matchEntries = new ArrayList<>();
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
matchEntries.add(matchEntryBuilder.build());
setFieldActionBuilder.setMatchEntry(matchEntries);
setFieldCaseBuilder.setSetFieldAction(setFieldActionBuilder.build());
return setFieldCaseBuilder.build();
}
Aggregations