GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — python_code_samples_network/apic-em_get_hosts at master · CiscoDevNet/python_code_samples_network

Expand file tree

/

apic-em_get_hosts

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
/

apic-em_get_hosts

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
README.md
README.md
 
 
gethosts.py
gethosts.py
 
 
requirements.txt
requirements.txt
 
 

README.md

Outline

Get Hosts List from APIC-EM

This example script uses the requests Python library to interact with the APIC-EM and retrieve the list of clients connected.

This script has been tested with Python 3.5, however may work with other versions.

DevNet Sandbox

This script targets the Always On APIC-EM DevNet Sandbox.

Find details on the Sandbox here.

To execute this script against a different device, update the variables that list the APIC-EM IP, User and Password.

Requirements

Python

  • requests

Getting Started

  • Clone the Python Examples and change into the directory.

    git clone https://github.com/CiscoDevNet/python_code_samples_network
    cd apic-em_get_hosts
  • Create and activate a virtualenv

    virtualenv venv --python=python3.5
    source venv/bin/activate 
  • Install the requirements

    pip install -r requirements.txt
  • Run the script

    $ python gethosts.py
    Client List from APIC-EM
    IP Address           MAC Address          Type
    10.1.15.117          00:24:d7:43:59:d8    wireless
    10.2.1.22            5c:f9:dd:52:07:78    wired
    10.1.12.20           e8:9a:8f:7a:22:99    wired   
    
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.