insalata.model package

Submodules

insalata.model.DhcpService module

class insalata.model.DhcpService.DhcpService(collectorName=None, timeout=None, address=None)

Bases: insalata.model.Service.Service

This class represents a DHCP-Service in the data model.

getAnnouncedGateway()
getDhcpRangeEnd()

Get the last index for the DHCP range.

Returns:The index of the last address to use for DHCP.
Return type:int
getDhcpRangeStart()

Get the start index for the DHCP range.

Returns:The index of the first address to use for DHCP.
Return type:int
getEnd()
getLease()
getStart()
setAnnouncedGateway(gateway, collectorName=None, timeout=None)
setLease(newLease, collectorName=None, timeout=None)
setStartEnd(start, end, collectorName=None, timeout=None)
toXML(root)

insalata.model.Disk module

class insalata.model.Disk.Disk(name, size=None, collectorName=None, timeout=None)

Bases: insalata.model.Node.Node

getGlobalID()
getHost()
getID()
getSize()
setSize(size, collectorName=None, timeout=None)
toXML(root)

insalata.model.DnsService module

class insalata.model.DnsService.DnsService(collectorName=None, timeout=None, address=None)

Bases: insalata.model.Service.Service

getDomain()
setDomain(newDomain, collectorName=None, timeout=None)
toXML(root)

insalata.model.Edge module

class insalata.model.Edge.Edge(first, second, collectorName=None, timeout=None, association=None, changed=None, name=None)

Bases: object

callOnChange(first, second, mode, association=None, changed=None)

Call the correct OnChangeEvent of the node(s).

Parameters:
delete(association=None, changed=None)

Delete this edge and remove its entry in all incident nodes.

Parameters:
  • association (str) – Name of the association this edge is representing. Used by setters for onChange
  • changed (insalata.model.Node.Node) – Changed element (Used for OnChange)
getName()
getNodes()

Return the two node objects of this edge.

Returns:
Tuple with both nodes that are connected by this edge.
getOther(node)

Return the node that is incident to this edge which is not equal to the given node object.

Keyword arguments:
node – One of the nodes that are incident to this edge. The other one will be returned.
Returns:
Node object – Node that is incident to this edge and is not equal to the given one
Method will return None if node does not match one of the incident nodes.
getScanners()

Get all timers of this node.

getTimers()

Return all verification Timers of this edge.

removeVerification(collectorName)

Remove a scanner from the list of scanners that verify this object. If no scanner verifies this edge, it will be deleted.

Keyword arguments:
collectorName – Scanner to remove.
verify(collectorName, timeout)

Verify this edge and start the timer.

Keyword arguments:
collectorName – Name of the scanner that verifies this edge. timeout – Timeout in seconds. After this timeout the scanner will be deleted from the list of verifying scanners.

insalata.model.Event module

class insalata.model.Event.Event

Bases: object

Implement Events in Python.

Class allows to add a handler to the event. If the event is triggered, all handlers will be informed.

add(fun)

Add a handler to this event.

Parameters:fun (function reference) – Function that should be called, if the event is triggered
remove(fun)

Remove a function from this event.

Parameters:fun (function reference) – Function to remove
trigger(sender, args)

Trigger the event and inform all handlers.

Parameters:
  • sender (object reference) – The trigger of the event
  • args (dict) – Arguements of the triggered event

insalata.model.FirewallRaw module

class insalata.model.FirewallRaw.FirewallRaw(firewall, data=None, collectorName=None, timeout=None)

Bases: insalata.model.Node.Node

getData()
getFirewall()
getGlobalID()
getHost()
getID()
setData(data, collectorModule, timeout)
toXML(root)

insalata.model.FirewallRule module

class insalata.model.FirewallRule.FirewallRule(chain, action, protocol, srcnet=None, destnet=None, srcports=None, destports=None, inInterface=None, outInterface=None, collectorName=None, timeout=None)

Bases: insalata.model.Node.Node

getAction()
getChain()
getDestNet()
getDestPorts()
getGlobalID()
getID()
getInInterface()
getOutInterface()
getProtocol()
getSrcNet()
getSrcPorts()
setInInterface(newInterface, collectorName=None, timeout=None)

Set the inInterface of this firewall rule.

Parameters:
  • newInterface – New Interface
  • collectorName (str) – Name of the collector module setting the interface
  • timeout (int) – Timeout the collector uses
setOutInterface(newInterface, collectorName=None, timeout=None)

Set the outInterface of this firewall rule.

Parameters:
  • newInterface – New Interface
  • collectorName (str) – Name of the collector module setting the interface
  • timeout (int) – Timeout the collector uses
toXML(root)

insalata.model.Graph module

class insalata.model.Graph.Graph(id, allL2Networks=set(), allL3Networks=set(), locations=set(), allHosts=set())

Bases: insalata.model.Node.Node

copy(configuration=None)

Copy the graph containing all hosts and networks that are in a given configuration. If configuration is None a full copy will be returned.

Parameters:configuration (str) – All hosts and networks must be contained in this configuration
freeze()

Freeze the graph => Pause every Timer of every Node

getEdge(first, second)

Get the Edge object between two objects.

Arguments:
first – First hosts that is incident to the edge. second – Second host that is incident to the edge.
Return:
Edge if existing or None
getGlobalID()
getHosts()
getID()
getL2Networks()
getL3Networks()
getLocations()
getObjectChangedEvent()

Return the objectChangedEvent of the graph.

The objectChangedEvent is triggered everytime a object in the graph changes.

getObjectDeletedEvent()

Return the objectDeletedEvent of this node.

The objectDeletedEvent is triggered everytime a object in the graph is deleted.

getObjectNewEvent()

Return the objectNewEvent of this node.

The objectNewEvent is triggered everytime a object is added to the graph.

getOrCreateDhcpService(collectorName, timeout, address)

Get the DhcpService on the given address or create a new one if necessary.

Parameters:
  • collectorName (str) – Name of the collector requesting this service
  • timeout (int) – Timeout of the collector
  • address – Address this service is deployed on
getOrCreateDisk(name, collectorName, timeout, host, size=None)

Get the host disk with the given name if existing or create a new one.

Parameters:
  • name (str) – Name of the disk on the host
  • collectorName (str) – Name of the collector requesting this address
  • timeout (int) – Timeout of the collector
  • host (insalata.model.Host.Host) – Host that contains the disk
  • size (int) – Size of the disk
getOrCreateDnsService(collectorName, timeout, address)

Get the DnsService on the given address or create a new one if necessary.

Parameters:
  • collectorName (str) – Name of the collector requesting this service
  • timeout (int) – Timeout of the collector
  • address – Address this service is deployed on
getOrCreateFirewallRaw(collectorName, timeout, host, firewall, data=None)

Get the rule with the given parametes on the host if existing or create a new one.

Parameters:
  • collectorName (str) – Name of the collector requesting this address
  • timeout (int) – Timeout of the collector
  • host (insalata.model.Host.Host) – Host that shall contain the rule
  • chain (str) – The name of the chain this rule belongs to.
  • firewall (str) – The productname of the firewall, e.g. “iptables”
  • data (str) – Raw firewall data of the given firewall type
getOrCreateFirewallRule(collectorName, timeout, host, chain, action, protocol, srcnet=None, destnet=None, srcports=None, destports=None, inInterface=None, outInterface=None)

Get the rule with the given parametes on the host if existing or create a new one.

Parameters:
  • collectorName (str) – Name of the collector requesting this address
  • timeout (int) – Timeout of the collector
  • host (insalata.model.Host.Host) – Host that shall contain the rule
  • chain (str) – The name of the chain this rule belongs to.
  • action (str) – The action (ACCEPT or DROP) for this rule.
  • protocol (str) – Protocol for this rule
  • srcnet (str) – Source network of this rule
  • destnet (str) – Source network of this rule
  • srcports (list) – Source ports this rule uses
  • destports (list) – Destination ports this rule uses
  • inInterface (insalata.model.Interface.Interface) – Interface the packet came from
  • outInterface (insalata.model.Interface.Interface) – Interface the packet leafes from
getOrCreateHost(id, collectorName, timeout, location=None, template=None)

Get the host with the given id or create a new one.

Parameters:
  • id (str) – Identifier of the host
  • collectorName (str) – Name of the collector requesting this host
  • timeout (int) – Timeout of the collector
  • location (insalata.model.Location.Location) – Location containing this host
  • template (str) – Template the host is build on
getOrCreateInterface(mac, collectorName, timeout, network=None)

Get the interface with the given MAC address or create a new one if it is not existing

Parameters:
  • mac (str) – MAC address of the interface
  • collectorName (str) – Name of the collector requesting this interface
  • timeout (int) – Timeout of the collector
  • network (insalata.model.Layer2Network.Layer2Network) – Network this interface is conntected to
getOrCreateLayer2Network(id, collectorName, timeout, location=None)

Get the Layer2Network with the given id or create a new one.

Parameters:
  • id (str) – Identifier of the network
  • collectorName (str) – Name of the collector requesting this network
  • timeout (int) – Timeout of the collector
  • location (insalata.model.Location.Location) – The locatin containing this network
getOrCreateLayer3Address(address, collectorName, timeout, netmask=None, gateway=None)

Get the Layer3Address with the given address or create it if it does not exist.

Parameters:
  • address (str) – Address of this Layer3Address
  • collectorName (str) – Name of the collector requesting this address
  • timeout (int) – Timeout of the collector
  • netmask (str) – Netmask of this address
  • gateway (str) – Gateway of this addess
getOrCreateLayer3Network(id, collectorName, timeout, address, netmask)

Get the Layer3Network with the given identifier or create a new one if it is not existing.

Parameters:
  • id (str) – Identifier of the network
  • collectorName (str) – Name of the collector requesting this network
  • timeout (int) – Timeout of the collector
  • address (str) – Address of this network
  • netmask (str) – Netmask of the network
getOrCreateLocation(id, collectorName, timeout)

Get the location with the given name if existing or create a new one.

Parameters:
  • id (str) – Name of the location
  • collectorName (str) – Name of the collector requesting this address
  • timeout (int) – Timeout of the collector
getOrCreateRoute(collectorName, timeout, host, dest, genmask, gateway, interface=None)

Get the route with the given parametes on the host if existing or create a new one.

Parameters:
  • collectorName (str) – Name of the collector requesting this address
  • timeout (int) – Timeout of the collector
  • host (insalata.model.Host.Host) – Host that shall contain the route
  • dest (str) – Destination address of this route
  • genmask (str) – Genmask used by this route
  • gateway (str) – Gateway used by this route
  • interface (insalata.model.Interface.Interface) – Interface this route uses for forwarding
getOrCreateService(port, protocol, collectorName, timeout, type, address)

Get the Service with the given port on the given address or create it if it does not exist.

Parameters:
  • port (int) – Port of this service
  • protocol (str) – Protocol this service is using
  • collectorName (str) – Name of the collector requesting this service
  • timeout (int) – Timeout of the collector
  • type – Type/Name of the service
  • address – Address this service is deployed on
melt()

Unfreeze the graph => Resume every timer of the nodes

objectChanged(sender, args)
objectDeleted(sender, args)

insalata.model.Host module

class insalata.model.Host.Host(id, location=None, template=None, collectorName=None, timeout=None)

Bases: insalata.model.Node.Node

addDisk(disk, collectorName=None, timeout=None)

Add a disk to this host.

Parameters:
  • disk (insalata.model.Disk.Disk) – Rule to add
  • collectorName (str) – Name of the collector module setting the disk
  • timeout (int) – Timeout the collector uses
addFirewallRule(newRule, collectorName=None, timeout=None)

Add a firewall rule to this host.

Parameters:
addInterface(newInterface, collectorName=None, timeout=None)

Add an interface to this host.

Parameters:
  • newInterface (insalata.model.Interface.Interface) – Interface to add
  • collectorName (str) – Name of the collector module setting the interface
  • timeout (int) – Timeout the collector uses
addRoute(newRoute, collectorName=None, timeout=None)

Add a route to this host.

Parameters:
  • newRoute (insalata.model.Route.Route) – Route to add
  • collectorName (str) – Name of the collector module setting the route
  • timeout (int) – Timeout the collector uses
getCPUs()
getConfigNames()
getDefaultDiskName()
getDisks()
getFirewallRaw()
getFirewallRules()
getGlobalID()
getID()
getInterfaces()
getLocation()
getMemory()
getNameApplied()
getPowerState()
getRoutes()
getTemplate()
setCPUs(newCPUs, collectorName=None, timeout=None)

Set the number of cpus of this host.

Parameters:
  • newCPUs (int) – New cpus value
  • collectorName (str) – Name of the collector module setting the CPU count
  • timeout (int) – Timeout the collector uses
setConfigNames(configs, collectorName=None, timeout=None)

Set the configurations

Parameters:
  • configs (list<str>) – Configurations this host is contained in
  • collectorName (str) – Name of the collector module adding the configuration
  • timeout (int) – Timeout the collector uses
setFirewallRaw(raw, collectorName=None, timeout=None)

Set the raw firewall dump for this host.

Parameters:
  • raw (insalata.model.FirewallRaw.FirewallRaw) – Raw firewall data to set
  • collectorName (str) – Name of the collector module setting the raw data
  • timeout (int) – Timeout the collector uses
setLocation(newLocation, collectorName=None, timeout=None)

Set the location this host is build on.

Parameters:
  • location (insalata.model.Location.Location) – New location a collector found
  • collectorName (str) – Name of the collector module setting the location
  • timeout (int) – Timeout the collector uses
setMemory(newMin, newMax, collectorName=None, timeout=None)

Set the memory of this host.

Parameters:
  • newMin – Minimal memory value
  • newMax (int) – Maximal memory value
  • collectorName (str) – Name of the collector module setting the memory
  • timeout (int) – Timeout the collector uses
setNameApplied(value)
setPowerState(powerState, collectorName=None, timeout=None)

Change the power state of this host.

Parameters:
  • powerState (str) – New power state
  • collectorName (str) – Name of the collector module adding the configuration
  • timeout (int) – Timeout the collector uses
setTemplate(newTemplate, collectorName=None, timeout=None)

Set the template this host is build on.

Parameters:
  • newTemplate (insalata.model.Template.Template) – New template a collector found
  • collectorName (str) – Name of the collector module setting the template
  • timeout (int) – Timeout the collector uses
toXML(root)

insalata.model.Interface module

class insalata.model.Interface.Interface(mac, network=None, collectorName=None, timeout=None)

Bases: insalata.model.Node.Node

addAddress(address, collectorName=None, timeout=None)

Add a Layer3Address object to this interface.

Parameters:
  • address – The layer 3 address object which shall be connected to the interface
  • type – insalata.model.Layer3Address.Layer3Address
  • collectorName (str) – Name of the collector module setting the address
  • timeout (int) – Timeout the collector uses
getAddresses()
getGlobalID()
getHost()
getID()
getMAC()
getMtu()
getNetwork()
getRate()
isDhcp()
setHost(newHost, collectorName=None, timeout=None)

Set the host containing this interface.

Parameters:
  • newHost (insalata.model.Host.Host) – Host containing the interface
  • collectorName (str) – Name of the collector module setting the host
  • timeout (int) – Timeout the collector uses
setMtu(mtu, collectorName=None, timeout=None)

Set the MTU of this interface.

Parameters:
  • mtu (int) – The MTU used by this interface
  • collectorName (str) – Name of the collector module setting the MTU
  • timeout (int) – Timeout the collector uses
setNetwork(newNetwork, collectorName=None, timeout=None)

Set the network of this interface.

Parameters:
setRate(newRate, collectorName=None, timeout=None)
toXML(root)

insalata.model.Layer2Network module

class insalata.model.Layer2Network.Layer2Network(id, location=None, collectorName=None, timeout=None)

Bases: insalata.model.Node.Node

getConfigNames()
getGlobalID()
getID()
getLocation()
setConfigNames(configs, collectorName=None, timeout=None)

Set the configurations

Parameters:
  • configs (list<str>) – Configurations this network is contained in
  • collectorName (str) – Name of the collector module adding the configuration
  • timeout (int) – Timeout the collector uses
setLocation(newLocation, collectorName=None, timeout=None)

Set the location containing the layer 2 network.

Parameters:
  • newLocation (insalata.model.Location.Location) – The location object containing the network
  • collectorName (str) – Name of the collector module setting the location
  • timeout (int) – Timeout the collector uses
toXML(root)

insalata.model.Layer3Address module

class insalata.model.Layer3Address.Layer3Address(address, netmask=None, gateway=None, collectorName=None, timeout=None)

Bases: insalata.model.Node.Node

addService(service, collectorName=None, timeout=None)

Add a service to this layer 3 address.

Parameters:
  • service (insalata.model.Layer3Address.Layer3Address) – Service to add to this address
  • collectorName (str) – Name of the collector module adding this value
  • timeout (int) – Timeout the collecor module uses
getGateway()
getGlobalID()
getID()
getInterface()
getNetmask()
getNetwork()
getPrefix()
getServices()
getStatic()
setGateway(value, collectorName=None, timeout=None)

Set the gateway of this address.

Parameters:
  • value (str) – New gateway
  • collectorName (str) – Name of the collector module setting this value
  • timeout (int) – Timeout the collecor module uses
setNetmask(value, collectorName=None, timeout=None)

Set the netmask of this address.

Parameters:
  • value (str) – New netmask
  • collectorName (str) – Name of the collector module setting this value
  • timeout (int) – Timeout the collecor module uses
setNetwork(newNetwork, collectorName=None, timeout=None)

Set the new Layer3Network of this address. If other networks are connected, the edges will be deleted. If the set network is already the defined one, the edge will be verified by the scanner.

Parameters:
  • newNetwork – New network of this address
  • collectorName (str) – Name of the scanner that sets the network
  • timeout (int) – Timeout the scanner uses
setStatic(value, collectorName=None, timeout=None)

Define if this address is configured statically on the host.

Parameters:
  • value (bool) – Boolean if the address is configured statically
  • collectorName (str) – Name of the collector module setting this value
  • timeout (int) – Timeout the collecor module uses
toXML(root)

insalata.model.Layer3Network module

class insalata.model.Layer3Network.Layer3Network(id, address, netmask, collectorName=None, timeout=None)

Bases: insalata.model.Node.Node

delConfigurations(collectorName=None, timeout=None)
getAddress()
getGlobalID()
getID()
getNetmask()
getPrefix()
setAddress(address, collectorName=None, timeout=None)
setNetmask(value, collectorName=None, timeout=None)

Change the netmask of this network.

Parameters:
  • value (str) – New netmask
  • collectorName (str) – Name of the collector module setting this value
  • timeout (int) – Timeout the collecor module uses
toXML(root)

insalata.model.Location module

class insalata.model.Location.Location(id, collectorName=None, timeout=None)

Bases: insalata.model.Node.Node

addTemplate(template)

Add a template to this location.

Parameters:template (insalata.model.Template.Template) – Template to add
delete()

Delete this node. This method overrides ‘delete’ from the Node classas we want to delete all templates when deleting the Location.

getDefaultTemplate()

The default template of this Location (defined in the settings) :param getDefaultTemplate: The default template of this location

getGlobalID()
getID()
getTemplates()
getType()
toXML(root)

insalata.model.Node module

class insalata.model.Node.Node(collectorName=None, timeout=None)

Bases: object

addEdge(edge)

Add an edge to the set of edges of this node object.

Parameters:edge (insalata.model.Edge.Edge) – Edge which should be added to the set of edges
bfs(action)
delete()

Delete this node and all edges pointing to it.

Triggers the onDeleteEvent.

static doBFS(action, start)
getAllNeighbors(type=None)

Get all neighbors of this node of a special type.

Keyword arguments:
type – Type of the returned objects. If None all neighbors will be returned.
Returns:
set of all neighbors of the type.
getBfsID()
getDeprecated()
getEdges()

Return the set of all edges of this node object.

Returns:
set of all edges.
getOnChangeEvent()

Return the onChangeEvent of this node.

The onChangeEvent is triggered everytime a value is changed.

getOnDeleteEvent()

Return the onDeleteEvent of this node.

The objectDeletedEvent is triggered when the object is deleted.

getScanners()

Get all timers of this node.

getTimers()

Return all verification Timers of this node.

removeEdge(edge)

Remove an edge from the list of edges of this node object.

param edge:Edge which should be removed from the set of edges
type edge:insalata.model.Edge.Edge
removeVerification(collectorName)

Remove a scanner from the list of scanners that verify this object. If no scanner verifies this node, he will be deleted.

Parameters:collecorName – Scanner to remove
removeVerificationTimeout(collectorName)
toGraphViz()
verify(collectorName, timeout)

Verify this node and start the timer.

Parameters:
  • collectorName (str) – Name of the scanner that verifies this node
  • timeout (int) – Timeout in seconds. After this timeout the scanner will be deleted from the list of verifying scanners

insalata.model.PartOfEdge module

class insalata.model.PartOfEdge.PartOfEdge(start, end, collectorName=None, timeout=None, association=None, changed=None)

Bases: insalata.model.Edge.Edge

insalata.model.Route module

class insalata.model.Route.Route(dest, gen, gateway, interface=None, collectorName=None, timeout=None)

Bases: insalata.model.Node.Node

getDestination()
getGateway()
getGenmask()
getGlobalID()
getID()
getInterface()
getPrefix()
setInterface(newInterface, collectorName=None, timeout=None)
toXML(root)

insalata.model.Service module

class insalata.model.Service.Service(port, protocol, type, collectorName=None, timeout=None, address=None)

Bases: insalata.model.Node.Node

getAddress()
getGlobalID()
getHost()
getID()
getInterface()
getIp()
getPort()
getProduct()
getProtocol()
getType()
getVersion()
setAddress(address, collectorName, timeout)
setProduct(product)
setType(value, collectorName=None, timeout=None)

Set the service type.

Parameters:
  • value (str) – Type for the service
  • collectorName (str) – Name of the collector module setting this value
  • timeout (int) – Timeout the collecor module uses
setVersion(version, collectorName=None, timeout=None)

Set the service version.

Parameters:
  • version (str) – Version for the service
  • collectorName (str) – Name of the collector module setting this value
  • timeout (int) – Timeout the collecor module uses
toXML(root)

insalata.model.Template module

class insalata.model.Template.Template(id, metadata)

Bases: insalata.model.Node.Node

getGlobalID()
getID()
getLocation()
getMetadata()

Module contents