Search in sources :

Example 1 with NeighborSolicitationPacketBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.ipv6service.nd.packet.rev160620.NeighborSolicitationPacketBuilder 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());
}
Also used : NeighborSolicitationPacketBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.ipv6service.nd.packet.rev160620.NeighborSolicitationPacketBuilder) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) Ipv6Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address)

Aggregations

Ipv6Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address)1 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)1 NeighborSolicitationPacketBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.ipv6service.nd.packet.rev160620.NeighborSolicitationPacketBuilder)1