#Ansible `netapp.ontap.na_ontap_service_processor_network` seems to be broken when using REST

1 messages · Page 1 of 1 (latest)

rare wedge
#

Maybe I am holding it wrong, but seems SP network cannot be set if using REST and DHCP is not enabled. I get the following message:
{'message': 'Error in BMC Network configuration: enabled option for IPv4 interface is missing.', 'code': '13631591'}.

A quick search in the module code shows this:

def modify_service_processor_network_rest(self, modify):
        api = 'cluster/nodes'
        body = {'service_processor': {}}
        ipv4_or_ipv6_body = {}
        if self.parameters.get('gateway_ip_address'):
            ipv4_or_ipv6_body['gateway'] = self.parameters['gateway_ip_address']
        if self.parameters.get('netmask'):
            ipv4_or_ipv6_body['netmask'] = self.parameters['netmask']
        if self.parameters.get('prefix_length'):
            ipv4_or_ipv6_body['netmask'] = self.parameters['prefix_length']
        if self.parameters.get('ip_address'):
            ipv4_or_ipv6_body['address'] = self.parameters['ip_address']
        if ipv4_or_ipv6_body:
            body['service_processor'][self.ipv4_or_ipv6] = ipv4_or_ipv6_body
        if 'dhcp' in self.parameters:
            body['service_processor']['dhcp_enabled'] = True if self.parameters['dhcp'] == 'v4' else False
        # if dhcp is enabled in REST, setting ip_address details manually requires dhcp: 'none' in params.
        # if dhcp: 'none' is not in params set it False to disable dhcp and assign manual ip address.
        elif ipv4_or_ipv6_body.get('gateway') and ipv4_or_ipv6_body.get('address') and ipv4_or_ipv6_body.get('netmask'):
            body['service_processor']['dhcp_enabled'] = False
        dummy, error = rest_generic.patch_async(self.rest_api, api, self.uuid, body)
        if error:
            self.module.fail_json(msg='Error modifying service processor network: %s' % error)
        if self.parameters.get('wait_for_completion'):
            retries = 25
            while self.is_sp_modified_rest(modify) is False and retries > 0:
                time.sleep(15)
                retries -= 1

Clearly - again if not wrong - there is a lot missing in that function. If dhcp_enabled is set to false, ONTAP expects either ipv6_interface or ipv4_interface that hold the address, netmask and gateway... Looks like someone was in real hurry to release this and missed what is about 60% of the function..

To confirm - using zapi works (that is the modify_service_processor_network() function.

obtuse gale
#

Hey sorry most of the ansible team was out the last week, were catching up.

I'll have the team look in to this an get back to you

royal gate
#

Hello, I experienced the same issue and set use_rest: never as workaround 😉