If the basic example of a string is changed to a fixed length of 13 (which exactly matches the string length passed to the data record) it works just fine:
importipfiximportipfix.visfromIPython.displayimportSVGdefdraw_message(msg, length=256):
returnSVG(ipfix.vis.MessageBufferRenderer(msg, raster=4).render(length=length))
defdraw_template(tmpl):
ofd=ipfix.vis.OctetFieldDrawing(raster=4)
ipfix.vis.draw_template(ofd, tmpl)
returnSVG(ofd.render((90,30)))
ipfix.ie.use_iana_default()
vtmpl=ipfix.template.for_specs(262, "wlanSSID[13]")
draw_template(vtmpl)
msg=ipfix.message.MessageBuffer()
msg.begin_export(8304)
msg.add_template(vtmpl)
msg.export_new_set(262)
msg.export_namedict({'wlanSSID': 'ietf-a-v6only'})
draw_message(msg)If it's changed to 12 it also works just fine, truncating the string to fit.
If it's changed to 14, or any other larger value, it crashes.
I'm guessing that it needs to correctly zero pad the string.
---------------------------------------------------------------------------ExpatErrorTraceback (mostrecentcalllast)
<ipython-input-3-9dedd178bbfb>in<module>()
5msg.export_namedict({'wlanSSID': 'ietf-a-v6only',
6'protocolIdentifier': 6})
---->7draw_message(msg)
<ipython-input-1-ffa57e3f6760>indraw_message(msg, length)
56defdraw_message(msg, length=256):
---->7returnSVG(ipfix.vis.MessageBufferRenderer(msg, raster=4).render(length=length))
89defdraw_template(tmpl):
/usr/lib/python3/dist-packages/IPython/core/display.pyin__init__(self, data, url, filename)
388data=None389-->390self.data=data391self.url=url392self.filename=NoneiffilenameisNoneelseunicode_type(filename)
/usr/lib/python3/dist-packages/IPython/core/display.pyindata(self, svg)
496fromxml.domimportminidom497svg=cast_bytes_py2(svg)
-->498x=minidom.parseString(svg)
499# get svg tag (should be 1)500found_svg=x.getElementsByTagName('svg')
/usr/lib/python3.5/xml/dom/minidom.pyinparseString(string, parser)
1966ifparserisNone:
1967fromxml.domimportexpatbuilder->1968returnexpatbuilder.parseString(string)
1969else:
1970fromxml.domimportpulldom/usr/lib/python3.5/xml/dom/expatbuilder.pyinparseString(string, namespaces)
923else:
924builder=ExpatBuilder()
-->925returnbuilder.parseString(string)
926927/usr/lib/python3.5/xml/dom/expatbuilder.pyinparseString(self, string)
221parser=self.getParser()
222try:
-->223parser.Parse(string, True)
224self._setup_subset(string)
225exceptParseEscape:
ExpatError: notwell-formed (invalidtoken): line1, column4720
If the basic example of a string is changed to a fixed length of 13 (which exactly matches the string length passed to the data record) it works just fine:
If it's changed to 12 it also works just fine, truncating the string to fit.
If it's changed to 14, or any other larger value, it crashes.
I'm guessing that it needs to correctly zero pad the string.