Skip to content
Snippets Groups Projects

Add screen scaping issue example

Merged Urs Baumann requested to merge add_screen_scaping_issue_example into master
1 file
+ 33
12
Compare changes
  • Side-by-side
  • Inline
@@ -42,22 +42,27 @@
\end{frame}
\begin{frame}
\frametitle{Most Popular Solutions}
\begin{description}[[leftmargin=!]
\setlength\itemsep{1em}
\item[TextFSM] template based state machine for parsing semi-formatted text
\item[TTP] Template Text Parser
\item[Genie] pyATS SDK from CISCO
\item[PyParsing] A Python Parsing Module
\item[Regex] Regular expression
\end{description}
\begin{frame}[fragile]{Human-Readable}
\begin{minted}[fontsize=\footnotesize]{python}
cpu_lines = cpu_output.splitlines()
# Matches either of
# Cpu(s): 5.2%us, 1.4%sy, 0.0%ni, 92.2%id, 0.6%wa, 0.3%hi, 0.4%si, 0.0%st ( 4.16 > )
# %Cpu(s): 4.2 us, 0.9 sy, 0.0 ni, 94.6 id, 0.0 wa, 0.1 hi, 0.2 si, 0.0 st ( 4.16 < )
m = re.match(".*ni, (?P<idle>.*).id.*", cpu_lines[2])
environment_counters["cpu"][0] = {
"%usage": round(100 - float(m.group("idle")), 1)
}
# Matches either of
# Mem: 3844356k total, 3763184k used, 81172k free, 16732k buffers ( 4.16 > )
# KiB Mem: 32472080 total, 5697604 used, 26774476 free, 372052 buffers ( 4.16 < )
# MiB Mem : 3889.2 total, 150.3 free, 1104.5 used, 2634.4 buff/cache (4.27 < )
mem_regex = (
\end{minted}
\url{https://github.com/napalm-automation/napalm/pull/1673}
\end{frame}
\begin{frame}{Learning Objectives}{Screen Scraping}
Participants will be able to
@@ -72,6 +77,22 @@
\end{frame}
\begin{frame}
\frametitle{Most Popular Solutions}
\begin{description}[[leftmargin=!]
\setlength\itemsep{1em}
\item[TextFSM] template based state machine for parsing semi-formatted text
\item[TTP] Template Text Parser
\item[Genie] pyATS SDK from CISCO
\item[PyParsing] A Python Parsing Module
\item[Regex] Regular expression
\end{description}
\end{frame}
\begin{frame}{TextFSM}
\begin{itemize}
Loading