OneView: rename _facts -> _info (#61208)

* Rename OneView _facts modules -> _info

* Adjust PR #.

* Forgot to update test names.

* Remove superfluous blank line.

* Some more things from review.
This commit is contained in:
Felix Fontein 2019-08-27 23:21:40 +02:00 committed by GitHub
parent 6ad40fd6b8
commit c9a9bd9d64
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 586 additions and 401 deletions

View file

@ -0,0 +1,17 @@
minor_changes:
- The ``oneview_datacenter_facts`` module has been renamed to ``oneview_datacenter_info``.
When called with the new name, the module no longer returns ``ansible_facts``.
- The ``oneview_enclosure_facts`` module has been renamed to ``oneview_enclosure_info``.
When called with the new name, the module no longer returns ``ansible_facts``.
- The ``oneview_ethernet_network_facts`` module has been renamed to ``oneview_ethernet_network_info``.
When called with the new name, the module no longer returns ``ansible_facts``.
- The ``oneview_fc_network_facts`` module has been renamed to ``oneview_fc_network_info``.
When called with the new name, the module no longer returns ``ansible_facts``.
- The ``oneview_fcoe_network_facts`` module has been renamed to ``oneview_fcoe_network_info``.
When called with the new name, the module no longer returns ``ansible_facts``.
- The ``oneview_logical_interconnect_group_facts`` module has been renamed to ``oneview_logical_interconnect_group_info``.
When called with the new name, the module no longer returns ``ansible_facts``.
- The ``oneview_network_set_facts`` module has been renamed to ``oneview_network_set_info``.
When called with the new name, the module no longer returns ``ansible_facts``.
- The ``oneview_san_manager_facts`` module has been renamed to ``oneview_san_manager_info``.
When called with the new name, the module no longer returns ``ansible_facts``.

View file

@ -418,6 +418,31 @@ be removed in Ansible 2.13. Please update update your playbooks accordingly.
* The ``one_image_facts`` module was renamed to :ref:`one_image_info <one_image_info_module>`.
* The ``onepassword_facts`` module was renamed to :ref:`onepassword_info <onepassword_info_module>`.
When called with the new name, the module no longer returns ``ansible_facts``.
To access return values, :ref:`register a variable <registered_variables>`.
* The ``oneview_datacenter_facts`` module was renamed to :ref:`oneview_datacenter_info <oneview_datacenter_info_module>`.
When called with the new name, the module no longer returns ``ansible_facts``.
To access return values, :ref:`register a variable <registered_variables>`.
* The ``oneview_enclosure_facts`` module was renamed to :ref:`oneview_enclosure_info <oneview_enclosure_info_module>`.
When called with the new name, the module no longer returns ``ansible_facts``.
To access return values, :ref:`register a variable <registered_variables>`.
* The ``oneview_ethernet_network_facts`` module was renamed to :ref:`oneview_ethernet_network_info <oneview_ethernet_network_info_module>`.
When called with the new name, the module no longer returns ``ansible_facts``.
To access return values, :ref:`register a variable <registered_variables>`.
* The ``oneview_fc_network_facts`` module was renamed to :ref:`oneview_fc_network_info <oneview_fc_network_info_module>`.
When called with the new name, the module no longer returns ``ansible_facts``.
To access return values, :ref:`register a variable <registered_variables>`.
* The ``oneview_fcoe_network_facts`` module was renamed to :ref:`oneview_fcoe_network_info <oneview_fcoe_network_info_module>`.
When called with the new name, the module no longer returns ``ansible_facts``.
To access return values, :ref:`register a variable <registered_variables>`.
* The ``oneview_logical_interconnect_group_facts`` module was renamed to :ref:`oneview_logical_interconnect_group_info <oneview_logical_interconnect_group_info_module>`.
When called with the new name, the module no longer returns ``ansible_facts``.
To access return values, :ref:`register a variable <registered_variables>`.
* The ``oneview_network_set_facts`` module was renamed to :ref:`oneview_network_set_info <oneview_network_set_info_module>`.
When called with the new name, the module no longer returns ``ansible_facts``.
To access return values, :ref:`register a variable <registered_variables>`.
* The ``oneview_san_manager_facts`` module was renamed to :ref:`oneview_san_manager_info <oneview_san_manager_info_module>`.
When called with the new name, the module no longer returns ``ansible_facts``.
To access return values, :ref:`register a variable <registered_variables>`.
* The ``os_flavor_facts`` module was renamed to :ref:`os_flavor_info <os_flavor_info_module>`.
When called with the new name, the module no longer returns ``ansible_facts``.
To access return values, :ref:`register a variable <registered_variables>`.

View file

@ -0,0 +1 @@
oneview_datacenter_info.py

View file

@ -0,0 +1 @@
oneview_enclosure_info.py

View file

@ -0,0 +1 @@
oneview_ethernet_network_info.py

View file

@ -0,0 +1 @@
oneview_fc_network_info.py

View file

@ -0,0 +1 @@
oneview_fcoe_network_info.py

View file

@ -0,0 +1 @@
oneview_logical_interconnect_group_info.py

View file

@ -0,0 +1 @@
oneview_network_set_info.py

View file

@ -0,0 +1 @@
oneview_san_manager_info.py

View file

@ -11,10 +11,12 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = '''
---
module: oneview_datacenter_facts
short_description: Retrieve facts about the OneView Data Centers
module: oneview_datacenter_info
short_description: Retrieve information about the OneView Data Centers
description:
- Retrieve facts about the OneView Data Centers.
- Retrieve information about the OneView Data Centers.
- This module was called C(oneview_datacenter_facts) before Ansible 2.9, returning C(ansible_facts).
Note that the M(oneview_datacenter_info) module no longer returns C(ansible_facts)!
version_added: "2.5"
requirements:
- "hpOneView >= 2.0.1"
@ -29,7 +31,7 @@ options:
- Data Center name.
options:
description:
- "Retrieve additional facts. Options available: 'visualContent'."
- "Retrieve additional information. Options available: 'visualContent'."
extends_documentation_fragment:
- oneview
@ -37,17 +39,19 @@ extends_documentation_fragment:
'''
EXAMPLES = '''
- name: Gather facts about all Data Centers
oneview_datacenter_facts:
- name: Gather information about all Data Centers
oneview_datacenter_info:
hostname: 172.16.101.48
username: administrator
password: my_password
api_version: 500
delegate_to: localhost
- debug: var=datacenters
register: result
- debug:
msg: "{{ result.datacenters }}"
- name: Gather paginated, filtered and sorted facts about Data Centers
oneview_datacenter_facts:
- name: Gather paginated, filtered and sorted information about Data Centers
oneview_datacenter_info:
hostname: 172.16.101.48
username: administrator
password: my_password
@ -57,20 +61,24 @@ EXAMPLES = '''
count: 3
sort: 'name:descending'
filter: 'state=Unmanaged'
- debug: var=datacenters
register: result
- debug:
msg: "{{ result.datacenters }}"
- name: Gather facts about a Data Center by name
oneview_datacenter_facts:
- name: Gather information about a Data Center by name
oneview_datacenter_info:
hostname: 172.16.101.48
username: administrator
password: my_password
api_version: 500
name: "My Data Center"
delegate_to: localhost
- debug: var=datacenters
register: result
- debug:
msg: "{{ result.datacenters }}"
- name: Gather facts about the Data Center Visual Content
oneview_datacenter_facts:
- name: Gather information about the Data Center Visual Content
oneview_datacenter_info:
hostname: 172.16.101.48
username: administrator
password: my_password
@ -79,18 +87,21 @@ EXAMPLES = '''
options:
- visualContent
delegate_to: localhost
- debug: var=datacenters
- debug: var=datacenter_visual_content
register: result
- debug:
msg: "{{ result.datacenters }}"
- debug:
msg: "{{ result.datacenter_visual_content }}"
'''
RETURN = '''
datacenters:
description: Has all the OneView facts about the Data Centers.
description: Has all the OneView information about the Data Centers.
returned: Always, but can be null.
type: dict
datacenter_visual_content:
description: Has facts about the Data Center Visual Content.
description: Has information about the Data Center Visual Content.
returned: When requested, but can be null.
type: dict
'''
@ -98,7 +109,7 @@ datacenter_visual_content:
from ansible.module_utils.oneview import OneViewModuleBase
class DatacenterFactsModule(OneViewModuleBase):
class DatacenterInfoModule(OneViewModuleBase):
argument_spec = dict(
name=dict(type='str'),
options=dict(type='list'),
@ -106,32 +117,39 @@ class DatacenterFactsModule(OneViewModuleBase):
)
def __init__(self):
super(DatacenterFactsModule, self).__init__(additional_arg_spec=self.argument_spec)
super(DatacenterInfoModule, self).__init__(additional_arg_spec=self.argument_spec)
self.is_old_facts = self.module._name == 'oneview_datacenter_facts'
if self.is_old_facts:
self.module.deprecate("The 'oneview_datacenter_facts' module has been renamed to 'oneview_datacenter_info', "
"and the renamed one no longer returns ansible_facts", version='2.13')
def execute_module(self):
client = self.oneview_client.datacenters
ansible_facts = {}
info = {}
if self.module.params.get('name'):
datacenters = client.get_by('name', self.module.params['name'])
if self.options and 'visualContent' in self.options:
if datacenters:
ansible_facts['datacenter_visual_content'] = client.get_visual_content(datacenters[0]['uri'])
info['datacenter_visual_content'] = client.get_visual_content(datacenters[0]['uri'])
else:
ansible_facts['datacenter_visual_content'] = None
info['datacenter_visual_content'] = None
ansible_facts['datacenters'] = datacenters
info['datacenters'] = datacenters
else:
ansible_facts['datacenters'] = client.get_all(**self.facts_params)
info['datacenters'] = client.get_all(**self.facts_params)
return dict(changed=False,
ansible_facts=ansible_facts)
if self.is_old_facts:
return dict(changed=False,
ansible_facts=info)
else:
return dict(changed=False, **info)
def main():
DatacenterFactsModule().run()
DatacenterInfoModule().run()
if __name__ == '__main__':

View file

@ -12,10 +12,12 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = '''
---
module: oneview_enclosure_facts
short_description: Retrieve facts about one or more Enclosures
module: oneview_enclosure_info
short_description: Retrieve information about one or more Enclosures
description:
- Retrieve facts about one or more of the Enclosures from OneView.
- Retrieve information about one or more of the Enclosures from OneView.
- This module was called C(oneview_enclosure_facts) before Ansible 2.9, returning C(ansible_facts).
Note that the M(oneview_enclosure_info) module no longer returns C(ansible_facts)!
version_added: "2.5"
requirements:
- hpOneView >= 2.0.1
@ -29,7 +31,7 @@ options:
- Enclosure name.
options:
description:
- "List with options to gather additional facts about an Enclosure and related resources.
- "List with options to gather additional information about an Enclosure and related resources.
Options allowed: C(script), C(environmentalConfiguration), and C(utilization). For the option C(utilization),
you can provide specific parameters."
@ -39,18 +41,20 @@ extends_documentation_fragment:
'''
EXAMPLES = '''
- name: Gather facts about all Enclosures
oneview_enclosure_facts:
- name: Gather information about all Enclosures
oneview_enclosure_info:
hostname: 172.16.101.48
username: administrator
password: my_password
api_version: 500
no_log: true
delegate_to: localhost
- debug: var=enclosures
register: result
- debug:
msg: "{{ result.enclosures }}"
- name: Gather paginated, filtered and sorted facts about Enclosures
oneview_enclosure_facts:
- name: Gather paginated, filtered and sorted information about Enclosures
oneview_enclosure_info:
params:
start: 0
count: 3
@ -62,10 +66,12 @@ EXAMPLES = '''
api_version: 500
no_log: true
delegate_to: localhost
- debug: var=enclosures
register: result
- debug:
msg: "{{ result.enclosures }}"
- name: Gather facts about an Enclosure by name
oneview_enclosure_facts:
- name: Gather information about an Enclosure by name
oneview_enclosure_info:
name: Enclosure-Name
hostname: 172.16.101.48
username: administrator
@ -73,10 +79,12 @@ EXAMPLES = '''
api_version: 500
no_log: true
delegate_to: localhost
- debug: var=enclosures
register: result
- debug:
msg: "{{ result.enclosures }}"
- name: Gather facts about an Enclosure by name with options
oneview_enclosure_facts:
- name: Gather information about an Enclosure by name with options
oneview_enclosure_info:
name: Test-Enclosure
options:
- script # optional
@ -88,14 +96,19 @@ EXAMPLES = '''
api_version: 500
no_log: true
delegate_to: localhost
- debug: var=enclosures
- debug: var=enclosure_script
- debug: var=enclosure_environmental_configuration
- debug: var=enclosure_utilization
register: result
- debug:
msg: "{{ result.enclosures }}"
- debug:
msg: "{{ result.enclosure_script }}"
- debug:
msg: "{{ result.enclosure_environmental_configuration }}"
- debug:
msg: "{{ result.enclosure_utilization }}"
- name: "Gather facts about an Enclosure with temperature data at a resolution of one sample per day, between two
- name: "Gather information about an Enclosure with temperature data at a resolution of one sample per day, between two
specified dates"
oneview_enclosure_facts:
oneview_enclosure_info:
name: Test-Enclosure
options:
- utilization: # optional
@ -111,28 +124,31 @@ EXAMPLES = '''
api_version: 500
no_log: true
delegate_to: localhost
- debug: var=enclosures
- debug: var=enclosure_utilization
register: result
- debug:
msg: "{{ result.enclosures }}"
- debug:
msg: "{{ result.enclosure_utilization }}"
'''
RETURN = '''
enclosures:
description: Has all the OneView facts about the Enclosures.
description: Has all the OneView information about the Enclosures.
returned: Always, but can be null.
type: dict
enclosure_script:
description: Has all the OneView facts about the script of an Enclosure.
description: Has all the OneView information about the script of an Enclosure.
returned: When requested, but can be null.
type: str
enclosure_environmental_configuration:
description: Has all the OneView facts about the environmental configuration of an Enclosure.
description: Has all the OneView information about the environmental configuration of an Enclosure.
returned: When requested, but can be null.
type: dict
enclosure_utilization:
description: Has all the OneView facts about the utilization of an Enclosure.
description: Has all the OneView information about the utilization of an Enclosure.
returned: When requested, but can be null.
type: dict
'''
@ -140,43 +156,50 @@ enclosure_utilization:
from ansible.module_utils.oneview import OneViewModuleBase
class EnclosureFactsModule(OneViewModuleBase):
class EnclosureInfoModule(OneViewModuleBase):
argument_spec = dict(name=dict(type='str'), options=dict(type='list'), params=dict(type='dict'))
def __init__(self):
super(EnclosureFactsModule, self).__init__(additional_arg_spec=self.argument_spec)
super(EnclosureInfoModule, self).__init__(additional_arg_spec=self.argument_spec)
self.is_old_facts = self.module._name == 'oneview_enclosure_facts'
if self.is_old_facts:
self.module.deprecate("The 'oneview_enclosure_facts' module has been renamed to 'oneview_enclosure_info', "
"and the renamed one no longer returns ansible_facts", version='2.13')
def execute_module(self):
ansible_facts = {}
info = {}
if self.module.params['name']:
enclosures = self._get_by_name(self.module.params['name'])
if self.options and enclosures:
ansible_facts = self._gather_optional_facts(self.options, enclosures[0])
info = self._gather_optional_info(self.options, enclosures[0])
else:
enclosures = self.oneview_client.enclosures.get_all(**self.facts_params)
ansible_facts['enclosures'] = enclosures
info['enclosures'] = enclosures
return dict(changed=False,
ansible_facts=ansible_facts)
if self.is_old_facts:
return dict(changed=False,
ansible_facts=info)
else:
return dict(changed=False, **info)
def _gather_optional_facts(self, options, enclosure):
def _gather_optional_info(self, options, enclosure):
enclosure_client = self.oneview_client.enclosures
ansible_facts = {}
info = {}
if options.get('script'):
ansible_facts['enclosure_script'] = enclosure_client.get_script(enclosure['uri'])
info['enclosure_script'] = enclosure_client.get_script(enclosure['uri'])
if options.get('environmentalConfiguration'):
env_config = enclosure_client.get_environmental_configuration(enclosure['uri'])
ansible_facts['enclosure_environmental_configuration'] = env_config
info['enclosure_environmental_configuration'] = env_config
if options.get('utilization'):
ansible_facts['enclosure_utilization'] = self._get_utilization(enclosure, options['utilization'])
info['enclosure_utilization'] = self._get_utilization(enclosure, options['utilization'])
return ansible_facts
return info
def _get_utilization(self, enclosure, params):
fields = view = refresh = filter = ''
@ -198,7 +221,7 @@ class EnclosureFactsModule(OneViewModuleBase):
def main():
EnclosureFactsModule().run()
EnclosureInfoModule().run()
if __name__ == '__main__':

View file

@ -11,10 +11,12 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = '''
---
module: oneview_ethernet_network_facts
short_description: Retrieve the facts about one or more of the OneView Ethernet Networks
module: oneview_ethernet_network_info
short_description: Retrieve the information about one or more of the OneView Ethernet Networks
description:
- Retrieve the facts about one or more of the Ethernet Networks from OneView.
- Retrieve the information about one or more of the Ethernet Networks from OneView.
- This module was called C(oneview_ethernet_network_facts) before Ansible 2.9, returning C(ansible_facts).
Note that the M(oneview_ethernet_network_info) module no longer returns C(ansible_facts)!
version_added: "2.4"
requirements:
- hpOneView >= 2.0.1
@ -28,7 +30,7 @@ options:
- Ethernet Network name.
options:
description:
- "List with options to gather additional facts about an Ethernet Network and related resources.
- "List with options to gather additional information about an Ethernet Network and related resources.
Options allowed: C(associatedProfiles) and C(associatedUplinkGroups)."
extends_documentation_fragment:
- oneview
@ -36,15 +38,17 @@ extends_documentation_fragment:
'''
EXAMPLES = '''
- name: Gather facts about all Ethernet Networks
oneview_ethernet_network_facts:
- name: Gather information about all Ethernet Networks
oneview_ethernet_network_info:
config: /etc/oneview/oneview_config.json
delegate_to: localhost
register: result
- debug: var=ethernet_networks
- debug:
msg: "{{ result.ethernet_networks }}"
- name: Gather paginated and filtered facts about Ethernet Networks
oneview_ethernet_network_facts:
- name: Gather paginated and filtered information about Ethernet Networks
oneview_ethernet_network_info:
config: /etc/oneview/oneview_config.json
params:
start: 1
@ -52,43 +56,50 @@ EXAMPLES = '''
sort: 'name:descending'
filter: 'purpose=General'
delegate_to: localhost
register: result
- debug: var=ethernet_networks
- debug:
msg: "{{ result.ethernet_networks }}"
- name: Gather facts about an Ethernet Network by name
oneview_ethernet_network_facts:
- name: Gather information about an Ethernet Network by name
oneview_ethernet_network_info:
config: /etc/oneview/oneview_config.json
name: Ethernet network name
delegate_to: localhost
register: result
- debug: var=ethernet_networks
- debug:
msg: "{{ result.ethernet_networks }}"
- name: Gather facts about an Ethernet Network by name with options
oneview_ethernet_network_facts:
- name: Gather information about an Ethernet Network by name with options
oneview_ethernet_network_info:
config: /etc/oneview/oneview_config.json
name: eth1
options:
- associatedProfiles
- associatedUplinkGroups
delegate_to: localhost
register: result
- debug: var=enet_associated_profiles
- debug: var=enet_associated_uplink_groups
- debug:
msg: "{{ result.enet_associated_profiles }}"
- debug:
msg: "{{ result.enet_associated_uplink_groups }}"
'''
RETURN = '''
ethernet_networks:
description: Has all the OneView facts about the Ethernet Networks.
description: Has all the OneView information about the Ethernet Networks.
returned: Always, but can be null.
type: dict
enet_associated_profiles:
description: Has all the OneView facts about the profiles which are using the Ethernet network.
description: Has all the OneView information about the profiles which are using the Ethernet network.
returned: When requested, but can be null.
type: dict
enet_associated_uplink_groups:
description: Has all the OneView facts about the uplink sets which are using the Ethernet network.
description: Has all the OneView information about the uplink sets which are using the Ethernet network.
returned: When requested, but can be null.
type: dict
'''
@ -96,7 +107,7 @@ enet_associated_uplink_groups:
from ansible.module_utils.oneview import OneViewModuleBase
class EthernetNetworkFactsModule(OneViewModuleBase):
class EthernetNetworkInfoModule(OneViewModuleBase):
argument_spec = dict(
name=dict(type='str'),
options=dict(type='list'),
@ -104,34 +115,41 @@ class EthernetNetworkFactsModule(OneViewModuleBase):
)
def __init__(self):
super(EthernetNetworkFactsModule, self).__init__(additional_arg_spec=self.argument_spec)
super(EthernetNetworkInfoModule, self).__init__(additional_arg_spec=self.argument_spec)
self.is_old_facts = self.module._name == 'oneview_ethernet_network_facts'
if self.is_old_facts:
self.module.deprecate("The 'oneview_ethernet_network_facts' module has been renamed to 'oneview_ethernet_network_info', "
"and the renamed one no longer returns ansible_facts", version='2.13')
self.resource_client = self.oneview_client.ethernet_networks
def execute_module(self):
ansible_facts = {}
info = {}
if self.module.params['name']:
ethernet_networks = self.resource_client.get_by('name', self.module.params['name'])
if self.module.params.get('options') and ethernet_networks:
ansible_facts = self.__gather_optional_facts(ethernet_networks[0])
info = self.__gather_optional_info(ethernet_networks[0])
else:
ethernet_networks = self.resource_client.get_all(**self.facts_params)
ansible_facts['ethernet_networks'] = ethernet_networks
info['ethernet_networks'] = ethernet_networks
return dict(changed=False, ansible_facts=ansible_facts)
if self.is_old_facts:
return dict(changed=False, ansible_facts=info)
else:
return dict(changed=False, **info)
def __gather_optional_facts(self, ethernet_network):
def __gather_optional_info(self, ethernet_network):
ansible_facts = {}
info = {}
if self.options.get('associatedProfiles'):
ansible_facts['enet_associated_profiles'] = self.__get_associated_profiles(ethernet_network)
info['enet_associated_profiles'] = self.__get_associated_profiles(ethernet_network)
if self.options.get('associatedUplinkGroups'):
ansible_facts['enet_associated_uplink_groups'] = self.__get_associated_uplink_groups(ethernet_network)
info['enet_associated_uplink_groups'] = self.__get_associated_uplink_groups(ethernet_network)
return ansible_facts
return info
def __get_associated_profiles(self, ethernet_network):
associated_profiles = self.resource_client.get_associated_profiles(ethernet_network['uri'])
@ -143,7 +161,7 @@ class EthernetNetworkFactsModule(OneViewModuleBase):
def main():
EthernetNetworkFactsModule().run()
EthernetNetworkInfoModule().run()
if __name__ == '__main__':

View file

@ -11,10 +11,12 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = '''
---
module: oneview_fc_network_facts
short_description: Retrieve the facts about one or more of the OneView Fibre Channel Networks
module: oneview_fc_network_info
short_description: Retrieve the information about one or more of the OneView Fibre Channel Networks
description:
- Retrieve the facts about one or more of the Fibre Channel Networks from OneView.
- Retrieve the information about one or more of the Fibre Channel Networks from OneView.
- This module was called C(oneview_fc_network_facts) before Ansible 2.9, returning C(ansible_facts).
Note that the M(oneview_fc_network_info) module no longer returns C(ansible_facts)!
version_added: "2.4"
requirements:
- hpOneView >= 2.0.1
@ -33,15 +35,17 @@ extends_documentation_fragment:
'''
EXAMPLES = '''
- name: Gather facts about all Fibre Channel Networks
oneview_fc_network_facts:
- name: Gather information about all Fibre Channel Networks
oneview_fc_network_info:
config: /etc/oneview/oneview_config.json
delegate_to: localhost
register: result
- debug: var=fc_networks
- debug:
msg: "{{ result.fc_networks }}"
- name: Gather paginated, filtered and sorted facts about Fibre Channel Networks
oneview_fc_network_facts:
- name: Gather paginated, filtered and sorted information about Fibre Channel Networks
oneview_fc_network_info:
config: /etc/oneview/oneview_config.json
params:
start: 1
@ -49,20 +53,24 @@ EXAMPLES = '''
sort: 'name:descending'
filter: 'fabricType=FabricAttach'
delegate_to: localhost
- debug: var=fc_networks
register: result
- debug:
msg: "{{ result.fc_networks }}"
- name: Gather facts about a Fibre Channel Network by name
oneview_fc_network_facts:
- name: Gather information about a Fibre Channel Network by name
oneview_fc_network_info:
config: /etc/oneview/oneview_config.json
name: network name
delegate_to: localhost
register: result
- debug: var=fc_networks
- debug:
msg: "{{ result.fc_networks }}"
'''
RETURN = '''
fc_networks:
description: Has all the OneView facts about the Fibre Channel Networks.
description: Has all the OneView information about the Fibre Channel Networks.
returned: Always, but can be null.
type: dict
'''
@ -70,7 +78,7 @@ fc_networks:
from ansible.module_utils.oneview import OneViewModuleBase
class FcNetworkFactsModule(OneViewModuleBase):
class FcNetworkInfoModule(OneViewModuleBase):
def __init__(self):
argument_spec = dict(
@ -78,7 +86,11 @@ class FcNetworkFactsModule(OneViewModuleBase):
params=dict(required=False, type='dict')
)
super(FcNetworkFactsModule, self).__init__(additional_arg_spec=argument_spec)
super(FcNetworkInfoModule, self).__init__(additional_arg_spec=argument_spec)
self.is_old_facts = self.module._name == 'oneview_fc_network_facts'
if self.is_old_facts:
self.module.deprecate("The 'oneview_fc_network_facts' module has been renamed to 'oneview_fc_network_info', "
"and the renamed one no longer returns ansible_facts", version='2.13')
def execute_module(self):
@ -87,11 +99,14 @@ class FcNetworkFactsModule(OneViewModuleBase):
else:
fc_networks = self.oneview_client.fc_networks.get_all(**self.facts_params)
return dict(changed=False, ansible_facts=dict(fc_networks=fc_networks))
if self.is_old_facts:
return dict(changed=False, ansible_facts=dict(fc_networks=fc_networks))
else:
return dict(changed=False, fc_networks=fc_networks)
def main():
FcNetworkFactsModule().run()
FcNetworkInfoModule().run()
if __name__ == '__main__':

View file

@ -1,98 +0,0 @@
#!/usr/bin/python
# Copyright (c) 2016-2017 Hewlett Packard Enterprise Development LP
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: oneview_fcoe_network_facts
short_description: Retrieve the facts about one or more of the OneView FCoE Networks
description:
- Retrieve the facts about one or more of the FCoE Networks from OneView.
version_added: "2.4"
requirements:
- hpOneView >= 2.0.1
author:
- Felipe Bulsoni (@fgbulsoni)
- Thiago Miotto (@tmiotto)
- Adriane Cardozo (@adriane-cardozo)
options:
name:
description:
- FCoE Network name.
extends_documentation_fragment:
- oneview
- oneview.factsparams
'''
EXAMPLES = '''
- name: Gather facts about all FCoE Networks
oneview_fcoe_network_facts:
config: /etc/oneview/oneview_config.json
delegate_to: localhost
- debug: var=fcoe_networks
- name: Gather paginated, filtered and sorted facts about FCoE Networks
oneview_fcoe_network_facts:
config: /etc/oneview/oneview_config.json
params:
start: 0
count: 3
sort: 'name:descending'
filter: 'vlanId=2'
delegate_to: localhost
- debug: var=fcoe_networks
- name: Gather facts about a FCoE Network by name
oneview_fcoe_network_facts:
config: /etc/oneview/oneview_config.json
name: Test FCoE Network Facts
delegate_to: localhost
- debug: var=fcoe_networks
'''
RETURN = '''
fcoe_networks:
description: Has all the OneView facts about the FCoE Networks.
returned: Always, but can be null.
type: dict
'''
from ansible.module_utils.oneview import OneViewModuleBase
class FcoeNetworkFactsModule(OneViewModuleBase):
def __init__(self):
argument_spec = dict(
name=dict(type='str'),
params=dict(type='dict'),
)
super(FcoeNetworkFactsModule, self).__init__(additional_arg_spec=argument_spec)
def execute_module(self):
if self.module.params['name']:
fcoe_networks = self.oneview_client.fcoe_networks.get_by('name', self.module.params['name'])
else:
fcoe_networks = self.oneview_client.fcoe_networks.get_all(**self.facts_params)
return dict(changed=False,
ansible_facts=dict(fcoe_networks=fcoe_networks))
def main():
FcoeNetworkFactsModule().run()
if __name__ == '__main__':
main()

View file

@ -0,0 +1,113 @@
#!/usr/bin/python
# Copyright (c) 2016-2017 Hewlett Packard Enterprise Development LP
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: oneview_fcoe_network_info
short_description: Retrieve the information about one or more of the OneView FCoE Networks
description:
- Retrieve the information about one or more of the FCoE Networks from OneView.
- This module was called C(oneview_fcoe_network_facts) before Ansible 2.9, returning C(ansible_facts).
Note that the M(oneview_fcoe_network_info) module no longer returns C(ansible_facts)!
version_added: "2.4"
requirements:
- hpOneView >= 2.0.1
author:
- Felipe Bulsoni (@fgbulsoni)
- Thiago Miotto (@tmiotto)
- Adriane Cardozo (@adriane-cardozo)
options:
name:
description:
- FCoE Network name.
extends_documentation_fragment:
- oneview
- oneview.factsparams
'''
EXAMPLES = '''
- name: Gather information about all FCoE Networks
oneview_fcoe_network_info:
config: /etc/oneview/oneview_config.json
delegate_to: localhost
register: result
- debug:
msg: "{{ result.fcoe_networks }}"
- name: Gather paginated, filtered and sorted information about FCoE Networks
oneview_fcoe_network_info:
config: /etc/oneview/oneview_config.json
params:
start: 0
count: 3
sort: 'name:descending'
filter: 'vlanId=2'
delegate_to: localhost
register: result
- debug:
msg: "{{ result.fcoe_networks }}"
- name: Gather information about a FCoE Network by name
oneview_fcoe_network_info:
config: /etc/oneview/oneview_config.json
name: Test FCoE Network Information
delegate_to: localhost
register: result
- debug:
msg: "{{ result.fcoe_networks }}"
'''
RETURN = '''
fcoe_networks:
description: Has all the OneView information about the FCoE Networks.
returned: Always, but can be null.
type: dict
'''
from ansible.module_utils.oneview import OneViewModuleBase
class FcoeNetworkInfoModule(OneViewModuleBase):
def __init__(self):
argument_spec = dict(
name=dict(type='str'),
params=dict(type='dict'),
)
super(FcoeNetworkInfoModule, self).__init__(additional_arg_spec=argument_spec)
self.is_old_facts = self.module._name == 'oneview_fcoe_network_facts'
if self.is_old_facts:
self.module.deprecate("The 'oneview_fcoe_network_facts' module has been renamed to 'oneview_fcoe_network_info', "
"and the renamed one no longer returns ansible_facts", version='2.13')
def execute_module(self):
if self.module.params['name']:
fcoe_networks = self.oneview_client.fcoe_networks.get_by('name', self.module.params['name'])
else:
fcoe_networks = self.oneview_client.fcoe_networks.get_all(**self.facts_params)
if self.is_old_facts:
return dict(changed=False,
ansible_facts=dict(fcoe_networks=fcoe_networks))
else:
return dict(changed=False, fcoe_networks=fcoe_networks)
def main():
FcoeNetworkInfoModule().run()
if __name__ == '__main__':
main()

View file

@ -12,10 +12,12 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = '''
---
module: oneview_logical_interconnect_group_facts
short_description: Retrieve facts about one or more of the OneView Logical Interconnect Groups
module: oneview_logical_interconnect_group_info
short_description: Retrieve information about one or more of the OneView Logical Interconnect Groups
description:
- Retrieve facts about one or more of the Logical Interconnect Groups from OneView
- Retrieve information about one or more of the Logical Interconnect Groups from OneView
- This module was called C(oneview_logical_interconnect_group_facts) before Ansible 2.9, returning C(ansible_facts).
Note that the M(oneview_logical_interconnect_group_info) module no longer returns C(ansible_facts)!
version_added: "2.5"
requirements:
- hpOneView >= 2.0.1
@ -33,19 +35,21 @@ extends_documentation_fragment:
'''
EXAMPLES = '''
- name: Gather facts about all Logical Interconnect Groups
oneview_logical_interconnect_group_facts:
- name: Gather information about all Logical Interconnect Groups
oneview_logical_interconnect_group_info:
hostname: 172.16.101.48
username: administrator
password: my_password
api_version: 500
no_log: true
delegate_to: localhost
register: result
- debug: var=logical_interconnect_groups
- debug:
msg: "{{ result.logical_interconnect_groups }}"
- name: Gather paginated, filtered and sorted facts about Logical Interconnect Groups
oneview_logical_interconnect_group_facts:
- name: Gather paginated, filtered and sorted information about Logical Interconnect Groups
oneview_logical_interconnect_group_info:
params:
start: 0
count: 3
@ -57,11 +61,13 @@ EXAMPLES = '''
api_version: 500
no_log: true
delegate_to: localhost
register: result
- debug: var=logical_interconnect_groups
- debug:
msg: "{{ result.logical_interconnect_groups }}"
- name: Gather facts about a Logical Interconnect Group by name
oneview_logical_interconnect_group_facts:
- name: Gather information about a Logical Interconnect Group by name
oneview_logical_interconnect_group_info:
name: logical lnterconnect group name
hostname: 172.16.101.48
username: administrator
@ -69,13 +75,15 @@ EXAMPLES = '''
api_version: 500
no_log: true
delegate_to: localhost
register: result
- debug: var=logical_interconnect_groups
- debug:
msg: "{{ result.logical_interconnect_groups }}"
'''
RETURN = '''
logical_interconnect_groups:
description: Has all the OneView facts about the Logical Interconnect Groups.
description: Has all the OneView information about the Logical Interconnect Groups.
returned: Always, but can be null.
type: dict
'''
@ -83,7 +91,7 @@ logical_interconnect_groups:
from ansible.module_utils.oneview import OneViewModuleBase
class LogicalInterconnectGroupFactsModule(OneViewModuleBase):
class LogicalInterconnectGroupInfoModule(OneViewModuleBase):
def __init__(self):
argument_spec = dict(
@ -91,7 +99,11 @@ class LogicalInterconnectGroupFactsModule(OneViewModuleBase):
params=dict(type='dict'),
)
super(LogicalInterconnectGroupFactsModule, self).__init__(additional_arg_spec=argument_spec)
super(LogicalInterconnectGroupInfoModule, self).__init__(additional_arg_spec=argument_spec)
self.is_old_facts = self.module._name == 'oneview_logical_interconnect_group_facts'
if self.is_old_facts:
self.module.deprecate("The 'oneview_logical_interconnect_group_facts' module has been renamed to 'oneview_logical_interconnect_group_info', "
"and the renamed one no longer returns ansible_facts", version='2.13')
def execute_module(self):
if self.module.params.get('name'):
@ -99,11 +111,14 @@ class LogicalInterconnectGroupFactsModule(OneViewModuleBase):
else:
ligs = self.oneview_client.logical_interconnect_groups.get_all(**self.facts_params)
return dict(changed=False, ansible_facts=dict(logical_interconnect_groups=ligs))
if self.is_old_facts:
return dict(changed=False, ansible_facts=dict(logical_interconnect_groups=ligs))
else:
return dict(changed=False, logical_interconnect_groups=ligs)
def main():
LogicalInterconnectGroupFactsModule().run()
LogicalInterconnectGroupInfoModule().run()
if __name__ == '__main__':

View file

@ -11,10 +11,12 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = '''
---
module: oneview_network_set_facts
short_description: Retrieve facts about the OneView Network Sets
module: oneview_network_set_info
short_description: Retrieve information about the OneView Network Sets
description:
- Retrieve facts about the Network Sets from OneView.
- Retrieve information about the Network Sets from OneView.
- This module was called C(oneview_network_set_facts) before Ansible 2.9, returning C(ansible_facts).
Note that the M(oneview_network_set_info) module no longer returns C(ansible_facts)!
version_added: "2.4"
requirements:
- hpOneView >= 2.0.1
@ -29,7 +31,7 @@ options:
options:
description:
- "List with options to gather facts about Network Set.
- "List with options to gather information about Network Set.
Option allowed: C(withoutEthernet).
The option C(withoutEthernet) retrieves the list of network_sets excluding Ethernet networks."
@ -39,19 +41,21 @@ extends_documentation_fragment:
'''
EXAMPLES = '''
- name: Gather facts about all Network Sets
oneview_network_set_facts:
- name: Gather information about all Network Sets
oneview_network_set_info:
hostname: 172.16.101.48
username: administrator
password: my_password
api_version: 500
no_log: true
delegate_to: localhost
register: result
- debug: var=network_sets
- debug:
msg: "{{ result.network_sets }}"
- name: Gather paginated, filtered, and sorted facts about Network Sets
oneview_network_set_facts:
- name: Gather paginated, filtered, and sorted information about Network Sets
oneview_network_set_info:
hostname: 172.16.101.48
username: administrator
password: my_password
@ -63,11 +67,13 @@ EXAMPLES = '''
filter: name='netset001'
no_log: true
delegate_to: localhost
register: result
- debug: var=network_sets
- debug:
msg: "{{ result.network_sets }}"
- name: Gather facts about all Network Sets, excluding Ethernet networks
oneview_network_set_facts:
- name: Gather information about all Network Sets, excluding Ethernet networks
oneview_network_set_info:
hostname: 172.16.101.48
username: administrator
password: my_password
@ -76,12 +82,13 @@ EXAMPLES = '''
- withoutEthernet
no_log: true
delegate_to: localhost
register: result
- debug: var=network_sets
- debug:
msg: "{{ result.network_sets }}"
- name: Gather facts about a Network Set by name
oneview_network_set_facts:
- name: Gather information about a Network Set by name
oneview_network_set_info:
hostname: 172.16.101.48
username: administrator
password: my_password
@ -89,12 +96,13 @@ EXAMPLES = '''
name: Name of the Network Set
no_log: true
delegate_to: localhost
register: result
- debug: var=network_sets
- debug:
msg: "{{ result.network_sets }}"
- name: Gather facts about a Network Set by name, excluding Ethernet networks
oneview_network_set_facts:
- name: Gather information about a Network Set by name, excluding Ethernet networks
oneview_network_set_info:
hostname: 172.16.101.48
username: administrator
password: my_password
@ -104,13 +112,15 @@ EXAMPLES = '''
- withoutEthernet
no_log: true
delegate_to: localhost
register: result
- debug: var=network_sets
- debug:
msg: "{{ result.network_sets }}"
'''
RETURN = '''
network_sets:
description: Has all the OneView facts about the Network Sets.
description: Has all the OneView information about the Network Sets.
returned: Always, but can be empty.
type: dict
'''
@ -118,7 +128,7 @@ network_sets:
from ansible.module_utils.oneview import OneViewModuleBase
class NetworkSetFactsModule(OneViewModuleBase):
class NetworkSetInfoModule(OneViewModuleBase):
argument_spec = dict(
name=dict(type='str'),
options=dict(type='list'),
@ -126,7 +136,11 @@ class NetworkSetFactsModule(OneViewModuleBase):
)
def __init__(self):
super(NetworkSetFactsModule, self).__init__(additional_arg_spec=self.argument_spec)
super(NetworkSetInfoModule, self).__init__(additional_arg_spec=self.argument_spec)
self.is_old_facts = self.module._name == 'oneview_network_set_facts'
if self.is_old_facts:
self.module.deprecate("The 'oneview_network_set_facts' module has been renamed to 'oneview_network_set_info', "
"and the renamed one no longer returns ansible_facts", version='2.13')
def execute_module(self):
@ -140,12 +154,15 @@ class NetworkSetFactsModule(OneViewModuleBase):
else:
network_sets = self.oneview_client.network_sets.get_all(**self.facts_params)
return dict(changed=False,
ansible_facts=dict(network_sets=network_sets))
if self.is_old_facts:
return dict(changed=False,
ansible_facts=dict(network_sets=network_sets))
else:
return dict(changed=False, network_sets=network_sets)
def main():
NetworkSetFactsModule().run()
NetworkSetInfoModule().run()
if __name__ == '__main__':

View file

@ -11,10 +11,12 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = '''
---
module: oneview_san_manager_facts
short_description: Retrieve facts about one or more of the OneView SAN Managers
module: oneview_san_manager_info
short_description: Retrieve information about one or more of the OneView SAN Managers
description:
- Retrieve facts about one or more of the SAN Managers from OneView
- Retrieve information about one or more of the SAN Managers from OneView
- This module was called C(oneview_san_manager_facts) before Ansible 2.9, returning C(ansible_facts).
Note that the M(oneview_san_manager_info) module no longer returns C(ansible_facts)!
version_added: "2.5"
requirements:
- hpOneView >= 2.0.1
@ -39,15 +41,17 @@ extends_documentation_fragment:
'''
EXAMPLES = '''
- name: Gather facts about all SAN Managers
oneview_san_manager_facts:
- name: Gather information about all SAN Managers
oneview_san_manager_info:
config: /etc/oneview/oneview_config.json
delegate_to: localhost
register: result
- debug: var=san_managers
- debug:
msg: "{{ result.san_managers }}"
- name: Gather paginated, filtered and sorted facts about SAN Managers
oneview_san_manager_facts:
- name: Gather paginated, filtered and sorted information about SAN Managers
oneview_san_manager_info:
config: /etc/oneview/oneview_config.json
params:
start: 0
@ -55,21 +59,25 @@ EXAMPLES = '''
sort: name:ascending
query: isInternal eq false
delegate_to: localhost
register: result
- debug: var=san_managers
- debug:
msg: "{{ result.san_managers }}"
- name: Gather facts about a SAN Manager by provider display name
oneview_san_manager_facts:
- name: Gather information about a SAN Manager by provider display name
oneview_san_manager_info:
config: /etc/oneview/oneview_config.json
provider_display_name: Brocade Network Advisor
delegate_to: localhost
register: result
- debug: var=san_managers
- debug:
msg: "{{ result.san_managers }}"
'''
RETURN = '''
san_managers:
description: Has all the OneView facts about the SAN Managers.
description: Has all the OneView information about the SAN Managers.
returned: Always, but can be null.
type: dict
'''
@ -77,15 +85,19 @@ san_managers:
from ansible.module_utils.oneview import OneViewModuleBase
class SanManagerFactsModule(OneViewModuleBase):
class SanManagerInfoModule(OneViewModuleBase):
argument_spec = dict(
provider_display_name=dict(type='str'),
params=dict(type='dict')
)
def __init__(self):
super(SanManagerFactsModule, self).__init__(additional_arg_spec=self.argument_spec)
super(SanManagerInfoModule, self).__init__(additional_arg_spec=self.argument_spec)
self.resource_client = self.oneview_client.san_managers
self.is_old_facts = self.module._name == 'oneview_san_manager_facts'
if self.is_old_facts:
self.module.deprecate("The 'oneview_san_manager_facts' module has been renamed to 'oneview_san_manager_info', "
"and the renamed one no longer returns ansible_facts", version='2.13')
def execute_module(self):
if self.module.params.get('provider_display_name'):
@ -98,11 +110,14 @@ class SanManagerFactsModule(OneViewModuleBase):
else:
resources = self.oneview_client.san_managers.get_all(**self.facts_params)
return dict(changed=False, ansible_facts=dict(san_managers=resources))
if self.is_old_facts:
return dict(changed=False, ansible_facts=dict(san_managers=resources))
else:
return dict(changed=False, san_managers=resources)
def main():
SanManagerFactsModule().run()
SanManagerInfoModule().run()
if __name__ == '__main__':

View file

@ -5178,38 +5178,38 @@ lib/ansible/modules/remote_management/manageiq/manageiq_tenant.py validate-modul
lib/ansible/modules/remote_management/manageiq/manageiq_user.py validate-modules:E335
lib/ansible/modules/remote_management/manageiq/manageiq_user.py validate-modules:E337
lib/ansible/modules/remote_management/manageiq/manageiq_user.py validate-modules:E338
lib/ansible/modules/remote_management/oneview/oneview_datacenter_facts.py validate-modules:E322
lib/ansible/modules/remote_management/oneview/oneview_datacenter_facts.py validate-modules:E337
lib/ansible/modules/remote_management/oneview/oneview_enclosure_facts.py validate-modules:E322
lib/ansible/modules/remote_management/oneview/oneview_enclosure_facts.py validate-modules:E337
lib/ansible/modules/remote_management/oneview/oneview_datacenter_info.py validate-modules:E322
lib/ansible/modules/remote_management/oneview/oneview_datacenter_info.py validate-modules:E337
lib/ansible/modules/remote_management/oneview/oneview_enclosure_info.py validate-modules:E322
lib/ansible/modules/remote_management/oneview/oneview_enclosure_info.py validate-modules:E337
lib/ansible/modules/remote_management/oneview/oneview_ethernet_network.py validate-modules:E322
lib/ansible/modules/remote_management/oneview/oneview_ethernet_network.py validate-modules:E337
lib/ansible/modules/remote_management/oneview/oneview_ethernet_network_facts.py validate-modules:E322
lib/ansible/modules/remote_management/oneview/oneview_ethernet_network_facts.py validate-modules:E337
lib/ansible/modules/remote_management/oneview/oneview_ethernet_network_info.py validate-modules:E322
lib/ansible/modules/remote_management/oneview/oneview_ethernet_network_info.py validate-modules:E337
lib/ansible/modules/remote_management/oneview/oneview_fc_network.py validate-modules:E322
lib/ansible/modules/remote_management/oneview/oneview_fc_network.py validate-modules:E337
lib/ansible/modules/remote_management/oneview/oneview_fc_network.py validate-modules:E338
lib/ansible/modules/remote_management/oneview/oneview_fc_network_facts.py validate-modules:E322
lib/ansible/modules/remote_management/oneview/oneview_fc_network_facts.py validate-modules:E337
lib/ansible/modules/remote_management/oneview/oneview_fc_network_info.py validate-modules:E322
lib/ansible/modules/remote_management/oneview/oneview_fc_network_info.py validate-modules:E337
lib/ansible/modules/remote_management/oneview/oneview_fcoe_network.py validate-modules:E322
lib/ansible/modules/remote_management/oneview/oneview_fcoe_network.py validate-modules:E337
lib/ansible/modules/remote_management/oneview/oneview_fcoe_network.py validate-modules:E338
lib/ansible/modules/remote_management/oneview/oneview_fcoe_network_facts.py validate-modules:E322
lib/ansible/modules/remote_management/oneview/oneview_fcoe_network_facts.py validate-modules:E337
lib/ansible/modules/remote_management/oneview/oneview_fcoe_network_info.py validate-modules:E322
lib/ansible/modules/remote_management/oneview/oneview_fcoe_network_info.py validate-modules:E337
lib/ansible/modules/remote_management/oneview/oneview_logical_interconnect_group.py validate-modules:E322
lib/ansible/modules/remote_management/oneview/oneview_logical_interconnect_group.py validate-modules:E337
lib/ansible/modules/remote_management/oneview/oneview_logical_interconnect_group.py validate-modules:E338
lib/ansible/modules/remote_management/oneview/oneview_logical_interconnect_group_facts.py validate-modules:E322
lib/ansible/modules/remote_management/oneview/oneview_logical_interconnect_group_facts.py validate-modules:E337
lib/ansible/modules/remote_management/oneview/oneview_logical_interconnect_group_info.py validate-modules:E322
lib/ansible/modules/remote_management/oneview/oneview_logical_interconnect_group_info.py validate-modules:E337
lib/ansible/modules/remote_management/oneview/oneview_network_set.py validate-modules:E322
lib/ansible/modules/remote_management/oneview/oneview_network_set.py validate-modules:E337
lib/ansible/modules/remote_management/oneview/oneview_network_set.py validate-modules:E338
lib/ansible/modules/remote_management/oneview/oneview_network_set_facts.py validate-modules:E322
lib/ansible/modules/remote_management/oneview/oneview_network_set_facts.py validate-modules:E337
lib/ansible/modules/remote_management/oneview/oneview_network_set_info.py validate-modules:E322
lib/ansible/modules/remote_management/oneview/oneview_network_set_info.py validate-modules:E337
lib/ansible/modules/remote_management/oneview/oneview_san_manager.py validate-modules:E322
lib/ansible/modules/remote_management/oneview/oneview_san_manager.py validate-modules:E337
lib/ansible/modules/remote_management/oneview/oneview_san_manager_facts.py validate-modules:E322
lib/ansible/modules/remote_management/oneview/oneview_san_manager_facts.py validate-modules:E337
lib/ansible/modules/remote_management/oneview/oneview_san_manager_info.py validate-modules:E322
lib/ansible/modules/remote_management/oneview/oneview_san_manager_info.py validate-modules:E337
lib/ansible/modules/remote_management/stacki/stacki_host.py validate-modules:E317
lib/ansible/modules/remote_management/stacki/stacki_host.py validate-modules:E322
lib/ansible/modules/remote_management/stacki/stacki_host.py validate-modules:E324
@ -6459,34 +6459,34 @@ test/units/modules/remote_management/oneview/hpe_test_utils.py future-import-boi
test/units/modules/remote_management/oneview/hpe_test_utils.py metaclass-boilerplate
test/units/modules/remote_management/oneview/oneview_module_loader.py future-import-boilerplate
test/units/modules/remote_management/oneview/oneview_module_loader.py metaclass-boilerplate
test/units/modules/remote_management/oneview/test_oneview_datacenter_facts.py future-import-boilerplate
test/units/modules/remote_management/oneview/test_oneview_datacenter_facts.py metaclass-boilerplate
test/units/modules/remote_management/oneview/test_oneview_enclosure_facts.py future-import-boilerplate
test/units/modules/remote_management/oneview/test_oneview_enclosure_facts.py metaclass-boilerplate
test/units/modules/remote_management/oneview/test_oneview_datacenter_info.py future-import-boilerplate
test/units/modules/remote_management/oneview/test_oneview_datacenter_info.py metaclass-boilerplate
test/units/modules/remote_management/oneview/test_oneview_enclosure_info.py future-import-boilerplate
test/units/modules/remote_management/oneview/test_oneview_enclosure_info.py metaclass-boilerplate
test/units/modules/remote_management/oneview/test_oneview_ethernet_network.py future-import-boilerplate
test/units/modules/remote_management/oneview/test_oneview_ethernet_network.py metaclass-boilerplate
test/units/modules/remote_management/oneview/test_oneview_ethernet_network_facts.py future-import-boilerplate
test/units/modules/remote_management/oneview/test_oneview_ethernet_network_facts.py metaclass-boilerplate
test/units/modules/remote_management/oneview/test_oneview_ethernet_network_info.py future-import-boilerplate
test/units/modules/remote_management/oneview/test_oneview_ethernet_network_info.py metaclass-boilerplate
test/units/modules/remote_management/oneview/test_oneview_fc_network.py future-import-boilerplate
test/units/modules/remote_management/oneview/test_oneview_fc_network.py metaclass-boilerplate
test/units/modules/remote_management/oneview/test_oneview_fc_network_facts.py future-import-boilerplate
test/units/modules/remote_management/oneview/test_oneview_fc_network_facts.py metaclass-boilerplate
test/units/modules/remote_management/oneview/test_oneview_fc_network_info.py future-import-boilerplate
test/units/modules/remote_management/oneview/test_oneview_fc_network_info.py metaclass-boilerplate
test/units/modules/remote_management/oneview/test_oneview_fcoe_network.py future-import-boilerplate
test/units/modules/remote_management/oneview/test_oneview_fcoe_network.py metaclass-boilerplate
test/units/modules/remote_management/oneview/test_oneview_fcoe_network_facts.py future-import-boilerplate
test/units/modules/remote_management/oneview/test_oneview_fcoe_network_facts.py metaclass-boilerplate
test/units/modules/remote_management/oneview/test_oneview_fcoe_network_info.py future-import-boilerplate
test/units/modules/remote_management/oneview/test_oneview_fcoe_network_info.py metaclass-boilerplate
test/units/modules/remote_management/oneview/test_oneview_logical_interconnect_group.py future-import-boilerplate
test/units/modules/remote_management/oneview/test_oneview_logical_interconnect_group.py metaclass-boilerplate
test/units/modules/remote_management/oneview/test_oneview_logical_interconnect_group_facts.py future-import-boilerplate
test/units/modules/remote_management/oneview/test_oneview_logical_interconnect_group_facts.py metaclass-boilerplate
test/units/modules/remote_management/oneview/test_oneview_logical_interconnect_group_info.py future-import-boilerplate
test/units/modules/remote_management/oneview/test_oneview_logical_interconnect_group_info.py metaclass-boilerplate
test/units/modules/remote_management/oneview/test_oneview_network_set.py future-import-boilerplate
test/units/modules/remote_management/oneview/test_oneview_network_set.py metaclass-boilerplate
test/units/modules/remote_management/oneview/test_oneview_network_set_facts.py future-import-boilerplate
test/units/modules/remote_management/oneview/test_oneview_network_set_facts.py metaclass-boilerplate
test/units/modules/remote_management/oneview/test_oneview_network_set_info.py future-import-boilerplate
test/units/modules/remote_management/oneview/test_oneview_network_set_info.py metaclass-boilerplate
test/units/modules/remote_management/oneview/test_oneview_san_manager.py future-import-boilerplate
test/units/modules/remote_management/oneview/test_oneview_san_manager.py metaclass-boilerplate
test/units/modules/remote_management/oneview/test_oneview_san_manager_facts.py future-import-boilerplate
test/units/modules/remote_management/oneview/test_oneview_san_manager_facts.py metaclass-boilerplate
test/units/modules/remote_management/oneview/test_oneview_san_manager_info.py future-import-boilerplate
test/units/modules/remote_management/oneview/test_oneview_san_manager_info.py metaclass-boilerplate
test/units/modules/source_control/gitlab.py future-import-boilerplate
test/units/modules/source_control/gitlab.py metaclass-boilerplate
test/units/modules/source_control/test_bitbucket_access_key.py future-import-boilerplate

View file

@ -16,12 +16,12 @@ from ansible.module_utils.oneview import (OneViewModuleException,
OneViewModuleBase)
from ansible.modules.remote_management.oneview.oneview_ethernet_network import EthernetNetworkModule
from ansible.modules.remote_management.oneview.oneview_ethernet_network_facts import EthernetNetworkFactsModule
from ansible.modules.remote_management.oneview.oneview_ethernet_network_info import EthernetNetworkInfoModule
from ansible.modules.remote_management.oneview.oneview_fc_network import FcNetworkModule
from ansible.modules.remote_management.oneview.oneview_fc_network_facts import FcNetworkFactsModule
from ansible.modules.remote_management.oneview.oneview_fc_network_info import FcNetworkInfoModule
from ansible.modules.remote_management.oneview.oneview_fcoe_network import FcoeNetworkModule
from ansible.modules.remote_management.oneview.oneview_fcoe_network_facts import FcoeNetworkFactsModule
from ansible.modules.remote_management.oneview.oneview_fcoe_network_info import FcoeNetworkInfoModule
from ansible.modules.remote_management.oneview.oneview_network_set import NetworkSetModule
from ansible.modules.remote_management.oneview.oneview_network_set_facts import NetworkSetFactsModule
from ansible.modules.remote_management.oneview.oneview_network_set_info import NetworkSetInfoModule
from ansible.modules.remote_management.oneview.oneview_san_manager import SanManagerModule
from ansible.modules.remote_management.oneview.oneview_san_manager_facts import SanManagerFactsModule
from ansible.modules.remote_management.oneview.oneview_san_manager_info import SanManagerInfoModule

View file

@ -3,7 +3,7 @@
import pytest
from ansible.modules.remote_management.oneview.oneview_datacenter_facts import DatacenterFactsModule
from ansible.modules.remote_management.oneview.oneview_datacenter_info import DatacenterInfoModule
from hpe_test_utils import FactsParamsTest
PARAMS_GET_CONNECTED = dict(
@ -13,7 +13,7 @@ PARAMS_GET_CONNECTED = dict(
)
class TestDatacenterFactsModule(FactsParamsTest):
class TestDatacenterInfoModule(FactsParamsTest):
@pytest.fixture(autouse=True)
def setUp(self, mock_ansible_module, mock_ov_client):
self.resource = mock_ov_client.datacenters
@ -25,11 +25,11 @@ class TestDatacenterFactsModule(FactsParamsTest):
self.mock_ansible_module.params = dict(config='config.json',)
DatacenterFactsModule().run()
DatacenterInfoModule().run()
self.mock_ansible_module.exit_json.assert_called_once_with(
changed=False,
ansible_facts=dict(datacenters=({"name": "Data Center Name"}))
datacenters=({"name": "Data Center Name"})
)
def test_should_get_datacenter_by_name(self):
@ -37,11 +37,11 @@ class TestDatacenterFactsModule(FactsParamsTest):
self.mock_ansible_module.params = dict(config='config.json', name="MyDatacenter")
DatacenterFactsModule().run()
DatacenterInfoModule().run()
self.mock_ansible_module.exit_json.assert_called_once_with(
changed=False,
ansible_facts=dict(datacenters=([{"name": "Data Center Name"}]))
datacenters=([{"name": "Data Center Name"}])
)
def test_should_get_datacenter_visual_content(self):
@ -52,12 +52,12 @@ class TestDatacenterFactsModule(FactsParamsTest):
self.mock_ansible_module.params = PARAMS_GET_CONNECTED
DatacenterFactsModule().run()
DatacenterInfoModule().run()
self.mock_ansible_module.exit_json.assert_called_once_with(
changed=False,
ansible_facts={'datacenter_visual_content': {'name': 'Visual Content'},
'datacenters': [{'name': 'Data Center Name', 'uri': '/rest/datacenter/id'}]}
datacenter_visual_content={'name': 'Visual Content'},
datacenters=[{'name': 'Data Center Name', 'uri': '/rest/datacenter/id'}]
)
def test_should_get_none_datacenter_visual_content(self):
@ -65,10 +65,10 @@ class TestDatacenterFactsModule(FactsParamsTest):
self.mock_ansible_module.params = PARAMS_GET_CONNECTED
DatacenterFactsModule().run()
DatacenterInfoModule().run()
self.mock_ansible_module.exit_json.assert_called_once_with(
changed=False,
ansible_facts={'datacenter_visual_content': None,
'datacenters': []}
datacenter_visual_content=None,
datacenters=[]
)

View file

@ -2,7 +2,7 @@
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from units.compat import unittest
from ansible.modules.remote_management.oneview.oneview_enclosure_facts import EnclosureFactsModule
from ansible.modules.remote_management.oneview.oneview_enclosure_info import EnclosureInfoModule
from hpe_test_utils import FactsParamsTestCase
@ -51,10 +51,10 @@ ENCLOSURE_ENVIRONMENTAL_CONFIG = {
}
class EnclosureFactsSpec(unittest.TestCase,
FactsParamsTestCase):
class EnclosureInfoSpec(unittest.TestCase,
FactsParamsTestCase):
def setUp(self):
self.configure_mocks(self, EnclosureFactsModule)
self.configure_mocks(self, EnclosureInfoModule)
self.enclosures = self.mock_ov_client.enclosures
FactsParamsTestCase.configure_client_mock(self, self.enclosures)
@ -62,22 +62,22 @@ class EnclosureFactsSpec(unittest.TestCase,
self.enclosures.get_all.return_value = PRESENT_ENCLOSURES
self.mock_ansible_module.params = PARAMS_GET_ALL
EnclosureFactsModule().run()
EnclosureInfoModule().run()
self.mock_ansible_module.exit_json.assert_called_once_with(
changed=False,
ansible_facts=dict(enclosures=(PRESENT_ENCLOSURES))
enclosures=(PRESENT_ENCLOSURES)
)
def test_should_get_enclosure_by_name(self):
self.enclosures.get_by.return_value = PRESENT_ENCLOSURES
self.mock_ansible_module.params = PARAMS_GET_BY_NAME
EnclosureFactsModule().run()
EnclosureInfoModule().run()
self.mock_ansible_module.exit_json.assert_called_once_with(
changed=False,
ansible_facts=dict(enclosures=(PRESENT_ENCLOSURES))
enclosures=(PRESENT_ENCLOSURES)
)
@ -89,15 +89,14 @@ class EnclosureFactsSpec(unittest.TestCase,
self.mock_ansible_module.params = PARAMS_GET_BY_NAME_WITH_OPTIONS
EnclosureFactsModule().run()
EnclosureInfoModule().run()
self.mock_ansible_module.exit_json.assert_called_once_with(
changed=False,
ansible_facts=dict(enclosures=PRESENT_ENCLOSURES,
enclosure_script=ENCLOSURE_SCRIPT,
enclosure_environmental_configuration=ENCLOSURE_ENVIRONMENTAL_CONFIG,
enclosure_utilization=ENCLOSURE_UTILIZATION)
enclosures=PRESENT_ENCLOSURES,
enclosure_script=ENCLOSURE_SCRIPT,
enclosure_environmental_configuration=ENCLOSURE_ENVIRONMENTAL_CONFIG,
enclosure_utilization=ENCLOSURE_UTILIZATION
)
def test_should_get_all_utilization_data(self):
@ -108,7 +107,7 @@ class EnclosureFactsSpec(unittest.TestCase,
self.mock_ansible_module.params = PARAMS_GET_BY_NAME_WITH_OPTIONS
EnclosureFactsModule().run()
EnclosureInfoModule().run()
self.enclosures.get_utilization.assert_called_once_with(PRESENT_ENCLOSURES[0]['uri'], fields='', filter='',
view='', refresh='')
@ -121,7 +120,7 @@ class EnclosureFactsSpec(unittest.TestCase,
self.mock_ansible_module.params = PARAMS_GET_UTILIZATION_WITH_PARAMS
EnclosureFactsModule().run()
EnclosureInfoModule().run()
date_filter = ["startDate=2016-06-30T03:29:42.000Z", "endDate=2016-07-01T03:29:42.000Z"]

View file

@ -3,7 +3,7 @@
from units.compat import unittest
from oneview_module_loader import EthernetNetworkFactsModule
from oneview_module_loader import EthernetNetworkInfoModule
from hpe_test_utils import FactsParamsTestCase
ERROR_MSG = 'Fake message error'
@ -47,11 +47,11 @@ ENET_ASSOCIATED_PROFILES = [dict(uri=ENET_ASSOCIATED_PROFILE_URIS[0], name='Serv
dict(uri=ENET_ASSOCIATED_PROFILE_URIS[1], name='Server Profile 2')]
class EthernetNetworkFactsSpec(unittest.TestCase,
FactsParamsTestCase
):
class EthernetNetworkInfoSpec(unittest.TestCase,
FactsParamsTestCase
):
def setUp(self):
self.configure_mocks(self, EthernetNetworkFactsModule)
self.configure_mocks(self, EthernetNetworkInfoModule)
self.ethernet_networks = self.mock_ov_client.ethernet_networks
FactsParamsTestCase.configure_client_mock(self, self.ethernet_networks)
@ -59,22 +59,22 @@ class EthernetNetworkFactsSpec(unittest.TestCase,
self.ethernet_networks.get_all.return_value = PRESENT_ENETS
self.mock_ansible_module.params = PARAMS_GET_ALL
EthernetNetworkFactsModule().run()
EthernetNetworkInfoModule().run()
self.mock_ansible_module.exit_json.assert_called_once_with(
changed=False,
ansible_facts=dict(ethernet_networks=(PRESENT_ENETS))
ethernet_networks=(PRESENT_ENETS)
)
def test_should_get_enet_by_name(self):
self.ethernet_networks.get_by.return_value = PRESENT_ENETS
self.mock_ansible_module.params = PARAMS_GET_BY_NAME
EthernetNetworkFactsModule().run()
EthernetNetworkInfoModule().run()
self.mock_ansible_module.exit_json.assert_called_once_with(
changed=False,
ansible_facts=dict(ethernet_networks=(PRESENT_ENETS))
ethernet_networks=(PRESENT_ENETS)
)
def test_should_get_enet_by_name_with_options(self):
@ -86,13 +86,13 @@ class EthernetNetworkFactsSpec(unittest.TestCase,
self.mock_ansible_module.params = PARAMS_GET_BY_NAME_WITH_OPTIONS
EthernetNetworkFactsModule().run()
EthernetNetworkInfoModule().run()
self.mock_ansible_module.exit_json.assert_called_once_with(
changed=False,
ansible_facts=dict(ethernet_networks=PRESENT_ENETS,
enet_associated_profiles=ENET_ASSOCIATED_PROFILES,
enet_associated_uplink_groups=ENET_ASSOCIATED_UPLINK_GROUPS)
ethernet_networks=PRESENT_ENETS,
enet_associated_profiles=ENET_ASSOCIATED_PROFILES,
enet_associated_uplink_groups=ENET_ASSOCIATED_UPLINK_GROUPS
)

View file

@ -2,7 +2,7 @@
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from units.compat import unittest
from oneview_module_loader import FcNetworkFactsModule
from oneview_module_loader import FcNetworkInfoModule
from hpe_test_utils import FactsParamsTestCase
ERROR_MSG = 'Fake message error'
@ -23,10 +23,10 @@ PRESENT_NETWORKS = [{
}]
class FcNetworkFactsSpec(unittest.TestCase,
FactsParamsTestCase):
class FcNetworkInfoSpec(unittest.TestCase,
FactsParamsTestCase):
def setUp(self):
self.configure_mocks(self, FcNetworkFactsModule)
self.configure_mocks(self, FcNetworkInfoModule)
self.fc_networks = self.mock_ov_client.fc_networks
FactsParamsTestCase.configure_client_mock(self, self.fc_networks)
@ -34,22 +34,22 @@ class FcNetworkFactsSpec(unittest.TestCase,
self.fc_networks.get_all.return_value = PRESENT_NETWORKS
self.mock_ansible_module.params = PARAMS_GET_ALL
FcNetworkFactsModule().run()
FcNetworkInfoModule().run()
self.mock_ansible_module.exit_json.assert_called_once_with(
changed=False,
ansible_facts=dict(fc_networks=PRESENT_NETWORKS)
fc_networks=PRESENT_NETWORKS
)
def test_should_get_fc_network_by_name(self):
self.fc_networks.get_by.return_value = PRESENT_NETWORKS
self.mock_ansible_module.params = PARAMS_GET_BY_NAME
FcNetworkFactsModule().run()
FcNetworkInfoModule().run()
self.mock_ansible_module.exit_json.assert_called_once_with(
changed=False,
ansible_facts=dict(fc_networks=PRESENT_NETWORKS)
fc_networks=PRESENT_NETWORKS
)

View file

@ -3,7 +3,7 @@
from units.compat import unittest
from oneview_module_loader import FcoeNetworkFactsModule
from oneview_module_loader import FcoeNetworkInfoModule
from hpe_test_utils import FactsParamsTestCase
@ -25,11 +25,11 @@ PRESENT_NETWORKS = [{
}]
class FcoeNetworkFactsSpec(unittest.TestCase,
FactsParamsTestCase
):
class FcoeNetworkInfoSpec(unittest.TestCase,
FactsParamsTestCase
):
def setUp(self):
self.configure_mocks(self, FcoeNetworkFactsModule)
self.configure_mocks(self, FcoeNetworkInfoModule)
self.fcoe_networks = self.mock_ov_client.fcoe_networks
FactsParamsTestCase.configure_client_mock(self, self.fcoe_networks)
@ -37,22 +37,22 @@ class FcoeNetworkFactsSpec(unittest.TestCase,
self.fcoe_networks.get_all.return_value = PRESENT_NETWORKS
self.mock_ansible_module.params = PARAMS_GET_ALL
FcoeNetworkFactsModule().run()
FcoeNetworkInfoModule().run()
self.mock_ansible_module.exit_json.assert_called_once_with(
changed=False,
ansible_facts=dict(fcoe_networks=PRESENT_NETWORKS)
fcoe_networks=PRESENT_NETWORKS
)
def test_should_get_fcoe_network_by_name(self):
self.fcoe_networks.get_by.return_value = PRESENT_NETWORKS
self.mock_ansible_module.params = PARAMS_GET_BY_NAME
FcoeNetworkFactsModule().run()
FcoeNetworkInfoModule().run()
self.mock_ansible_module.exit_json.assert_called_once_with(
changed=False,
ansible_facts=dict(fcoe_networks=PRESENT_NETWORKS)
fcoe_networks=PRESENT_NETWORKS
)

View file

@ -2,7 +2,7 @@
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from units.compat import unittest
from ansible.modules.remote_management.oneview.oneview_logical_interconnect_group_facts import LogicalInterconnectGroupFactsModule
from ansible.modules.remote_management.oneview.oneview_logical_interconnect_group_info import LogicalInterconnectGroupInfoModule
from hpe_test_utils import FactsParamsTestCase
@ -24,9 +24,9 @@ PRESENT_LIGS = [{
}]
class LogicalInterconnectGroupFactsSpec(unittest.TestCase, FactsParamsTestCase):
class LogicalInterconnectGroupInfoSpec(unittest.TestCase, FactsParamsTestCase):
def setUp(self):
self.configure_mocks(self, LogicalInterconnectGroupFactsModule)
self.configure_mocks(self, LogicalInterconnectGroupInfoModule)
self.logical_interconnect_groups = self.mock_ov_client.logical_interconnect_groups
FactsParamsTestCase.configure_client_mock(self, self.logical_interconnect_groups)
@ -34,22 +34,22 @@ class LogicalInterconnectGroupFactsSpec(unittest.TestCase, FactsParamsTestCase):
self.logical_interconnect_groups.get_all.return_value = PRESENT_LIGS
self.mock_ansible_module.params = PARAMS_GET_ALL
LogicalInterconnectGroupFactsModule().run()
LogicalInterconnectGroupInfoModule().run()
self.mock_ansible_module.exit_json.assert_called_once_with(
changed=False,
ansible_facts=dict(logical_interconnect_groups=(PRESENT_LIGS))
logical_interconnect_groups=(PRESENT_LIGS)
)
def test_should_get_lig_by_name(self):
self.logical_interconnect_groups.get_by.return_value = PRESENT_LIGS
self.mock_ansible_module.params = PARAMS_GET_BY_NAME
LogicalInterconnectGroupFactsModule().run()
LogicalInterconnectGroupInfoModule().run()
self.mock_ansible_module.exit_json.assert_called_once_with(
changed=False,
ansible_facts=dict(logical_interconnect_groups=(PRESENT_LIGS))
logical_interconnect_groups=(PRESENT_LIGS)
)

View file

@ -2,7 +2,7 @@
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from units.compat import unittest
from oneview_module_loader import NetworkSetFactsModule
from oneview_module_loader import NetworkSetInfoModule
from hpe_test_utils import FactsParamsTestCase
ERROR_MSG = 'Fake message error'
@ -30,10 +30,10 @@ PARAMS_GET_BY_NAME_WITHOUT_ETHERNET = dict(
)
class NetworkSetFactsSpec(unittest.TestCase,
FactsParamsTestCase):
class NetworkSetInfoSpec(unittest.TestCase,
FactsParamsTestCase):
def setUp(self):
self.configure_mocks(self, NetworkSetFactsModule)
self.configure_mocks(self, NetworkSetInfoModule)
self.network_sets = self.mock_ov_client.network_sets
FactsParamsTestCase.configure_client_mock(self, self.network_sets)
@ -49,13 +49,13 @@ class NetworkSetFactsSpec(unittest.TestCase,
self.network_sets.get_all.return_value = network_sets
self.mock_ansible_module.params = PARAMS_GET_ALL
NetworkSetFactsModule().run()
NetworkSetInfoModule().run()
self.network_sets.get_all.assert_called_once_with()
self.mock_ansible_module.exit_json.assert_called_once_with(
changed=False,
ansible_facts=dict(network_sets=network_sets))
network_sets=network_sets)
def test_should_get_all_network_sets_without_ethernet(self):
network_sets = [{
@ -69,13 +69,13 @@ class NetworkSetFactsSpec(unittest.TestCase,
self.network_sets.get_all.return_value = network_sets
self.mock_ansible_module.params = PARAMS_GET_ALL
NetworkSetFactsModule().run()
NetworkSetInfoModule().run()
self.network_sets.get_all.assert_called_once_with()
self.mock_ansible_module.exit_json.assert_called_once_with(
changed=False,
ansible_facts=dict(network_sets=network_sets))
network_sets=network_sets)
def test_should_get_network_set_by_name(self):
network_sets = [{
@ -86,13 +86,13 @@ class NetworkSetFactsSpec(unittest.TestCase,
self.network_sets.get_by.return_value = network_sets
self.mock_ansible_module.params = PARAMS_GET_BY_NAME
NetworkSetFactsModule().run()
NetworkSetInfoModule().run()
self.network_sets.get_by.assert_called_once_with('name', 'Network Set 1')
self.mock_ansible_module.exit_json.assert_called_once_with(
changed=False,
ansible_facts=dict(network_sets=network_sets))
network_sets=network_sets)
def test_should_get_network_set_by_name_without_ethernet(self):
network_sets = [{
@ -103,14 +103,14 @@ class NetworkSetFactsSpec(unittest.TestCase,
self.network_sets.get_all_without_ethernet.return_value = network_sets
self.mock_ansible_module.params = PARAMS_GET_BY_NAME_WITHOUT_ETHERNET
NetworkSetFactsModule().run()
NetworkSetInfoModule().run()
expected_filter = "\"'name'='Network Set 1'\""
self.network_sets.get_all_without_ethernet.assert_called_once_with(filter=expected_filter)
self.mock_ansible_module.exit_json.assert_called_once_with(
changed=False,
ansible_facts=dict(network_sets=network_sets))
network_sets=network_sets)
if __name__ == '__main__':

View file

@ -2,11 +2,11 @@
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from units.compat import unittest
from oneview_module_loader import SanManagerFactsModule
from oneview_module_loader import SanManagerInfoModule
from hpe_test_utils import FactsParamsTestCase
class SanManagerFactsSpec(unittest.TestCase, FactsParamsTestCase):
class SanManagerInfoSpec(unittest.TestCase, FactsParamsTestCase):
ERROR_MSG = 'Fake message error'
PARAMS_GET_ALL = dict(
@ -25,7 +25,7 @@ class SanManagerFactsSpec(unittest.TestCase, FactsParamsTestCase):
}]
def setUp(self):
self.configure_mocks(self, SanManagerFactsModule)
self.configure_mocks(self, SanManagerInfoModule)
self.san_managers = self.mock_ov_client.san_managers
FactsParamsTestCase.configure_client_mock(self, self.san_managers)
@ -34,33 +34,33 @@ class SanManagerFactsSpec(unittest.TestCase, FactsParamsTestCase):
self.san_managers.get_all.return_value = self.PRESENT_SAN_MANAGERS
self.mock_ansible_module.params = self.PARAMS_GET_ALL
SanManagerFactsModule().run()
SanManagerInfoModule().run()
self.mock_ansible_module.exit_json.assert_called_once_with(
changed=False,
ansible_facts=dict(san_managers=self.PRESENT_SAN_MANAGERS)
san_managers=self.PRESENT_SAN_MANAGERS
)
def test_should_get_by_display_name(self):
self.san_managers.get_by_provider_display_name.return_value = self.PRESENT_SAN_MANAGERS[0]
self.mock_ansible_module.params = self.PARAMS_GET_BY_PROVIDER_DISPLAY_NAME
SanManagerFactsModule().run()
SanManagerInfoModule().run()
self.mock_ansible_module.exit_json.assert_called_once_with(
changed=False,
ansible_facts=dict(san_managers=self.PRESENT_SAN_MANAGERS)
san_managers=self.PRESENT_SAN_MANAGERS
)
def test_should_return_empty_list_when_get_by_display_name_is_null(self):
self.san_managers.get_by_provider_display_name.return_value = None
self.mock_ansible_module.params = self.PARAMS_GET_BY_PROVIDER_DISPLAY_NAME
SanManagerFactsModule().run()
SanManagerInfoModule().run()
self.mock_ansible_module.exit_json.assert_called_once_with(
changed=False,
ansible_facts=dict(san_managers=[])
san_managers=[]
)