| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
from neutron.plugins.ml2.drivers.l2pop import rpc as l2pop_rpc |
| 17 |
from neutron.plugins.ml2 import managers |
| 18 |
from neutron.plugins.ml2 import rpc as rpc |
| 19 |
from neutron_lib.agent import topics |
| 20 |
|
| 21 |
|
| 22 |
class Tunnel_Calls: |
| 23 |
"""Common tunnel calls for L2 agent.""" |
| 24 |
def __init__(self): |
| 25 |
self._construct_rpc_stuff() |
| 26 |
|
| 27 |
def _construct_rpc_stuff(self): |
| 28 |
self.notifier = rpc.AgentNotifierApi(topics.AGENT) |
| 29 |
self.type_manager = managers.TypeManager() |
| 30 |
self.tunnel_rpc_obj = rpc.RpcCallbacks(self.notifier, |
| 31 |
self.type_manager) |
| 32 |
|
| 33 |
def trigger_tunnel_sync(self, context, tunnel_ip): |
| 34 |
"""Sends tunnel sync RPC message to the neutron |
| 35 |
|
| 36 |
L2 agent. |
| 37 |
""" |
| 38 |
tunnel_dict = {'tunnel_ip': tunnel_ip, |
| 39 |
'tunnel_type': 'vxlan'} |
| 40 |
self.tunnel_rpc_obj.tunnel_sync(context, |
| 41 |
**tunnel_dict) |
| 42 |
|
| 43 |
def trigger_l2pop_sync(self, context, other_fdb_entries): |
| 44 |
"""Sends L2pop ADD RPC message to the neutron L2 agent.""" |
| 45 |
l2pop_rpc.L2populationAgentNotifyAPI().add_fdb_entries( |
| 46 |
context, other_fdb_entries) |
| 47 |
|
| 48 |
def trigger_l2pop_delete(self, context, other_fdb_entries, host=None): |
| 49 |
"""Sends L2pop DELETE RPC message to the neutron L2 agent.""" |
| 50 |
l2pop_rpc.L2populationAgentNotifyAPI().remove_fdb_entries( |
| 51 |
context, other_fdb_entries, host) |