Debian Codegraph @

neutron_vpnaas/tests/unit/dummy_ipsec.py

raw
1 # Copyright 2018, Fujitsu Vietnam Ltd.
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.service_drivers import base_ipsec
19 from neutron_vpnaas.services.vpn.service_drivers import ipsec_validator
20
21
22 IPSEC = 'ipsec'
23 BASE_IPSEC_VERSION = '1.0'
24
25
26 class DummyIPsecVPNDriver(base_ipsec.BaseIPsecVPNDriver):
27 """Dummy VPN Service Driver class for IPsec."""
28
29 def __init__(self, service_plugin):
30 super().__init__(
31 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 'dummy_ipsec_driver', self.endpoints, fanout=False)
39 self.conn.consume_in_threads()
40 self.agent_rpc = base_ipsec.IPsecVpnAgentApi(
41 'dummy_ipsec_agent', BASE_IPSEC_VERSION, self)