�
�Udac @` s� d d l m Z m Z m Z e Z i d d 6d g d 6d d 6Z d Z d Z d
Z d d l
Z
d d l m Z d
d d d d g Z
d d d g Z d d d d d g Z d d g Z d e f d � � YZ d � Z e d k r� e � n d S( i ( t absolute_importt divisiont print_functions 1.1t metadata_versiont previewt statust communityt supported_bysF
---
module: flowadm
short_description: Manage bandwidth resource control and priority for protocols, services and zones on Solaris/illumos systems
description:
- Create/modify/remove networking bandwidth and associated resources for a type of traffic on a particular link.
version_added: "2.2"
author: Adam Števko (@xen0l)
options:
name:
description: >
- A flow is defined as a set of attributes based on Layer 3 and Layer 4
headers, which can be used to identify a protocol, service, or a zone.
required: true
aliases: [ 'flow' ]
link:
description:
- Specifiies a link to configure flow on.
required: false
local_ip:
description:
- Identifies a network flow by the local IP address.
required: false
remote_ip:
description:
- Identifies a network flow by the remote IP address.
required: false
transport:
description: >
- Specifies a Layer 4 protocol to be used. It is typically used in combination with I(local_port) to
identify the service that needs special attention.
required: false
local_port:
description:
- Identifies a service specified by the local port.
required: false
dsfield:
description: >
- Identifies the 8-bit differentiated services field (as defined in
RFC 2474). The optional dsfield_mask is used to state the bits of interest in
the differentiated services field when comparing with the dsfield
value. Both values must be in hexadecimal.
required: false
maxbw:
description: >
- Sets the full duplex bandwidth for the flow. The bandwidth is
specified as an integer with one of the scale suffixes(K, M, or G
for Kbps, Mbps, and Gbps). If no units are specified, the input
value will be read as Mbps.
required: false
priority:
description:
- Sets the relative priority for the flow.
required: false
default: 'medium'
choices: [ 'low', 'medium', 'high' ]
temporary:
description:
- Specifies that the configured flow is temporary. Temporary
flows do not persist across reboots.
required: false
default: false
type: bool
state:
description:
- Create/delete/enable/disable an IP address on the network interface.
required: false
default: present
choices: [ 'absent', 'present', 'resetted' ]
s�
# Limit SSH traffic to 100M via vnic0 interface
- flowadm:
link: vnic0
flow: ssh_out
transport: tcp
local_port: 22
maxbw: 100M
state: present
# Reset flow properties
- flowadm:
name: dns
state: resetted
# Configure policy for EF PHB (DSCP value of 101110 from RFC 2598) with a bandwidth of 500 Mbps and a high priority.
- flowadm:
link: bge0
dsfield: '0x2e:0xfc'
maxbw: 500M
priority: high
flow: efphb-flow
state: present
s�
name:
description: flow name
returned: always
type: str
sample: "http_drop"
link:
description: flow's link
returned: if link is defined
type: str
sample: "vnic0"
state:
description: state of the target
returned: always
type: str
sample: "present"
temporary:
description: flow's persistence
returned: always
type: bool
sample: "True"
priority:
description: flow's priority
returned: if priority is defined
type: str
sample: "low"
transport:
description: flow's transport
returned: if transport is defined
type: str
sample: "tcp"
maxbw:
description: flow's maximum bandwidth
returned: if maxbw is defined
type: str
sample: "100M"
local_Ip:
description: flow's local IP address
returned: if local_ip is defined
type: str
sample: "10.0.0.42"
local_port:
description: flow's local port
returned: if local_port is defined
type: int
sample: 1337
remote_Ip:
description: flow's remote IP address
returned: if remote_ip is defined
type: str
sample: "10.0.0.42"
dsfield:
description: flow's differentiated services value
returned: if dsfield is defined
type: str
sample: "0x2e:0xfc"
N( t
AnsibleModulet tcpt udpt sctpt icmpt icmpv6t lowt mediumt hight local_ipt remote_ipt transportt
local_portt dsfieldt maxbwt priorityt Flowc B` s� e Z d � Z e d � � Z e d � � Z e d � � Z e d � � Z d � Z d � Z d � Z
d � Z d � Z d
� Z
RS( c C` s� | | _ | j d | _ | j d | _ | j d | _ | j d | _ | j d | _ | j d | _ | j d | _ | j d | _ | j d | _
| j d
| _ | j d | _ i t
d 6t
d 6| _ d S( Nt namet linkR R R R R R R t temporaryt state( t modulet paramsR R R R R R R R R R R t Falset _needs_updating( t selfR ( ( sK /usr/lib/python2.7/site-packages/ansible/modules/network/illumos/flowadm.pyt __init__� s c C` s d t | � k o d k SS( Ni i�� ( t int( t clst port( ( sK /usr/lib/python2.7/site-packages/ansible/modules/network/illumos/flowadm.pyt
is_valid_port� s c C` s� | j d � d k r- | j d � \ } } n | } t | j d � � d k r� y t j t j | � Wn t j k
r| t SXd | k o� d k n s� t SnO y t j t j | � Wn t j k
r� t SXd | k o� d k n s� t St S( Nt /i t .i i i i� (
t countt splitt lent sockett inet_ptont AF_INETt errorR t AF_INET6t True( R$ t ipt
ip_addresst netmask( ( sK /usr/lib/python2.7/site-packages/ansible/modules/network/illumos/flowadm.pyt is_valid_address� s"