if  transport == 'TLS':
    session_config = SessionConfig(SessionConfig.SessionTransportMode.TLS)
    session_config.ca_certs = cert
    ne.connect(user, pswd, session_config)
elif transport == 'TIPC':
    session_config = SessionConfig(SessionConfig.SessionTransportMode.TIPC)
    ne.connect(user, pswd, session_config)
else:
    print "Please set-up a valid transport type: TIPC or TLS"
    exit(0)


RX_BYTES = InterfaceStatistics.InterfaceStatisticsParameter.ONEP_IF_STAT_RX_BYTES
FILTER =  InterfaceFilter(None, NetworkInterface.InterfaceTypes.ONEP_IF_TYPE_ETHERNET)

print "Getting Interface Statistics on", switchIP

intf_list_ne = ne.get_interface_list(FILTER)

for intf in intf_list_ne:
    try:
        int = ne.get_interface_by_name(intf.name)
        int_stats =  int.get_statistics()
        r_bytes=int_stats.get_param(RX_BYTES)
        if r_bytes > 0:
            print "Interface",intf.name,"RX_BYTES",r_bytes
    except:
        continue

ne.disconnect();
if transport == 'TLS':
    session_config = SessionConfig(SessionConfig.SessionTransportMode.TLS)
    session_config.ca_certs = cert
    ne.connect(user, pswd, session_config)
elif transport == 'TIPC':
    session_config = SessionConfig(SessionConfig.SessionTransportMode.TIPC)
    ne.connect(user, pswd, session_config)
else:
    print "Please set-up a valid transport type: TIPC or TLS"
    exit(0)

RX_BYTES = InterfaceStatistics.InterfaceStatisticsParameter.ONEP_IF_STAT_RX_BYTES
FILTER = InterfaceFilter(None,
                         NetworkInterface.InterfaceTypes.ONEP_IF_TYPE_ETHERNET)

print "Getting Interface Statistics on", switchIP

intf_list_ne = ne.get_interface_list(FILTER)

for intf in intf_list_ne:
    try:
        int = ne.get_interface_by_name(intf.name)
        int_stats = int.get_statistics()
        r_bytes = int_stats.get_param(RX_BYTES)
        if r_bytes > 0:
            print "Interface", intf.name, "RX_BYTES", r_bytes
    except:
        continue

ne.disconnect()
Пример #3
0
    session_config = SessionConfig(SessionConfig.SessionTransportMode.TLS)
    session_config.ca_certs = cert
    ne.connect(user, pswd, session_config)
elif transport == 'TIPC':
    session_config = SessionConfig(SessionConfig.SessionTransportMode.TIPC)
    ne.connect(user, pswd, session_config)
else:
    print "Please set-up a valid transport type: TIPC or TLS"
    exit(0)
#
#
# Get Interface list
#
rx_CRC = InterfaceStatistics.InterfaceStatisticsParameter.ONEP_IF_STAT_RX_PKTS_CRC
filter =  InterfaceFilter(None, NetworkInterface.InterfaceTypes.ONEP_IF_TYPE_ETHERNET)
intf_list_ne = ne.get_interface_list(filter)
#
# For every Interface, check the CRC errors
#
for intf_ne in intf_list_ne:
    try:
        int = ne.get_interface_by_name(intf_ne.name)
        int_stats =  int.get_statistics()
        rx_CRC_pkts=int_stats.get_param(rx_CRC)
        print "CRC_pkts: ", rx_CRC_pkts,"on int", intf_ne.name
        #
        # If CRC error are greater than the threshold, generate a syslog message,
        # print the values and shut down the interface
        #
        if rx_CRC_pkts > crcThreshold:
            string_print = "CRC threshold of ",crcThreshold," exceeded. Shutting down interface ",intf_ne.name
Пример #4
0
    session_config.ca_certs = cert
    ne.connect(user, pswd, session_config)
elif transport == 'TIPC':
    session_config = SessionConfig(SessionConfig.SessionTransportMode.TIPC)
    ne.connect(user, pswd, session_config)
else:
    print "Please set-up a valid transport type: TIPC or TLS"
    exit(0)
#
#
# Get Interface list
#
rx_CRC = InterfaceStatistics.InterfaceStatisticsParameter.ONEP_IF_STAT_RX_PKTS_CRC
filter = InterfaceFilter(None,
                         NetworkInterface.InterfaceTypes.ONEP_IF_TYPE_ETHERNET)
intf_list_ne = ne.get_interface_list(filter)
#
# For every Interface, check the CRC errors
#
for intf_ne in intf_list_ne:
    try:
        int = ne.get_interface_by_name(intf_ne.name)
        int_stats = int.get_statistics()
        rx_CRC_pkts = int_stats.get_param(rx_CRC)
        print "CRC_pkts: ", rx_CRC_pkts, "on int", intf_ne.name
        #
        # If CRC error are greater than the threshold, generate a syslog message,
        # print the values and shut down the interface
        #
        if rx_CRC_pkts > crcThreshold:
            string_print = "CRC threshold of ", crcThreshold, " exceeded. Shutting down interface ", intf_ne.name