'Setup subnet parameters
This methods setups subnet parameters which are available
in both create and update.'

def _setup_subnet_parameters(self, params, data, is_create=True):

    is_update = (not is_create)
    params['enable_dhcp'] = data['enable_dhcp']
    if (int(data['ip_version']) == 6):
        ipv6_modes = utils.get_ipv6_modes_attrs_from_menu(data['ipv6_modes'])
        if (ipv6_modes[0] and is_create):
            params['ipv6_ra_mode'] = ipv6_modes[0]
        if (ipv6_modes[1] and is_create):
            params['ipv6_address_mode'] = ipv6_modes[1]
    if data['allocation_pools']:
        pools = [dict(zip(['start', 'end'], pool.strip().split(','))) for pool in data['allocation_pools'].splitlines() if pool.strip()]
        params['allocation_pools'] = pools
    if (data['host_routes'] or is_update):
        routes = [dict(zip(['destination', 'nexthop'], route.strip().split(','))) for route in data['host_routes'].splitlines() if route.strip()]
        params['host_routes'] = routes
    if (data['dns_nameservers'] or is_update):
        nameservers = [ns.strip() for ns in data['dns_nameservers'].splitlines() if ns.strip()]
        params['dns_nameservers'] = nameservers
