| 1 |
# Copyright 2015, Nachi Ueno, NTT I3, Inc. |
| 2 |
# All Rights Reserved. |
| 3 |
# |
| 4 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 5 |
# not use this file except in compliance with the License. You may obtain |
| 6 |
# a copy of the License at |
| 7 |
# |
| 8 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
# |
| 10 |
# Unless required by applicable law or agreed to in writing, software |
| 11 |
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 12 |
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 13 |
# License for the specific language governing permissions and limitations |
| 14 |
# under the License. |
| 15 |
|
| 16 |
from neutron_lib import rpc as n_rpc |
| 17 |
|
| 18 |
from neutron_vpnaas.services.vpn.common import topics |
| 19 |
from neutron_vpnaas.services.vpn.service_drivers import base_ipsec |
| 20 |
from neutron_vpnaas.services.vpn.service_drivers import ipsec_validator |
| 21 |
|
| 22 |
|
| 23 |
IPSEC = 'ipsec' |
| 24 |
BASE_IPSEC_VERSION = '1.0' |
| 25 |
|
| 26 |
|
| 27 |
class IPsecVPNDriver(base_ipsec.BaseIPsecVPNDriver): |
| 28 |
"""VPN Service Driver class for IPsec.""" |
| 29 |
|
| 30 |
def __init__(self, service_plugin): |
| 31 |
super().__init__(service_plugin, |
| 32 |
ipsec_validator.IpsecVpnValidator(self)) |
| 33 |
|
| 34 |
def create_rpc_conn(self): |
| 35 |
self.endpoints = [base_ipsec.IPsecVpnDriverCallBack(self)] |
| 36 |
self.conn = n_rpc.Connection() |
| 37 |
self.conn.create_consumer( |
| 38 |
topics.IPSEC_DRIVER_TOPIC, self.endpoints, fanout=False) |
| 39 |
self.conn.consume_in_threads() |
| 40 |
self.agent_rpc = base_ipsec.IPsecVpnAgentApi( |
| 41 |
topics.IPSEC_AGENT_TOPIC, BASE_IPSEC_VERSION, self) |