SoftLayer.network¶
Network Manager/helpers
license: | MIT, see LICENSE for more details. |
---|
-
class
SoftLayer.managers.network.
NetworkManager
(client)[source]¶ Manage SoftLayer network objects: VLANs, subnets, IPs and rwhois
See product information here: http://www.softlayer.com/networking
Parameters: client (SoftLayer.API.BaseClient) – the client instance -
add_global_ip
(version=4, test_order=False)[source]¶ Adds a global IP address to the account.
Parameters: - version (int) – Specifies whether this is IPv4 or IPv6
- test_order (bool) – If true, this will only verify the order.
-
add_securitygroup_rule
(group_id, remote_ip=None, remote_group=None, direction=None, ethertype=None, port_max=None, port_min=None, protocol=None)[source]¶ Add a rule to a security group
Parameters: - group_id (int) – The ID of the security group to add this rule to
- remote_ip (str) – The remote IP or CIDR to enforce the rule on
- remote_group (int) – The remote security group ID to enforce the rule on
- direction (str) – The direction to enforce (egress or ingress)
- ethertype (str) – The ethertype to enforce (IPv4 or IPv6)
- port_max (int) – The upper port bound to enforce (icmp code if the protocol is icmp)
- port_min (int) – The lower port bound to enforce (icmp type if the protocol is icmp)
- protocol (str) – The protocol to enforce (icmp, udp, tcp)
-
add_securitygroup_rules
(group_id, rules)[source]¶ Add rules to a security group
Parameters: - group_id (int) – The ID of the security group to add the rules to
- rules (list) – The list of rule dictionaries to add
-
add_subnet
(subnet_type, quantity=None, endpoint_id=None, version=4, test_order=False)[source]¶ Orders a new subnet
Parameters: - subnet_type (str) – Type of subnet to add: private, public, global,static
- quantity (int) – Number of IPs in the subnet
- endpoint_id (int) – id for the subnet to be placed into
- version (int) – 4 for IPv4, 6 for IPv6
- test_order (bool) – If true, this will only verify the order.
-
assign_global_ip
(global_ip_id, target)[source]¶ Assigns a global IP address to a specified target.
Parameters: - global_ip_id (int) – The ID of the global IP being assigned
- target (string) – The IP address to assign
-
attach_securitygroup_component
(group_id, component_id)[source]¶ Attaches a network component to a security group.
Parameters: - group_id (int) – The ID of the security group
- component_id (int) – The ID of the network component to attach
-
attach_securitygroup_components
(group_id, component_ids)[source]¶ Attaches network components to a security group.
Parameters: - group_id (int) – The ID of the security group
- component_ids (list) – The IDs of the network components to attach
-
cancel_global_ip
(global_ip_id)[source]¶ Cancels the specified global IP address.
Parameters: id (int) – The ID of the global IP to be cancelled.
-
cancel_subnet
(subnet_id)[source]¶ Cancels the specified subnet.
Parameters: subnet_id (int) – The ID of the subnet to be cancelled.
-
create_securitygroup
(name=None, description=None)[source]¶ Creates a security group.
Parameters: - name (string) – The name of the security group
- description (string) – The description of the security group
-
delete_securitygroup
(group_id)[source]¶ Deletes the specified security group.
Parameters: group_id (int) – The ID of the security group
-
detach_securitygroup_component
(group_id, component_id)[source]¶ Detaches a network component from a security group.
Parameters: - group_id (int) – The ID of the security group
- component_id (int) – The ID of the component to detach
-
detach_securitygroup_components
(group_id, component_ids)[source]¶ Detaches network components from a security group.
Parameters: - group_id (int) – The ID of the security group
- component_ids (list) – The IDs of the network components to detach
-
edit_rwhois
(abuse_email=None, address1=None, address2=None, city=None, company_name=None, country=None, first_name=None, last_name=None, postal_code=None, private_residence=None, state=None)[source]¶ Edit rwhois record.
-
edit_securitygroup
(group_id, name=None, description=None)[source]¶ Edit security group details.
Parameters: - group_id (int) – The ID of the security group
- name (string) – The name of the security group
- description (string) – The description of the security group
-
edit_securitygroup_rule
(group_id, rule_id, remote_ip=None, remote_group=None, direction=None, ethertype=None, port_max=None, port_min=None, protocol=None)[source]¶ Edit a security group rule.
Parameters: - group_id (int) – The ID of the security group the rule belongs to
- rule_id (int) – The ID of the rule to edit
- remote_ip (str) – The remote IP or CIDR to enforce the rule on
- remote_group (int) – The remote security group ID to enforce the rule on
- direction (str) – The direction to enforce (egress or ingress)
- ethertype (str) – The ethertype to enforce (IPv4 or IPv6)
- port_max (str) – The upper port bound to enforce
- port_min (str) – The lower port bound to enforce
- protocol (str) – The protocol to enforce (icmp, udp, tcp)
-
get_event_logs_by_request_id
(request_id)[source]¶ Gets all event logs by the given request id
Parameters: request_id (string) – The request id we want to filter on
-
get_nas_credentials
(identifier, **kwargs)[source]¶ Returns a list of IDs of VLANs which match the given VLAN name.
Parameters: instance_id (integer) – the instance ID Returns: A dictionary containing a large amount of information about the specified instance.
-
get_rwhois
()[source]¶ Returns the RWhois information about the current account.
Returns: A dictionary containing the account’s RWhois information.
-
get_securitygroup
(group_id, **kwargs)[source]¶ Returns the information about the given security group.
Parameters: id (string) – The ID for the security group Returns: A diction of information about the security group
-
get_subnet
(subnet_id, **kwargs)[source]¶ Returns information about a single subnet.
Parameters: id (string) – Either the ID for the subnet or its network identifier Returns: A dictionary of information about the subnet
-
get_vlan
(vlan_id)[source]¶ Returns information about a single VLAN.
Parameters: id (int) – The unique identifier for the VLAN Returns: A dictionary containing a large amount of information about the specified VLAN.
-
ip_lookup
(ip_address)[source]¶ Looks up an IP address and returns network information about it.
Parameters: ip_address (string) – An IP address. Can be IPv4 or IPv6 Returns: A dictionary of information about the IP
-
list_global_ips
(version=None, identifier=None, **kwargs)[source]¶ Returns a list of all global IP address records on the account.
Parameters: - version (int) – Only returns IPs of this version (4 or 6)
- identifier (string) – If specified, the list will only contain the global ips matching this network identifier.
-
list_securitygroup_rules
(group_id)[source]¶ List security group rules associated with a security group.
Parameters: group_id (int) – The security group to list rules for
-
list_subnets
(identifier=None, datacenter=None, version=0, subnet_type=None, network_space=None, **kwargs)[source]¶ Display a list of all subnets on the account.
This provides a quick overview of all subnets including information about data center residence and the number of devices attached.
Parameters: - identifier (string) – If specified, the list will only contain the subnet matching this network identifier.
- datacenter (string) – If specified, the list will only contain subnets in the specified data center.
- version (int) – Only returns subnets of this version (4 or 6).
- subnet_type (string) – If specified, it will only returns subnets of this type.
- network_space (string) – If specified, it will only returns subnets with the given address space label.
- **kwargs (dict) – response-level options (mask, limit, etc.)
-
list_vlans
(datacenter=None, vlan_number=None, name=None, **kwargs)[source]¶ Display a list of all VLANs on the account.
This provides a quick overview of all VLANs including information about data center residence and the number of devices attached.
Parameters: - datacenter (string) – If specified, the list will only contain VLANs in the specified data center.
- vlan_number (int) – If specified, the list will only contain the VLAN matching this VLAN number.
- name (int) – If specified, the list will only contain the VLAN matching this VLAN name.
- **kwargs (dict) – response-level options (mask, limit, etc.)
-
remove_securitygroup_rule
(group_id, rule_id)[source]¶ Remove a rule from a security group.
Parameters: - group_id (int) – The ID of the security group
- rule_id (int) – The ID of the rule to remove
-
remove_securitygroup_rules
(group_id, rules)[source]¶ Remove rules from a security group.
Parameters: - group_id (int) – The ID of the security group
- rules (list) – The list of IDs to remove
-
summary_by_datacenter
()[source]¶ Summary of the networks on the account, grouped by data center.
The resultant dictionary is primarily useful for statistical purposes. It contains count information rather than raw data. If you want raw information, see the
list_vlans()
method instead.Returns: A dictionary keyed by data center with the data containing a set of counts for subnets, hardware, virtual servers, and other objects residing within that data center.
-