�
�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
l
m Z d d l j j Z d d l m Z e j � 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 certifiedt supported_bysZ
module: na_ontap_net_routes
short_description: NetApp ONTAP network routes
extends_documentation_fragment:
- netapp.na_ontap
version_added: '2.6'
author: NetApp Ansible Team (@carchi8py) <[email protected]>
description:
- Modify ONTAP network routes.
options:
state:
description:
- Whether you want to create or delete a network route.
choices: ['present', 'absent']
default: present
vserver:
description:
- The name of the vserver.
required: true
destination:
description:
- Specify the route destination.
- Example 10.7.125.5/20, fd20:13::/64.
required: true
gateway:
description:
- Specify the route gateway.
- Example 10.7.125.1, fd20:13::1.
required: true
metric:
description:
- Specify the route metric.
- If this field is not provided the default will be set to 20.
from_destination:
description:
- Specify the route destination that should be changed.
- new_destination was removed to fix idempotency issues. To rename destination the original goes to from_destination and the new goes to destination.
version_added: '2.8'
from_gateway:
description:
- Specify the route gateway that should be changed.
version_added: '2.8'
from_metric:
description:
- Specify the route metric that should be changed.
version_added: '2.8'
sB
- name: create route
na_ontap_net_routes:
state: present
vserver: "{{ Vserver name }}"
username: "{{ netapp_username }}"
password: "{{ netapp_password }}"
hostname: "{{ netapp_hostname }}"
destination: 10.7.125.5/20
gateway: 10.7.125.1
metric: 30
s
N( t
AnsibleModule( t to_native( t NetAppModulet NetAppOntapNetRoutesc B` s_ e Z d Z d � Z d d � Z d d � Z d � Z d d � Z d � Z d � Z
d � Z RS(
s3
Create, Modifies and Destroys a Net Route
c C` su t j � | _ | j j t d t d t d d d g d d � d t d t d d � d
t d t d d � d t d t d d � d t d t d d � d
t d t d d d d � d t d t d d d d � d t d t d d d d � � � t d | j d t � | _ t
� | _ | j j | j j
� | _ t t k rL| j j d d � n% t j d | j d | j d � | _ d S( s6
Initialize the Ontap Net Route class
t statet requiredt choicest presentt absentt defaultt vservert typet strt destinationt gatewayt metrict from_destinationt from_gatewayt from_metrict
argument_spect supports_check_modet msgs( the python NetApp-Lib module is requiredt moduleN( t netapp_utilst na_ontap_host_argument_specR t updatet dictt Falset Truet NoneR R R
t na_helpert set_parameterst paramst
parameterst HAS_NETAPP_LIBt fail_jsont setup_na_ontap_zapit server( t self( ( sV /usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_net_routes.pyt __init__^ s( %c C` s� t j j d � } | j d | j d � | j d | j d � | d k rt | j j d � d k rt | j d } n | } | d k r� | j d | � n y | j j | t � WnB t j j
k
r� } | j j d d t
| � d t j � � n Xd S( s%
Creates a new Route
s net-routes-createR R R R s Error creating net route: %st exceptionN( R t zapit NaElementt
add_new_childR) R% t getR- t invoke_successfullyR$ t
NaApiErrorR R+ R t tracebackt
format_exc( R. t current_metrict route_objR t error( ( sV /usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_net_routes.pyt create_net_route} s $
c C` s� t j j d � } | d k r* | j } n | j d | d � | j d | d � y | j j | t � WnB t j j k
r� } | j
j d d t | � d t
j � � n Xd S( s'