@Test public void testIsisTlv() throws Exception { channelBuffer = ChannelBuffers.copiedBuffer(tlv); tlvHeader.setTlvType(TlvType.AREAADDRESS.value()); isisTlv = tlvFinder.findTlv(tlvHeader, channelBuffer); assertThat(isisTlv, instanceOf(AreaAddressTlv.class)); channelBuffer = ChannelBuffers.copiedBuffer(tlv); tlvHeader.setTlvType(TlvType.HOSTNAME.value()); isisTlv = tlvFinder.findTlv(tlvHeader, channelBuffer); assertThat(isisTlv, instanceOf(HostNameTlv.class)); channelBuffer = ChannelBuffers.copiedBuffer(tlv); tlvHeader.setTlvType(TlvType.IDRPINFORMATION.value()); isisTlv = tlvFinder.findTlv(tlvHeader, channelBuffer); assertThat(isisTlv, instanceOf(IdrpInformationTlv.class)); channelBuffer = ChannelBuffers.copiedBuffer(tlv); tlvHeader.setTlvType(TlvType.IPEXTENDEDREACHABILITY.value()); isisTlv = tlvFinder.findTlv(tlvHeader, channelBuffer); assertThat(isisTlv, instanceOf(IpExtendedReachabilityTlv.class)); channelBuffer = ChannelBuffers.copiedBuffer(tlv); tlvHeader.setTlvType(TlvType.IPINTERFACEADDRESS.value()); isisTlv = tlvFinder.findTlv(tlvHeader, channelBuffer); assertThat(isisTlv, instanceOf(IpInterfaceAddressTlv.class)); channelBuffer = ChannelBuffers.copiedBuffer(tlv); tlvHeader.setTlvType(TlvType.IPINTERNALREACHABILITY.value()); isisTlv = tlvFinder.findTlv(tlvHeader, channelBuffer); assertThat(isisTlv, instanceOf(IpInternalReachabilityTlv.class)); channelBuffer = ChannelBuffers.copiedBuffer(tlv); tlvHeader.setTlvType(TlvType.PROTOCOLSUPPORTED.value()); isisTlv = tlvFinder.findTlv(tlvHeader, channelBuffer); assertThat(isisTlv, instanceOf(ProtocolSupportedTlv.class)); channelBuffer = ChannelBuffers.copiedBuffer(tlv); tlvHeader.setTlvType(TlvType.ISREACHABILITY.value()); isisTlv = tlvFinder.findTlv(tlvHeader, channelBuffer); assertThat(isisTlv, instanceOf(IsReachabilityTlv.class)); channelBuffer = ChannelBuffers.copiedBuffer(tlv); tlvHeader.setTlvType(TlvType.ISNEIGHBORS.value()); isisTlv = tlvFinder.findTlv(tlvHeader, channelBuffer); assertThat(isisTlv, instanceOf(IsisNeighborTlv.class)); channelBuffer = ChannelBuffers.copiedBuffer(tlv); tlvHeader.setTlvType(TlvType.LSPENTRY.value()); isisTlv = tlvFinder.findTlv(tlvHeader, channelBuffer); assertThat(isisTlv, instanceOf(LspEntriesTlv.class)); channelBuffer = ChannelBuffers.copiedBuffer(tlv); tlvHeader.setTlvType(TlvType.PADDING.value()); isisTlv = tlvFinder.findTlv(tlvHeader, channelBuffer); assertThat(isisTlv, instanceOf(PaddingTlv.class)); channelBuffer = ChannelBuffers.copiedBuffer(tlv1); tlvHeader.setTlvType(TlvType.ADJACENCYSTATE.value()); isisTlv = tlvFinder.findTlv(tlvHeader, channelBuffer); assertThat(isisTlv, instanceOf(AdjacencyStateTlv.class)); }
public static IsisTlv findTlv(TlvHeader tlvHeader, ChannelBuffer channelBuffer) { IsisTlv isisTlv = null; switch (TlvType.get(tlvHeader.tlvType())) { case AREAADDRESS: AreaAddressTlv areaAddressTlv = new AreaAddressTlv(tlvHeader); areaAddressTlv.readFrom(channelBuffer); isisTlv = areaAddressTlv; break; case AUTHENTICATION: break; case EXTENDEDISREACHABILITY: IsExtendedReachability isExtendedReachability = new IsExtendedReachability(tlvHeader); isExtendedReachability.readFrom(channelBuffer); isisTlv = isExtendedReachability; break; case HOSTNAME: HostNameTlv hostNameTlv = new HostNameTlv(tlvHeader); hostNameTlv.readFrom(channelBuffer); isisTlv = hostNameTlv; break; case IDRPINFORMATION: IdrpInformationTlv idrpInformationTlv = new IdrpInformationTlv(tlvHeader); idrpInformationTlv.readFrom(channelBuffer); isisTlv = idrpInformationTlv; break; case IPEXTENDEDREACHABILITY: IpExtendedReachabilityTlv iperTlv = new IpExtendedReachabilityTlv(tlvHeader); iperTlv.readFrom(channelBuffer); isisTlv = iperTlv; break; case IPINTERFACEADDRESS: IpInterfaceAddressTlv ipTlv = new IpInterfaceAddressTlv(tlvHeader); ipTlv.readFrom(channelBuffer); isisTlv = ipTlv; break; case IPINTERNALREACHABILITY: IpInternalReachabilityTlv iprTlv = new IpInternalReachabilityTlv(tlvHeader); iprTlv.readFrom(channelBuffer); isisTlv = iprTlv; break; case ISALIAS: break; case PROTOCOLSUPPORTED: ProtocolSupportedTlv psTlv = new ProtocolSupportedTlv(tlvHeader); psTlv.readFrom(channelBuffer); isisTlv = psTlv; break; case ISREACHABILITY: IsReachabilityTlv isrTlv = new IsReachabilityTlv(tlvHeader); isrTlv.readFrom(channelBuffer); isisTlv = isrTlv; break; case ISNEIGHBORS: IsisNeighborTlv isisNeighborTlv = new IsisNeighborTlv(tlvHeader); isisNeighborTlv.readFrom(channelBuffer); isisTlv = isisNeighborTlv; break; case LSPENTRY: LspEntriesTlv lspEntriesTlv = new LspEntriesTlv(tlvHeader); lspEntriesTlv.readFrom(channelBuffer); isisTlv = lspEntriesTlv; break; case PADDING: PaddingTlv paddingTlv = new PaddingTlv(tlvHeader); paddingTlv.readFrom(channelBuffer); isisTlv = paddingTlv; break; case ADJACENCYSTATE: AdjacencyStateTlv adjacencyStateTlv = new AdjacencyStateTlv(tlvHeader); adjacencyStateTlv.readFrom(channelBuffer); isisTlv = adjacencyStateTlv; break; default: break; } return isisTlv; }
TlvFinder extends TlvHeader { public static IsisTlv findTlv(TlvHeader tlvHeader, ChannelBuffer channelBuffer) { IsisTlv isisTlv = null; switch (TlvType.get(tlvHeader.tlvType())) { case AREAADDRESS: AreaAddressTlv areaAddressTlv = new AreaAddressTlv(tlvHeader); areaAddressTlv.readFrom(channelBuffer); isisTlv = areaAddressTlv; break; case AUTHENTICATION: break; case EXTENDEDISREACHABILITY: IsExtendedReachability isExtendedReachability = new IsExtendedReachability(tlvHeader); isExtendedReachability.readFrom(channelBuffer); isisTlv = isExtendedReachability; break; case HOSTNAME: HostNameTlv hostNameTlv = new HostNameTlv(tlvHeader); hostNameTlv.readFrom(channelBuffer); isisTlv = hostNameTlv; break; case IDRPINFORMATION: IdrpInformationTlv idrpInformationTlv = new IdrpInformationTlv(tlvHeader); idrpInformationTlv.readFrom(channelBuffer); isisTlv = idrpInformationTlv; break; case IPEXTENDEDREACHABILITY: IpExtendedReachabilityTlv iperTlv = new IpExtendedReachabilityTlv(tlvHeader); iperTlv.readFrom(channelBuffer); isisTlv = iperTlv; break; case IPINTERFACEADDRESS: IpInterfaceAddressTlv ipTlv = new IpInterfaceAddressTlv(tlvHeader); ipTlv.readFrom(channelBuffer); isisTlv = ipTlv; break; case IPINTERNALREACHABILITY: IpInternalReachabilityTlv iprTlv = new IpInternalReachabilityTlv(tlvHeader); iprTlv.readFrom(channelBuffer); isisTlv = iprTlv; break; case ISALIAS: break; case PROTOCOLSUPPORTED: ProtocolSupportedTlv psTlv = new ProtocolSupportedTlv(tlvHeader); psTlv.readFrom(channelBuffer); isisTlv = psTlv; break; case ISREACHABILITY: IsReachabilityTlv isrTlv = new IsReachabilityTlv(tlvHeader); isrTlv.readFrom(channelBuffer); isisTlv = isrTlv; break; case ISNEIGHBORS: IsisNeighborTlv isisNeighborTlv = new IsisNeighborTlv(tlvHeader); isisNeighborTlv.readFrom(channelBuffer); isisTlv = isisNeighborTlv; break; case LSPENTRY: LspEntriesTlv lspEntriesTlv = new LspEntriesTlv(tlvHeader); lspEntriesTlv.readFrom(channelBuffer); isisTlv = lspEntriesTlv; break; case PADDING: PaddingTlv paddingTlv = new PaddingTlv(tlvHeader); paddingTlv.readFrom(channelBuffer); isisTlv = paddingTlv; break; case ADJACENCYSTATE: AdjacencyStateTlv adjacencyStateTlv = new AdjacencyStateTlv(tlvHeader); adjacencyStateTlv.readFrom(channelBuffer); isisTlv = adjacencyStateTlv; break; default: break; } return isisTlv; } }
TlvFinder extends TlvHeader { public static IsisTlv findTlv(TlvHeader tlvHeader, ChannelBuffer channelBuffer) { IsisTlv isisTlv = null; switch (TlvType.get(tlvHeader.tlvType())) { case AREAADDRESS: AreaAddressTlv areaAddressTlv = new AreaAddressTlv(tlvHeader); areaAddressTlv.readFrom(channelBuffer); isisTlv = areaAddressTlv; break; case AUTHENTICATION: break; case EXTENDEDISREACHABILITY: IsExtendedReachability isExtendedReachability = new IsExtendedReachability(tlvHeader); isExtendedReachability.readFrom(channelBuffer); isisTlv = isExtendedReachability; break; case HOSTNAME: HostNameTlv hostNameTlv = new HostNameTlv(tlvHeader); hostNameTlv.readFrom(channelBuffer); isisTlv = hostNameTlv; break; case IDRPINFORMATION: IdrpInformationTlv idrpInformationTlv = new IdrpInformationTlv(tlvHeader); idrpInformationTlv.readFrom(channelBuffer); isisTlv = idrpInformationTlv; break; case IPEXTENDEDREACHABILITY: IpExtendedReachabilityTlv iperTlv = new IpExtendedReachabilityTlv(tlvHeader); iperTlv.readFrom(channelBuffer); isisTlv = iperTlv; break; case IPINTERFACEADDRESS: IpInterfaceAddressTlv ipTlv = new IpInterfaceAddressTlv(tlvHeader); ipTlv.readFrom(channelBuffer); isisTlv = ipTlv; break; case IPINTERNALREACHABILITY: IpInternalReachabilityTlv iprTlv = new IpInternalReachabilityTlv(tlvHeader); iprTlv.readFrom(channelBuffer); isisTlv = iprTlv; break; case ISALIAS: break; case PROTOCOLSUPPORTED: ProtocolSupportedTlv psTlv = new ProtocolSupportedTlv(tlvHeader); psTlv.readFrom(channelBuffer); isisTlv = psTlv; break; case ISREACHABILITY: IsReachabilityTlv isrTlv = new IsReachabilityTlv(tlvHeader); isrTlv.readFrom(channelBuffer); isisTlv = isrTlv; break; case ISNEIGHBORS: IsisNeighborTlv isisNeighborTlv = new IsisNeighborTlv(tlvHeader); isisNeighborTlv.readFrom(channelBuffer); isisTlv = isisNeighborTlv; break; case LSPENTRY: LspEntriesTlv lspEntriesTlv = new LspEntriesTlv(tlvHeader); lspEntriesTlv.readFrom(channelBuffer); isisTlv = lspEntriesTlv; break; case PADDING: PaddingTlv paddingTlv = new PaddingTlv(tlvHeader); paddingTlv.readFrom(channelBuffer); isisTlv = paddingTlv; break; case ADJACENCYSTATE: AdjacencyStateTlv adjacencyStateTlv = new AdjacencyStateTlv(tlvHeader); adjacencyStateTlv.readFrom(channelBuffer); isisTlv = adjacencyStateTlv; break; default: break; } return isisTlv; }  }
TlvFinder extends TlvHeader { public static IsisTlv findTlv(TlvHeader tlvHeader, ChannelBuffer channelBuffer) { IsisTlv isisTlv = null; switch (TlvType.get(tlvHeader.tlvType())) { case AREAADDRESS: AreaAddressTlv areaAddressTlv = new AreaAddressTlv(tlvHeader); areaAddressTlv.readFrom(channelBuffer); isisTlv = areaAddressTlv; break; case AUTHENTICATION: break; case EXTENDEDISREACHABILITY: IsExtendedReachability isExtendedReachability = new IsExtendedReachability(tlvHeader); isExtendedReachability.readFrom(channelBuffer); isisTlv = isExtendedReachability; break; case HOSTNAME: HostNameTlv hostNameTlv = new HostNameTlv(tlvHeader); hostNameTlv.readFrom(channelBuffer); isisTlv = hostNameTlv; break; case IDRPINFORMATION: IdrpInformationTlv idrpInformationTlv = new IdrpInformationTlv(tlvHeader); idrpInformationTlv.readFrom(channelBuffer); isisTlv = idrpInformationTlv; break; case IPEXTENDEDREACHABILITY: IpExtendedReachabilityTlv iperTlv = new IpExtendedReachabilityTlv(tlvHeader); iperTlv.readFrom(channelBuffer); isisTlv = iperTlv; break; case IPINTERFACEADDRESS: IpInterfaceAddressTlv ipTlv = new IpInterfaceAddressTlv(tlvHeader); ipTlv.readFrom(channelBuffer); isisTlv = ipTlv; break; case IPINTERNALREACHABILITY: IpInternalReachabilityTlv iprTlv = new IpInternalReachabilityTlv(tlvHeader); iprTlv.readFrom(channelBuffer); isisTlv = iprTlv; break; case ISALIAS: break; case PROTOCOLSUPPORTED: ProtocolSupportedTlv psTlv = new ProtocolSupportedTlv(tlvHeader); psTlv.readFrom(channelBuffer); isisTlv = psTlv; break; case ISREACHABILITY: IsReachabilityTlv isrTlv = new IsReachabilityTlv(tlvHeader); isrTlv.readFrom(channelBuffer); isisTlv = isrTlv; break; case ISNEIGHBORS: IsisNeighborTlv isisNeighborTlv = new IsisNeighborTlv(tlvHeader); isisNeighborTlv.readFrom(channelBuffer); isisTlv = isisNeighborTlv; break; case LSPENTRY: LspEntriesTlv lspEntriesTlv = new LspEntriesTlv(tlvHeader); lspEntriesTlv.readFrom(channelBuffer); isisTlv = lspEntriesTlv; break; case PADDING: PaddingTlv paddingTlv = new PaddingTlv(tlvHeader); paddingTlv.readFrom(channelBuffer); isisTlv = paddingTlv; break; case ADJACENCYSTATE: AdjacencyStateTlv adjacencyStateTlv = new AdjacencyStateTlv(tlvHeader); adjacencyStateTlv.readFrom(channelBuffer); isisTlv = adjacencyStateTlv; break; default: break; } return isisTlv; }  static IsisTlv findTlv(TlvHeader tlvHeader, ChannelBuffer channelBuffer); }
TlvFinder extends TlvHeader { public static IsisTlv findTlv(TlvHeader tlvHeader, ChannelBuffer channelBuffer) { IsisTlv isisTlv = null; switch (TlvType.get(tlvHeader.tlvType())) { case AREAADDRESS: AreaAddressTlv areaAddressTlv = new AreaAddressTlv(tlvHeader); areaAddressTlv.readFrom(channelBuffer); isisTlv = areaAddressTlv; break; case AUTHENTICATION: break; case EXTENDEDISREACHABILITY: IsExtendedReachability isExtendedReachability = new IsExtendedReachability(tlvHeader); isExtendedReachability.readFrom(channelBuffer); isisTlv = isExtendedReachability; break; case HOSTNAME: HostNameTlv hostNameTlv = new HostNameTlv(tlvHeader); hostNameTlv.readFrom(channelBuffer); isisTlv = hostNameTlv; break; case IDRPINFORMATION: IdrpInformationTlv idrpInformationTlv = new IdrpInformationTlv(tlvHeader); idrpInformationTlv.readFrom(channelBuffer); isisTlv = idrpInformationTlv; break; case IPEXTENDEDREACHABILITY: IpExtendedReachabilityTlv iperTlv = new IpExtendedReachabilityTlv(tlvHeader); iperTlv.readFrom(channelBuffer); isisTlv = iperTlv; break; case IPINTERFACEADDRESS: IpInterfaceAddressTlv ipTlv = new IpInterfaceAddressTlv(tlvHeader); ipTlv.readFrom(channelBuffer); isisTlv = ipTlv; break; case IPINTERNALREACHABILITY: IpInternalReachabilityTlv iprTlv = new IpInternalReachabilityTlv(tlvHeader); iprTlv.readFrom(channelBuffer); isisTlv = iprTlv; break; case ISALIAS: break; case PROTOCOLSUPPORTED: ProtocolSupportedTlv psTlv = new ProtocolSupportedTlv(tlvHeader); psTlv.readFrom(channelBuffer); isisTlv = psTlv; break; case ISREACHABILITY: IsReachabilityTlv isrTlv = new IsReachabilityTlv(tlvHeader); isrTlv.readFrom(channelBuffer); isisTlv = isrTlv; break; case ISNEIGHBORS: IsisNeighborTlv isisNeighborTlv = new IsisNeighborTlv(tlvHeader); isisNeighborTlv.readFrom(channelBuffer); isisTlv = isisNeighborTlv; break; case LSPENTRY: LspEntriesTlv lspEntriesTlv = new LspEntriesTlv(tlvHeader); lspEntriesTlv.readFrom(channelBuffer); isisTlv = lspEntriesTlv; break; case PADDING: PaddingTlv paddingTlv = new PaddingTlv(tlvHeader); paddingTlv.readFrom(channelBuffer); isisTlv = paddingTlv; break; case ADJACENCYSTATE: AdjacencyStateTlv adjacencyStateTlv = new AdjacencyStateTlv(tlvHeader); adjacencyStateTlv.readFrom(channelBuffer); isisTlv = adjacencyStateTlv; break; default: break; } return isisTlv; }  static IsisTlv findTlv(TlvHeader tlvHeader, ChannelBuffer channelBuffer);  }