stl_tmpl.add_spec_list(stl_item_list) # create the exporter exporter = pyfixbuf.Exporter() #create the IPFIX file to write to exporter.init_net(hostname=sys.argv[1], port=sys.argv[2], transport=sys.argv[3]) #create the session session = pyfixbuf.Session(infomodel) # for exporters we need to create internal and external templates session.add_internal_template(template_id=999, template=tmpl) session.add_external_template(template_id=999, template=tmpl) session.add_internal_template(template_id=1000, template=sub_tmpl) session.add_external_template(template_id=1000, template=sub_tmpl) session.add_internal_template(template_id=1001, template=stl_tmpl) session.add_external_template(template_id=1001, template=stl_tmpl) # create the record to fill to export # we can just give it the template since we don't have duplicate elements rec = pyfixbuf.Record(infomodel, tmpl) #create the buffer for exporter
# Add the lists to their respective template tmpl.add_spec_list(data_list) stats_tmpl.add_spec_list(stats_list) # Create a collector collector = p.Collector() # Give the collector your input file to read from collector.init_file(sys.argv[1]) # Create a session session = p.Session(infomodel) # Add your template to the session session.add_internal_template(tmpl, 999) # Add the Stats Template session.add_internal_template(stats_tmpl, 911) # create a Record for the main template and stats template rec = p.Record(infomodel, tmpl) statsrec = p.Record(infomodel, stats_tmpl)