<commit_before># Copyright 2018 NOKIA
#
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

import logging

from openstack_dashboard.api.neutron import NeutronAPIDictWrapper
from openstack_dashboard.api.neutron import neutronclient

LOG = logging.getLogger(__name__)


def router_add_gateway(request, router_id, network_id, enable_snat=None):
    body = {'network_id': network_id}
    if enable_snat is not None:
        body['enable_snat'] = enable_snat
    neutronclient(request).add_gateway_router(router_id, body)


def vsd_organisation_list(request, **params):
    LOG.debug("vsd_organisation_list(): params=%s", params)
    vsd_organisations = neutronclient(request).list(
        'vsd_organisations', '/vsd-organisations',
        True, **params).get('vsd_organisations')<commit_msg>Fix neutron passthrough function import<commit_after># Copyright 2018 NOKIA
#
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

# flake8: noqa

import logging

# DO NOT REMOVE: This allows users to do neutron.get_subnets although it
# is not implemented here.
from openstack_dashboard.api.neutron import *  # noqa

LOG = logging.getLogger(__name__)


def router_add_gateway(request, router_id, network_id, enable_snat=None):
    body = {'network_id': network_id}
    if enable_snat is not None:
        body['enable_snat'] = enable_snat
    neutronclient(request).add_gateway_router(router_id, body)


def vsd_organisation_list(request, **params):
    LOG.debug("vsd_organisation_list(): params=%s", params)
    vsd_organisations = neutronclient(request).list(
        'vsd_organisations', '/vsd-organisations',
        True, **params).get('vsd_organisations')
{'fraction_non_alphanumeric': 0.08574610244988864, 'fraction_numerical': 0.006310319227913883, 'mean_word_length': 4.253411306042885, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5497761', 'n_tokens_mistral': 796, 'n_tokens_neox': 775, 'n_words': 262}