use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.of.object.Of in project netvirt by opendaylight.
the class ElanItmUtils method getExternalTunnelItmEgressAction.
/**
* Builds the list of actions to be taken when sending the packet over an
* external VxLan tunnel interface, such as stamping the VNI on the VxLAN
* header, setting the vlanId if it proceeds and output the packet over the
* right port.
*
* @param srcDpnId
* Dpn where the tunnelInterface is located
* @param torNode
* NodeId of the ExternalDevice where the packet must be sent to.
* @param vni
* Vni to be stamped on the VxLAN Header.
* @return the external itm egress action
*/
public List<Action> getExternalTunnelItmEgressAction(BigInteger srcDpnId, NodeId torNode, long vni) {
List<Action> result = Collections.emptyList();
GetExternalTunnelInterfaceNameInput input = new GetExternalTunnelInterfaceNameInputBuilder().setDestinationNode(torNode.getValue()).setSourceNode(srcDpnId.toString()).setTunnelType(TunnelTypeVxlan.class).build();
Future<RpcResult<GetExternalTunnelInterfaceNameOutput>> output = itmRpcService.getExternalTunnelInterfaceName(input);
try {
if (output.get().isSuccessful()) {
GetExternalTunnelInterfaceNameOutput tunnelInterfaceNameOutput = output.get().getResult();
String tunnelIfaceName = tunnelInterfaceNameOutput.getInterfaceName();
LOG.debug("Received tunnelInterfaceName from getTunnelInterfaceName RPC {}", tunnelIfaceName);
result = buildTunnelItmEgressActions(tunnelIfaceName, vni);
}
} catch (InterruptedException | ExecutionException e) {
LOG.error("Error in RPC call getTunnelInterfaceName {}", e);
}
return result;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.of.object.Of in project netvirt by opendaylight.
the class ElanItmUtils method getInternalTunnelItmEgressAction.
/**
* Builds the list of actions to be taken when sending the packet over an internal VxLAN tunnel interface, such
* as setting the serviceTag/segmentationID on the VNI field of the VxLAN header, setting the vlanId if it proceeds
* and output the packet over the right port.
*
* @param sourceDpnId
* Dpn where the tunnelInterface is located
* @param destinationDpnId
* Dpn where the packet must be sent to. It is used here in order
* to select the right tunnel interface.
* @param tunnelKey
* Tunnel key to be sent on the VxLAN header.
* @return the internal itm egress action
*/
public List<Action> getInternalTunnelItmEgressAction(BigInteger sourceDpnId, BigInteger destinationDpnId, long tunnelKey) {
List<Action> result = Collections.emptyList();
LOG.trace("In getInternalItmEgressAction Action source {}, destination {}, serviceTag/Vni {}", sourceDpnId, destinationDpnId, tunnelKey);
Class<? extends TunnelTypeBase> tunType = TunnelTypeVxlan.class;
GetTunnelInterfaceNameInput input = new GetTunnelInterfaceNameInputBuilder().setDestinationDpid(destinationDpnId).setSourceDpid(sourceDpnId).setTunnelType(tunType).build();
Future<RpcResult<GetTunnelInterfaceNameOutput>> output = itmRpcService.getTunnelInterfaceName(input);
try {
if (output.get().isSuccessful()) {
GetTunnelInterfaceNameOutput tunnelInterfaceNameOutput = output.get().getResult();
String tunnelIfaceName = tunnelInterfaceNameOutput.getInterfaceName();
LOG.info("Received tunnelInterfaceName from getTunnelInterfaceName RPC {}", tunnelIfaceName);
result = buildTunnelItmEgressActions(tunnelIfaceName, tunnelKey);
} else {
LOG.trace("Tunnel interface doesn't exist between srcDpId {} dstDpId {}", sourceDpnId, destinationDpnId);
}
} catch (InterruptedException | ExecutionException e) {
LOG.error("Error in RPC call getTunnelInterfaceName {}", e);
}
return result;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.of.object.Of in project netvirt by opendaylight.
the class ElanUtils method buildLocalDmacFlowEntry.
/**
* Builds the flow to be programmed in the DMAC table of the local DPN (that
* is, where the MAC is attached to). This flow consists in:
*
* <p>Match: + elanTag in metadata + packet goes to a MAC locally attached
* Actions: + optionally, pop-vlan + set-vlan-id + output to ifName's
* portNumber
*
* @param elanTag
* the elan tag
* @param dpId
* the dp id
* @param ifName
* the if name
* @param macAddress
* the mac address
* @param elanInfo
* the elan info
* @param ifTag
* the if tag
* @return the flow
*/
public Flow buildLocalDmacFlowEntry(long elanTag, BigInteger dpId, String ifName, String macAddress, ElanInstance elanInfo, long ifTag) {
List<MatchInfo> mkMatches = new ArrayList<>();
mkMatches.add(new MatchMetadata(ElanHelper.getElanMetadataLabel(elanTag), MetaDataUtil.METADATA_MASK_SERVICE));
mkMatches.add(new MatchEthernetDestination(new MacAddress(macAddress)));
List<Instruction> mkInstructions = new ArrayList<>();
List<Action> actions = getEgressActionsForInterface(ifName, /* tunnelKey */
null);
mkInstructions.add(MDSALUtil.buildApplyActionsInstruction(actions));
Flow flow = MDSALUtil.buildFlowNew(NwConstants.ELAN_DMAC_TABLE, getKnownDynamicmacFlowRef(NwConstants.ELAN_DMAC_TABLE, dpId, ifTag, macAddress, elanTag), 20, elanInfo.getElanInstanceName(), 0, 0, ElanConstants.COOKIE_ELAN_KNOWN_DMAC.add(BigInteger.valueOf(elanTag)), mkMatches, mkInstructions);
return flow;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.of.object.Of in project netvirt by opendaylight.
the class ElanUtils method setupTermDmacFlows.
/**
* Installs a Flow in INTERNAL_TUNNEL_TABLE of the affected DPN that sends
* the packet through the specified interface if the tunnel_id matches the
* interface's lportTag.
*
* @param interfaceInfo
* the interface info
* @param mdsalApiManager
* the mdsal API manager
* @param writeFlowGroupTx
* the writeFLowGroup tx
*/
public void setupTermDmacFlows(InterfaceInfo interfaceInfo, IMdsalApiManager mdsalApiManager, WriteTransaction writeFlowGroupTx) {
BigInteger dpId = interfaceInfo.getDpId();
int lportTag = interfaceInfo.getInterfaceTag();
Flow flow = MDSALUtil.buildFlowNew(NwConstants.INTERNAL_TUNNEL_TABLE, getIntTunnelTableFlowRef(NwConstants.INTERNAL_TUNNEL_TABLE, lportTag), 5, String.format("%s:%d", "ITM Flow Entry ", lportTag), 0, 0, ITMConstants.COOKIE_ITM.add(BigInteger.valueOf(lportTag)), getTunnelIdMatchForFilterEqualsLPortTag(lportTag), getInstructionsInPortForOutGroup(interfaceInfo.getInterfaceName()));
mdsalApiManager.addFlowToTx(dpId, flow, writeFlowGroupTx);
LOG.debug("Terminating service table flow entry created on dpn:{} for logical Interface port:{}", dpId, interfaceInfo.getPortName());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.of.object.Of in project netvirt by opendaylight.
the class Ipv6NeighborSolicitation method transmitNeighborSolicitation.
public boolean transmitNeighborSolicitation(BigInteger dpnId, NodeConnectorRef nodeRef, MacAddress srcMacAddress, Ipv6Address srcIpv6Address, Ipv6Address targetIpv6Address) {
byte[] txPayload = frameNeighborSolicitationRequest(srcMacAddress, srcIpv6Address, targetIpv6Address);
NodeConnectorRef nodeConnectorRef = MDSALUtil.getNodeConnRef(dpnId, "0xfffffffd");
TransmitPacketInput input = new TransmitPacketInputBuilder().setPayload(txPayload).setNode(new NodeRef(InstanceIdentifier.builder(Nodes.class).child(Node.class, new NodeKey(new NodeId("openflow:" + dpnId))).toInstance())).setEgress(nodeRef).setIngress(nodeConnectorRef).build();
// Tx the packet out of the controller.
LOG.debug("Transmitting the Neighbor Solicitation packet out on {}", dpnId);
JdkFutures.addErrorLogging(packetService.transmitPacket(input), LOG, "transmitPacket");
return true;
}
Aggregations