def test_add_tunnel_endpoints(self): tun_1 = ovs_db_v2.add_tunnel_endpoint('192.168.0.1') tun_2 = ovs_db_v2.add_tunnel_endpoint('192.168.0.2') self.assertEquals(1, tun_1.id) self.assertEquals('192.168.0.1', tun_1.ip_address) self.assertEquals(2, tun_2.id) self.assertEquals('192.168.0.2', tun_2.ip_address)
def tunnel_sync(self, rpc_context, **kwargs): """Update new tunnel. Updates the datbase with the tunnel IP. All listening agents will also be notified about the new tunnel IP. """ tunnel_ip = kwargs.get('tunnel_ip') # Update the database with the IP tunnel = ovs_db_v2.add_tunnel_endpoint(tunnel_ip) tunnels = ovs_db_v2.get_tunnel_endpoints() entry = dict() entry['tunnels'] = tunnels # Notify all other listening agents self.notifier.tunnel_update(rpc_context, tunnel.ip_address, tunnel.id) # Return the list of tunnels IP's to the agent return entry
def tunnel_sync(self, rpc_context, **kwargs): """Update new tunnel. Updates the datbase with the tunnel IP. All listening agents will also be notified about the new tunnel IP. """ tunnel_ip = kwargs.get("tunnel_ip") # Update the database with the IP tunnel = ovs_db_v2.add_tunnel_endpoint(tunnel_ip) tunnels = ovs_db_v2.get_tunnel_endpoints() entry = dict() entry["tunnels"] = tunnels # Notify all other listening agents self.notifier.tunnel_update(rpc_context, tunnel.ip_address, tunnel.id) # Return the list of tunnels IP's to the agent return entry