Module ip — Inmanta 2017.2.1 documentation

# Module ip

> - License: Apache 2.0
> - Version: 0.8.0
> - Author: Inmanta <code@inmanta.com>
> - This module requires compiler version 2016.5 or higher
> - Upstream project: https://github.com/inmanta/ip.git

## Entities

entity `ip::Alias`

  Parents: `ip::IP`

  attribute bool `dhcp`=False
  attribute ip::ip `netmask`='0.0.0.0'
  attribute number `alias`=0
  relation net::Interface `iface` [1]

    other end: `net::Interface.ip_address [0:*]`

  relation ip::services::Server `server` [0:*]

    other end: `ip::services::Server.ips [0:*]`

  The following implements statements select implementations for this entity:

  > - `std::none`

entity `ip::Gateway`

  Parents: `std::Entity`

  Model a gateway in a network

  attribute number `metric`
  attribute string `ipaddress`
  relation ip::Network `network` [1]

    other end: `ip::Network.gateway [0:*]`

  The following implements statements select implementations for this entity:

  > - `std::none`

entity `ip::Host`

  Parents: `std::Host`

  A host that has an ip attribute for easy ip address access in the configuration model.

  attribute ip::ip `ip`

    The ipaddress of this node

  attribute string `remote_user`='root'

    The remote user for the remote agent to login with

  attribute ip::port `remote_port`=22

    The remote port for this remote agent to use.

  attribute bool `remote_agent`=False

    Start the mgmt agent for this node on the server and use remote io (ssh)

  relation ip::Router `router` [0:1]

    other end: `ip::Router.host [1]`

  relation ip::services::Client `clients` [0:*]

    other end: `ip::services::Client.host [1]`

  relation ip::services::Server `servers` [0:*]

    other end: `ip::services::Server.host [1]`

  The following implements statements select implementations for this entity:

  > - `std::hostDefaults`

entity `ip::IP`

  Parents: `std::Entity`

  Base class for all ip addresses

  attribute ip::ip `v4`='0.0.0.0'

  The following implements statements select implementations for this entity:

  > - `std::none`

entity `ip::Network`

  Parents: `std::Entity`

  A network in this infrastructure.

  attribute bool `dhcp`
  attribute string `netmask`
  attribute string `network`
  attribute string `name`
  relation ip::Gateway `gateway` [0:*]

    other end: `ip::Gateway.network [1]`

  The following implements statements select implementations for this entity:

  > - `std::none`

entity `ip::PortRange`

  Parents: `std::Entity`

  attribute ip::port `high`
  attribute ip::port `low`
  relation ip::Service `service_src` [0:*]

    other end: `ip::Service.src_range [0:*]`

  relation ip::Service `service_dst` [0:*]

    other end: `ip::Service.dst_range [0:*]`

  The following implements statements select implementations for this entity:

  > - `std::none`

entity `ip::Route`

  Parents: `std::Entity`

  Model a route to a network

  attribute string `gateway`
  attribute string `netmask`
  attribute string `network`
  relation net::Interface `iface` [1:*]

    other end: `net::Interface.routes [0:*]`

  The following implements statements select implementations for this entity:

  > - `std::none`

entity `ip::Router`

  Parents: `std::Entity`

  This interface is used to indicate that a host may function as a router

  relation net::Interface `ifaces` [1:*]

    other end: `net::Interface.router [0:1]`

  relation ip::Host `host` [1]

    other end: `ip::Host.router [0:1]`

  The following implements statements select implementations for this entity:

  > - `std::none`

entity `ip::Service`

  Parents: `std::Entity`

  Define a service as a protocol and a source and destination port range

  attribute ip::protocol `proto`
  relation ip::services::BaseServer `listening_servers` [0:*]

    other end: `ip::services::BaseServer.services [0:*]`

  relation ip::PortRange `src_range` [0:*]

    other end: `ip::PortRange.service_src [0:*]`

  relation ip::PortRange `dst_range` [0:*]

    other end: `ip::PortRange.service_dst [0:*]`

  The following implements statements select implementations for this entity:

  > - `std::none`

entity `ip::services::BaseClient`

  Parents: `std::Entity`

  Base client class that connects to a server

  relation ip::services::BaseServer `servers` [0:*]

    other end: `ip::services::BaseServer.clients [0:*]`

entity `ip::services::BaseServer`

  Parents: `std::Entity`

  Base class for servers that accept connections from clients

  relation ip::Service `services` [0:*]

    other end: `ip::Service.listening_servers [0:*]`

  relation ip::services::BaseClient `clients` [0:*]

    other end: `ip::services::BaseClient.servers [0:*]`

entity `ip::services::Client`

  Parents: `ip::services::BaseClient`

  This interface models a client that is linked to a host

  relation ip::Host `host` [1]

    other end: `ip::Host.clients [0:*]`

  The following implements statements select implementations for this entity:

  > - `std::none`

entity `ip::services::Server`

  Parents: `ip::services::BaseServer`

  This interface models a server that accepts connections from a client

  relation ip::Alias `ips` [0:*]

    other end: `ip::Alias.server [0:*]`

  relation ip::Host `host` [1]

    other end: `ip::Host.servers [0:*]`

  The following implements statements select implementations for this entity:

  > - `std::none`

entity `ip::services::VirtualClient`

  Parents: `ip::services::BaseClient`, `ip::services::VirtualSide`

  This interface models a virtual client. It can for example represent all clients that exist on the internet.

  attribute string `name`

  The following implements statements select implementations for this entity:

  > - `std::none`

entity `ip::services::VirtualHost`

  Parents: `ip::services::VirtualScope`

  An address represented by a hostname

  attribute std::hoststring `hostname`

  The following implements statements select implementations for this entity:

  > - `std::none`

entity `ip::services::VirtualIp`

  Parents: `ip::services::VirtualScope`

  Only one ip

  attribute ip::ip `address`

entity `ip::services::VirtualNetwork`

  Parents: `ip::services::VirtualScope`

  Define a virtual network segment

  attribute ip::ip `netmask`
  attribute ip::ip `network`

entity `ip::services::VirtualRange`

  Parents: `ip::services::VirtualScope`

  A range defined by from/to

  attribute ip::ip `to`
  attribute ip::ip `from`

  The following implements statements select implementations for this entity:

  > - `std::none`

entity `ip::services::VirtualScope`

  Parents: `std::Entity`

  This interface represents a scope to determine what a virtual client or server is.

  relation ip::services::VirtualSide `side` [0:*]

    other end: `ip::services::VirtualSide.scope [0:*]`

entity `ip::services::VirtualServer`

  Parents: `ip::services::BaseServer`, `ip::services::VirtualSide`

  Same as VirtualClient but then for a server

  attribute string `name`

entity `ip::services::VirtualSide`

  Parents: `std::Entity`

  A base class for a virtual server or client

  relation ip::services::VirtualScope `scope` [0:*]

    other end: `ip::services::VirtualScope.side [0:*]`

## Implementations

implementation `ip::agentConfig`

## Plugins

`ip.` `cidr_to_network`(cidr: string) → string

  Given cidr return the network address

`ip.` `concat`(host: std::hoststring, domain: std::hoststring) → std::hoststring

  Concat host and domain

`ip.` `connect_to`(scope: ip::services::VirtualScope) → string

`ip.` `hostname`(fqdn: string) → string

  Return the hostname part of the fqdn

`ip.` `ipindex`(addr: ip::cidr, position: number) → string

  Return the address at position in the network.

`ip.` `ipnet`(addr: ip::cidr, what: string) → string

`ip.` `net_to_nm`(network_addr: string) → string

`ip.` `netmask`(cidr: number) → ip::ip

  Given the cidr, return the netmask

`ip.` `network`(ip: ip::ip, cidr: string) → string

  Given the ip and the cidr, return the network address

`ip.` `networkaddress`(ip: ip::Alias) → string

  Return the network address