use of org.onosproject.net.pi.model.PiPacketMetadataModel in project onos by opennetworkinglab.
the class P4InfoParser method parseCtrlPktMetadatas.
private static Map<PiPacketOperationType, PiPacketOperationModel> parseCtrlPktMetadatas(P4Info p4info) throws P4InfoParserException {
final Map<PiPacketOperationType, PiPacketOperationModel> packetOpMap = Maps.newHashMap();
for (ControllerPacketMetadata ctrlPktMetaMsg : p4info.getControllerPacketMetadataList()) {
final ImmutableList.Builder<PiPacketMetadataModel> metadataListBuilder = ImmutableList.builder();
ctrlPktMetaMsg.getMetadataList().forEach(metadataMsg -> metadataListBuilder.add(new P4PacketMetadataModel(PiPacketMetadataId.of(metadataMsg.getName()), isFieldString(p4info, metadataMsg.getTypeName().getName()) ? P4PacketMetadataModel.BIT_WIDTH_UNDEFINED : metadataMsg.getBitwidth())));
packetOpMap.put(mapPacketOpType(ctrlPktMetaMsg.getPreamble().getName()), new P4PacketOperationModel(mapPacketOpType(ctrlPktMetaMsg.getPreamble().getName()), metadataListBuilder.build()));
}
return packetOpMap;
}
Aggregations