use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message in project kie-wb-common by kiegroup.
the class Bpmn2JsonUnmarshaller method revisitCatchEvents.
/**
* Updates event definitions for all catch events.
* @param def Definitions
*/
public void revisitCatchEvents(Definitions def) {
List<RootElement> rootElements = def.getRootElements();
List<Signal> toAddSignals = new ArrayList<Signal>();
Set<Error> toAddErrors = new HashSet<Error>();
Set<Escalation> toAddEscalations = new HashSet<Escalation>();
Set<Message> toAddMessages = new HashSet<Message>();
Set<ItemDefinition> toAddItemDefinitions = new HashSet<ItemDefinition>();
for (RootElement root : rootElements) {
if (root instanceof Process) {
setCatchEventsInfo((Process) root, def, toAddSignals, toAddErrors, toAddEscalations, toAddMessages, toAddItemDefinitions);
}
}
for (Lane lane : _lanes) {
setCatchEventsInfoForLanes(lane, def, toAddSignals, toAddErrors, toAddEscalations, toAddMessages, toAddItemDefinitions);
}
for (Signal s : toAddSignals) {
def.getRootElements().add(s);
}
for (Error er : toAddErrors) {
def.getRootElements().add(er);
}
for (Escalation es : toAddEscalations) {
def.getRootElements().add(es);
}
for (ItemDefinition idef : toAddItemDefinitions) {
def.getRootElements().add(idef);
}
for (Message msg : toAddMessages) {
def.getRootElements().add(msg);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message in project netvirt by opendaylight.
the class NexthopManager method createLocalNextHop.
public long createLocalNextHop(long vpnId, BigInteger dpnId, String ifName, String ipNextHopAddress, String ipPrefixAddress, String gwMacAddress, String jobKey) {
String vpnName = fibUtil.getVpnNameFromId(vpnId);
if (vpnName == null) {
return 0;
}
String macAddress = fibUtil.getMacAddressFromPrefix(ifName, vpnName, ipPrefixAddress);
String ipAddress = macAddress != null ? ipPrefixAddress : ipNextHopAddress;
long groupId = createNextHopPointer(getNextHopKey(vpnId, ipAddress));
if (groupId == 0) {
LOG.error("Unable to allocate groupId for vpnId {} , prefix {} IntfName {}, nextHopAddr {}", vpnId, ipAddress, ifName, ipNextHopAddress);
return groupId;
}
String nextHopLockStr = vpnId + ipAddress;
jobCoordinator.enqueueJob(jobKey, () -> {
synchronized (nextHopLockStr.intern()) {
VpnNexthop nexthop = getVpnNexthop(vpnId, ipAddress);
LOG.trace("nexthop: {} retrieved for vpnId {}, prefix {}, ifName {} on dpn {}", nexthop, vpnId, ipAddress, ifName, dpnId);
if (nexthop == null) {
String encMacAddress = macAddress == null ? fibUtil.getMacAddressFromPrefix(ifName, vpnName, ipAddress) : macAddress;
List<BucketInfo> listBucketInfo = new ArrayList<>();
List<ActionInfo> listActionInfo = new ArrayList<>();
int actionKey = 0;
// MAC re-write
if (encMacAddress != null) {
if (gwMacAddress != null) {
LOG.trace("The Local NextHop Group Source Mac {} for VpnInterface {} on VPN {}", gwMacAddress, ifName, vpnId);
listActionInfo.add(new ActionSetFieldEthernetSource(actionKey++, new MacAddress(gwMacAddress)));
}
listActionInfo.add(new ActionSetFieldEthernetDestination(actionKey++, new MacAddress(encMacAddress)));
// listActionInfo.add(0, new ActionPopMpls());
} else {
// FIXME: Log message here.
LOG.debug("mac address for new local nexthop is null");
}
listActionInfo.addAll(getEgressActionsForInterface(ifName, actionKey));
BucketInfo bucket = new BucketInfo(listActionInfo);
listBucketInfo.add(bucket);
GroupEntity groupEntity = MDSALUtil.buildGroupEntity(dpnId, groupId, ipAddress, GroupTypes.GroupAll, listBucketInfo);
LOG.trace("Install LNH Group: id {}, mac address {}, interface {} for prefix {}", groupId, encMacAddress, ifName, ipAddress);
// Try to install group directly on the DPN bypassing the FRM, in order to avoid waiting for the
// group to get installed before programming the flows
installGroupOnDpn(groupId, dpnId, ipAddress, listBucketInfo, getNextHopKey(vpnId, ipAddress), GroupTypes.GroupAll);
// install Group
mdsalApiManager.syncInstallGroup(groupEntity);
// update MD-SAL DS
addVpnNexthopToDS(dpnId, vpnId, ipAddress, groupId);
} else {
// nexthop exists already; a new flow is going to point to
// it, increment the flowrefCount by 1
int flowrefCnt = nexthop.getFlowrefCount() + 1;
VpnNexthop nh = new VpnNexthopBuilder().setKey(new VpnNexthopKey(ipAddress)).setFlowrefCount(flowrefCnt).build();
LOG.trace("Updating vpnnextHop {} for refCount {} to Operational DS", nh, flowrefCnt);
MDSALUtil.syncUpdate(dataBroker, LogicalDatastoreType.OPERATIONAL, getVpnNextHopIdentifier(vpnId, ipAddress), nh);
}
}
return Collections.emptyList();
});
return groupId;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message in project openflowplugin by opendaylight.
the class MultipartReplyExperimenterDeserializer method deserialize.
@Override
@SuppressWarnings("unchecked")
public MultipartReplyBody deserialize(ByteBuf message) {
final MultipartReplyExperimenterBuilder builder = new MultipartReplyExperimenterBuilder();
final long expId = message.readUnsignedInt();
final long expType = message.readUnsignedInt();
try {
final OFDeserializer<ExperimenterMessageOfChoice> deserializer = registry.getDeserializer(new ExperimenterIdTypeDeserializerKey(EncodeConstants.OF13_VERSION_ID, expId, expType, ExperimenterMessageOfChoice.class));
builder.setExperimenterMessageOfChoice(deserializer.deserialize(message));
} catch (ClassCastException | IllegalStateException es) {
final OFDeserializer<ExperimenterDataOfChoice> deserializer = registry.getDeserializer(ExperimenterDeserializerKeyFactory.createMultipartReplyMessageDeserializerKey(EncodeConstants.OF13_VERSION_ID, expId, expType));
final ExperimenterDataOfChoice data = deserializer.deserialize(message);
final MessageTypeKey<? extends ExperimenterDataOfChoice> key = new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, (Class<? extends ExperimenterDataOfChoice>) data.getImplementedInterface());
final ConvertorMessageFromOFJava<ExperimenterDataOfChoice, MessagePath> convertor = OFSessionUtil.getExtensionConvertorProvider().getMessageConverter(key);
try {
builder.setExperimenterMessageOfChoice(convertor.convert(data, MessagePath.MPMESSAGE_RPC_OUTPUT));
} catch (ConversionException ce) {
LOG.debug("Failed to deserialize multipart reply experimenter for key: {}", key);
}
}
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message in project openflowplugin by opendaylight.
the class MultipartReplyGroupDescDeserializer method deserialize.
@Override
public MultipartReplyBody deserialize(ByteBuf message) {
final MultipartReplyGroupDescBuilder builder = new MultipartReplyGroupDescBuilder();
final List<GroupDescStats> items = new ArrayList<>();
while (message.readableBytes() > 0) {
final int itemLength = message.readUnsignedShort();
final GroupDescStatsBuilder itemBuilder = new GroupDescStatsBuilder().setGroupType(GroupTypes.forValue(message.readUnsignedByte()));
message.skipBytes(PADDING_IN_GROUP_DESC_HEADER);
itemBuilder.setGroupId(new GroupId(message.readUnsignedInt()));
itemBuilder.setKey(new GroupDescStatsKey(itemBuilder.getGroupId()));
final List<Bucket> subItems = new ArrayList<>();
int actualLength = GROUP_DESC_HEADER_LENGTH;
long bucketKey = 0;
while (actualLength < itemLength) {
final int bucketsLength = message.readUnsignedShort();
final BucketBuilder bucketBuilder = new BucketBuilder().setBucketId(new BucketId(bucketKey)).setKey(new BucketKey(new BucketId(bucketKey))).setWeight(message.readUnsignedShort()).setWatchPort(message.readUnsignedInt()).setWatchGroup(message.readUnsignedInt());
message.skipBytes(PADDING_IN_BUCKETS_HEADER);
final List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actions = new ArrayList<>();
final int startIndex = message.readerIndex();
final int bucketLength = bucketsLength - BUCKETS_HEADER_LENGTH;
int offset = 0;
while (message.readerIndex() - startIndex < bucketLength) {
actions.add(new ActionBuilder().setKey(new ActionKey(offset)).setOrder(offset).setAction(ActionUtil.readAction(EncodeConstants.OF13_VERSION_ID, message, registry, ActionPath.GROUP_DESC_STATS_UPDATED_BUCKET_ACTION)).build());
offset++;
}
bucketBuilder.setAction(actions);
subItems.add(bucketBuilder.build());
bucketKey++;
actualLength += bucketsLength;
}
items.add(itemBuilder.setBuckets(new BucketsBuilder().setBucket(subItems).build()).build());
}
return builder.setGroupDescStats(items).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message in project openflowplugin by opendaylight.
the class MultipartReplyMeterConfigDeserializer method deserialize.
@Override
public MultipartReplyBody deserialize(ByteBuf message) {
final MultipartReplyMeterConfigBuilder builder = new MultipartReplyMeterConfigBuilder();
final List<MeterConfigStats> items = new ArrayList<>();
while (message.readableBytes() > 0) {
final int itemLength = message.readUnsignedShort();
final MeterConfigStatsBuilder itemBuilder = new MeterConfigStatsBuilder().setFlags(readMeterFlags(message)).setMeterId(new MeterId(message.readUnsignedInt()));
final List<MeterBandHeader> subItems = new ArrayList<>();
int actualLength = METER_CONFIG_LENGTH;
while (actualLength < itemLength) {
final int itemStartIndex = message.readerIndex();
final int itemBandType = message.readUnsignedShort();
final MeterBandHeaderBuilder subItemBuilder = new MeterBandHeaderBuilder();
actualLength += message.readUnsignedShort();
switch(itemBandType) {
case OFPMBTDROP:
subItemBuilder.setMeterBandTypes(new MeterBandTypesBuilder().setFlags(new MeterBandType(true, false, false)).build()).setBandType(new DropBuilder().setDropRate(message.readUnsignedInt()).setDropBurstSize(message.readUnsignedInt()).build());
message.skipBytes(PADDING_IN_METER_BAND_DROP_HEADER);
break;
case OFPMBTDSCP:
subItemBuilder.setMeterBandTypes(new MeterBandTypesBuilder().setFlags(new MeterBandType(false, true, false)).build()).setBandType(new DscpRemarkBuilder().setDscpRemarkRate(message.readUnsignedInt()).setDscpRemarkBurstSize(message.readUnsignedInt()).setPrecLevel(message.readUnsignedByte()).build());
message.skipBytes(PADDING_IN_METER_BAND_DSCP_HEADER);
break;
case OFPMBTEXPERIMENTER:
// TODO: Finish meter band experimenter deserialization
final long expId = message.getUnsignedInt(message.readerIndex() + 2 * EncodeConstants.SIZE_OF_INT_IN_BYTES);
message.readerIndex(itemStartIndex);
final OFDeserializer<Experimenter> deserializer = registry.getDeserializer(new ExperimenterIdDeserializerKey(EncodeConstants.OF13_VERSION_ID, expId, Experimenter.class));
subItemBuilder.setMeterBandTypes(new MeterBandTypesBuilder().setFlags(new MeterBandType(false, false, true)).build()).setBandType(deserializer.deserialize(message));
break;
default:
}
subItems.add(subItemBuilder.build());
}
items.add(itemBuilder.setKey(new MeterConfigStatsKey(itemBuilder.getMeterId())).setMeterBandHeaders(new MeterBandHeadersBuilder().setMeterBandHeader(subItems).build()).build());
}
return builder.setMeterConfigStats(items).build();
}
Aggregations