Raw Text vs Structured data

This section covers the differences between raw text output from the Alcatel IOO and how the data can be structured to become usable

Raw Text output

By default the Alcatel IOO returns data in raw text format. Though the text is delimited is practically impossible to do anything with it.

For example:

The command:

LIST_PM_DATA_REQ[]

returns:

PM_DATA_NOTIF[notificationType=pmList|friendlyName=elementNAme|neLocationName=
|periodType=15{pmPoint=elementName/r01sr1sl08/port#01-OCHrsTMi-PMTR15{period=2012060501
|LOD=0{BBE=0|ES=0|SES=0|NEUAS=0|UAS=0|BBU=0|SUS=0|BEC=0|BER=0|QF=0|SCS=0|US=0|CS=0|FEBBE=0|FEES=0|FESES=0|FEUAS=0}
.....

which provides info about the Performance Monitoring points but requires quite some parsing to become usable.

If, although, someone wants to get the raw text output, it is still possible by setting the parse argument to False in the corresponding methods:

  • list_pm_point()
  • list_pm_data()
  • list_ne_dir()

depending on what the user wants to acquire

To tackle with this, the Python pyparsing, module was used.

Structured Data

The pyparsing module provides a way to “build” a grammar that matches the output from the Alcatel IOO. Once the text is parsed through the pyparsing module, it becomes structured in a Python list of lists of lists (and probably of dicts) data structure. At this point the data is iterable but yet, it is hard to use it.

The final step is to dictionarize this data structure. Now the data is iterable and the values accessible via dictionary keys (example from eos_pmd – Performance Monitoring (PM) data module):

from iooclient.eos_pmd import *

with eosPmd('1.2.3.4', 20006, 'pass') as pmd:
    pmd.list_pm_points()

will give a list of dicts of lists of dicts...:

[
    {'friendlyName': 'ma1eie',
   'neLocationName': None,
   'notificationType': 'pmList',
   'periodType': '15',
   'pmpoints': [{'periods': [{'LOD': '0 ',
                         'counters': [{'BBE': '0'},
                                      {'BBU': '0'},
                                      {'BEC': '0'},
                                      {'BER': '0'},
                                      {'CS': '0'},
                                      {'ES': '0'},
                                      {'FEBBE': '0'},
                                      {'FEES': '0'},
                                      {'FESES': '0'},
                                      {'FEUAS': '0'},
                                      {'NEUAS': '0'},
                                      {'QF': '0'},
                                      {'SCS': '0'},
                                      {'SES': '0'},
                                      {'SUS': '0'},
                                      {'UAS': '0'},
                                      {'US': '0'}],
   'period': '2012061501'},
    {....},
    {....},...
]

As list of dictionaries the data can be iterated and fed into applications (eg. Django).