Abstract Network Model

class autonetkit.anm.OverlayBase(anm, overlay_id)[source]

Base class for overlays - overlay graphs, subgraphs, projections, etc

data[source]

Returns data stored on this overlay graph

device(key)[source]

To access programatically

edge(edge_to_find, dst_to_find=None)[source]

returns edge in this graph with same src and same edge_id

groupby(attribute, nodes=None)[source]

Returns a dictionary sorted by attribute

>>> G_in.groupby("asn")
{u'1': [r1, r2, r3, sw1], u'2': [r4]}
has_edge(edge)[source]

Tests if edge in graph

node(key)[source]

Returns node based on name This is currently O(N). Could use a lookup table

overlay(key)[source]

Get to other overlay graphs in functions

routers(*args, **kwargs)[source]

Shortcut for nodes(), sets device_type to be router

class autonetkit.anm.OverlayEdge(anm, overlay_id, src_id, dst_id)[source]

API to access link in network

attr_any(*args)[source]

Return edges which either src and dst have attributes set

attr_both(*args)[source]

Return edges which both src and dst have attributes set

attr_equal(*args)[source]

Return edges which both src and dst have attributes equal

bind_interface(node, interface)[source]

Bind this edge to specified index

dst[source]

Destination node of edge

dst_int

Interface bound to destination node of edge

get(key)[source]

For consistency, edge.get(key) is neater than getattr(edge, key)

set(key, val)[source]

For consistency, edge.set(key, value) is neater than setattr(edge, key, value)

src[source]

Source node of edge

src_int

Interface bound to source node of edge

class autonetkit.anm.OverlayGraph(anm, overlay_id)[source]

API to interact with an overlay graph in ANM

add_edges_from(ebunch, bidirectional=False, retain=None, **kwargs)[source]

Add edges. Unlike NetworkX, can only add an edge if both src and dst in graph already. If they are not, then they will not be added (silently ignored)

Bidirectional will add edge in both directions. Useful if going from an undirected graph to a directed, eg G_in to G_bgp

add_nodes_from(nbunch, retain=None, update=False, **kwargs)[source]

Update won’t append data (which could clobber) if node exists

allocate_interfaces()[source]

allocates edges to interfaces

update(nbunch=None, **kwargs)[source]

Sets property defined in kwargs to all nodes in nbunch

update_edges(ebunch=None, **kwargs)[source]

Sets property defined in kwargs to all edges in ebunch

class autonetkit.anm.OverlayGraphData(anm, overlay_id)[source]

API to access link in network