Skip to content
This repository has been archived by the owner on Jul 19, 2024. It is now read-only.

Commit

Permalink
change < > to &lt; &gt;
Browse files Browse the repository at this point in the history
  • Loading branch information
jrogers1126 committed Jun 29, 2015
1 parent ba6d4c1 commit 8c42211
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/usingpyezlibrary.md
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ These two features are very powerful, but are somewhat abstract concepts. To bet

In this example, we’re going to build on the XML examples shown previously in the “RPC Mapping Examples” section, and show how we can use PyEZ to programmatically collect details about port states. This might feel like a simplistic use case, but this is actually the script that the author first wrote when starting out with the PyEZ library to solve a real world “on the job” customer problem.

The first thing we need to do is map the <rpc> for the “show interface” command to a table structure. A table takes all of the XML output and collects into an ordered fashion. Table and view definitions are written in the YAML format, which is an easy to read format that is also programming language independent. The PyEZ library stores these definitions in the “lib/jnpr/junos/op/” directory in the folder where the PyEZ library is stored.
The first thing we need to do is map the &lt;rpc&gt; for the “show interface” command to a table structure. A table takes all of the XML output and collects into an ordered fashion. Table and view definitions are written in the YAML format, which is an easy to read format that is also programming language independent. The PyEZ library stores these definitions in the “lib/jnpr/junos/op/” directory in the folder where the PyEZ library is stored.

First, lets have a look at the following table definition that ships with the PyEZ library.

Expand All @@ -374,9 +374,9 @@ PhyPortTable:
view: PhyPortView
```
If you recall from our investigations in the “DMI and the NETCONF Protocol” the RPC command associated with “show interface” command is <get-interface-information>. The second line of the output above requests that this table definition should map to the XML output from that <rpc-reply>. We then filter down our interface list to just Fast Ethernet, Gigabit Ethernet and 10 Gigabit Ethernet interfaces (“[fge]e*”). The “item” section creates the equivalent of the table row in this data structure. By defining “physical-interface” as the “item” each interface from the XML output will be represented separately in the Table Structure.
If you recall from our investigations in the “DMI and the NETCONF Protocol” the RPC command associated with “show interface” command is &lt;get-interface-information&gt;. The second line of the output above requests that this table definition should map to the XML output from that &lt;rpc-reply&gt;. We then filter down our interface list to just Fast Ethernet, Gigabit Ethernet and 10 Gigabit Ethernet interfaces (“[fge]e*”). The “item” section creates the equivalent of the table row in this data structure. By defining “physical-interface” as the “item” each interface from the XML output will be represented separately in the Table Structure.
The last line in the output above is used to feed this table into a “view”. The view definition below takes each of the XML tags from the <rpc-reply> and maps them to dictionary keys on the left. These keys are the equivalent of columns in this data structure.
The last line in the output above is used to feed this table into a “view”. The view definition below takes each of the XML tags from the &lt;rpc-reply&gt; and maps them to dictionary keys on the left. These keys are the equivalent of columns in this data structure.
**PhyPort View Definition:**
```yaml
Expand Down

0 comments on commit 8c42211

Please sign in to comment.