use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.VlanVid in project openflowplugin by opendaylight.
the class OfToSalVlanVidCase method process.
@Override
public Optional<MatchBuilder> process(@Nonnull VlanVidCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final VlanMatchBuilder vlanMatchBuilder = data.getVlanMatchBuilder();
final VlanVid vlanVid = source.getVlanVid();
if (vlanVid != null) {
VlanIdBuilder vlanBuilder = new VlanIdBuilder();
vlanBuilder.setVlanId(new VlanId(vlanVid.getVlanVid()));
vlanBuilder.setVlanIdPresent(vlanVid.isCfiBit());
vlanMatchBuilder.setVlanId(vlanBuilder.build());
matchBuilder.setVlanMatch(vlanMatchBuilder.build());
}
return Optional.of(matchBuilder);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.VlanVid in project netvirt by opendaylight.
the class NatUtil method getEgressActionsForInterface.
@Nonnull
public static List<ActionInfo> getEgressActionsForInterface(OdlInterfaceRpcService interfaceManager, String ifName, Long tunnelKey, int pos) {
LOG.debug("getEgressActionsForInterface : called for interface {}", ifName);
GetEgressActionsForInterfaceInputBuilder egressActionsBuilder = new GetEgressActionsForInterfaceInputBuilder().setIntfName(ifName);
if (tunnelKey != null) {
egressActionsBuilder.setTunnelKey(tunnelKey);
}
List<ActionInfo> listActionInfo = new ArrayList<>();
try {
Future<RpcResult<GetEgressActionsForInterfaceOutput>> result = interfaceManager.getEgressActionsForInterface(egressActionsBuilder.build());
RpcResult<GetEgressActionsForInterfaceOutput> rpcResult = result.get();
if (!rpcResult.isSuccessful()) {
LOG.error("getEgressActionsForInterface : RPC Call to Get egress actions for interface {} " + "returned with Errors {}", ifName, rpcResult.getErrors());
} else {
List<Action> actions = rpcResult.getResult().getAction();
for (Action action : actions) {
org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionClass = action.getAction();
if (actionClass instanceof OutputActionCase) {
listActionInfo.add(new ActionOutput(pos++, ((OutputActionCase) actionClass).getOutputAction().getOutputNodeConnector()));
} else if (actionClass instanceof PushVlanActionCase) {
listActionInfo.add(new ActionPushVlan(pos++));
} else if (actionClass instanceof SetFieldCase) {
if (((SetFieldCase) actionClass).getSetField().getVlanMatch() != null) {
int vlanVid = ((SetFieldCase) actionClass).getSetField().getVlanMatch().getVlanId().getVlanId().getValue();
listActionInfo.add(new ActionSetFieldVlanVid(pos++, vlanVid));
}
} else if (actionClass instanceof NxActionResubmitRpcAddGroupCase) {
Short tableId = ((NxActionResubmitRpcAddGroupCase) actionClass).getNxResubmit().getTable();
listActionInfo.add(new ActionNxResubmit(pos++, tableId));
} else if (actionClass instanceof NxActionRegLoadNodesNodeTableFlowApplyActionsCase) {
NxRegLoad nxRegLoad = ((NxActionRegLoadNodesNodeTableFlowApplyActionsCase) actionClass).getNxRegLoad();
listActionInfo.add(new ActionRegLoad(pos++, NxmNxReg6.class, nxRegLoad.getDst().getStart(), nxRegLoad.getDst().getEnd(), nxRegLoad.getValue().longValue()));
}
}
}
} catch (InterruptedException | ExecutionException e) {
LOG.error("Exception when egress actions for interface {}", ifName, e);
}
return listActionInfo;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.VlanVid in project openflowplugin by opendaylight.
the class VlanVidEntryDeserializerTest method deserializeEntry.
@Test
public void deserializeEntry() throws Exception {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
final int vlanVid = 8;
final byte[] vlanMask = new byte[] { 16, 0 };
writeHeader(in, false);
in.writeShort(vlanVid | (1 << 12));
VlanMatch vlanMatch = deserialize(in).getVlanMatch();
assertEquals(vlanVid, vlanMatch.getVlanId().getVlanId().getValue().intValue());
assertTrue(vlanMatch.getVlanId().isVlanIdPresent());
assertEquals(0, in.readableBytes());
writeHeader(in, true);
in.writeShort(vlanVid);
in.writeBytes(vlanMask);
vlanMatch = deserialize(in).getVlanMatch();
assertEquals(0, vlanMatch.getVlanId().getVlanId().getValue().intValue());
assertTrue(vlanMatch.getVlanId().isVlanIdPresent());
assertEquals(0, in.readableBytes());
writeHeader(in, false);
in.writeShort(vlanVid);
vlanMatch = deserialize(in).getVlanMatch();
assertEquals(vlanVid, vlanMatch.getVlanId().getVlanId().getValue().intValue());
assertFalse(vlanMatch.getVlanId().isVlanIdPresent());
}
Aggregations