use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.rev200120.output.Result in project openflowplugin by opendaylight.
the class GroupDescriptionService method transformToNotification.
@Override
public GroupDescStatsUpdated transformToNotification(List<MultipartReply> result, TransactionId emulatedTxId) {
GroupDescStatsUpdatedBuilder notification = new GroupDescStatsUpdatedBuilder();
notification.setId(getDeviceInfo().getNodeId());
notification.setMoreReplies(Boolean.FALSE);
notification.setTransactionId(emulatedTxId);
notification.setGroupDescStats(new ArrayList<>());
final VersionConvertorData data = new VersionConvertorData(getVersion());
for (MultipartReply mpReply : result) {
MultipartReplyGroupDescCase caseBody = (MultipartReplyGroupDescCase) mpReply.getMultipartReplyBody();
MultipartReplyGroupDesc replyBody = caseBody.getMultipartReplyGroupDesc();
final Optional<List<GroupDescStats>> groupDescStatsList = convertorExecutor.convert(replyBody.getGroupDesc(), data);
groupDescStatsList.ifPresent(groupDescStats -> notification.getGroupDescStats().addAll(groupDescStats));
}
return notification.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.rev200120.output.Result in project openflowplugin by opendaylight.
the class ActionResponseConvertor method convert.
@Override
public List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action> convert(List<Action> source, ActionResponseConvertorData data) {
final List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action> result = new ArrayList<>();
final OpenflowVersion ofVersion = OpenflowVersion.get(data.getVersion());
// Iterate over Openflow actions, run them through tokenizer and then add them to list of converted actions
if (source != null) {
for (final Action action : source) {
final Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action> convertedAction = PROCESSOR.process(action.getActionChoice(), data, getConvertorExecutor());
if (convertedAction.isPresent()) {
result.add(convertedAction.get());
} else {
/**
* TODO: EXTENSION PROPOSAL (action, OFJava to MD-SAL)
* - we might also need a way on how to identify exact type of augmentation to be
* used as match can be bound to multiple models
*/
org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action processedAction = ActionExtensionHelper.processAlienAction(action, ofVersion, data.getActionPath());
if (processedAction != null) {
result.add(processedAction);
}
}
}
}
return result;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.rev200120.output.Result in project openflowplugin by opendaylight.
the class MultipartReplyTableFeaturesDeserializerTest method writeValues.
private void writeValues(ByteBuf buffer, int propertyType) {
buffer.clear();
final int replyIndex = buffer.readerIndex();
buffer.writeShort(EncodeConstants.EMPTY_LENGTH);
buffer.writeByte(TABLE_ID);
buffer.writeZero(PADDING_IN_MULTIPART_REPLY_TABLE_FEATURES);
buffer.writeZero(MAX_TABLE_NAME_LENGTH);
buffer.writeLong(METADATA_MATCH);
buffer.writeLong(METADATA_WRITE);
buffer.writeInt(TABLE_CONFIG);
buffer.writeInt(MAX_ENTRIES);
final int propIndex = buffer.writerIndex();
buffer.writeShort(propertyType);
final int propLengthIndex = buffer.writerIndex();
buffer.writeShort(EncodeConstants.EMPTY_LENGTH);
TableFeaturesPropType propType = TableFeaturesPropType.forValue(propertyType);
switch(propType) {
case OFPTFPTINSTRUCTIONS:
case OFPTFPTINSTRUCTIONSMISS:
int instructionStartIndex = buffer.writerIndex();
buffer.writeShort(InstructionConstants.APPLY_ACTIONS_TYPE);
int instructionLengthIndex = buffer.writerIndex();
buffer.writeShort(EncodeConstants.EMPTY_LENGTH);
buffer.setShort(instructionLengthIndex, buffer.writerIndex() - instructionStartIndex);
break;
case OFPTFPTNEXTTABLES:
case OFPTFPTNEXTTABLESMISS:
buffer.writeByte(1);
buffer.writeByte(2);
break;
case OFPTFPTWRITEACTIONS:
case OFPTFPTWRITEACTIONSMISS:
buffer.writeShort(InstructionConstants.WRITE_ACTIONS_TYPE);
buffer.writeShort(EncodeConstants.EMPTY_LENGTH);
break;
case OFPTFPTAPPLYACTIONS:
case OFPTFPTAPPLYACTIONSMISS:
buffer.writeShort(InstructionConstants.APPLY_ACTIONS_TYPE);
buffer.writeShort(EncodeConstants.EMPTY_LENGTH);
break;
case OFPTFPTMATCH:
buffer.writeShort(OxmMatchConstants.OPENFLOW_BASIC_CLASS);
buffer.writeByte(OxmMatchConstants.ARP_OP << 1);
buffer.writeByte(EncodeConstants.EMPTY_LENGTH);
break;
case OFPTFPTWILDCARDS:
buffer.writeShort(OxmMatchConstants.OPENFLOW_BASIC_CLASS);
buffer.writeByte(OxmMatchConstants.ARP_SHA << 1);
buffer.writeByte(EncodeConstants.EMPTY_LENGTH);
break;
case OFPTFPTWRITESETFIELD:
buffer.writeShort(OxmMatchConstants.OPENFLOW_BASIC_CLASS);
buffer.writeByte(OxmMatchConstants.ARP_SPA << 1);
buffer.writeByte(EncodeConstants.EMPTY_LENGTH);
break;
case OFPTFPTWRITESETFIELDMISS:
buffer.writeShort(OxmMatchConstants.OPENFLOW_BASIC_CLASS);
buffer.writeByte(OxmMatchConstants.ARP_THA << 1);
buffer.writeByte(EncodeConstants.EMPTY_LENGTH);
break;
case OFPTFPTAPPLYSETFIELD:
buffer.writeShort(OxmMatchConstants.OPENFLOW_BASIC_CLASS);
buffer.writeByte(OxmMatchConstants.ARP_TPA << 1);
buffer.writeByte(EncodeConstants.EMPTY_LENGTH);
break;
case OFPTFPTAPPLYSETFIELDMISS:
buffer.writeShort(OxmMatchConstants.OPENFLOW_BASIC_CLASS);
buffer.writeByte(OxmMatchConstants.ETH_TYPE << 1);
buffer.writeByte(EncodeConstants.EMPTY_LENGTH);
break;
default:
break;
}
int propLength = buffer.writerIndex() - propIndex;
buffer.setShort(propLengthIndex, buffer.writerIndex() - propIndex);
int paddingRemainder = propLength % EncodeConstants.PADDING;
int result = 0;
if (paddingRemainder != 0) {
result = EncodeConstants.PADDING - paddingRemainder;
}
buffer.writeZero(result);
buffer.setShort(replyIndex, buffer.writerIndex() - replyIndex);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.rev200120.output.Result in project netvirt by opendaylight.
the class BaseVrfEntryHandler method addTunnelInterfaceActions.
protected void addTunnelInterfaceActions(AdjacencyResult adjacencyResult, Uint32 vpnId, VrfEntry vrfEntry, List<ActionInfo> actionInfos, String rd) {
Class<? extends TunnelTypeBase> tunnelType = VpnExtraRouteHelper.getTunnelType(nextHopManager.getItmManager(), adjacencyResult.getInterfaceName());
if (tunnelType == null) {
LOG.debug("Tunnel type not found for vrfEntry {}", vrfEntry);
return;
}
// TODO - For now have added routePath into adjacencyResult so that we know for which
// routePath this result is built for. If this is not possible construct a map which does
// the same.
String nextHopIp = adjacencyResult.getNextHopIp();
java.util.Optional<Uint32> optionalLabel = FibUtil.getLabelForNextHop(vrfEntry, nextHopIp);
if (!optionalLabel.isPresent()) {
LOG.warn("NextHopIp {} not found in vrfEntry {}", nextHopIp, vrfEntry);
return;
}
Uint32 label = optionalLabel.get();
Uint64 tunnelId = null;
Prefixes prefixInfo = null;
// revisit
if (tunnelType.equals(TunnelTypeVxlan.class)) {
if (FibHelper.isControllerManagedNonSelfImportedRoute(RouteOrigin.value(vrfEntry.getOrigin()))) {
prefixInfo = fibUtil.getPrefixToInterface(vpnId, vrfEntry.getDestPrefix());
// For extra route, the prefixInfo is fetched from the primary adjacency
if (prefixInfo == null) {
prefixInfo = fibUtil.getPrefixToInterface(vpnId, adjacencyResult.getPrefix());
}
} else {
// Imported Route. Get Prefix Info from parent RD
VpnInstanceOpDataEntry parentVpn = fibUtil.getVpnInstance(vrfEntry.getParentVpnRd());
prefixInfo = fibUtil.getPrefixToInterface(parentVpn.getVpnId(), adjacencyResult.getPrefix());
}
// Internet VPN VNI will be used as tun_id for NAT use-cases
if (Prefixes.PrefixCue.Nat.equals(prefixInfo.getPrefixCue())) {
if (vrfEntry.getL3vni() != null && vrfEntry.getL3vni().toJava() != 0) {
tunnelId = Uint64.valueOf(vrfEntry.getL3vni().longValue());
}
} else {
if (FibUtil.isVxlanNetwork(prefixInfo.getNetworkType())) {
tunnelId = Uint64.valueOf(prefixInfo.getSegmentationId().longValue());
} else {
LOG.warn("Network is not of type VXLAN for prefix {}." + "Going with default Lport Tag.", prefixInfo.toString());
tunnelId = Uint64.valueOf(label.longValue());
}
}
} else {
tunnelId = Uint64.valueOf(label.longValue());
}
LOG.debug("adding set tunnel id action for label {}", label);
actionInfos.add(new ActionSetFieldTunnelId(tunnelId));
addRewriteDstMacAction(vpnId, vrfEntry, prefixInfo, actionInfos);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.rev200120.output.Result in project netvirt by opendaylight.
the class ElanL2GatewayUtils method checkIfPhyLocatorAlreadyExistsInRemoteMcastEntry.
/**
* gets the macs addresses for elan interfaces.
*
* @param lstElanInterfaceNames
* the lst elan interface names
* @return the list
*/
/*
public List<PhysAddress> getElanDpnMacsFromInterfaces(Set<String> lstElanInterfaceNames) {
List<PhysAddress> result = new ArrayList<>();
for (String interfaceName : lstElanInterfaceNames) {
ElanInterfaceMac elanInterfaceMac = ElanUtils.getElanInterfaceMacByInterfaceName(broker, interfaceName);
if (elanInterfaceMac != null && elanInterfaceMac.getMacEntry() != null) {
for (MacEntry macEntry : elanInterfaceMac.getMacEntry()) {
result.add(macEntry.getMacAddress());
}
}
}
return result;
}*/
/**
* Check if phy locator already exists in remote mcast entry.
*
* @param nodeId
* the node id
* @param remoteMcastMac
* the remote mcast mac
* @param expectedPhyLocatorIp
* the expected phy locator ip
* @return true, if successful
*/
public static boolean checkIfPhyLocatorAlreadyExistsInRemoteMcastEntry(NodeId nodeId, RemoteMcastMacs remoteMcastMac, IpAddress expectedPhyLocatorIp) {
if (remoteMcastMac != null) {
HwvtepPhysicalLocatorAugmentation expectedPhyLocatorAug = HwvtepSouthboundUtils.createHwvtepPhysicalLocatorAugmentation(expectedPhyLocatorIp);
HwvtepPhysicalLocatorRef expectedPhyLocRef = new HwvtepPhysicalLocatorRef(HwvtepSouthboundUtils.createPhysicalLocatorInstanceIdentifier(nodeId, expectedPhyLocatorAug));
if (remoteMcastMac.getLocatorSet() != null) {
for (LocatorSet locatorSet : remoteMcastMac.getLocatorSet()) {
if (Objects.equals(locatorSet.getLocatorRef(), expectedPhyLocRef)) {
LOG.trace("matched phyLocRef: {}", expectedPhyLocRef);
return true;
}
}
}
}
return false;
}
Aggregations