vLAN API Methods

API for vLANs

vlan.add()

Adds a host to the vLAN.

A host can be added to several vLANs. The first one is considered “primary” as is the vLAN that will used for the default route. The primary vLAN can be replaced by using the primary option in this method.

The primary vLAN can’t be changed if the host is providing a service in a load balancer using that same vLAN.

When a host is added to a vLAN, the network infrastructure is changed automatically and as consequence the host may lose connectivity if the required configuration changes are not performed.

If needed, a private IP in the vLAN network will be allocated and assigned to the host to be used by Memset’s automated tools.

In the case of Miniservers, a reboot using server.reboot() is required so any new interface and the vLAN configuration is available to the host.

By default automatic host configuration is supported for all Miniservers using Memset’s automated tools. For unmanaged Miniservers and Fullservers, manual configuration changes may be required.

Parameters:
  • name (String) – Name of the service. Service names are 1-64 characters A-Z, a-z, 0-9, -, . and _. Ensure this value has at most 64 characters.
  • host (String) – Name of the host service Service names are 1-64 characters A-Z, a-z, 0-9, -, . and _. Ensure this value has at most 64 characters.
  • primary (Boolean, Optional) – Replace the primary vLAN on the host. Unless this parameter is set, the default behaviour in Miniservers in case the host is already in a vLAN is to add a new interface to configure the new vLAN.
Returns:

the output of vlan.list() after adding the host.

Raises :

May raise ApiErrorPreconditionFailed if the primary vLAN can’t be changed.

vlan.info()

Describes the vLAN returning a dictionary.

Parameters:name (String) – Name of the service. Service names are 1-64 characters A-Z, a-z, 0-9, -, . and _. Ensure this value has at most 64 characters.
Returns:A dictionary with the following keys:
name
String: The canonical name of the vLAN. This is also the service name.
network
String: The network address assigned to the vLAN in CIDR format, e.g. “10.1.1.0/24”.
hosts
List of Strings: The names of all hosts associated to this vLAN.
network_zone
String: The network zone this vLAN is in, e.g. “reading”.
vlan.list()

Lists information about hosts associated to this vLAN returning a list of dictionaries.

Parameters:name (String) – Name of the service. Service names are 1-64 characters A-Z, a-z, 0-9, -, . and _. Ensure this value has at most 64 characters.
Returns:A list of dictionaries with the following keys:
name
String: The canonical name of the service.
type
String: The type of host, e.g. “fullserver”, “miniserver”, etc.
private_ips
List of Strings: The private IP addresses from the vLAN network that are associated to the host, e.g. “10.1.1.10”. This list is used by Memset’s automated tools and is based on the information stored in our database. It can be empty if there are no associated IPs.
tagged
Boolean: Whether this vLAN is a tagged vLAN or not.
vlan.remove()

Removes a host from the vLAN.

The host will be removed from the vLAN unless one of the following conditions apply:

  • The host is a Fullserver and this is the only vLAN it is in.
  • The server is providing a service in a load balancer in this vLAN.

When a host is added to a vLAN, the network infrastructure is changed automatically and as consequence the host may lose connectivity if the required configuration changes are not performed.

Once the host is removed from the vLAN it is possible that the private address will not be in use any more. That private IP address won’t be removed automatically to avoid possible configuration problems in the host’s services. Please contact support if you want a private IP address to be deallocated.

In the case of Miniservers, a reboot using server.reboot() is required so any new interface and the vLAN configuration is available to the host.

By default automatic host configuration is supported for all Miniservers using Memset’s automated tools. For unmanaged Miniservers and Fullservers, manual configuration changes may be required.

Parameters:
  • name (String) – Name of the service. Service names are 1-64 characters A-Z, a-z, 0-9, -, . and _. Ensure this value has at most 64 characters.
  • host (String) – Name of the host service Service names are 1-64 characters A-Z, a-z, 0-9, -, . and _. Ensure this value has at most 64 characters.
Returns:

the output of vlan.list() after removing the host.

Raises :

May raise ApiErrorPreconditionFailed if the host can’t be removed.

Previous topic

SquirrelSave Methods

Next topic

Errors

This Page