autonetkit.nidb package

Submodules

autonetkit.nidb.base module

class autonetkit.nidb.base.DmBase

Bases: object

add_edge(src, dst, retain=None, **kwargs)
add_edges_from(ebunch, retain=None, **kwargs)

Used to copy edges from ANM -> NIDB Note: won’t support (yet) copying from one NIDB to another #TODO: allow copying from one NIDB to another (check for DmNode as well as NmNode)

To keep congruency, only allow copying edges from ANM can’t add NIDB edges directly (node, node) oor (port, port) workflow: if need this, create a new overlay and copy from there

add_nodes_from(nbunch, retain=None, **kwargs)
copy_graphics(network_model)

Transfers graphics data from anm to nidb

data
edge(edge_to_find, key=0)

returns edge in this graph with same src and dst

edges(nbunch=None, *args, **kwargs)
filter(nbunch=None, *args, **kwargs)

TODO: expand this to allow args also, ie to test if value evaluates to True

interface(interface)
is_multigraph()
l3devices(*args, **kwargs)

Shortcut for nodes(), sets device_type to be server

name
node(key)

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

nodes(*args, **kwargs)
raw_graph()

Returns the underlying NetworkX graph

restore(pickle_file)
restore_latest(directory=None)
routers(*args, **kwargs)

Shortcut for nodes(), sets device_type to be router

save(timestamp=True, use_gzip=True)
servers(*args, **kwargs)

Shortcut for nodes(), sets device_type to be server

switches(*args, **kwargs)

Shortcut for nodes(), sets device_type to be switch

update(nbunch, **kwargs)

autonetkit.nidb.config_stanza module

class autonetkit.nidb.config_stanza.ConfigStanza(*args, **kwargs)

Bases: object

add_stanza(name, **kwargs)

Adds a sub-stanza to this stanza

items()
to_json()

autonetkit.nidb.device_model module

class autonetkit.nidb.device_model.DeviceModel(network_model=None)

Bases: autonetkit.nidb.base.DmBase

boundary_edges(nbunch, nbunch2=None)
boundary_nodes(nbunch, nbunch2=None)
subgraph(nbunch, name=None)
timestamp
topologies()
topology(key)
class autonetkit.nidb.device_model.DmGraphData(nidb)

Bases: object

API to access overlay graph data in network

class autonetkit.nidb.device_model.DmLabTopology(nidb, topology_id)

Bases: object

API to access lab topology in network

dump()
set(key, val)

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

class autonetkit.nidb.device_model.DmSubgraph(graph, name=None)

Bases: autonetkit.nidb.base.DmBase

autonetkit.nidb.edge module

class autonetkit.nidb.edge.DmEdge(nidb, src_id, dst_id, ekey=0)

Bases: object

API to access edge in nidb

dst
dst_int
dump()
get(key)

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

is_multigraph()
raw_interfaces

Direct access to the interfaces dictionary, used by ANK modules

src
src_int

autonetkit.nidb.interface module

class autonetkit.nidb.interface.DmInterface(nidb, node_id, interface_id)

Bases: object

description
dict()

Returns shallow copy of dictionary used. Note not a deep copy: modifying values may have impact

dump()
edges()

Returns all edges from node that have this interface ID This is the convention for binding an edge to an interface

get(key)

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

is_bound

Returns if this interface is bound to an edge on this layer

is_loopback
is_loopback_zero
is_physical
neighbors()

Returns interfaces on nodes that are linked to this interface Can get nodes using [i.node for i in interface.neighbors()]

node

Returns parent node of this interface

set(key, val)

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

class autonetkit.nidb.interface.InterfaceDataDict(data)

Bases: _abcoll.MutableMapping

A dictionary which allows access as dict.key as well as dict[‘key’] Based on http://stackoverflow.com/questions/3387691 only allows read only acess

dump()

autonetkit.nidb.node module

class autonetkit.nidb.node.DmNode(nidb, node_id)

Bases: object

API to access overlay graph node in network

add_interface(description=None, category='physical', *args, **kwargs)

Public function to add interface

add_stanza(name, **kwargs)
degree()
dump()
edges(*args, **kwargs)
get(key)
get_interfaces(*args, **kwargs)

Public function to view interfaces

Temporary function name until Compiler/DeviceModel/Templates move to using “proper” interfaces

id
interface(key)
interfaces

Called by templates, sorts by ID

is_device_type(device_type)

Generic user-defined cross-overlay search for device_type for consistency with ANM

is_l3device()

Layer 3 devices: router, server, cloud, host ie not switch

is_router()
is_server()
is_switch()
label
loopback_interfaces()
loopback_zero
neighbors()
physical_interfaces()
raw_interfaces

Direct access to the interfaces dictionary, used by ANK modules

set(key, val)

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

Module contents