/usr/bin/ovs-l3ping is in openvswitch-test 2.9.0-0ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | #! /usr/bin/python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
ovs L3 ping utility allows to do tests between two remote hosts without
opening holes in the firewall for the XML RPC control connection. This is
achieved by tunneling the control connection inside the tunnel itself.
"""
import socket
import xmlrpclib
import ovstest.args as args
import ovstest.tests as tests
import ovstest.util as util
def get_packet_sizes(me, he, remote_ip):
"""
This function retrieves MTUs from both hosts and returns a list of
packet sizes, that are more likely to uncover possible configuration
issues.
"""
mtu_node1 = 1500
mtu_node2 = 1500
server1 = util.rpc_client(me[0], me[1])
server2 = util.rpc_client(he[0], he[1])
iface1 = server2.get_interface(remote_ip)
iface2 = server1.get_interface_from_routing_decision(remote_ip)
if iface1:
mtu_node1 = server2.get_interface_mtu(iface1)
if iface2:
mtu_node2 = server1.get_interface_mtu(iface2)
return util.get_datagram_sizes(mtu_node1, mtu_node2)
if __name__ == '__main__':
local_server = None
try:
args = args.l3_initialize_args()
tunnel_mode = args.tunnelMode
if args.server is not None: # Start in server mode
local_server = tests.configure_l3(args.server, tunnel_mode)
local_server.wait()
elif args.client is not None: # Run in client mode
bandwidth = args.targetBandwidth
interval = args.testInterval
me = (util.ip_from_cidr(args.client[1][0]), args.client[1][1],
args.client[1][0], args.client[1][2])
he = (args.client[2][0], args.client[2][1],
args.client[2][0], args.client[2][2])
local_server = tests. configure_l3(args.client, tunnel_mode)
ps = get_packet_sizes(me, he, args.client[0])
tests.do_direct_tests(me, he, bandwidth, interval, ps)
except KeyboardInterrupt:
print "Terminating"
except xmlrpclib.Fault:
print "Couldn't contact peer"
except socket.error:
print "Couldn't contact peer"
except xmlrpclib.ProtocolError:
print "XMLRPC control channel was abruptly terminated"
finally:
if local_server is not None:
local_server.terminate()
|