# Copyright (c) 2015 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. lib_LTLIBRARIES += libvnet.la libvnet_la_SOURCES = libvnet_la_DEPENDENCIES = \ libvppinfra.la \ libvlib.la \ libsvmdb.la \ libsvm.la \ libvlibapi.la \ libvlibmemory.la \ libvlibmemoryclient.la libvnet_la_LIBADD = $(libvnet_la_DEPENDENCIES) -lm -lpthread -ldl -lrt $(DPDK_LD_ADD) libvnet_la_LDFLAGS = $(DPDK_LD_FLAGS) if WITH_LIBSSL libvnet_la_LIBADD += -lcrypto endif ######################################## # Generic stuff ######################################## libvnet_la_SOURCES += \ vnet/config.c \ vnet/devices/devices.c \ vnet/handoff.c \ vnet/interface.c \ vnet/interface_api.c \ vnet/interface_cli.c \ vnet/interface_format.c \ vnet/interface_output.c \ vnet/misc.c \ vnet/replication.c \ vnet/rewrite.c nobase_include_HEADERS += \ vnet/api_errno.h \ vnet/buffer.h \ vnet/config.h \ vnet/devices/devices.h \ vnet/global_funcs.h \ vnet/handoff.h \ vnet/interface.h \ vnet/interface.api.h \ vnet/interface_funcs.h \ vnet/l3_types.h \ vnet/pipeline.h \ vnet/replication.h \ vnet/rewrite.h \ vnet/vnet.h \ vnet/vnet_all_api_h.h \ vnet/vnet_msg_enum.h API_FILES += vnet/interface.api ######################################## # Policer infra ######################################## libvnet_la_SOURCES += \ vnet/policer/node_funcs.c \ vnet/policer/policer.c \ vnet/policer/xlate.c nobase_include_HEADERS += \ vnet/policer/police.h \ vnet/policer/policer.h \ vnet/policer/xlate.h ######################################## # Cop - junk filter ######################################## libvnet_la_SOURCES += \ vnet/cop/cop.c \ vnet/cop/node1.c \ vnet/cop/ip4_whitelist.c \ vnet/cop/ip6_whitelist.c nobase_include_HEADERS += \ vnet/cop/cop.h ######################################## # Layer 2 protocols go here ######################################## ######################################## # Layer 2 protocol: Ethernet ######################################## libvnet_la_SOURCES += \ vnet/ethernet/arp.c \ vnet/ethernet/format.c \ vnet/ethernet/init.c \ vnet/ethernet/interface.c \ vnet/ethernet/node.c \ vnet/ethernet/pg.c nobase_include_HEADERS += \ vnet/ethernet/arp_packet.h \ vnet/ethernet/error.def \ vnet/ethernet/ethernet.h \ vnet/ethernet/packet.h \ vnet/ethernet/types.def ######################################## # Layer 2 protocol: Ethernet bridging ######################################## libvnet_la_SOURCES += \ vnet/l2/feat_bitmap.c \ vnet/l2/l2_api.c \ vnet/l2/l2_bd.c \ vnet/l2/l2_bvi.c \ vnet/l2/l2_input_classify.c \ vnet/l2/l2_output_classify.c \ vnet/l2/l2_efp_filter.c \ vnet/l2/l2_fib.c \ vnet/l2/l2_flood.c \ vnet/l2/l2_fwd.c \ vnet/l2/l2_input_acl.c \ vnet/l2/l2_input.c \ vnet/l2/l2_input_vtr.c \ vnet/l2/l2_learn.c \ vnet/l2/l2_output_acl.c \ vnet/l2/l2_output.c \ vnet/l2/l2_patch.c \ vnet/l2/l2_rw.c \ vnet/l2/l2_vtr.c \ vnet/l2/l2_xcrw.c nobase_include_HEADERS += \ vnet/l2/feat_bitmap.h \ vnet/l2/l2_input.h \ vnet/l2/l2_output.h \ vnet/l2/l2_vtr.h \ vnet/l2/l2_input_vtr.h \ vnet/l2/l2_efp_filter.h \ vnet/l2/l2_fwd.h \ vnet/l2/l2_bd.h \ vnet/l2/l2_bvi.h \ vnet/l2/l2_flood.h \ vnet/l2/l2_fib.h \ vnet/l2/l2_rw.h \ vnet/l2/l2_xcrw.h \ vnet/l2/l2_classify.h \ vnet/l2/l2.api.h API_FILES += vnet/l2/l2.api ######################################## # Layer 2 protocol: SRP ######################################## libvnet_la_SOURCES += \ vnet/srp/format.c \ vnet/srp/interface.c \ vnet/srp/node.c \ vnet/srp/pg.c nobase_include_HEADERS += \ vnet/srp/packet.h \ vnet/srp/srp.h ######################################## # Layer 2 protocol: PPP ######################################## libvnet_la_SOURCES += \ vnet/ppp/node.c \ vnet/ppp/pg.c \ vnet/ppp/ppp.c nobase_include_HEADERS += \ vnet/ppp/error.def \ vnet/ppp/ppp.h \ vnet/ppp/packet.h ######################################## # Layer 2 protocol: HDLC ######################################## libvnet_la_SOURCES += \ vnet/hdlc/node.c \ vnet/hdlc/pg.c \ vnet/hdlc/hdlc.c nobase_include_HEADERS += \ vnet/hdlc/error.def \ vnet/hdlc/hdlc.h \ vnet/hdlc/packet.h ######################################## # Layer 2 protocol: LLC ######################################## libvnet_la_SOURCES += \ vnet/llc/llc.c \ vnet/llc/node.c \ vnet/llc/pg.c nobase_include_HEADERS += \ vnet/llc/llc.h ######################################## # Layer 2 protocol: SNAP ######################################## libvnet_la_SOURCES += \ vnet/snap/snap.c \ vnet/snap/node.c \ vnet/snap/pg.c nobase_include_HEADERS += \ vnet/snap/snap.h ######################################## # Layer 2 / vxlan ######################################## libvnet_la_SOURCES += \ vnet/vxlan/vxlan.c \ vnet/vxlan/encap.c \ vnet/vxlan/decap.c \ vnet/vxlan/vxlan_api.c nob
import gc
import pprint
import vpp_papi
from vpp_papi_provider import VppPapiProvider
import objgraph
from pympler import tracker
tr = tracker.SummaryTracker()

"""
  Internal debug module

  The module provides functions for debugging test framework
"""


def on_tear_down_class(cls):
    gc.collect()
    tr.print_diff()
    objects = gc.get_objects()
    counter = 0
    with open(cls.tempdir + '/python_objects.txt', 'w') as f:
        interesting = [
            o for o in objects
            if isinstance(o, (VppPapiProvider, vpp_papi.VPP))]
        del objects
        gc.collect()
        for o in interesting:
            objgraph.show_backrefs([o], max_depth=5,
                                   filename="%s/%s.png" %
                                   (cls.tempdir, counter))
            counter += 1
            refs = gc.get_referrers(o)
            pp = pprint.PrettyPrinter(indent=2)
            f.write("%s\n" % pp.pformat(o))
            for r in refs:
                try:
                    f.write("%s\n" % pp.pformat(r))
                except:
                    f.write("%s\n" % type(r))
re graph arc support ######################################## libvnet_la_SOURCES += \ vnet/feature/feature.c \ vnet/feature/registration.c nobase_include_HEADERS += \ vnet/feature/feature.h ######################################## # Unix kernel related ######################################## # FIXME: vnet/unix/hgshm.c libvnet_la_SOURCES += \ vnet/unix/gdb_funcs.c \ vnet/unix/pcap.c \ vnet/unix/tap_api.c \ vnet/unix/tapcli.c \ vnet/unix/tuntap.c nobase_include_HEADERS += \ vnet/unix/pcap.h \ vnet/unix/tuntap.h \ vnet/unix/tap.api.h \ vnet/unix/tapcli.h API_FILES += vnet/unix/tap.api ######################################## # FIB ######################################## libvnet_la_SOURCES += \ vnet/fib/fib.c \ vnet/fib/fib_test.c \ vnet/fib/ip4_fib.c \ vnet/fib/ip6_fib.c \ vnet/fib/mpls_fib.c \ vnet/fib/fib_table.c \ vnet/fib/fib_walk.c \ vnet/fib/fib_types.c \ vnet/fib/fib_node.c \ vnet/fib/fib_node_list.c \ vnet/fib/fib_entry.c \ vnet/fib/fib_entry_src.c \ vnet/fib/fib_entry_src_rr.c \ vnet/fib/fib_entry_src_interface.c \ vnet/fib/fib_entry_src_default_route.c \ vnet/fib/fib_entry_src_special.c \ vnet/fib/fib_entry_src_api.c \ vnet/fib/fib_entry_src_adj.c \ vnet/fib/fib_entry_src_mpls.c \ vnet/fib/fib_entry_src_lisp.c \ vnet/fib/fib_entry_cover.c \ vnet/fib/fib_entry_delegate.c \ vnet/fib/fib_path_list.c \ vnet/fib/fib_path.c \ vnet/fib/fib_path_ext.c \ vnet/fib/fib_urpf_list.c \ vnet/fib/fib_attached_export.c nobase_include_HEADERS += \ vnet/fib/fib.h \ vnet/fib/fib_api.h \ vnet/fib/ip4_fib.h \ vnet/fib/ip6_fib.h \ vnet/fib/fib_types.h \ vnet/fib/fib_table.h \ vnet/fib/fib_node.h \ vnet/fib/fib_node_list.h \ vnet/fib/fib_entry.h \ vnet/fib/fib_entry_delegate.h ######################################## # ADJ ######################################## libvnet_la_SOURCES += \ vnet/adj/adj_nbr.c \ vnet/adj/adj_rewrite.c \ vnet/adj/adj_glean.c \ vnet/adj/adj_midchain.c \ vnet/adj/adj_l2.c \ vnet/adj/adj.c nobase_include_HEADERS += \ vnet/adj/adj.h \ vnet/adj/adj_types.h \ vnet/adj/adj_rewrite.h \ vnet/adj/adj_glean.h \ vnet/adj/adj_nbr.h ######################################## # Data-Plane Objects ######################################## libvnet_la_SOURCES += \ vnet/dpo/dpo.c \ vnet/dpo/drop_dpo.c \ vnet/dpo/ip_null_dpo.c \ vnet/dpo/punt_dpo.c \ vnet/dpo/receive_dpo.c \ vnet/dpo/load_balance.c \ vnet/dpo/load_balance_map.c \ vnet/dpo/lookup_dpo.c \ vnet/dpo/classify_dpo.c \ vnet/dpo/mpls_label_dpo.c nobase_include_HEADERS += \ vnet/dpo/load_balance.h \ vnet/dpo/drop_dpo.h \ vnet/dpo/lookup_dpo.h \ vnet/dpo/punt_dpo.h \ vnet/dpo/classify_dpo.h \ vnet/dpo/receive_dpo.h \ vnet/dpo/ip_null_dpo.h \ vnet/dpo/dpo.h ######################################## # Plugin client library ######################################## nobase_include_HEADERS += \ vnet/plugin/plugin.h pcap2pg_SOURCES = \ vnet/unix/pcap2pg.c \ vnet/unix/pcap.h pcap2pg_LDFLAGS = -static pcap2pg_LDADD = libvnet.la libvppinfra.la -lpthread libvlibmemory.la -lm -ldl noinst_PROGRAMS += pcap2pg # vi:syntax=automake