@Test public void testDecodeWhenBlueprintIsNotAvailable() throws Exception { byte[] dataSet = IpfixUtilities.hexStringToByteArray("010300200000006F6161000000DE00000000014D6262000001BC0503000318A3"); IpfixDataSet set = new IpfixDataSet(dataSet); Set<IpfixDecodedData> decodedDataSet = m_decodingDataRecordService.decodeDataSet("", 1L, set, null, m_templateProvider); assertTrue(decodedDataSet.isEmpty()); verify(m_templateProvider).get(259); }
@Override public Set<IpfixDecodedData> decodeDataSet(String deviceName, long obsvDomain, IpfixDataSet set, IpfixMessage ipfixMessage, CollectingServiceImpl.TemplateProvider templateProvider) throws DecodingException { if (Objects.isNull(set)) { throw new DecodingException("Data set is invalid for decoding process."); } int templateId = set.getHeader().getId(); LOGGER.debug(String.format("Start decoding data set (Observation domain: %s, Set id: %s)", obsvDomain, templateId)); AbstractTemplateRecord blueprint = templateProvider.get(templateId); if (Objects.isNull(blueprint)) { LOGGER.debug(String.format("Template %s on device %s not available in cache, start buffering", templateId, deviceName)); return Collections.emptySet(); } else { LOGGER.debug("Template available in cache, start decoding"); return decodeDataSetWithTemplate(deviceName, blueprint, obsvDomain, set, ipfixMessage); } }
DecodingDataRecordServiceImpl implements DecodingDataRecordService { @Override public Set<IpfixDecodedData> decodeDataSet(String deviceName, long obsvDomain, IpfixDataSet set, IpfixMessage ipfixMessage, CollectingServiceImpl.TemplateProvider templateProvider) throws DecodingException { if (Objects.isNull(set)) { throw new DecodingException("Data set is invalid for decoding process."); } int templateId = set.getHeader().getId(); LOGGER.debug(String.format("Start decoding data set (Observation domain: %s, Set id: %s)", obsvDomain, templateId)); AbstractTemplateRecord blueprint = templateProvider.get(templateId); if (Objects.isNull(blueprint)) { LOGGER.debug(String.format("Template %s on device %s not available in cache, start buffering", templateId, deviceName)); return Collections.emptySet(); } else { LOGGER.debug("Template available in cache, start decoding"); return decodeDataSetWithTemplate(deviceName, blueprint, obsvDomain, set, ipfixMessage); } } }
DecodingDataRecordServiceImpl implements DecodingDataRecordService { @Override public Set<IpfixDecodedData> decodeDataSet(String deviceName, long obsvDomain, IpfixDataSet set, IpfixMessage ipfixMessage, CollectingServiceImpl.TemplateProvider templateProvider) throws DecodingException { if (Objects.isNull(set)) { throw new DecodingException("Data set is invalid for decoding process."); } int templateId = set.getHeader().getId(); LOGGER.debug(String.format("Start decoding data set (Observation domain: %s, Set id: %s)", obsvDomain, templateId)); AbstractTemplateRecord blueprint = templateProvider.get(templateId); if (Objects.isNull(blueprint)) { LOGGER.debug(String.format("Template %s on device %s not available in cache, start buffering", templateId, deviceName)); return Collections.emptySet(); } else { LOGGER.debug("Template available in cache, start decoding"); return decodeDataSetWithTemplate(deviceName, blueprint, obsvDomain, set, ipfixMessage); } } DecodingDataRecordServiceImpl(InformationElementService informationElementServiceCache,
                                         DecodeMethodFactory decodeMethodFactory, DeviceCacheService deviceCacheService); }
DecodingDataRecordServiceImpl implements DecodingDataRecordService { @Override public Set<IpfixDecodedData> decodeDataSet(String deviceName, long obsvDomain, IpfixDataSet set, IpfixMessage ipfixMessage, CollectingServiceImpl.TemplateProvider templateProvider) throws DecodingException { if (Objects.isNull(set)) { throw new DecodingException("Data set is invalid for decoding process."); } int templateId = set.getHeader().getId(); LOGGER.debug(String.format("Start decoding data set (Observation domain: %s, Set id: %s)", obsvDomain, templateId)); AbstractTemplateRecord blueprint = templateProvider.get(templateId); if (Objects.isNull(blueprint)) { LOGGER.debug(String.format("Template %s on device %s not available in cache, start buffering", templateId, deviceName)); return Collections.emptySet(); } else { LOGGER.debug("Template available in cache, start decoding"); return decodeDataSetWithTemplate(deviceName, blueprint, obsvDomain, set, ipfixMessage); } } DecodingDataRecordServiceImpl(InformationElementService informationElementServiceCache,
                                         DecodeMethodFactory decodeMethodFactory, DeviceCacheService deviceCacheService); @Override Set<IpfixDecodedData> decodeDataSet(String deviceName, long obsvDomain, IpfixDataSet set, IpfixMessage ipfixMessage,
                                                CollectingServiceImpl.TemplateProvider templateProvider); }
DecodingDataRecordServiceImpl implements DecodingDataRecordService { @Override public Set<IpfixDecodedData> decodeDataSet(String deviceName, long obsvDomain, IpfixDataSet set, IpfixMessage ipfixMessage, CollectingServiceImpl.TemplateProvider templateProvider) throws DecodingException { if (Objects.isNull(set)) { throw new DecodingException("Data set is invalid for decoding process."); } int templateId = set.getHeader().getId(); LOGGER.debug(String.format("Start decoding data set (Observation domain: %s, Set id: %s)", obsvDomain, templateId)); AbstractTemplateRecord blueprint = templateProvider.get(templateId); if (Objects.isNull(blueprint)) { LOGGER.debug(String.format("Template %s on device %s not available in cache, start buffering", templateId, deviceName)); return Collections.emptySet(); } else { LOGGER.debug("Template available in cache, start decoding"); return decodeDataSetWithTemplate(deviceName, blueprint, obsvDomain, set, ipfixMessage); } } DecodingDataRecordServiceImpl(InformationElementService informationElementServiceCache,
                                         DecodeMethodFactory decodeMethodFactory, DeviceCacheService deviceCacheService); @Override Set<IpfixDecodedData> decodeDataSet(String deviceName, long obsvDomain, IpfixDataSet set, IpfixMessage ipfixMessage,
                                                CollectingServiceImpl.TemplateProvider templateProvider);  }