2.3.3.1 Lab - Create A Network Device Inventory in Python
2.3.3.1 Lab - Create A Network Device Inventory in Python
Objectives
Part 1: Investigate the Network Device Inventory API
Part 2: Modify the Code
Background / Scenario
An important skill for software developers is the ability to obtain, modify, and reuse code that was previously
created. Coder communities like GitHub and Stack Overflow, among others, provide support for developers
and many people freely share code there. Obtaining and modifying code for a specific need is an import skill
for adding efficiency to the software development process.
In this lab, you will modify the code that was created to obtain the inventory of network hosts and repurpose it
to obtain an inventory of network devices.
Required Resources
Access to the APIC-EM in the DevNet sandbox at https://{YOUR-APICEM}.cisco.com
Postman
Python 3 with IDLE
Python requests module
Python tabulate module
The functions file that you have created
The print_hosts.py file that you created or the print_hosts_sol.py file
Access to the Internet
Cisco and/or its affiliates. All rights reserved. Cisco Confidential Page 1 of 2 www.netacad.com
Lab - Create a Network Device Inventory in Python
b. Compare GET /network-device JSON to the GET /host JSON you viewed in the previous lab. How
is the structure of the network device inventory JSON similar to the structure of the host inventory
JSON?
La respuestas Get/network-divace cuenta con muchas mas claves 34 en total, minetras que los Get /host
Son dispositivos conectados a una red y utilizan estos servicios por lo cual las claves van a disminuir
c. How many network devices are included in the inventory?
Existen dos objetos y 6 respuestas
d. You want to access and display information for the network devices similar to the information that
are displayed for the hosts. However, the keys do not use the names hostType and hostIP. What
are the names of similar keys for the network devices?
Reflection
1. What are the advantages of modifying and reusing code in this way?
Menos lineas de codigo, es mucho mas comprensible y se aprovecha el trabajo anterior, se reduce el tiempo
de ejecución
2. What are the challenges?
Comprender el codigo que se va a reutilizar para reducer el tiempo y que no se convierta en un problema
3. What can developers do to make the process easier?
La reutilizacion de Código es una tecnica que se la emplea para reducer el tiempo en el Desarrollo del
Proyecto, permitiendonos reutilizar grandes componentes de software.
Cisco and/or its affiliates. All rights reserved. Cisco Confidential Page 2 of 2 www.netacad.com