# notice and this notice are preserved. This file is offered as-is,
# without warranty of any kind.
+from __future__ import print_function
+
import getopt
import re
import sys
self.current_record = dict()
def startDocument(self):
- print """\
+ print("""\
/* IPFIX entities. */
#ifndef IPFIX_ENTITY
#define IPFIX_ENTITY(ENUM, ID, SIZE, NAME)
#endif
-"""
+""")
def endDocument(self):
- print """
-#undef IPFIX_ENTITY"""
+ print("""
+#undef IPFIX_ENTITY""")
def startElement(self, name, attrs):
if name in self.RECORD_FIELDS:
self.current_record['dataTypeSize'] = self.DATA_TYPE_SIZE.get(
self.current_record['dataType'], 0)
- print 'IPFIX_ENTITY(%(enumName)s, %(elementId)s, ' \
- '%(dataTypeSize)i, %(name)s)' % self.current_record
+ print('IPFIX_ENTITY(%(enumName)s, %(elementId)s, '
+ '%(dataTypeSize)i, %(name)s)' % self.current_record)
self.current_record.clear()
def characters(self, content):
def usage(name):
- print """\
+ print("""\
%(name)s: IPFIX entity definition generator
Prints C macros defining IPFIX entities from the standard IANA file at
<http://www.iana.org/assignments/ipfix/ipfix.xml>
The following options are also available:
-h, --help display this help message
-V, --version display version information\
-""" % {'name': name}
+""" % {'name': name})
sys.exit(0)
if __name__ == '__main__':
if key in ['-h', '--help']:
usage()
elif key in ['-V', '--version']:
- print 'ipfix-gen-entities (Open vSwitch)'
+ print('ipfix-gen-entities (Open vSwitch)')
else:
sys.exit(0)