Пример #1
0
#         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 os
import six
import yaml

from gbpservice.nfp.common import constants as nfp_constants
from gbpservice.nfp.core import log as nfp_logging

LOG = nfp_logging.getLogger(__name__)

NEUTRON_ML2_CONF = "/etc/neutron/plugins/ml2/ml2_conf.ini"


def _parse_service_flavor_string(service_flavor_str):
    service_details = {}
    if ',' not in service_flavor_str:
        service_details['device_type'] = 'nova'
        service_details['service_vendor'] = service_flavor_str
    else:
        service_flavor_dict = dict(
            item.split('=') for item in service_flavor_str.split(','))
        service_details = {
            key.strip(): value.strip()
            for key, value in six.iteritems(service_flavor_dict)
Пример #2
0
import os
import oslo_messaging as messaging
import requests
import six

from gbpservice.contrib.nfp.configurator.agents import agent_base
from gbpservice.contrib.nfp.configurator.lib import constants as common_const
from gbpservice.contrib.nfp.configurator.lib import fw_constants as const
from gbpservice.contrib.nfp.configurator.lib import utils as load_driver
from gbpservice.nfp.core import event as nfp_event
from gbpservice.nfp.core import log as nfp_logging
from gbpservice.nfp.core import module as nfp_api

from oslo_serialization import jsonutils

LOG = nfp_logging.getLogger(__name__)


class FwaasRpcSender(agent_base.AgentBaseEventHandler):
    """ Implements Fwaas response path to Neutron plugin.

    Methods of this class are invoked by the FwaasEventHandler class
    for sending response from driver to the Fwaas Neutron plugin.

    """

    def __init__(self, sc, host, drivers, rpcmgr):
        super(FwaasRpcSender, self).__init__(sc, drivers, rpcmgr)
        self.host = host

    def set_firewall_status(self, agent_info,