Changeset 1506:2ab9d941bad5 in freeDiameter for contrib
- Timestamp:
- Apr 3, 2020, 3:04:13 PM (4 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
contrib/tools/csv_to_fd
r1498 r1506 2 2 3 3 """ 4 Convert CSV files containing RADIUS or Diameter AVP tables4 Convert 8 column CSV files containing RADIUS or Diameter AVP tables 5 5 into various formats. 6 6 7 7 Format of the CSV files is one of: 8 8 - Row per 3GPP AVP tables: 9 Name, Code, Section, DataType, Must, May, ShouldNot, MustNot [, extra]9 Name, Code, Section, DataType, Must, May, ShouldNot, MustNot 10 10 - Name: 11 11 AVP Name. String, validated as ALPHA *(ALPHA / DIGIT / "-") … … 601 601 with open(filename, 'r') as csvfile: 602 602 csvdata = csv.DictReader(csvfile, CSV_COLUMN_NAMES, 603 restkey='extra_cells' )603 restkey='extra_cells', restval='') 604 604 standard = '' 605 605 vendor = 0 … … 607 607 for row in csvdata: 608 608 try: 609 if csvdata.restkey in row: 610 raise ValueError('Extra cells: {}'.format( 611 ','.join(row[csvdata.restkey]))) 609 612 if row['name'] in (None, '', 'Attribute Name'): 610 613 continue … … 641 644 # Process AVP 642 645 avpproc.avp(avp) 643 except ValueErroras e:646 except (TypeError, ValueError) as e: 644 647 errors.append('CSV file "{}" line {}: {}\n'.format( 645 648 filename, csvdata.line_num, e))
Note: See TracChangeset
for help on using the changeset viewer.