1
# Copyright 2015 Brocade Communications System, Inc.
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
8
# http://www.apache.org/licenses/LICENSE-2.0
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
17
from networking_brocade.vyatta.common import l3_agent as vyatta_l3
18
from neutron.agent import l3_agent as entry
19
from oslo_config import cfg
20
from oslo_log import log as logging
22
from neutron_vpnaas.services.vpn import vyatta_vpn_service
25
LOG = logging.getLogger(__name__)
30
default=['neutron_vpnaas.services.vpn.device_drivers.'
31
'vyatta_ipsec.VyattaIPSecDriver'],
32
help=_("The vpn device drivers Neutron will use")),
34
cfg.CONF.register_opts(vpn_agent_opts, 'vpnagent')
37
class VyattaVPNAgent(vyatta_l3.L3AgentMiddleware):
38
def __init__(self, host, conf=None):
39
super(VyattaVPNAgent, self).__init__(host, conf)
40
self.service = vyatta_vpn_service.VyattaVPNService(self)
41
self.event_observers.add(self.service)
42
self.devices = self.service.load_device_drivers(host)
44
def _router_added(self, router_id, router):
45
super(VyattaVPNAgent, self)._router_added(router_id, router)
46
for device in self.devices:
47
device.create_router(router_id)
49
def _router_removed(self, router_id):
50
for device in self.devices:
51
device.destroy_router(router_id)
52
super(VyattaVPNAgent, self)._router_removed(router_id)
54
def _process_router_if_compatible(self, router):
55
super(VyattaVPNAgent, self)._process_router_if_compatible(router)
56
for device in self.devices:
57
device.sync(self.context, None)
62
manager='neutron_vpnaas.services.vpn.vyatta_agent.VyattaVPNAgent')