<commit_before>#
# Copyright (c) 2014 Juniper Networks, Inc. All rights reserved.
#

import bottle
import cgitb
import gevent
import json
import logging
from pprint import pformat
import requests
import sys

from vnc_api import vnc_api
from neutron_plugin_db import DBInterface


LOG = logging.getLogger(__name__)

@bottle.error(400)
def error_400(err):
    return err.body

@bottle.error(404)
def error_404(err):
    return err.body

@bottle.error(409)
def error_409(err):
    return err.body


class NeutronPluginInterface(object):
    """
    An instance of this class receives requests from Contrail Neutron Plugin
    """

    def __init__(self, api_server_ip, api_server_port, conf_sections):
        self._vnc_api_ip = api_server_ip
        self._vnc_api_port = api_server_port
        self._config_sections = conf_sections
        self._auth_user = conf_sections.get('KEYSTONE', 'admin_user')
        self._auth_passwd = conf_sections.get('KEYSTONE', '<PASSWORD>')
        self._auth_tenant = conf_sections.get('KEYSTONE', 'admin_tenant_name')
        self._multi_tenancy = None
        self._vnc_lib = None
        self._cfgdb = None
        self._cfgdb_map = {}
<commit_msg>Fix multi tenancy for neutron plugin access<commit_after>#
# Copyright (c) 2014 Juniper Networks, Inc. All rights reserved.
#

import bottle
import cgitb
import gevent
import json
import logging
from pprint import pformat
import requests
import sys
import string
import ConfigParser

from vnc_api import vnc_api
from neutron_plugin_db import DBInterface


LOG = logging.getLogger(__name__)

@bottle.error(400)
def error_400(err):
    return err.body

@bottle.error(404)
def error_404(err):
    return err.body

@bottle.error(409)
def error_409(err):
    return err.body


class NeutronPluginInterface(object):
    """
    An instance of this class receives requests from Contrail Neutron Plugin
    """

    def __init__(self, api_server_ip, api_server_port, conf_sections):
        self._vnc_api_ip = api_server_ip
        self._vnc_api_port = api_server_port
        self._config_sections = conf_sections
        self._auth_user = conf_sections.get('KEYSTONE', 'admin_user')
        self._auth_passwd = conf_sections.get('KEYSTONE', '<PASSWORD>_password')
        self._auth_tenant = conf_sections.get('KEYSTONE', 'admin_tenant_name')
        try:
            self._multi_tenancy = conf_sections.get('DEFAULTS', 'multi_tenancy')
        except ConfigParser.NoOptionError:
            self._multi_tenancy = False
        self._vnc_lib = None
        self._cfgdb = None
        self._cfgdb_map = {}

{'fraction_non_alphanumeric': 0.08401084010840108, 'fraction_numerical': 0.017034456058846303, 'mean_word_length': 3.689655172413793, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '6272363', 'n_tokens_mistral': 860, 'n_tokens_neox': 813, 'n_words': 202}