<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thanks Duncan.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
regards</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Anna Patil</div>
<div>
<div id="appendonsend"></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Duncan Grisby <duncan@grisby.org><br>
<b>Sent:</b> Monday, August 17, 2020 8:03 PM<br>
<b>To:</b> Anna Patil <patilanna@hotmail.com>; omniorb-list@omniorb-support.com <omniorb-list@omniorb-support.com><br>
<b>Subject:</b> Re: [omniORB] CosNotification.StructuredEvent printing</font>
<div> </div>
</div>
<div>
<div>You have received a CosNotification::StructuredEvent struct, as defined in idl/COS/CosNotification.idl. It's a pretty complicated data structure, but you don't need to "parse" it -- it is already a collection of Python objects. You just need to access
 the members you want.</div>
<div><br>
</div>
<div>What are you actually trying to do?  Get particular data out of the structure, or dump the whole thing in a human-readable way?</div>
<div><br>
</div>
<div>StructuredEvent is defined as:</div>
<div><br>
</div>
<pre>     struct StructuredEvent {</pre>
<pre>             EventHeader header;</pre>
<pre>             FilterableEventBody filterable_data;</pre>
<pre>             any remainder_of_body;</pre>
<pre>     };</pre>
<pre><br></pre>
<div>So the Python object you have has corresponding members. e.g.</div>
<div><br>
</div>
<pre>s_event         = # the value you received</pre>
<pre>header          = s_event.header</pre>
<pre>filterable_data = s_event.filterable_data</pre>
<pre><br></pre>
<div><br>
</div>
<div>and then for example, filterable_data is defined as:</div>
<div><br>
</div>
<pre>     struct Property {</pre>
<pre>             PropertyName name;</pre>
<pre>             PropertyValue value;</pre>
<pre>     };</pre>
<pre>     typedef sequence<Property> PropertySeq;</pre>
<pre><br></pre>
<pre>     // The following are the same, but serve different purposes.</pre>
<pre>     typedef PropertySeq FilterableEventBody;</pre>
<div><br>
</div>
<div><br>
</div>
<div>So filterable_data is a list of Property structures:</div>
<div><br>
</div>
<div><br>
</div>
<pre>for prop in filterable_data:</pre>
<pre>    name  = prop.name</pre>
<pre><br></pre>
<pre>    # value is an Any, so you can get its contents with value()</pre>
<pre>    value = prop.value.value()</pre>
<pre><br></pre>
<pre>    print(f"Property {name} = {value}")</pre>
<pre><br></pre>
<pre><br></pre>
<div>You can access all the data in that sort of way.  Without more specific details about what you are trying to do, it's not possible to tell you exactly what code you might need.</div>
<div><br>
</div>
<div>Duncan.</div>
<div><br>
</div>
<div><br>
</div>
<div>On Sat, 2020-08-15 at 05:42 +0000, Anna Patil via omniORB-list wrote:</div>
<blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid; padding-left:1ex">
<div>Hi All,</div>
<div><br>
</div>
<div><br>
</div>
<div>I am able to pull pull_structured_event() as below, however support required to parse these events.</div>
<div><br>
</div>
<div><br>
</div>
<div>Received event from nms</div>
<div>---------------------------------------------</div>
<div>CosNotification.StructuredEvent(header=CosNotification.EventHeader(fixed_header=CosNotification.FixedEventHeader(event_type=CosNotification.EventType(domain_name='tmf_mtnm', type_name='NT_ALARM'), event_name=''), variable_header=[]), filterable_data=[CosNotification.Property(name='notificationId',
 value=CORBA.Any(CORBA.TC_string, '2646127')), CosNotification.Property(name='objectName', value=CORBA.Any(CORBA.TypeCode("IDL:mtnm.tmforum.org/globaldefs/NVSList_T:1.0"), [globaldefs.NameAndStringValue_T(name='EMS', value='ECI/LightSoft_1'), globaldefs.NameAndStringValue_T(name='ManagedElement',
 value='ECI/EMS_STMS_40/9130'), globaldefs.NameAndStringValue_T(name='PTP', value='port-ub/0')])), CosNotification.Property(name='nativeEMSName', value=CORBA.Any(CORBA.TC_string, 'ge-ub/0.0')), CosNotification.Property(name='objectType', value=CORBA.Any(CORBA.TypeCode("IDL:mtnm.tmforum.org/notifications/ObjectType_T:1.0"),
 OT_PHYSICAL_TERMINATION_POINT)), CosNotification.Property(name='emsTime', value=CORBA.Any(CORBA.TC_string, '20200814132322.3')), CosNotification.Property(name='neTime', value=CORBA.Any(CORBA.TC_string, '20200814132319.470')), CosNotification.Property(name='isClearable',
 value=CORBA.Any(CORBA.TC_boolean, False)), CosNotification.Property(name='layerRate', value=CORBA.Any(CORBA.TC_short, 87)), CosNotification.Property(name='perceivedSeverity', value=CORBA.Any(CORBA.TypeCode("IDL:mtnm.tmforum.org/notifications/PerceivedSeverity_T:1.0"),
 PS_INDETERMINATE)), CosNotification.Property(name='nativeProbableCause', value=CORBA.Any(CORBA.TC_string, 'OSPF If Config Error')), CosNotification.Property(name='probableCause', value=CORBA.Any(CORBA.TC_string, 'UNIDENTIFIED')), CosNotification.Property(name='probableCauseQualifier',
 value=CORBA.Any(CORBA.TC_string, 'ospfIfConfigError@@ge-ub/0.0@@0')), CosNotification.Property(name='serviceAffecting', value=CORBA.Any(CORBA.TypeCode("IDL:mtnm.tmforum.org/notifications/ServiceAffecting_T:1.0"), SA_NON_SERVICE_AFFECTING)), CosNotification.Property(name='affectedTPList',
 value=CORBA.Any(CORBA.TypeCode("IDL:mtnm.tmforum.org/globaldefs/NamingAttributesList_T:1.0"), [])), CosNotification.Property(name='rcaiIndicator', value=CORBA.Any(CORBA.TC_boolean, False)), CosNotification.Property(name='additionalText', value=CORBA.Any(CORBA.TC_string,
 'ospfIfConfigError: OSPF interface configuration error 7 received from ')), CosNotification.Property(name='additionalInfo', value=CORBA.Any(CORBA.TypeCode("IDL:mtnm.tmforum.org/globaldefs/NVSList_T:1.0"), [globaldefs.NameAndStringValue_T(name='LSNExt_NativeProbableCause',
 value='OSPF If Config Error'), globaldefs.NameAndStringValue_T(name='LSNExt_AckStatus', value='ALM_UNACKNOWLEDGED'), globaldefs.NameAndStringValue_T(name='LSNExt_MEName', value='Shapath_Bareja_8CH'), globaldefs.NameAndStringValue_T(name='LSNExt_GroupName',
 value='Apollo_Gujrat'), globaldefs.NameAndStringValue_T(name='LSNExt_ALCV', value='Unknown'), globaldefs.NameAndStringValue_T(name='LSNExt_AlarmUniqueString', value='EMS DN=ECI/EMS_STMS_40, EMS notifId=9183695, CAM ID=5')]))], remainder_of_body=CORBA.Any(CORBA.TC_null,
 None))</div>
<div><br>
</div>
<div>---------------------------------</div>
<div><br>
</div>
<div><br>
</div>
<div>would like to print like below</div>
<div>========== </div>
<div>Sample taken from <a href="https://docs.oracle.com/cd/E51879_01/doc.724/e59309/tmfin_nms_list_ref.htm#BABHIEAF">https://docs.oracle.com/cd/E51879_01/doc.724/e59309/tmfin_nms_list_ref.htm#BABHIEAF</a></div>
<div><br>
</div>
<div><br>
</div>
<div>this is done in java, how can I parse in Python.</div>
<div><br>
</div>
<div><br>
</div>
<div>  name: notificationId value:29</div>
<div>           name: objectName value:</div>
<div>                           name: EMS value:ECI/LightSoft_1</div>
<div>                           name: ManagedElement value:LSN/EMS_XDM_121/1064</div>
<div>                           name: EquipmentHolder value:/rack=1/shelf=1/slot=1/sub_slot=4</div>
<div>           name: objectType value:OT_EQUIPMENT_HOLDER</div>
<div>           name: emsTime value:20140302141559.0</div>
<div>           name: neTime value:</div>
<div>           name: edgePointRelated value:FALSE</div>
<div>           name: remainder_of_body  value:</div>
<div>                   Name: attributeList value:</div>
<div>                           name: EMS value:ECI/LightSoft_1</div>
<div> </div>
<div>                           name: ManagedElement value:LSN/EMS_XDM_121/1064</div>
<div>                           name: EquipmentHolder value:/rack=1/shelf=1/slot=1/sub_slot=4</div>
<div> </div>
<div>                   name: userLabel value:I1 OTR1 4</div>
<div>                   name: nativeEMSName value:I1 OTR1 4</div>
<div>                   name: owner value:</div>
<div>                   name: alarmReportingIndicator value:TRUE</div>
<div>                   name: holderType value:sub_slot</div>
<div>                   name: expectedOrInstalledEquipment value:</div>
<div>                           name: EMS value:LSN/EMS_XDM_121</div>
<div> </div>
<div>                           name: ManagedElement value:1064</div>
<div>                           name: EquipmentHolder value:/rack=1/shelf=1/slot=1/sub_slot=4</div>
<div> </div>
<div>                           name: Equipment value:1</div>
<div>                   name: EquipmentObjectTypeList value:</div>
<div>                           NONE</div>
<div>                           ETR1</div>
<div>                           OTR1</div>
<div>                   name: holderState value:EXPECTED_AND_NOT_INSTALLED</div>
<div>                   name: additionalInfo value:</div>
<div>                           name: LSNExt_TimestampSignature value:20140302141559.8</div>
<div><br>
</div>
<div><br>
</div>
<div>regards</div>
<div>Anna Patil </div>
<div><br>
</div>
<div><br>
</div>
<div>_______________________________________________</div>
<div>omniORB-list mailing list</div>
<div><a href="mailto:omniORB-list@omniorb-support.com">omniORB-list@omniorb-support.com</a></div>
<div><br>
</div>
<div><a href="https://www.omniorb-support.com/mailman/listinfo/omniorb-list">https://www.omniorb-support.com/mailman/listinfo/omniorb-list</a></div>
<div><br>
</div>
</blockquote>
<div><span>
<pre>-- 
 -- Duncan Grisby         --
  -- duncan@grisby.org     --
   -- http://www.grisby.org --

</pre>
</span></div>
</div>
</div>
</body>
</html>