use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.Weight in project lispflowmapping by opendaylight.
the class LispSouthboundHandlerTest method mapRegister__TwoRlocs.
@Test
public void mapRegister__TwoRlocs() throws Exception {
// P Bit & M Bit set
// EID prefix: 172.1.1.2/32, TTL: 10, Authoritative, No-Action
// Local RLOC: 10.1.0.110, Reachable, Priority/Weight: 1/100, Multicast
// Priority/Weight: 255/0
// Local RLOC: 192.168.136.51, Reachable, Priority/Weight: 6/100,
// Multicast Priority/Weight: 255/0
mapRegisterPacket = extractWSUdpByteArray("0000 00 0c 29 7a ce 8d 00 0c 29 e4 ef 70 08 00 45 00 " + "0010 00 68 00 00 40 00 40 11 26 15 0a 01 00 6e 0a 01 " + "0020 00 01 10 f6 10 f6 00 54 03 3b 38 00 01 01 00 00 " + "0030 00 00 00 00 00 00 00 01 00 14 ae d8 7b d4 9c 59 " + "0040 e9 35 75 6e f1 29 27 a3 45 20 96 06 c2 e1 00 00 " + "0050 00 0a 02 20 10 00 00 00 00 01 ac 01 01 02 01 64 " + "0060 ff 00 00 05 00 01 0a 01 00 6e 06 64 ff 00 00 05 " + "0070 00 01 c0 a8 88 33");
ArgumentCaptor<AddMapping> captor = ArgumentCaptor.forClass(AddMapping.class);
handleMapRegisterPacket(mapRegisterPacket);
Mockito.verify(mockLispSouthboundPlugin).sendNotificationIfPossible(captor.capture());
List<MappingRecordItem> eidRecords = captor.getValue().getMapRegister().getMappingRecordItem();
assertEquals(1, eidRecords.size());
MappingRecord eidRecord = eidRecords.get(0).getMappingRecord();
assertEquals(2, eidRecord.getLocatorRecord().size());
assertEquals(LispAddressUtil.asIpv4Rloc("10.1.0.110"), eidRecord.getLocatorRecord().get(0).getRloc());
assertEquals(LispAddressUtil.asIpv4Rloc("192.168.136.51"), eidRecord.getLocatorRecord().get(1).getRloc());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.Weight in project lispflowmapping by opendaylight.
the class MultiSiteScenario method provideLocatorRecord.
private LocatorRecord provideLocatorRecord(final Rloc rloc, final String rlocStr, final short weight, final short priority) {
final LocatorRecordBuilder locatorRecordBuilder = new LocatorRecordBuilder();
locatorRecordBuilder.setRloc(rloc);
locatorRecordBuilder.setLocatorId(rlocStr);
locatorRecordBuilder.setPriority(priority);
locatorRecordBuilder.setWeight(weight);
locatorRecordBuilder.setMulticastPriority(DEFAULT_MULTICAST_PRIORITY);
locatorRecordBuilder.setMulticastWeight(DEFAULT_MULTICAST_WEIGHT);
locatorRecordBuilder.setLocalLocator(DEFAULT_LOCAL_LOCATOR);
locatorRecordBuilder.setRlocProbed(DEFAULT_RLOC_PROBED);
locatorRecordBuilder.setRouted(DEFAULT_ROUTED);
return locatorRecordBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.Weight in project bgpcep by opendaylight.
the class SrAttributeParserTest method testRangeTlvIpv6.
@Test
public void testRangeTlvIpv6() {
final byte[] tested = Bytes.concat(new byte[] { 0, 0, 0, 5, // binding sid
4, // binding sid
(byte) 0x88, // binding sid
0, // binding sid
0x34, // binding sid
5, // binding sid
0x48, // binding sid
0, // binding sid
0, // binding sub-tlvs
4, (byte) 0x8c, 0, 0x14, 0, 0, 0, // IPv6 ERO
0 }, // IPv6 ERO
IPV6_A_BYTES, // IPv6 ERO backup
new byte[] { 4, (byte) 0x8f, 0, 0x14, 0, 0, 0, 0 }, // IPv6 ERO backup
IPV6_B_BYTES);
final SrRange parsedRange = RangeTlvParser.parseSrRange(Unpooled.wrappedBuffer(tested), ProtocolId.IsisLevel1);
final List<SubTlvs> rangeSubTlvs = new ArrayList<>();
final List<BindingSubTlvs> bindingSubTlvs = new ArrayList<>();
bindingSubTlvs.add(new BindingSubTlvsBuilder().setBindingSubTlv(new Ipv6EroCaseBuilder().setLoose(Boolean.FALSE).setAddress(new Ipv6Address(IPV6_A)).build()).build());
bindingSubTlvs.add(new BindingSubTlvsBuilder().setBindingSubTlv(new Ipv6EroBackupCaseBuilder().setLoose(Boolean.FALSE).setAddress(new Ipv6Address(IPV6_B)).build()).build());
rangeSubTlvs.add(new SubTlvsBuilder().setRangeSubTlv(new BindingSidTlvCaseBuilder().setWeight(new Weight((short) 5)).setFlags(BINDING_FLAGS).setBindingSubTlvs(bindingSubTlvs).build()).build());
final SrRange expected = new SrRangeBuilder().setInterArea(Boolean.FALSE).setRangeSize(5).setSubTlvs(rangeSubTlvs).build();
assertEquals(expected, parsedRange);
final ByteBuf serializedRange = Unpooled.buffer();
RangeTlvParser.serializeSrRange(parsedRange, serializedRange);
assertArrayEquals(tested, ByteArray.getAllBytes(serializedRange));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.Weight in project bgpcep by opendaylight.
the class SrAttributeParserTest method testSrLanAdjIdOspf.
@Test
public void testSrLanAdjIdOspf() {
final byte[] tested = { (byte) 0x60, 10, 0, 0, 1, 2, 3, 4, 0, 0x5d, (byte) 0xc0 };
final SrLanAdjIds srLanAdjId = new SrLanAdjIdsBuilder().setFlags(OSPF_LAN_ADJ_FLAGS).setWeight(new Weight((short) 10)).setNeighborId(new Ipv4Address("1.2.3.4")).setSidLabelIndex(new LocalLabelCaseBuilder().setLocalLabel(new MplsLabel(24000L)).build()).build();
assertEquals(srLanAdjId, SrLinkAttributesParser.parseLanAdjacencySegmentIdentifier(Unpooled.wrappedBuffer(tested), ProtocolId.Ospf));
final ByteBuf serializedData = SrLinkAttributesParser.serializeLanAdjacencySegmentIdentifier(srLanAdjId);
assertArrayEquals(tested, ByteArray.readAllBytes(serializedData));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.Weight in project bgpcep by opendaylight.
the class SrLinkAttributesParser method parseEpeAdjacencySegmentIdentifier.
public static EpeAdjSidTlv parseEpeAdjacencySegmentIdentifier(final ByteBuf buffer) {
final Weight weight;
final SidLabelIndex sidValue;
if (buffer.isReadable()) {
buffer.skipBytes(FLAGS_BYTE_SIZE);
weight = new Weight(buffer.readUnsignedByte());
buffer.skipBytes(RESERVED);
sidValue = SidLabelIndexParser.parseSidLabelIndex(Size.forValue(buffer.readableBytes()), buffer);
} else {
weight = null;
sidValue = null;
}
return new EpeAdjSidTlv() {
@Override
public Class<? extends DataContainer> getImplementedInterface() {
return EpeAdjSidTlv.class;
}
@Override
public Weight getWeight() {
return weight;
}
@Override
public SidLabelIndex getSidLabelIndex() {
return sidValue;
}
};
}
Aggregations