still available even if a row has been deleted.
"""
- def __init__(self, p):
- self.uuid = p.uuid
- self.network_id = p.network_id
- self.interface_id = p.interface_id
- self.state = p.state
- self.status = p.op_status
-
- def __eq__(self, other):
- '''Compare only fields that will cause us to re-wire.'''
- try:
- return (self and other
- and self.interface_id == other.interface_id
- and self.state == other.state)
- except:
- return False
-
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __hash__(self):
- return hash(self.uuid)
-
-
-class Portv2(object):
- """Represents a quantumv2 port.
-
- Class stores port data in a ORM-free way, so attributres are
- still available even if a row has been deleted.
- """
-
def __init__(self, p):
self.id = p.id
self.network_id = p.network_id
class OVSQuantumAgent(object):
def __init__(self, integ_br, root_helper, polling_interval,
- reconnect_interval, target_v2_api, rpc):
+ reconnect_interval, rpc):
self.root_helper = root_helper
self.setup_integration_br(integ_br)
self.polling_interval = polling_interval
self.reconnect_interval = reconnect_interval
- self.target_v2_api = target_v2_api
self.rpc = rpc
if rpc:
self.setup_rpc(integ_br)
continue
for port in ports:
- if self.target_v2_api:
- all_bindings[port.id] = port
- else:
- all_bindings[port.interface_id] = port
+ all_bindings[port.id] = port
vlan_bindings = {}
try:
MAX_VLAN_TAG = 4094
def __init__(self, integ_br, tun_br, local_ip, root_helper,
- polling_interval, reconnect_interval, target_v2_api,
- rpc):
+ polling_interval, reconnect_interval, rpc):
'''Constructor.
:param integ_br: name of the integration bridge.
:param root_helper: utility to use when running shell cmds.
:param polling_interval: interval (secs) to poll DB.
:param reconnect_internal: retry interval (secs) on DB error.
- :param target_v2_api: if True use v2 api.
:param rpc: if True use RPC interface to interface with plugin.
'''
self.root_helper = root_helper
self.local_ip = local_ip
self.tunnel_count = 0
self.setup_tunnel_br(tun_br)
- self.target_v2_api = target_v2_api
self.rpc = rpc
if rpc:
self.setup_rpc(integ_br)
while True:
try:
- if self.target_v2_api:
- all_bindings = dict((p.id, Portv2(p))
- for p in db.ports.all())
- else:
- all_bindings = dict((p.interface_id, Port(p))
- for p in db.ports.all())
+ all_bindings = dict((p.id, Port(p))
+ for p in db.ports.all())
all_bindings_vif_port_ids = set(all_bindings)
lsw_id_bindings = dict((bind.network_id, bind.vlan_id)
for bind in db.vlan_bindings.all())
root_helper = cfg.CONF.AGENT.root_helper
rpc = cfg.CONF.AGENT.rpc
- # Determine API Version to use
- target_v2_api = cfg.CONF.AGENT.target_v2_api
-
- # RPC only works with v2
- if rpc and not target_v2_api:
- rpc = False
-
if enable_tunneling:
# Get parameters for OVSQuantumTunnelAgent
tun_br = cfg.CONF.OVS.tunnel_bridge
local_ip = cfg.CONF.OVS.local_ip
plugin = OVSQuantumTunnelAgent(integ_br, tun_br, local_ip, root_helper,
polling_interval, reconnect_interval,
- target_v2_api, rpc)
+ rpc)
else:
# Get parameters for OVSQuantumAgent.
plugin = OVSQuantumAgent(integ_br, root_helper, polling_interval,
- reconnect_interval, target_v2_api, rpc)
+ reconnect_interval, rpc)
# Start everything.
plugin.daemon_loop(db_connection_url)
b = ovs_quantum_agent.OVSQuantumTunnelAgent(self.INT_BRIDGE,
self.TUN_BRIDGE,
'10.0.0.1',
- 'sudo', 2, 2, False, False)
+ 'sudo', 2, 2, False)
self.mox.VerifyAll()
def testProvisionLocalVlan(self):
a = ovs_quantum_agent.OVSQuantumTunnelAgent(self.INT_BRIDGE,
self.TUN_BRIDGE,
'10.0.0.1',
- 'sudo', 2, 2, False, False)
+ 'sudo', 2, 2, False)
a.available_local_vlans = set([LV_ID])
a.provision_local_vlan(NET_UUID, LS_ID)
self.mox.VerifyAll()
a = ovs_quantum_agent.OVSQuantumTunnelAgent(self.INT_BRIDGE,
self.TUN_BRIDGE,
'10.0.0.1',
- 'sudo', 2, 2, False, False)
+ 'sudo', 2, 2, False)
a.available_local_vlans = set()
a.local_vlan_map[NET_UUID] = LVM
a.reclaim_local_vlan(NET_UUID, LVM)
a = ovs_quantum_agent.OVSQuantumTunnelAgent(self.INT_BRIDGE,
self.TUN_BRIDGE,
'10.0.0.1',
- 'sudo', 2, 2, False, False)
+ 'sudo', 2, 2, False)
a.local_vlan_map[NET_UUID] = LVM
a.port_bound(VIF_PORT, NET_UUID, LS_ID)
self.mox.VerifyAll()
a = ovs_quantum_agent.OVSQuantumTunnelAgent(self.INT_BRIDGE,
self.TUN_BRIDGE,
'10.0.0.1',
- 'sudo', 2, 2, False, False)
+ 'sudo', 2, 2, False)
a.available_local_vlans = set([LV_ID])
a.local_vlan_map[NET_UUID] = LVM
a.port_unbound(VIF_PORT, NET_UUID)
a = ovs_quantum_agent.OVSQuantumTunnelAgent(self.INT_BRIDGE,
self.TUN_BRIDGE,
'10.0.0.1',
- 'sudo', 2, 2, False, False)
+ 'sudo', 2, 2, False)
a.available_local_vlans = set([LV_ID])
a.local_vlan_map[NET_UUID] = LVM
a.port_dead(VIF_PORT)