Updating check_switch_started in p4runtime_switch.py (#85)

The previous implementation had a race conditiona between the
socket check and the BMv2 startup. Sometimes, if the check happen
just before (or as) BMv2 was trying to bind the port, it would
not be able to bind it. This solution uses psutil's equivalent
to 'netstat' to determine whether is BMv2 has bound the port yet.

Also, some minor README and comment improvements.
This commit is contained in:
Brian O'Connor
2017-11-08 11:48:15 -08:00
committed by Robert Soule
parent b2161b8a27
commit b41473fcc0
4 changed files with 40 additions and 20 deletions

View File

@@ -48,13 +48,20 @@ def writeTunnelRules(p4info_helper, ingress_sw, egress_sw, tunnel_id,
# 2) Tunnel Transit Rule
# The rule will need to be added to the myTunnel_exact table and match on
# the tunnel ID (hdr.myTunnel.dst_id). For our simple topology, transit
# traffic will need to be forwarded on the using the myTunnel_forward action
# on the SWITCH_TO_SWITCH_PORT (port 2).
# the tunnel ID (hdr.myTunnel.dst_id). Traffic will need to be forwarded
# using the myTunnel_forward action on the port connected to the next switch.
#
# We will only need on transit rule on the ingress switch because we are
# For our simple topology, switch 1 and switch 2 are connected using a
# link attached to port 2 on both switches. We have defined a variable at
# the top of the file, SWITCH_TO_SWITCH_PORT, that you can use as the output
# port for this action.
#
# We will only need a transit rule on the ingress switch because we are
# using a simple topology. In general, you'll need on transit rule for
# each switch in the path (except the last one).
# each switch in the path (except the last switch, which has the egress rule),
# and you will need to select the port dynamically for each switch based on
# your topology.
table_entry = p4info_helper.buildTableEntry(
table_name="myTunnel_exact",
match_fields={