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

Service Methods

Next topic

Website Firewall Methods

This Page