batfish-bot: 

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.png" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/batfish/pybatfish/190)
<!-- Reviewable:end -->

diff --git a/jupyter_notebooks/README.md b/jupyter_notebooks/README.md
index 2a6435a..444001f 100644
--- a/jupyter_notebooks/README.md
+++ b/jupyter_notebooks/README.md
@@ -11,7 +11,9 @@ The current list of notebooks are:
    - Shows how to use analyze ACLs and firewalls rules using Batfish. 
 - [Provably Safe ACL and Firewall Changes](Provably%20Safe%20ACL%20and%20Firewall%20Changes.ipynb) [[video](https://www.youtube.com/watch?v=MJYLVL9UOWk)]
    - Shows a workflow to ensure changes to ACLs and firewall rules are correct and safe.
-
+- [Introduction to Forwarding Analysis](Introduction%20to%20Forwarding%20Analysis.ipynb)
+   - Shows how forwarding paths can be analyzed using traceroute and reachability queries.
+   
 We will continue adding notebooks that demonstrating additional use cases of Batfish. 
 
 ------
diff --git a/pybatfish/datamodel/flow.py b/pybatfish/datamodel/flow.py
index fd25b71..e92dca7 100644
--- a/pybatfish/datamodel/flow.py
+++ b/pybatfish/datamodel/flow.py
@@ -113,15 +113,13 @@ class Flow(DataModelElement):
         iface_str = self._iface_str()
         vrf_str = self._vrf_str()
         return \
-            "start={node}{iface}{vrf} [{src_ip}:{src_port}->{dst_ip}:{dst_port}" \
+            "start={node}{iface}{vrf} [{src}->{dst}" \
             " {ip_proto}{dscp}{ecn}{offset}{length}{state}{flags}]".format(
                 node=self.ingressNode,
                 iface=iface_str,
                 vrf=vrf_str,
-                src_ip=self.srcIp,
-                src_port=self.srcPort,
-                dst_ip=self.dstIp,
-                dst_port=self.dstPort,
+                src=self._ip_port(self.srcIp, self.srcPort),
+                dst=self._ip_port(self.dstIp, self.dstPort),
                 ip_proto=self.get_ip_protocol_str(),
                 dscp=(" dscp={}".format(self.dscp) if self.dscp != 0 else ""),
                 ecn=(" ecn={}".format(self.ecn) if self.ecn != 0 else ""),
@@ -164,17 +162,32 @@ class Flow(DataModelElement):
         else:
             return self.ipProtocol
 
+    def _has_ports(self):
+        # type: () -> bool
+        return self.ipProtocol in ['TCP', 'UDP', 'DCCP', 'SCTP']
+
     def _repr_html_(self):
         # type: () -> str
-        return "Src IP: {src_ip}<br>Src Port: {src_port}<br>Dst IP: {dst_ip}<br>Dst Port: {dst_port}<br>IP Protocol: {ip_protocol}<br>Start Location: {node}{iface}{vrf}" \
-            .format(node=self.ingressNode,
-                    iface=escape_html(self._iface_str()),
-                    vrf=escape_html(self._vrf_str()),
-                    src_ip=self.srcIp,
-                    src_port=self.srcPort,
-                    dst_ip=self.dstIp,
-                    dst_port=self.dstPort,
-                    ip_protocol=self.get_ip_protocol_str())
+        lines = []
+        lines.append('Src IP: %s' % self.srcIp)
+        if self._has_ports():
+            lines.append('Src Port: %d' % self.srcPort)
+        lines.append('Dst IP: %s' % self.dstIp)
+        if self._has_ports():
+            lines.append('Dst Port: %d' % self.dstPort)
+        lines.append('IP Protocol: %s' % self.get_ip_protocol_str())
+        lines.append('Start Location: {node}{iface}{vrf}'.format(
+            node=self.ingressNode,
+            iface=self.ingressInterface,
+            vrf=self.ingressVrf))
+        return '<br>'.join(lines)
+
+    def _ip_port(self, ip, port):
+        # type: (str, int) -> str
+        if self._has_ports():
+            return "{ip}:{port}".format(ip=ip, port=port)
+        else:
+            return self.srcIp
 
 
 @attr.s(frozen=True)

Pretty-printing ICMP flows should not include src/dst port 
Example of current rendering:
```
Src IP: 2.1.2.1
Src Port: 0
Dst IP: 2.1.1.1
Dst Port: 0
IP Protocol: ICMP
Start Location: as2core1
```
diff --git a/tests/datamodel/test_flow.py b/tests/datamodel/test_flow.py
index 28a26ce..a869cd0 100644
--- a/tests/datamodel/test_flow.py
+++ b/tests/datamodel/test_flow.py
@@ -62,7 +62,7 @@ def testFlowDeserialization():
 
     # check the string representation has the essential elements (without forcing a strict format)
     flowStr = str(flow)
-    assert "5.5.1.1:0" in flowStr
+    assert "5.5.1.1" in flowStr
     assert "intface" in flowStr
     assert "vrfAbc" in flowStr
 
@@ -209,5 +209,75 @@ def test_match_tcp_generators():
                                                  MatchTcpFlags.match_rst()]
 
 
+def test_flow_repr_html_ports():
+    # ICMP flows do not have ports
+    flowDict = {
+        "dscp": 0,
+        "dstIp": "2.1.1.1",
+        "dstPort": 0,
+        "ecn": 0,
+        "fragmentOffset": 0,
+        "icmpCode": 255,
+        "icmpVar": 255,
+        "ingressNode": "ingress",
+        "ipProtocol": "ICMP",
+        "packetLength": 0,
+        "srcIp": "5.5.1.1",
+        "srcPort": 0,
+        "state": "NEW",
+        "tag": "BASE",
+        "tcpFlagsAck": 0,
+        "tcpFlagsCwr": 0,
+        "tcpFlagsEce": 0,
+        "tcpFlagsFin": 0,
+        "tcpFlagsPsh": 0,
+        "tcpFlagsRst": 0,
+        "tcpFlagsSyn": 0,
+        "tcpFlagsUrg": 0
+    }
+    assert("Port" not in Flow.from_dict(flowDict)._repr_html_())
+
+    # UDP
+    flowDict['ipProtocol'] = "UDP"
+    assert ("Port" in Flow.from_dict(flowDict)._repr_html_())
+
+
+def test_flow_str_ports():
+    # ICMP flows do not have ports
+    flowDict = {
+        "dscp": 0,
+        "dstIp": "2.1.1.1",
+        "dstPort": 1234,
+        "ecn": 0,
+        "fragmentOffset": 0,
+        "icmpCode": 255,
+        "icmpVar": 255,
+        "ingressNode": "ingress",
+        "ipProtocol": "ICMP",
+        "packetLength": 0,
+        "srcIp": "5.5.1.1",
+        "srcPort": 2345,
+        "state": "NEW",
+        "tag": "BASE",
+        "tcpFlagsAck": 0,
+        "tcpFlagsCwr": 0,
+        "tcpFlagsEce": 0,
+        "tcpFlagsFin": 0,
+        "tcpFlagsPsh": 0,
+        "tcpFlagsRst": 0,
+        "tcpFlagsSyn": 0,
+        "tcpFlagsUrg": 0
+    }
+    str = repr(Flow.from_dict(flowDict))
+    assert("2.1.1.1:1234" not in str)
+    assert("5.5.1.1:2345" not in str)
+
+    # UDP
+    flowDict['ipProtocol'] = "UDP"
+    str = repr(Flow.from_dict(flowDict))
+    assert("2.1.1.1:1234" not in str)
+    assert("5.5.1.1:2345" not in str)
+
+
 if __name__ == "__main__":
     pytest.main()

pip install -e .[dev,test]
parse_log_pytest
requirements.txt
pytest requests_mock
apt-get update apt-get install -y gcc
3.6
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
alabaster==0.7.13
anyio==3.6.2
argon2-cffi==21.3.0
argon2-cffi-bindings==21.2.0
async-generator==1.10
attrs==22.2.0
Babel==2.11.0
backcall==0.2.0
bleach==4.1.0
build==0.9.0
certifi==2021.5.30
cffi==1.15.1
charset-normalizer==2.0.12
check-manifest==0.48
comm==0.1.4
contextvars==2.4
coverage==6.2
dataclasses==0.8
decorator==5.1.1
deepdiff==5.7.0
defusedxml==0.7.1
Deprecated==1.2.18
docutils==0.17.1
entrypoints==0.4
flake8==5.0.4
flake8-docstrings==1.6.0
flake8-import-order==0.18.2
idna==3.10
imagesize==1.4.1
immutables==0.19
importlib-metadata==4.2.0
iniconfig==1.1.1
ipykernel==5.5.6
ipython==7.16.3
ipython-genutils==0.2.0
ipywidgets==7.8.5
jedi==0.17.2
Jinja2==3.0.3
json5==0.9.16
jsonschema==3.2.0
jupyter==1.1.1
jupyter-client==7.1.2
jupyter-console==6.4.3
jupyter-core==4.9.2
jupyter-server==1.13.1
jupyterlab==3.2.9
jupyterlab-pygments==0.1.2
jupyterlab-server==2.10.3
jupyterlab_widgets==1.1.11
MarkupSafe==2.0.1
mccabe==0.7.0
mistune==0.8.4
mypy==0.971
mypy-extensions==1.0.0
nbclassic==0.3.5
nbclient==0.5.9
nbconvert==6.0.7
nbformat==5.1.3
nest-asyncio==1.6.0
notebook==6.4.10
numpy==1.19.5
ordered-set==4.0.2
packaging==21.3
pandas==1.1.5
pandocfilters==1.5.1
parso==0.7.1
pep517==0.13.1
pexpect==4.9.0
pickleshare==0.7.5
pluggy==1.0.0
prometheus-client==0.17.1
prompt-toolkit==3.0.36
ptyprocess==0.7.0
py==1.11.0
-e git+https://github.com/batfish/pybatfish.git@1fe6bc41347d12a3936e2151deb17f8a5f6d289f#egg=pybatfish
pycodestyle==2.9.1
pycparser==2.21
pydocstyle==6.3.0
pyflakes==2.5.0
Pygments==2.14.0
pyparsing==3.1.4
pyrsistent==0.18.0
pytest==7.0.1
python-dateutil==2.9.0.post0
pytz==2025.2
pyzmq==25.1.2
requests==2.27.1
requests-mock==1.12.1
requests-toolbelt==1.0.0
Send2Trash==1.8.3
simplejson==3.20.1
six==1.17.0
sniffio==1.2.0
snowballstemmer==2.2.0
Sphinx==4.3.2
sphinx-rtd-theme==1.3.0
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
terminado==0.12.1
testpath==0.6.0
tomli==1.2.3
tornado==6.1
traitlets==4.3.3
typed-ast==1.5.5
typing_extensions==4.1.1
urllib3==1.26.20
wcwidth==0.2.13
webencodings==0.5.1
websocket-client==1.3.1
widgetsnbextension==3.6.10
wrapt==1.16.0
zipp==3.6.0

name: pybatfish
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - alabaster==0.7.13
      - anyio==3.6.2
      - argon2-cffi==21.3.0
      - argon2-cffi-bindings==21.2.0
      - async-generator==1.10
      - attrs==22.2.0
      - babel==2.11.0
      - backcall==0.2.0
      - bleach==4.1.0
      - build==0.9.0
      - cffi==1.15.1
      - charset-normalizer==2.0.12
      - check-manifest==0.48
      - comm==0.1.4
      - contextvars==2.4
      - coverage==6.2
      - dataclasses==0.8
      - decorator==5.1.1
      - deepdiff==5.7.0
      - defusedxml==0.7.1
      - deprecated==1.2.18
      - docutils==0.17.1
      - entrypoints==0.4
      - flake8==5.0.4
      - flake8-docstrings==1.6.0
      - flake8-import-order==0.18.2
      - idna==3.10
      - imagesize==1.4.1
      - immutables==0.19
      - importlib-metadata==4.2.0
      - iniconfig==1.1.1
      - ipykernel==5.5.6
      - ipython==7.16.3
      - ipython-genutils==0.2.0
      - ipywidgets==7.8.5
      - jedi==0.17.2
      - jinja2==3.0.3
      - json5==0.9.16
      - jsonschema==3.2.0
      - jupyter==1.1.1
      - jupyter-client==7.1.2
      - jupyter-console==6.4.3
      - jupyter-core==4.9.2
      - jupyter-server==1.13.1
      - jupyterlab==3.2.9
      - jupyterlab-pygments==0.1.2
      - jupyterlab-server==2.10.3
      - jupyterlab-widgets==1.1.11
      - markupsafe==2.0.1
      - mccabe==0.7.0
      - mistune==0.8.4
      - mypy==0.971
      - mypy-extensions==1.0.0
      - nbclassic==0.3.5
      - nbclient==0.5.9
      - nbconvert==6.0.7
      - nbformat==5.1.3
      - nest-asyncio==1.6.0
      - notebook==6.4.10
      - numpy==1.19.5
      - ordered-set==4.0.2
      - packaging==21.3
      - pandas==1.1.5
      - pandocfilters==1.5.1
      - parso==0.7.1
      - pep517==0.13.1
      - pexpect==4.9.0
      - pickleshare==0.7.5
      - pluggy==1.0.0
      - prometheus-client==0.17.1
      - prompt-toolkit==3.0.36
      - ptyprocess==0.7.0
      - py==1.11.0
      - pycodestyle==2.9.1
      - pycparser==2.21
      - pydocstyle==6.3.0
      - pyflakes==2.5.0
      - pygments==2.14.0
      - pyparsing==3.1.4
      - pyrsistent==0.18.0
      - pytest==7.0.1
      - python-dateutil==2.9.0.post0
      - pytz==2025.2
      - pyzmq==25.1.2
      - requests==2.27.1
      - requests-mock==1.12.1
      - requests-toolbelt==1.0.0
      - send2trash==1.8.3
      - simplejson==3.20.1
      - six==1.17.0
      - sniffio==1.2.0
      - snowballstemmer==2.2.0
      - sphinx==4.3.2
      - sphinx-rtd-theme==1.3.0
      - sphinxcontrib-applehelp==1.0.2
      - sphinxcontrib-devhelp==1.0.2
      - sphinxcontrib-htmlhelp==2.0.0
      - sphinxcontrib-jquery==4.1
      - sphinxcontrib-jsmath==1.0.1
      - sphinxcontrib-qthelp==1.0.3
      - sphinxcontrib-serializinghtml==1.1.5
      - terminado==0.12.1
      - testpath==0.6.0
      - tomli==1.2.3
      - tornado==6.1
      - traitlets==4.3.3
      - typed-ast==1.5.5
      - typing-extensions==4.1.1
      - urllib3==1.26.20
      - wcwidth==0.2.13
      - webencodings==0.5.1
      - websocket-client==1.3.1
      - widgetsnbextension==3.6.10
      - wrapt==1.16.0
      - zipp==3.6.0
prefix: /opt/conda/envs/pybatfish

tests/datamodel/test_flow.py::test_flow_repr_html_ports
tests/datamodel/test_flow.py::testFlowDeserialization tests/datamodel/test_flow.py::testFlowDeserializationOptionalMissing tests/datamodel/test_flow.py::test_flow_trace_hop_no_transformed_flow tests/datamodel/test_flow.py::test_get_ip_protocol_str tests/datamodel/test_flow.py::test_header_constraints_serialization tests/datamodel/test_flow.py::test_hop_repr_str tests/datamodel/test_flow.py::test_match_tcp_generators tests/datamodel/test_flow.py::test_flow_str_ports
pybatfish/datamodel/flow.py jupyter_notebooks/README.md
pybatfish/datamodel/flow.py jupyter_notebooks/README.md