use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv4._case.Ipv4 in project openflowplugin by opendaylight.
the class AbstractMatchEntryDeserializer method readPrefix.
/**
* Read Ipv4Prefix from message.
* @param message buffered message
* @param hasMask determines if prefix has mask or not
* @return IPv4 prefix
*/
protected static Ipv4Prefix readPrefix(ByteBuf message, boolean hasMask) {
final Ipv4Address address = ByteBufUtils.readIetfIpv4Address(message);
int mask = 32;
if (hasMask) {
mask = IpConversionUtil.countBits(OxmDeserializerHelper.convertMask(message, EncodeConstants.GROUPS_IN_IPV4_ADDRESS));
}
return IpConversionUtil.createPrefix(address, mask);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv4._case.Ipv4 in project openflowplugin by opendaylight.
the class SetNwDstActionSerializerTest method testSerialize.
@Test
public void testSerialize() throws Exception {
final Ipv4 address = new Ipv4Builder().setIpv4Address(new Ipv4Prefix("192.168.76.2/32")).build();
final Action action = new SetNwDstActionCaseBuilder().setSetNwDstAction(new SetNwDstActionBuilder().setAddress(address).build()).build();
assertAction(action, out -> {
byte[] addressBytes = new byte[4];
out.readBytes(addressBytes);
assertArrayEquals(addressBytes, new byte[] { (byte) 192, (byte) 168, 76, 2 });
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv4._case.Ipv4 in project openflowplugin by opendaylight.
the class OpenflowpluginTestCommandProvider method createICMPv6Match.
private static MatchBuilder createICMPv6Match() {
final MatchBuilder match = new MatchBuilder();
final EthernetMatchBuilder eth = new EthernetMatchBuilder();
final EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
ethTypeBuilder.setType(new EtherType(0x86ddL));
eth.setEthernetType(ethTypeBuilder.build());
match.setEthernetMatch(eth.build());
// ipv4 version
final IpMatchBuilder ipmatch = new IpMatchBuilder();
ipmatch.setIpProtocol((short) 58);
match.setIpMatch(ipmatch.build());
// icmpv6
final Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder();
// match
icmpv6match.setIcmpv6Type((short) 135);
icmpv6match.setIcmpv6Code((short) 1);
match.setIcmpv6Match(icmpv6match.build());
return match;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv4._case.Ipv4 in project openflowplugin by opendaylight.
the class OpenflowpluginTestCommandProvider method createL4SCTPMatch.
private static MatchBuilder createL4SCTPMatch() {
final MatchBuilder match = new MatchBuilder();
final EthernetMatchBuilder eth = new EthernetMatchBuilder();
final EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
ethTypeBuilder.setType(new EtherType(0x0800L));
eth.setEthernetType(ethTypeBuilder.build());
match.setEthernetMatch(eth.build());
// ipv4 version
final IpMatchBuilder ipmatch = new IpMatchBuilder();
ipmatch.setIpProtocol((short) 132);
match.setIpMatch(ipmatch.build());
final SctpMatchBuilder sctpmatch = new SctpMatchBuilder();
final PortNumber srcport = new PortNumber(1435);
final PortNumber dstport = new PortNumber(22);
sctpmatch.setSctpSourcePort(srcport);
sctpmatch.setSctpDestinationPort(dstport);
match.setLayer4Match(sctpmatch.build());
return match;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv4._case.Ipv4 in project openflowplugin by opendaylight.
the class OpenflowpluginTestCommandProvider method createToSMatch.
private static MatchBuilder createToSMatch() {
final MatchBuilder match = new MatchBuilder();
final EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
final EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
final EtherType type = new EtherType(0x0800L);
ethmatch.setEthernetType(ethtype.setType(type).build());
match.setEthernetMatch(ethmatch.build());
// ipv4 version
final IpMatchBuilder ipmatch = new IpMatchBuilder();
ipmatch.setIpProtocol((short) 6);
final Dscp dscp = new Dscp((short) 8);
ipmatch.setIpDscp(dscp);
match.setIpMatch(ipmatch.build());
return match;
}
Aggregations