mobile_insight.analyzer.profile module¶
Profile abstraction
Author: Yuanjie Li
- class mobile_insight.analyzer.profile.Profile(profile_hierarchy)¶
Bases:
object
Profile abstraction
Given the profile hierarchy, this abstraction achieves
Automatically create Tables for profile
Enforce query with hierarchical name (e.g., LTERrcAnalyzer.Reconfig.Drx.long_drx)
Update profile values
- __build_db()¶
Build the internal DBs for the profile
- __create_table(node)¶
Create SQL tables for the node
- Parameters
node (Node) – a node in the profile hierarchy
- __get_root_name()¶
- query(profile_name)¶
Query the profile value with a hierarchical name. Example: self.query(‘cell_id=87’,’LteRrc:87.Reconfig.Drx.Short_drx’)
- Parameters
profile_name – a hierarcical name separated by ‘.’. If id is required, it’s separated by “:”
e.g., “LteRrc:87.Sib.Inter_freq:5780.ThreshXHigh” :type profile_name: string :returns: value list that satisfies the query, or None if no such field (id not exist, incomplete record, etc.)
- update(profile_name, value_dict)¶
Update a profile value
Example 1: self.update(‘LteRrc:87.Reconfig.Drx’,{Drx_short:1,Drx_long:5}) Example 2: self.update(‘LteRrc:87.Sib.Inter_freq:5780’,{ThreshXHigh:1,ThreshXLow:2})
If the id does not exist, create a new item in the root, with specified values and all other fields as “null”
Otherwise, update the specified field values, and keep the ramaining values unchanged.
The update operation is atomic. No partial update would be performed
- Parameters
profile_name (string) – a hierarcical name separated by ‘.’ (e.g., LteRrc.Reconfig.Drx)
value – a field_name->value dictionary of the specified updated values.
All the field names should appear in the profile_name. :type value: string->string dictionary :returns: True if the update succeeds, False otherwise
- class mobile_insight.analyzer.profile.ProfileHierarchy(root)¶
Bases:
object
An abstraction for analyzers to declare the profile it maintains.
Given this hierarchy, the analyzer automatically builds underlying database, and enforces query with hierarchical name (e.g., LTERrcAnalyzer.Reconfig.Drx.long_drx)
Example construction: consider the following RRC profile hierarchy
- LteRrc
Sib - Inter_freq (id_required, e.g., Inter_freq:5780)
ThreshXHigh
ThreshXLow
Reconfig - Drx
Short_drx
Long_drx
The following code constructs such a profile hierachy:
LteRrcProfile = ProfileHierarchy(‘LteRrc’) root = LteRrcProfile.get_root(); sib=root.add(‘Sib’,False);
inter_freq=sib.add(‘Inter_freq’,True) #ID required
- reconfig=root.add(‘Reconfig’,False);
measconfig=reconfig.add(‘MeasConfig’,False) drx=reconfig.add(‘Drx’,False);
drx.add(‘Drx_short’,False); drx.add(‘Drx_long’,False);
- get_node(name)¶
Get the node based on the hierarchical name
- Parameters
name (string) – a hierarchical name separated by ‘.’ (e.g., LteRrc:87.Sib)
- Returns
the Node that corresponds to this name, or None if it does not exist
- get_root()¶
Return the root node