use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress in project netvirt by opendaylight.
the class EvpnVrfEntryHandler method createRemoteFibEntry.
private void createRemoteFibEntry(final BigInteger remoteDpnId, final long vpnId, final VrfTablesKey vrfTableKey, final VrfEntry vrfEntry, boolean isNatPrefix, WriteTransaction tx) {
String rd = vrfTableKey.getRouteDistinguisher();
List<SubTransaction> subTxns = new ArrayList<>();
LOG.debug("createremotefibentry: adding route {} for rd {} with transaction {}", vrfEntry.getDestPrefix(), rd, tx);
List<NexthopManager.AdjacencyResult> tunnelInterfaceList = resolveAdjacency(remoteDpnId, vpnId, vrfEntry, rd);
if (tunnelInterfaceList.isEmpty()) {
LOG.error("Could not get interface for route-paths: {} in vpn {}", vrfEntry.getRoutePaths(), rd);
LOG.warn("Failed to add Route: {} in vpn: {}", vrfEntry.getDestPrefix(), rd);
return;
}
for (NexthopManager.AdjacencyResult adjacencyResult : tunnelInterfaceList) {
List<ActionInfo> actionInfos = new ArrayList<>();
BigInteger tunnelId;
String prefix = adjacencyResult.getPrefix();
Prefixes prefixInfo = getFibUtil().getPrefixToInterface(vpnId, prefix);
String interfaceName = prefixInfo.getVpnInterfaceName();
if (vrfEntry.getOrigin().equals(RouteOrigin.BGP.getValue()) || isNatPrefix) {
tunnelId = BigInteger.valueOf(vrfEntry.getL3vni());
} else if (elanManager.isOpenStackVniSemanticsEnforced()) {
tunnelId = BigInteger.valueOf(getFibUtil().getVniForVxlanNetwork(prefixInfo.getSubnetId()).get());
} else {
Interface interfaceState = getFibUtil().getInterfaceStateFromOperDS(interfaceName);
tunnelId = BigInteger.valueOf(interfaceState.getIfIndex());
}
LOG.debug("adding set tunnel id action for label {}", tunnelId);
String macAddress = null;
String vpnName = getFibUtil().getVpnNameFromId(vpnId);
if (vpnName == null) {
LOG.debug("Failed to get VPN name for vpnId {}", vpnId);
return;
}
if (interfaceName != null) {
macAddress = getFibUtil().getMacAddressFromPrefix(interfaceName, vpnName, prefix);
actionInfos.add(new ActionSetFieldEthernetDestination(new MacAddress(macAddress)));
}
actionInfos.add(new ActionSetFieldTunnelId(tunnelId));
List<ActionInfo> egressActions = nexthopManager.getEgressActionsForInterface(adjacencyResult.getInterfaceName(), actionInfos.size());
if (egressActions.isEmpty()) {
LOG.error("Failed to retrieve egress action for prefix {} route-paths {} interface {}." + " Aborting remote FIB entry creation..", vrfEntry.getDestPrefix(), vrfEntry.getRoutePaths(), adjacencyResult.getInterfaceName());
return;
}
actionInfos.addAll(egressActions);
List<InstructionInfo> instructions = new ArrayList<>();
instructions.add(new InstructionApplyActions(actionInfos));
makeConnectedRoute(remoteDpnId, vpnId, vrfEntry, rd, instructions, NwConstants.ADD_FLOW, tx, subTxns);
}
LOG.debug("Successfully added FIB entry for prefix {} in rd {}", vrfEntry.getDestPrefix(), rd);
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress in project netvirt by opendaylight.
the class TestBuilders method buildLocalMcastMacs.
public static LocalMcastMacs buildLocalMcastMacs(InstanceIdentifier<Node> iid, String mac, String logicalSwitchName, String tepIp) {
LocalMcastMacsBuilder localMcastMacsBuilder = new LocalMcastMacsBuilder();
if (mac.equals("unknown-dst")) {
localMcastMacsBuilder.setMacEntryKey(new MacAddress("00:00:00:00:00:00"));
} else {
localMcastMacsBuilder.setMacEntryKey(new MacAddress(mac));
}
localMcastMacsBuilder.setMacEntryUuid(getUUid(mac));
// mMacLocalBuilder.setIpaddr(new IpAddress(ip.toCharArray()));
localMcastMacsBuilder.setLogicalSwitchRef(buildLogicalSwitchesRef(iid, logicalSwitchName));
List<LocatorSet> locatorSets = new ArrayList<>();
locatorSets.add(new LocatorSetBuilder().setLocatorRef(buildLocatorRef(iid, tepIp)).build());
localMcastMacsBuilder.setLocatorSet(locatorSets);
return localMcastMacsBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress in project netvirt by opendaylight.
the class IfMgr method addHostIntf.
public void addHostIntf(Uuid portId, Uuid snetId, Uuid networkId, IpAddress fixedIp, String macAddress, String deviceOwner) {
LOG.debug("addHostIntf portId {}, snetId {}, networkId {}, ip {}, mac {}", portId, snetId, networkId, fixedIp, macAddress);
// Save the interface ipv6 address in its fully expanded format
Ipv6Address addr = new Ipv6Address(InetAddresses.forString(fixedIp.getIpv6Address().getValue()).getHostAddress());
fixedIp = new IpAddress(addr);
VirtualPort intf = VirtualPort.builder().intfUUID(portId).networkID(networkId).macAddress(macAddress).routerIntfFlag(false).deviceOwner(deviceOwner).build();
intf.setSubnetInfo(snetId, fixedIp);
VirtualPort prevIntf = vintfs.putIfAbsent(portId, intf);
if (prevIntf == null) {
Long elanTag = getNetworkElanTag(networkId);
// Do service binding for the port and set the serviceBindingStatus to true.
ipv6ServiceUtils.bindIpv6Service(portId.getValue(), elanTag, NwConstants.IPV6_TABLE);
intf.setServiceBindingStatus(true);
/* Update the intf dpnId/ofPort from the Operational Store */
updateInterfaceDpidOfPortInfo(portId);
} else {
intf = prevIntf;
intf.setSubnetInfo(snetId, fixedIp);
}
VirtualSubnet snet = getSubnet(snetId);
if (snet != null) {
intf.setSubnet(snetId, snet);
} else {
addUnprocessed(unprocessedSubnetIntfs, snetId, intf);
}
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress in project netvirt by opendaylight.
the class Ipv6NeighborSolicitation method frameNeighborSolicitationRequest.
private byte[] frameNeighborSolicitationRequest(MacAddress srcMacAddress, Ipv6Address srcIpv6Address, Ipv6Address targetIpv6Address) {
MacAddress macAddress = Ipv6ServiceUtils.getIpv6MulticastMacAddress(targetIpv6Address);
Ipv6Address snMcastAddr = Ipv6ServiceUtils.getIpv6SolicitedNodeMcastAddress(targetIpv6Address);
NeighborSolicitationPacketBuilder nsPacket = new NeighborSolicitationPacketBuilder();
nsPacket.setSourceMac(srcMacAddress);
nsPacket.setDestinationMac(macAddress);
nsPacket.setEthertype(NwConstants.ETHTYPE_IPV6);
nsPacket.setVersion(Ipv6Constants.IP_VERSION_6);
nsPacket.setFlowLabel((long) 0);
nsPacket.setIpv6Length(32);
nsPacket.setNextHeader(Ipv6Constants.ICMP_V6_TYPE);
nsPacket.setHopLimit(Ipv6Constants.ICMP_V6_MAX_HOP_LIMIT);
nsPacket.setSourceIpv6(srcIpv6Address);
nsPacket.setDestinationIpv6(snMcastAddr);
nsPacket.setIcmp6Type(Ipv6Constants.ICMP_V6_NS_CODE);
nsPacket.setIcmp6Code((short) 0);
nsPacket.setIcmp6Chksum(0);
nsPacket.setReserved((long) 0);
nsPacket.setTargetIpAddress(targetIpv6Address);
nsPacket.setOptionType(Ipv6Constants.ICMP_V6_OPTION_SOURCE_LLA);
nsPacket.setSourceAddrLength((short) 1);
nsPacket.setSourceLlAddress(srcMacAddress);
return fillNeighborSolicitationPacket(nsPacket.build());
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress 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