[omniORB] CosNotification.StructuredEvent printing
Duncan Grisby
duncan at grisby.org
Mon Aug 17 14:33:48 UTC 2020
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.
What are you actually trying to do? Get particular data out of the
structure, or dump the whole thing in a human-readable way?
StructuredEvent is defined as:
struct StructuredEvent { EventHeader header;
FilterableEventBody filterable_data; any
remainder_of_body; };
So the Python object you have has corresponding members. e.g.
s_event = # the value you
receivedheader = s_event.headerfilterable_data =
s_event.filterable_data
and then for example, filterable_data is defined as:
struct Property { PropertyName name;
PropertyValue value; }; typedef sequence<Property> PropertySeq;
// The following are the same, but serve different purposes.
typedef PropertySeq FilterableEventBody;
So filterable_data is a list of Property structures:
for prop in filterable_data: name = prop.name
# value is an Any, so you can get its contents with
value() value = prop.value.value()
print(f"Property {name} = {value}")
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.
Duncan.
On Sat, 2020-08-15 at 05:42 +0000, Anna Patil via omniORB-list wrote:
> Hi All,
>
>
> I am able to pull pull_structured_event() as below, however support
> required to parse these events.
>
>
> Received event from nms
> ---------------------------------------------
> CosNotification.StructuredEvent(header=CosNotification.EventHeader(fi
> xed_header=CosNotification.FixedEventHeader(event_type=CosNotificatio
> n.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/NVSLi
> st_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/Ob
> jectType_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/Pe
> rceivedSeverity_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/Se
> rviceAffecting_T:1.0"), SA_NON_SERVICE_AFFECTING)),
> CosNotification.Property(name='affectedTPList',
> value=CORBA.Any(CORBA.TypeCode("IDL:mtnm.tmforum.org/globaldefs/Namin
> gAttributesList_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/NVSLi
> st_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))
>
> ---------------------------------
>
>
> would like to print like below
> ==========
> Sample taken from
> https://docs.oracle.com/cd/E51879_01/doc.724/e59309/tmfin_nms_list_ref.htm#BABHIEAF
>
>
> this is done in java, how can I parse in Python.
>
>
> name: notificationId value:29
> name: objectName value:
> name: EMS value:ECI/LightSoft_1
> name: ManagedElement
> value:LSN/EMS_XDM_121/1064
> name: EquipmentHolder
> value:/rack=1/shelf=1/slot=1/sub_slot=4
> name: objectType value:OT_EQUIPMENT_HOLDER
> name: emsTime value:20140302141559.0
> name: neTime value:
> name: edgePointRelated value:FALSE
> name: remainder_of_body value:
> Name: attributeList value:
> name: EMS value:ECI/LightSoft_1
>
> name: ManagedElement
> value:LSN/EMS_XDM_121/1064
> name: EquipmentHolder
> value:/rack=1/shelf=1/slot=1/sub_slot=4
>
> name: userLabel value:I1 OTR1 4
> name: nativeEMSName value:I1 OTR1 4
> name: owner value:
> name: alarmReportingIndicator value:TRUE
> name: holderType value:sub_slot
> name: expectedOrInstalledEquipment value:
> name: EMS value:LSN/EMS_XDM_121
>
> name: ManagedElement value:1064
> name: EquipmentHolder
> value:/rack=1/shelf=1/slot=1/sub_slot=4
>
> name: Equipment value:1
> name: EquipmentObjectTypeList value:
> NONE
> ETR1
> OTR1
> name: holderState value:EXPECTED_AND_NOT_INSTALLED
> name: additionalInfo value:
> name: LSNExt_TimestampSignature
> value:20140302141559.8
>
>
> regards
> Anna Patil
>
>
> _______________________________________________
> omniORB-list mailing list
> omniORB-list at omniorb-support.com
>
> https://www.omniorb-support.com/mailman/listinfo/omniorb-list
>
--
-- Duncan Grisby --
-- duncan at grisby.org --
-- http://www.grisby.org --
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.omniorb-support.com/pipermail/omniorb-list/attachments/20200817/99957954/attachment.html>
More information about the omniORB-list
mailing list