@Test public void testFindSubTlv() throws Exception { tlvHeader.setTlvLength(4); tlvHeader.setTlvType(SubTlvType.ADMINISTRATIVEGROUP.value()); AdministrativeGroup administrativeGroup = new AdministrativeGroup(tlvHeader); channelBuffer = ChannelBuffers.copiedBuffer(packet1); tlv = SubTlvFinder.findSubTlv(tlvHeader, channelBuffer); assertThat(tlv, is(notNullValue())); tlvHeader = new TlvHeader(); tlvHeader.setTlvLength(4); tlvHeader.setTlvType(SubTlvType.TRAFFICENGINEERINGMETRIC.value()); TrafficEngineeringMetric trafficEngineeringMetric = new TrafficEngineeringMetric(tlvHeader); channelBuffer = ChannelBuffers.copiedBuffer(packet1); tlv = SubTlvFinder.findSubTlv(tlvHeader, channelBuffer); assertThat(tlv, is(notNullValue())); tlvHeader = new TlvHeader(); tlvHeader.setTlvLength(4); tlvHeader.setTlvType(SubTlvType.MAXIMUMBANDWIDTH.value()); MaximumBandwidth maximumBandwidth = new MaximumBandwidth(tlvHeader); channelBuffer = ChannelBuffers.copiedBuffer(packet1); tlv = SubTlvFinder.findSubTlv(tlvHeader, channelBuffer); assertThat(tlv, is(notNullValue())); tlvHeader = new TlvHeader(); tlvHeader.setTlvLength(4); tlvHeader.setTlvType(SubTlvType.MAXIMUMRESERVABLEBANDWIDTH.value()); MaximumReservableBandwidth maximumReservableBandwidth = new MaximumReservableBandwidth(tlvHeader); channelBuffer = ChannelBuffers.copiedBuffer(packet1); tlv = SubTlvFinder.findSubTlv(tlvHeader, channelBuffer); assertThat(tlv, is(notNullValue())); tlvHeader = new TlvHeader(); tlvHeader.setTlvLength(4); tlvHeader.setTlvType(SubTlvType.UNRESERVEDBANDWIDTH.value()); UnreservedBandwidth unreservedBandwidth = new UnreservedBandwidth(tlvHeader); channelBuffer = ChannelBuffers.copiedBuffer(packet1); tlv = SubTlvFinder.findSubTlv(tlvHeader, channelBuffer); assertThat(tlv, is(notNullValue())); tlvHeader = new TlvHeader(); tlvHeader.setTlvLength(4); tlvHeader.setTlvType(SubTlvType.INTERFACEADDRESS.value()); InterfaceIpAddress ipInterfaceAddressTlv = new InterfaceIpAddress(tlvHeader); channelBuffer = ChannelBuffers.copiedBuffer(packet1); tlv = SubTlvFinder.findSubTlv(tlvHeader, channelBuffer); assertThat(tlv, is(notNullValue())); }
public static TrafficEngineeringSubTlv findSubTlv(TlvHeader tlvHeader, ChannelBuffer channelBuffer) { TrafficEngineeringSubTlv subTlv = null; switch (SubTlvType.get(tlvHeader.tlvType())) { case ADMINISTRATIVEGROUP: AdministrativeGroup administrativeGroup = new AdministrativeGroup(tlvHeader); administrativeGroup.readFrom(channelBuffer); subTlv = administrativeGroup; break; case MAXIMUMBANDWIDTH: MaximumBandwidth maximumBandwidth = new MaximumBandwidth(tlvHeader); maximumBandwidth.readFrom(channelBuffer); subTlv = maximumBandwidth; break; case MAXIMUMRESERVABLEBANDWIDTH: MaximumReservableBandwidth maxResBandwidth = new MaximumReservableBandwidth(tlvHeader); maxResBandwidth.readFrom(channelBuffer); subTlv = maxResBandwidth; break; case TRAFFICENGINEERINGMETRIC: TrafficEngineeringMetric teMetric = new TrafficEngineeringMetric(tlvHeader); teMetric.readFrom(channelBuffer); subTlv = teMetric; break; case UNRESERVEDBANDWIDTH: UnreservedBandwidth unreservedBandwidth = new UnreservedBandwidth(tlvHeader); unreservedBandwidth.readFrom(channelBuffer); subTlv = unreservedBandwidth; break; case INTERFACEADDRESS: InterfaceIpAddress ipInterfaceAddressTlv = new InterfaceIpAddress(tlvHeader); ipInterfaceAddressTlv.readFrom(channelBuffer); subTlv = ipInterfaceAddressTlv; break; case NEIGHBORADDRESS: NeighborIpAddress ipNeighborAddressTlv = new NeighborIpAddress(tlvHeader); ipNeighborAddressTlv.readFrom(channelBuffer); subTlv = ipNeighborAddressTlv; break; default: break; } return subTlv; }
SubTlvFinder { public static TrafficEngineeringSubTlv findSubTlv(TlvHeader tlvHeader, ChannelBuffer channelBuffer) { TrafficEngineeringSubTlv subTlv = null; switch (SubTlvType.get(tlvHeader.tlvType())) { case ADMINISTRATIVEGROUP: AdministrativeGroup administrativeGroup = new AdministrativeGroup(tlvHeader); administrativeGroup.readFrom(channelBuffer); subTlv = administrativeGroup; break; case MAXIMUMBANDWIDTH: MaximumBandwidth maximumBandwidth = new MaximumBandwidth(tlvHeader); maximumBandwidth.readFrom(channelBuffer); subTlv = maximumBandwidth; break; case MAXIMUMRESERVABLEBANDWIDTH: MaximumReservableBandwidth maxResBandwidth = new MaximumReservableBandwidth(tlvHeader); maxResBandwidth.readFrom(channelBuffer); subTlv = maxResBandwidth; break; case TRAFFICENGINEERINGMETRIC: TrafficEngineeringMetric teMetric = new TrafficEngineeringMetric(tlvHeader); teMetric.readFrom(channelBuffer); subTlv = teMetric; break; case UNRESERVEDBANDWIDTH: UnreservedBandwidth unreservedBandwidth = new UnreservedBandwidth(tlvHeader); unreservedBandwidth.readFrom(channelBuffer); subTlv = unreservedBandwidth; break; case INTERFACEADDRESS: InterfaceIpAddress ipInterfaceAddressTlv = new InterfaceIpAddress(tlvHeader); ipInterfaceAddressTlv.readFrom(channelBuffer); subTlv = ipInterfaceAddressTlv; break; case NEIGHBORADDRESS: NeighborIpAddress ipNeighborAddressTlv = new NeighborIpAddress(tlvHeader); ipNeighborAddressTlv.readFrom(channelBuffer); subTlv = ipNeighborAddressTlv; break; default: break; } return subTlv; } }
SubTlvFinder { public static TrafficEngineeringSubTlv findSubTlv(TlvHeader tlvHeader, ChannelBuffer channelBuffer) { TrafficEngineeringSubTlv subTlv = null; switch (SubTlvType.get(tlvHeader.tlvType())) { case ADMINISTRATIVEGROUP: AdministrativeGroup administrativeGroup = new AdministrativeGroup(tlvHeader); administrativeGroup.readFrom(channelBuffer); subTlv = administrativeGroup; break; case MAXIMUMBANDWIDTH: MaximumBandwidth maximumBandwidth = new MaximumBandwidth(tlvHeader); maximumBandwidth.readFrom(channelBuffer); subTlv = maximumBandwidth; break; case MAXIMUMRESERVABLEBANDWIDTH: MaximumReservableBandwidth maxResBandwidth = new MaximumReservableBandwidth(tlvHeader); maxResBandwidth.readFrom(channelBuffer); subTlv = maxResBandwidth; break; case TRAFFICENGINEERINGMETRIC: TrafficEngineeringMetric teMetric = new TrafficEngineeringMetric(tlvHeader); teMetric.readFrom(channelBuffer); subTlv = teMetric; break; case UNRESERVEDBANDWIDTH: UnreservedBandwidth unreservedBandwidth = new UnreservedBandwidth(tlvHeader); unreservedBandwidth.readFrom(channelBuffer); subTlv = unreservedBandwidth; break; case INTERFACEADDRESS: InterfaceIpAddress ipInterfaceAddressTlv = new InterfaceIpAddress(tlvHeader); ipInterfaceAddressTlv.readFrom(channelBuffer); subTlv = ipInterfaceAddressTlv; break; case NEIGHBORADDRESS: NeighborIpAddress ipNeighborAddressTlv = new NeighborIpAddress(tlvHeader); ipNeighborAddressTlv.readFrom(channelBuffer); subTlv = ipNeighborAddressTlv; break; default: break; } return subTlv; } private  SubTlvFinder(); }
SubTlvFinder { public static TrafficEngineeringSubTlv findSubTlv(TlvHeader tlvHeader, ChannelBuffer channelBuffer) { TrafficEngineeringSubTlv subTlv = null; switch (SubTlvType.get(tlvHeader.tlvType())) { case ADMINISTRATIVEGROUP: AdministrativeGroup administrativeGroup = new AdministrativeGroup(tlvHeader); administrativeGroup.readFrom(channelBuffer); subTlv = administrativeGroup; break; case MAXIMUMBANDWIDTH: MaximumBandwidth maximumBandwidth = new MaximumBandwidth(tlvHeader); maximumBandwidth.readFrom(channelBuffer); subTlv = maximumBandwidth; break; case MAXIMUMRESERVABLEBANDWIDTH: MaximumReservableBandwidth maxResBandwidth = new MaximumReservableBandwidth(tlvHeader); maxResBandwidth.readFrom(channelBuffer); subTlv = maxResBandwidth; break; case TRAFFICENGINEERINGMETRIC: TrafficEngineeringMetric teMetric = new TrafficEngineeringMetric(tlvHeader); teMetric.readFrom(channelBuffer); subTlv = teMetric; break; case UNRESERVEDBANDWIDTH: UnreservedBandwidth unreservedBandwidth = new UnreservedBandwidth(tlvHeader); unreservedBandwidth.readFrom(channelBuffer); subTlv = unreservedBandwidth; break; case INTERFACEADDRESS: InterfaceIpAddress ipInterfaceAddressTlv = new InterfaceIpAddress(tlvHeader); ipInterfaceAddressTlv.readFrom(channelBuffer); subTlv = ipInterfaceAddressTlv; break; case NEIGHBORADDRESS: NeighborIpAddress ipNeighborAddressTlv = new NeighborIpAddress(tlvHeader); ipNeighborAddressTlv.readFrom(channelBuffer); subTlv = ipNeighborAddressTlv; break; default: break; } return subTlv; } private  SubTlvFinder(); static TrafficEngineeringSubTlv findSubTlv(TlvHeader tlvHeader, ChannelBuffer channelBuffer); }
SubTlvFinder { public static TrafficEngineeringSubTlv findSubTlv(TlvHeader tlvHeader, ChannelBuffer channelBuffer) { TrafficEngineeringSubTlv subTlv = null; switch (SubTlvType.get(tlvHeader.tlvType())) { case ADMINISTRATIVEGROUP: AdministrativeGroup administrativeGroup = new AdministrativeGroup(tlvHeader); administrativeGroup.readFrom(channelBuffer); subTlv = administrativeGroup; break; case MAXIMUMBANDWIDTH: MaximumBandwidth maximumBandwidth = new MaximumBandwidth(tlvHeader); maximumBandwidth.readFrom(channelBuffer); subTlv = maximumBandwidth; break; case MAXIMUMRESERVABLEBANDWIDTH: MaximumReservableBandwidth maxResBandwidth = new MaximumReservableBandwidth(tlvHeader); maxResBandwidth.readFrom(channelBuffer); subTlv = maxResBandwidth; break; case TRAFFICENGINEERINGMETRIC: TrafficEngineeringMetric teMetric = new TrafficEngineeringMetric(tlvHeader); teMetric.readFrom(channelBuffer); subTlv = teMetric; break; case UNRESERVEDBANDWIDTH: UnreservedBandwidth unreservedBandwidth = new UnreservedBandwidth(tlvHeader); unreservedBandwidth.readFrom(channelBuffer); subTlv = unreservedBandwidth; break; case INTERFACEADDRESS: InterfaceIpAddress ipInterfaceAddressTlv = new InterfaceIpAddress(tlvHeader); ipInterfaceAddressTlv.readFrom(channelBuffer); subTlv = ipInterfaceAddressTlv; break; case NEIGHBORADDRESS: NeighborIpAddress ipNeighborAddressTlv = new NeighborIpAddress(tlvHeader); ipNeighborAddressTlv.readFrom(channelBuffer); subTlv = ipNeighborAddressTlv; break; default: break; } return subTlv; } private  SubTlvFinder(); static TrafficEngineeringSubTlv findSubTlv(TlvHeader tlvHeader, ChannelBuffer channelBuffer);  }