1 /*! \file instru_packet_trace_example.py
6 """instru_packet_trace_example.py: OpEN API Instrumentation Packet Trace example"""
30 import OpEN_py
as OpEN
31 from OpENUtil
import *
35 class PacketTraceExample:
36 def __init__(self, client):
37 self.m_client = client
39 def packetTraceExampleUsage(self):
41 packetData_p = OpEN.new_OPEN_PT_PACKET_tp()
42 traceProfile_p = OpEN.new_OPEN_PT_TRACE_PROFILE_tp()
43 time_p = OpEN.new_time_tp()
47 result = OpEN.openapiPtTraceProfileGet(self.m_client, asic, port, packetData_p, traceProfile_p, time_p)
48 if result == OpEN.OPEN_E_NONE:
49 print "Success to get trace profile."
51 print "Bad return code trying to get trace profile. result = %d" % (result)
53 OpEN.delete_OPEN_PT_PACKET_tp(packetData_p)
54 OpEN.delete_OPEN_PT_TRACE_PROFILE_tp(traceProfile_p)
55 OpEN.delete_time_tp(time_p)
59 """Demonstrate OpEN usage for Packet Trace APIs"""
62 ret = open.connect(
"instru_packet_trace_example")
63 if ret == OpEN.OPEN_E_NONE :
64 open.getNetworkOSVersion()
66 client = open.get_client()
67 packetTraceExample = PacketTraceExample(client)
68 packetTraceExample.packetTraceExampleUsage()
71 print "Unable to connect"
73 if __name__ ==
'__main__': main()